Skip to content

Conversation

@eligutovsky
Copy link
Member

@eligutovsky eligutovsky commented Dec 7, 2023

Description of Changes

This is the first PR in the series of PRs focused on increasing the reliability of the Notification Service Center by modernizing the code with the latest Swift standards.
Tests cover the new code.

Breaking Changes

  • None

Release Checklist

Prepare:

  • Detail any breaking changes. Breaking changes require a new major version number
  • Check pod lib lint passes
  • Update any relevant sections of the repository wiki pages on a branch

Bump versions in:

  • OptimoveCore.podspec

  • OptimoveNotificationServiceExtension.podspec

  • OptimoveSDK.podspec

  • OptimoveCore/Sources/Classes/Constants/SDKVersion.swift

  • README.md

  • CHANGELOG.md

  • Update major version numbers in wiki (basic integration + push guides)

Integration tests

T&T Only

  • Init SDK with only T&T credentials
  • Associate customer
  • Associate email
  • Track events

Mobile Only

  • Init SDK with all credentials
  • Track events
  • Associate customer (verify both backends)
  • Register for push
  • Opt-in for In-App
  • Send test push
  • Send test In-App
  • Receive / trigger deep link handler (In-App/Push)
  • Receive / trigger the content extension, render image and action buttons for push
  • Verify push opened handler

Deferred Deep Links

  • With app installed, trigger deep link handler
  • With app uninstalled, follow deep link, install test bundle, verify deep link read from Clipboard, trigger deep link handler

Combined

  • Track event for T&T, verify push received
  • Trigger scheduled campaign, verify push received
  • Trigger scheduled campaign, verify In-App received

Release:

  • Squash and merge to master
  • Delete branch once merged
  • Create tag from master matching chosen version
  • Run pod trunk push to publish to CocoaPods

Post Release:

  • Push wiki pages to master

@eligutovsky eligutovsky changed the base branch from master to feat/delayed-configuration December 7, 2023 12:17
@eligutovsky eligutovsky changed the base branch from feat/delayed-configuration to rc/5.6.0 December 7, 2023 12:17
@eligutovsky eligutovsky force-pushed the refactor/notification-service-extension branch from 8977e93 to e3f2155 Compare December 7, 2023 13:31
Base automatically changed from rc/5.6.0 to master December 7, 2023 15:12
@eligutovsky eligutovsky force-pushed the refactor/notification-service-extension branch from e3f2155 to 20a8284 Compare December 7, 2023 17:10
@eligutovsky eligutovsky changed the title refactor: notification service extension refactor: notification service extension [1] Dec 7, 2023
@eligutovsky eligutovsky changed the base branch from master to rc/5.7.0 December 8, 2023 15:09
@eligutovsky eligutovsky marked this pull request as ready for review December 8, 2023 15:28
Copy link
Member Author

@eligutovsky eligutovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vvoicehovics @cgwyllie I have added some comments about the code changes


enum MediaHelper {
/// Use ``Region.US`` as fallback region.
static let mediaResizerBaseUrl: String = "https://i-us-east-1.app.delivery"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL was used here as a fallback URL, in case if no access to the persistent key-value storage.
Now, this code has the storage as a dependency in class init, and also will not be executed in the runtime.

Copy link
Member Author

@eligutovsky eligutovsky Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be helpful to replace the notification content with the text "Error: Check Optimove AppGroup capabilities" if there is no storage available? This could help us reduce the number of integration issues related to missing images.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some playground, I found that optimobile Core data throwing an no db file.

@available(iOS 10.0, *)
class CategoryManager {
let categoryReadLock = DispatchSemaphore(value: 0)
let dynamicCategoryLock = DispatchSemaphore(value: 1)
Copy link
Member Author

@eligutovsky eligutovsky Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These locks were replaced with the Swift async. You will find the usage below.


// Force a reload of the categories
_ = sharedInstance.getExistingCategories()
await UNUserNotificationCenter.current().notificationCategories()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awaiting for a result instead of manual mutex signaling


return newArray
static func writeCategoryIds(_ ids: Set<String>) {
UserDefaults.standard.set(Array(ids), forKey: Constants.DYNAMIC_CATEGORY)
Copy link
Member Author

@eligutovsky eligutovsky Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard iOS persistence will be replaced with the storage abstraction in this bulk of PRs

self.categoryReadLock.signal()
}

_ = categoryReadLock.wait(timeout: DispatchTime.now() + DispatchTimeInterval.seconds(5))
Copy link
Member Author

@eligutovsky eligutovsky Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain about deleting this.
The mentioned extension operates as a distinct process and is granted a maximum of 30 seconds to complete its current task. In case the time limit is exceeded, the operating system will invoke another function for this instance and we will have one last opportunity to invoke the callback from the initial method's callback function.

name: "Optimove",
platforms: [
.iOS(.v10),
.iOS(.v13),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cgwyllie this is the breaking change.

@eligutovsky eligutovsky mentioned this pull request Jan 29, 2024
34 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants