Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

6.2.3 is completely broken on Android #157

@i1skn

Description

@i1skn

Describe the bug
6.2.3 is completely broken for Android

To reproduce
Launch ManualTestApp on Android using 6.2.3
Observe in console ERROR [Error: LaunchDarkly SDK already initialized] immediately after run.

Expected behavior
Calling .configure(...) should not resolve into an LaunchDarkly SDK already initialized error neither at the start of the app, nor after we call .close() and then .configure(...) again.

SDK version
6.2.3

OS/platform
Android 12

Additional context
This happens because .isInitialized(...) used to return a rejected Promise, when client is not available and since 6.2.3 (as pointed here) it resolves with false.

If you look on the code below, you'll see, that if .isInitialized(...) is not rejected -> we throw an error, but right we do not reject it, hence we see a vicious cycle.

On 6.2.2 .isInitialized(...) would resolve with false after you've called .close() instead of rejecting (see here this issue).

So, 6.2.3 is completely unusable on Android.

configure(config, user, timeout) {
return LaunchdarklyReactNativeClient.isInitialized("default")
.then(
ignored => {
throw new Error('LaunchDarkly SDK already initialized');
},
() => {
const configWithOverriddenDefaults = Object.assign({
backgroundPollingIntervalMillis: 3600000, // the iOS SDK defaults this to 900000
disableBackgroundUpdating: false, // the iOS SDK defaults this to true
pollUri: 'https://clientsdk.launchdarkly.com',
wrapperName: 'react-native-client-sdk',
wrapperVersion: this.getVersion()
}, config);
if (timeout == undefined) {
return LaunchdarklyReactNativeClient.configure(configWithOverriddenDefaults, user);
} else {
return LaunchdarklyReactNativeClient.configureWithTimeout(configWithOverriddenDefaults, user, timeout);
}
}
);
}

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions