Skip to content

Commit 1e8c522

Browse files
authored
Version 2.1.1 (#30)
* AndroidManifest.xml no longer enforces supportsRtl="true" * Client no longer reconnects after detecting an invalidated mobile key * Client can be initialized outside the main thread
1 parent 3bdaf0b commit 1e8c522

File tree

9 files changed

+31
-15
lines changed

9 files changed

+31
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
All notable changes to the LaunchDarkly Android SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
55

6+
## [2.1.1] - 2017-11-27
7+
### Fixed
8+
- `AndroidManifest.xml` no longer enforces `supportsRtl="true"`
9+
- Client no longer reconnects after detecting an invalidated mobile key
10+
- Client can be initialized outside the main thread. Thanks @jonathanmgrimm!
11+
612
## [2.1.0] - 2017-10-13
713
### Added
814
- `LDConfig.Builder#setUseReport` method to allow switching the request verb from `GET` to `REPORT`. Do not use unless advised by LaunchDarkly.

circle.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Disable emulator audio
22
machine:
33
environment:
4+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
45
QEMU_AUDIO_DRV: none
56
version: oraclejdk8
67

@@ -32,4 +33,4 @@ test:
3233
- ./gradlew :launchdarkly-android-client:test --console=plain -PdisablePreDex
3334
- ./gradlew :launchdarkly-android-client:connectedAndroidTest --console=plain -PdisablePreDex
3435
- cp -r launchdarkly-android-client/build/reports/* $CIRCLE_TEST_REPORTS
35-
- ./gradlew packageRelease --console=plain -PdisablePreDex
36+
- ./gradlew packageRelease --console=plain -PdisablePreDex

example/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
package="com.launchdarkly.example">
44

55
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
6-
android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme">
6+
android:label="@string/app_name" android:theme="@style/AppTheme">
77
<activity android:name=".MainActivity">
88
<intent-filter>
99
<action android:name="android.intent.action.MAIN" />

example/src/main/java/com/launchdarkly/example/MainActivity.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ protected void onCreate(Bundle savedInstanceState) {
5959
@Override
6060
public void onStop() {
6161
super.onStop();
62-
try {
63-
ldClient.close();
64-
} catch (IOException e) {
65-
Log.e(TAG, "Exception when closing LaunchDarkly Client", e);
66-
}
62+
doSafeClientAction(() -> {
63+
try {
64+
ldClient.close();
65+
} catch (IOException e) {
66+
Log.e(TAG, "Exception when closing LaunchDarkly Client", e);
67+
}
68+
});
6769
}
6870

6971
private void setupFlushButton() {

launchdarkly-android-client/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply plugin: 'io.codearte.nexus-staging'
88

99
allprojects {
1010
group = 'com.launchdarkly'
11-
version = '2.1.0'
11+
version = '2.1.1'
1212
sourceCompatibility = 1.8
1313
targetCompatibility = 1.8
1414
}

launchdarkly-android-client/src/main/AndroidManifest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
1212

1313
<application
14-
android:label="@string/app_name"
15-
android:supportsRtl="true">
14+
android:label="@string/app_name">
1615
<receiver android:name=".PollingUpdater" />
1716
<receiver
1817
android:name=".ConnectivityReceiver"
@@ -23,4 +22,4 @@
2322
</receiver>
2423

2524
</application>
26-
</manifest>
25+
</manifest>

launchdarkly-android-client/src/main/java/com/launchdarkly/android/LDClientInterface.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.launchdarkly.android;
22

33

4-
import android.content.Context;
5-
64
import com.google.gson.JsonElement;
75

86
import java.io.Closeable;

launchdarkly-android-client/src/main/java/com/launchdarkly/android/PollingUpdater.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ synchronized static void startBackgroundPolling(Context context) {
5151

5252
synchronized static void startPolling(Context context, int initialDelayMillis, int intervalMillis) {
5353
stop(context);
54-
Log.d(TAG, "startPolling with initialDelayMillis: " + initialDelayMillis + " intervalMillis: " + intervalMillis);
54+
Log.d(TAG, String.format("startPolling with initialDelayMillis: %d and intervalMillis: %d", initialDelayMillis, intervalMillis));
5555
PendingIntent pendingIntent = getPendingIntent(context);
5656
AlarmManager alarmMgr = getAlarmManager(context);
5757

launchdarkly-android-client/src/main/java/com/launchdarkly/android/StreamUpdateProcessor.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class StreamUpdateProcessor implements UpdateProcessor {
2828
private final URI uri;
2929
private SettableFuture<Void> initFuture;
3030
private Debounce queue;
31+
private boolean connection401Error = false;
3132

3233
StreamUpdateProcessor(LDConfig config, UserManager userManager) {
3334
this.config = config;
@@ -40,7 +41,7 @@ public synchronized ListenableFuture<Void> start() {
4041
initFuture = SettableFuture.create();
4142
initialized.set(false);
4243

43-
if (!running) {
44+
if (!running && !connection401Error) {
4445
stop();
4546
Log.d(TAG, "Starting.");
4647
Headers headers = new Headers.Builder()
@@ -97,6 +98,15 @@ public void onError(Throwable t) {
9798
if (!initialized.getAndSet(true)) {
9899
initFuture.setException(t);
99100
}
101+
if (code == 401) {
102+
connection401Error = true;
103+
try {
104+
LDClient clientSingleton = LDClient.get();
105+
clientSingleton.setOffline();
106+
} catch (LaunchDarklyException e) {
107+
Log.e(TAG, "Client unavailable to be set offline", e);
108+
}
109+
}
100110
stop();
101111
}
102112
}

0 commit comments

Comments
 (0)