Skip to content

Commit

Permalink
fix: Loading cached user data before IAM sdk initialization (SDKCF-6826)
Browse files Browse the repository at this point in the history
* fix: Loading cached user data before IAM sdk initialization (SDKCF-6826)

chore: modified test case to satisfy the updated logic for registerPreference

chore: updated changelog (SDKCF-6826)

* chore: update readme (SDKCF-6826)
  • Loading branch information
SoumenRautray committed Oct 31, 2023
1 parent c4b350b commit d94ab6e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
- Added device_id to DisplayPermission request header [SDKCF-6624]
- Prevent calling `configure()` then RMC module is integrated [SDKCF-6710]
- Added rmcsdk version parameter to all api calls [SDKCF-6709]
- Retaining API calls until configure() is called [SDKCF-6812]
- Improvements:
- Retaining API calls until `configure()` is called [SDKCF-6740]
- Retaining API calls until configure() is called [SDKCF-6812]
- Fixes:
- Fixed Xcode 15 beta errors [SDKCF-6692]
- Fixed Finding RMC Bundle [SDKCF-6751]
- Fixed Loading cached user data before IAM initialisation [SDKCF-6826]
### 8.0.0 (2023-06-21)
- **Breaking changes:**
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,10 @@ In your `Info.plist` configuration, set the PostScript names under `InAppMessagi
* Status bar characters and icons are not visible when Full-Screen campaign is presented
* If your app is running on iOS version below 13.0 you need to either change background color of the campaign or set proper `preferredStatusbarStyle` in the top-most view controller. (for iOS versions above 13.0 this issue is handled internally by the SDK)
* A launch event campaign is presented more times than expected.
* Ensure that `registerPreference()` is called after `configure()` and before any `logEvent()` method
* Ideally `registerPreference()` should be called after `configure()` and before any `logEvent()` method
* The preference object must contain up-to-date information before `registerPreference()` is called
* Each *userId*/*idTrackingIdentifier* combination (including empty one) has its own counter for campaign impressions.
* Killing the app or calling `closeMessage()` API while campaign is being displayed doesn't count as impression.
**Note:** If `registerPreference()` is called before `configure()` then it gets retained and gets triggered after `configure()` is called.

#### For other issues and more detailed information, Rakuten developers should refer to the Troubleshooting Guide on the internal developer documentation portal.
3 changes: 3 additions & 0 deletions Sources/RInAppMessaging/InAppMessagingModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ internal class InAppMessagingModule: ErrorDelegate, CampaignDispatcherDelegate,
accountRepository.setPreference(preference)

guard isInitialized else {
if accountRepository.updateUserInfo() {
campaignRepository.loadCachedData()
}
return
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/Tests/InAppMessagingModuleSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ class InAppMessagingModuleSpec: QuickSpec {
expect(accountRepository.userInfoProvider).to(beIdenticalTo(aUser))
}

it("will not call checkUserChanges()") {
it("will call updateUserInfo() to update cached user data") {
iamModule.registerPreference(aUser)
expect(accountRepository.wasUpdateUserInfoCalled).to(beFalse())
expect(accountRepository.wasUpdateUserInfoCalled).to(beTrue())
}
}
}
Expand Down

0 comments on commit d94ab6e

Please sign in to comment.