Skip to content

AB#274406 - Ensure instance config is updated with resolved region on delayed initialisation#133

Open
kris-opti wants to merge 1 commit intomasterfrom
274406-ensure-region-overriden-from-creds
Open

AB#274406 - Ensure instance config is updated with resolved region on delayed initialisation#133
kris-opti wants to merge 1 commit intomasterfrom
274406-ensure-region-overriden-from-creds

Conversation

@kris-opti
Copy link
Contributor

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

  • 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

@kris-opti kris-opti changed the title AB#274406 - ensure instance config is updated with resolved region on delayed initialisation AB#274406 - Ensure instance config is updated with resolved region on delayed initialisation Feb 9, 2026
Logger.info("Completing delayed configuration with credentials: \(credentials)")
updateStorageValues(config)
setCredentials(credentials)
instance?.config = config
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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.
@kris-opti kris-opti force-pushed the 274406-ensure-region-overriden-from-creds branch from 19a1963 to 01bed77 Compare February 9, 2026 17:00
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