-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: sdk wrappers not having device token registered because of application lifecycle #285
Merged
Merged
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
8895cd7
test
Shahroz16 8fab6fa
auto generated files
Shahroz16 bf1a26a
sourcery
Shahroz16 1e770f2
remove unused import and added check for shared error
Shahroz16 662fc50
lint and generate
Shahroz16 c45b9ce
Merge branch 'main' of github.com:customerio/customerio-ios into shah…
Shahroz16 4807e85
refactor: make getting instances of classes before SDK initialization…
levibostian e5e2c8e
added comments and refactored name
Shahroz16 c6755d3
autogenerate
Shahroz16 b021b6d
added support to store device token and register on sdk init
Shahroz16 0256a46
autogenerate
Shahroz16 d0e37f5
autogenerate
Shahroz16 c0cce41
autogenerate
Shahroz16 36ee48e
autogenerate
Shahroz16 eb701ba
added global datastore support in modules
Shahroz16 edb46ab
Merge branch 'main' of github.com:customerio/customerio-ios into shah…
Shahroz16 3dbc9bd
updated method to avoid duplicate requests in native
Shahroz16 fa90fa0
throw error in case of cast failure
Shahroz16 d9807d0
Merge branch 'main' of github.com:customerio/customerio-ios into shah…
Shahroz16 01f66a4
remove global data store from ModuleTopLevelObject
levibostian 02002b7
Merge branch 'main' into shahroz-old-token-fix
levibostian ef7510a
Merge branch 'main' of github.com:customerio/customerio-ios into shah…
Shahroz16 1a5bffb
Merge branch 'main' of github.com:customerio/customerio-ios into shah…
Shahroz16 d23bbf8
Merge branch 'main' of github.com:customerio/customerio-ios into shah…
Shahroz16 423328a
update globaldatastore
Shahroz16 fa1523e
fixed tests
Shahroz16 2cfd1ba
autogen
Shahroz16 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/Common/autogenerated/AutoDependencyInjection.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingInApp/autogenerated/AutoDependencyInjection.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingInApp/autogenerated/AutoLenses.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingInApp/autogenerated/AutoMockable.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import CioTracking | ||
import Common | ||
import Foundation | ||
#if canImport(UserNotifications) && canImport(UIKit) | ||
#if canImport(UIKit) | ||
import UIKit | ||
import UserNotifications | ||
#endif | ||
|
||
/** | ||
|
@@ -28,17 +27,21 @@ public class MessagingPush: ModuleTopLevelObject<MessagingPushInstance>, Messagi | |
Self.shared = MessagingPush() | ||
} | ||
|
||
// At this time, we do not require `MessagingPush.initialize()` to be called to make the SDK work. There is | ||
// currently no module initialization to perform. | ||
// initialize the module so that it can start automatically fetching device token | ||
public static func initialize() { | ||
MessagingPush.shared.initializeModuleIfSdkInitialized() | ||
} | ||
|
||
@available(iOSApplicationExtension, unavailable) | ||
override public func inititlizeModule(diGraph: DIGraph) { | ||
let logger = diGraph.logger | ||
logger.debug("Setting up MessagingPush module...") | ||
|
||
logger.info("MessagingPush module setup with SDK") | ||
|
||
#if canImport(UIKit) | ||
UIApplication.shared.registerForRemoteNotifications() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we put a comment over this to specify why this we decided to add this function call. |
||
#endif | ||
} | ||
|
||
override public func getImplementationInstance(diGraph: DIGraph) -> MessagingPushInstance { | ||
|
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPush/autogenerated/AutoDependencyInjection.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPush/autogenerated/AutoMockable.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPushAPN/autogenerated/AutoDependencyInjection.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPushAPN/autogenerated/AutoLenses.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPushAPN/autogenerated/AutoMockable.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPushFCM/autogenerated/AutoDependencyInjection.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPushFCM/autogenerated/AutoLenses.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/MessagingPushFCM/autogenerated/AutoMockable.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/Tracking/autogenerated/AutoDependencyInjection.generated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a lot less work in the long-term of putting these functions as top-level in the stacktrace as possible. Example: It's better to put this annotation over
initialize()
function instead of over all the functions thatinitialize()
calls.With this in mind, I suggest we move this annotation over the
static func initialize()
function and see if it works. The Xcode compiler might complain and require us to put it over both functions. But, I think it's worth the time to see if moving it works.