Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
dba2c2c
feat: add push_notification decodable
eligutovsky Dec 7, 2023
04f8fe5
refactor: notification attachments
eligutovsky Dec 7, 2023
ae3daca
chore: add mutable-content flag
eligutovsky Dec 7, 2023
e6ea51b
refactor: use static instead of class
eligutovsky Dec 7, 2023
f8088bf
refactor: category manager
eligutovsky Dec 7, 2023
20a8284
chore: change notification fixtures
eligutovsky Dec 7, 2023
a062657
refactor: add optimobile core
eligutovsky Dec 7, 2023
64ead6f
chore: move push notification to mobile core
eligutovsky Dec 7, 2023
d6e697f
chore: keep message struct in notification
eligutovsky Dec 8, 2023
b67069e
chore: wrap attachments
eligutovsky Dec 8, 2023
7cd93c3
refactor: notification struct
eligutovsky Dec 8, 2023
0a66d7e
refactor: move legacy optimove core to sdk
eligutovsky Dec 8, 2023
e741854
chore: merge mobile core with optimove core
eligutovsky Dec 8, 2023
85adee6
refactor: review access level
eligutovsky Dec 8, 2023
9a121c6
refactor: split storage facade to files
eligutovsky Dec 8, 2023
615864e
feat: add migration 5.7.0
eligutovsky Dec 8, 2023
b4f1c8b
feat: remove kumulos key-value storage
eligutovsky Dec 8, 2023
f9d268a
feat: add appgroup to storge facade
eligutovsky Dec 8, 2023
e24e830
chore: remove app group helper
eligutovsky Dec 8, 2023
78c4929
refactor: badge arithmetic
eligutovsky Dec 8, 2023
8eaf717
chore: migration version 6.0.0
eligutovsky Feb 6, 2024
6d2fe1e
chore: add debug product
eligutovsky Feb 6, 2024
a64a40a
feat: expose sdk state
eligutovsky Feb 6, 2024
1f677e8
fix: return back access level of OptimoveInApp
eligutovsky Feb 6, 2024
c8fb299
refactor: rename method
eligutovsky Feb 6, 2024
332bb01
docs: update changelog
eligutovsky Feb 6, 2024
1f2427d
chore: move back access level of in-app
eligutovsky Feb 7, 2024
6efe532
chore: add in-app into optimove class
eligutovsky Feb 7, 2024
4323989
fix: switch in-app manager to optimove storage
eligutovsky Feb 7, 2024
a6278a4
add identifiable
eligutovsky Mar 26, 2024
f63a1b3
Merge commit 'e28fd2b7506d5e00b36fdf6fd5e6e70904b9e3fc' into refactor…
k-antipochkin Sep 5, 2024
82a5b41
Merge commit '5c08ce95a08a2308c61b231dd8e021f123c48cd4' into refactor…
k-antipochkin Sep 5, 2024
907cbe0
Merge commit '1fbede97d754d611d50a6c25e0a299bc94593d93' into refactor…
k-antipochkin Sep 6, 2024
92cd25b
Merge branch 'master' into refactor/notification-service-extension-2
k-antipochkin Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions OptimobileShared/AppGroupsHelper.swift

This file was deleted.

7 changes: 0 additions & 7 deletions OptimobileShared/Extensions/Notifications.swift

This file was deleted.

59 changes: 0 additions & 59 deletions OptimobileShared/KeyValPersistenceHelper.swift

This file was deleted.

19 changes: 0 additions & 19 deletions OptimobileShared/MediaHelper.swift

This file was deleted.

68 changes: 0 additions & 68 deletions OptimobileShared/OptimobileHelper.swift

This file was deleted.

9 changes: 0 additions & 9 deletions OptimobileShared/PendingNotification.swift

This file was deleted.

Empty file.

This file was deleted.

17 changes: 14 additions & 3 deletions OptimoveCore/Sources/Classes/Extension/Bundle+HostApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@

import Foundation

public extension Bundle {
extension Bundle {
/// Returns the bundle containing the host app.
/// https://stackoverflow.com/a/27849695
static func hostAppBundle() -> Bundle? {
static func hostAppBundle() -> Bundle {
let mainBundle = Bundle.main
if mainBundle.bundleURL.pathExtension == "appex" {
// Peel off two directory levels - SOME_APP.app/PlugIns/SOME_APP_EXTENSION.appex
// Peel off two directory levels - APP.app/PlugIns/APP_EXTENSION.appex
let url = mainBundle.bundleURL.deletingLastPathComponent().deletingLastPathComponent()
if let hostBundle = Bundle(url: url) {
return hostBundle
}
}
return mainBundle
}

/// Returns the bundle identifier of the host app.
static var hostAppBundleIdentifier: String {
return hostAppBundle().bundleIdentifier!
}

/// Returns the app group identifier for the SDK app.
static var optimoveAppGroupIdentifier: String {
return "group.\(hostAppBundleIdentifier).optimove"
}
}
12 changes: 0 additions & 12 deletions OptimoveCore/Sources/Classes/Extension/Result+Successful.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Foundation

public extension utsname {
extension utsname {
var deviceModel: String {
var systemInfo = self
uname(&systemInfo)
Expand Down
36 changes: 36 additions & 0 deletions OptimoveCore/Sources/Classes/MediaHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright © 2022 Optimove. All rights reserved.

import Foundation

public struct MediaHelper {
enum Error: LocalizedError {
case noMediaUrlFound
case invalidPictureUrl(String)
}

let storage: KeyValueStorage

public init(storage: KeyValueStorage) {
self.storage = storage
}

public func getCompletePictureUrl(pictureUrlString: String, width: UInt) throws -> URL {
if pictureUrlString.hasPrefix("https://") || pictureUrlString.hasPrefix("http://") {
guard let url = URL(string: pictureUrlString) else {
throw Error.invalidPictureUrl(pictureUrlString)
}
return url
}

guard let mediaUrl: String = storage[.mediaURL] else {
throw Error.noMediaUrlFound
}

let urlString = "\(mediaUrl)/\(width)x/\(pictureUrlString)"
guard let url = URL(string: urlString) else {
throw Error.invalidPictureUrl(urlString)
}

return url
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright © 2023 Optimove. All rights reserved.

enum OptimobileEvent: String, Codable {
public enum OptimobileEvent: String, Codable {
case DEEP_LINK_MATCHED = "k.deepLink.matched"
case DEVICE_UNSUBSCRIBED = "k.push.deviceUnsubscribed"
case ENGAGE_BEACON_ENTERED_PROXIMITY = "k.engage.beaconEnteredProximity"
Expand Down
55 changes: 55 additions & 0 deletions OptimoveCore/Sources/Classes/OptimobileHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright © 2022 Optimove. All rights reserved.

import Foundation

public struct OptimobileHelper {
static let installIdLock = DispatchSemaphore(value: 1)
public static let userIdLock = DispatchSemaphore(value: 1)

let storage: KeyValueStorage

public init(storage: KeyValueStorage) {
self.storage = storage
}

public func installId() -> String {
OptimobileHelper.installIdLock.wait()
defer {
OptimobileHelper.installIdLock.signal()
}

if let existingID: String = storage[.installUUID] {
return existingID
}

let newID = UUID().uuidString
storage.set(value: newID, key: .installUUID)
return newID
}

/**
Returns the identifier for the user currently associated with the Kumulos installation record

If no user is associated, it returns the Kumulos installation ID
*/
public func currentUserIdentifier() -> String {
OptimobileHelper.userIdLock.wait()
defer { OptimobileHelper.userIdLock.signal() }
if let userId: String = storage[.userID] {
return userId
}

return installId()
}

public func getBadge(notification: PushNotification) -> Int? {
if let incrementBy = notification.badgeIncrement,
let current: Int = storage[.badgeCount]
{
let badge = current + incrementBy
return badge < 0 ? 0 : badge
}

return notification.aps.badge
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

import Foundation

enum OptimobileUserDefaultsKey: String {
public enum OptimobileUserDefaultsKey: String, CaseIterable {
case REGION = "KumulosEventsRegion"
case MEDIA_BASE_URL = "KumulosMediaBaseUrl"
case INSTALL_UUID = "KumulosUUID"
case USER_ID = "KumulosCurrentUserID"
case BADGE_COUNT = "KumulosBadgeCount"
case PENDING_NOTIFICATIONS = "KumulosPendingNotifications"
case PENDING_ANALYTICS = "KumulosPendingAnalytics"

// exist only in standard defaults for app
case MIGRATED_TO_GROUPS = "KumulosDidMigrateToAppGroups"
case IN_APP_LAST_SYNCED_AT = "KumulosMessagesLastSyncedAt"
case IN_APP_MOST_RECENT_UPDATED_AT = "KumulosInAppMostRecentUpdatedAt"
case IN_APP_CONSENTED = "KumulosInAppConsented"
Expand Down
Loading