Repository navigation
[SDK-758] Report a failed pre-init switch the same way iOS does - #1101
Open
joaodordio wants to merge 1 commit into
Open
joaodordio wants to merge 1 commit into
joaodordio wants to merge 1 commit into
Conversation
switchProject before initialization always reported a clean switch, even when initialization failed. It now forwards that result, and a successful cold start still reports SWITCHED_CLEANLY.
rtlsilva
approved these changes
Oct 9, 2026
rtlsilva
left a comment
Contributor
There was a problem hiding this comment.
Approved with 1 non-blocking documentation-contract finding.
| * the API key already in use, it is a no-op. Called while an initialization is still in flight, | ||
| * it waits for that initialization and then switches. | ||
| * and logs a warning. It reports {@link IterableProjectSwitchResult#SWITCHED_CLEANLY} when that | ||
| * initialization succeeds, and {@link IterableProjectSwitchResult#SWITCHED_WITH_WARNINGS} when it |
Contributor
There was a problem hiding this comment.
This new failure meaning conflicts with the rest of the public callback contract.
IterableProjectSwitchResult, IterableProjectSwitchCallback, and the @param below still say warnings only describe teardown/cleanup, neither result is a failure, and the SDK is running on the new project.
An initialization exception can occur before IterableApi.initialize runs - as the new test demonstrates - so those guarantees are no longer true.
Suggest updating all public Javadocs to cover this case and state what callers can safely assume or do after it.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📝 Summary
A failed switchProject before init now reports SWITCHED_WITH_WARNINGS, matching iOS. Success stays SWITCHED_CLEANLY.
🎟️ Jira Ticket: SDK-758
📖 Description
switchProjectbefore initialization always reportedSWITCHED_CLEANLY, even when initialization failed. iOS already reports.switchedWithWarningswhenstart()fails.Android now forwards whether
initializeInBackgroundsucceeded. A successful cold start is stillSWITCHED_CLEANLY. A timeout or an exception isSWITCHED_WITH_WARNINGS. The SDK is still left pointed at the requested project.IterableInitializationCallbackis unchanged. It still only means initialization finished. The success flag is an internal listener, because adding an argument to the public callback would break every app that implements it.The two failure signals are not the same event. On iOS, failure is
start()returning false, usually the first in-app sync. On Android,initialize()does not fail when in-app sync fails. The signal forwarded here is the oneinitializeInBackgroundalready had: timeout or exception. Reasoning is on the Jira ticket.Targets
feature/SDK-673-switch-project. Independent of SDK-757. iOS: Iterable/iterable-swift-sdk#1094🧪 How to test?
The first test is the successful cold start. The second forces the next background initialization to fail and expects
SWITCHED_WITH_WARNINGS.🧾 Changelog
Updated the unreleased
switchProjectentry. The note that Android cannot distinguish a failed initialization is removed. A failed or timed-out cold start now reportsSWITCHED_WITH_WARNINGS.📹 Loom recording if applicable
N/A
🐞 Github Issues solved
None
📚 Docs PR if applicable
No docs PR.
switchProjectis not in iterable-docs yet. That write-up is SDK-676, and this result contract is noted there.