AB#274406 - Ensure instance config is updated with resolved region on delayed initialisation#133
AB#274406 - Ensure instance config is updated with resolved region on delayed initialisation#133
Conversation
| Logger.info("Completing delayed configuration with credentials: \(credentials)") | ||
| updateStorageValues(config) | ||
| setCredentials(credentials) | ||
| instance?.config = config |
There was a problem hiding this comment.
I am not entirely sure this fixes the presumable issue. Who references the local config after it is initializes here?
Changing it here won't affect the inappmanager for example - the config is a struct and structs are passed by value, ie, the inappmanager has the old config.
| Logger.info("Completing delayed configuration with credentials: \(credentials)") | ||
| updateStorageValues(config) | ||
| setCredentials(credentials) | ||
| instance?.config = config |
There was a problem hiding this comment.
I am not entirely sure this fixes the presumable issue. Who references the local config after it is initializes here?
Changing it here won't affect the inappmanager for example - the config is a struct and structs are passed by value, ie, the inappmanager has the old config.
| Logger.info("Completing delayed configuration with credentials: \(credentials)") | ||
| updateStorageValues(config) | ||
| setCredentials(credentials) | ||
| instance?.config = config |
There was a problem hiding this comment.
I am not entirely sure this fixes the presumable issue. Who references the local config after it is initializes here?
Changing it here won't affect the inappmanager for example - the config is a struct and structs are passed by value, ie, the inappmanager has the old config.
…pport When using delayed initialization, the Optimobile instance config retains the initial placeholder region (e.g. .DEV) since OptimobileConfig is a value type set once at init. This caused InAppPresenter.showMessage() to pass the wrong region when rendering in-app messages. Rather than patching the instance config (which wouldn't help components holding local copies of the struct), this follows the established pattern used by UrlBuilder: read the region from storage, which is always correctly updated by completeDelayedConfiguration via updateStorageValues. InAppPresenter already holds a urlBuilder reference, so this change uses urlBuilder.region (a computed property backed by storage) instead of reaching through Optimobile.sharedInstance.config.region.
19a1963 to
01bed77
Compare
Ensure instance config is updated with resolved region on delayed initialisation configuration completion.
When using delayed initialization, the Optimobile instance config was not being updated after credentials were resolved via setCredentials(). This meant Optimobile.sharedInstance.config.region retained the initial placeholder region (e.g. .DEV) instead of the actual region extracted from the provided credentials.
While the storage layer (used by UrlBuilder for network requests) was correctly updated, the instance config was stale. This caused InAppPresenter to pass the wrong region when rendering in-app messages.
Updating instance.config in completeDelayedConfiguration ensures all config consumers see the resolved values.
Description of Changes
(briefly outline the reason for changes, and describe what's been done)
Breaking Changes
Release Checklist
Prepare:
pod lib lintpassesBump versions in:
OptimoveCore.podspecOptimoveNotificationServiceExtension.podspecOptimoveSDK.podspecOptimoveCore/Sources/Classes/Constants/SDKVersion.swiftREADME.mdCHANGELOG.mdUpdate major version numbers in wiki (basic integration + push guides)
Integration tests
T&T Only
Mobile Only
Deferred Deep Links
Combined
Release:
pod trunk pushto publish to CocoaPodsPost Release: