Skip to content
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

Improve handling of push token / profile updates #118

Merged
merged 20 commits into from
Dec 5, 2023

Conversation

ndurell
Copy link
Contributor

@ndurell ndurell commented Nov 16, 2023

Description

The idea of this PR is to reduce the number of redundant request to the backend where possible. This PR also ensures that when token data is present that it gets assigned to the correct profile when identifiers change.

Other changes:

  1. We no longer send an anonymous profile request when the sdk is initialized.
  2. When the SDK is not initialized in DEBUG mode we throw a fatalError when setter methods are called. This will not happen in release mode.
  3. When switch identifiers we may send a token request instead of profile request to ensure the token data is assigned to the right profile

Check List

  • Are you changing anything with the public API?
  • Have you tested this change on real device?
  • Are your changes backwards compatible with previous SDK Versions?
  • Have you added unit test coverage for your changes?
  • Have you verified that your changes are compatible with all the operating system version this SDK currently supports?

Manual Test Plan

Supporting Materials

@ndurell ndurell force-pushed the noah/save_identifiers_during_initialization branch from 6b1c4ba to 9b6592b Compare November 16, 2023 19:34
@ndurell ndurell marked this pull request as ready for review November 16, 2023 20:17
@ndurell ndurell requested a review from a team as a code owner November 16, 2023 20:17
@ndurell ndurell requested a review from ajaysubra November 16, 2023 20:17
@@ -86,9 +86,6 @@ struct KlaviyoReducer: ReducerProtocol {

state = initialState
state.initalizationState = .initialized
if let request = try? state.buildProfileRequest() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are no longer sending a request after initialization.

Comment on lines +78 to +80
#if DEBUG
fatalError(msg)
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

Sources/KlaviyoSwift/KlaviyoState.swift Show resolved Hide resolved
@ndurell ndurell force-pushed the noah/save_identifiers_during_initialization branch from 6aea95d to eb40c1d Compare November 29, 2023 16:20
Copy link
Contributor

@evan-masseau evan-masseau left a comment

Choose a reason for hiding this comment

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

Looks good from just reading thru on GH

@ndurell ndurell force-pushed the noah/save_identifiers_during_initialization branch from 35ce83d to 4051ca0 Compare December 4, 2023 15:58
@ndurell ndurell merged commit 332c224 into master Dec 5, 2023
4 checks passed
@ndurell ndurell deleted the noah/save_identifiers_during_initialization branch December 5, 2023 16:24
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.

3 participants