Skip to content

Commit 748c0cb

Browse files
committed
Fix unit tests
1 parent 0b55906 commit 748c0cb

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ gson = "2.9.0"
66
commons-codec = "1.15"
77
semantic-version = "2.1.1"
88
junit-jupiter = "5.10.0"
9-
logback = "1.5.13"
9+
logback = "1.5.19"
1010
mockwebserver = "4.12.0"
1111
mockito = "4.8.0"
1212
android-retrofuture = "1.7.4"

samples/android-kotlin/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21'
3737
implementation 'androidx.appcompat:appcompat:1.5.1'
3838
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
39-
implementation 'com.configcat:configcat-android-client:11.1.0'
39+
implementation 'com.configcat:configcat-android-client:0.0.6'
4040
implementation 'com.noveogroup.android:android-logger:1.3.1'
4141
testImplementation 'junit:junit:4.13.2'
4242
androidTestImplementation 'androidx.test.ext:junit:1.1.4'

src/main/java/com/configcat/AppStateMonitor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.io.IOException;
1414
import java.util.ArrayList;
1515
import java.util.List;
16+
import java.util.Objects;
1617
import java.util.concurrent.atomic.AtomicBoolean;
1718
import java.util.concurrent.locks.ReentrantReadWriteLock;
1819

@@ -108,6 +109,9 @@ public void onActivityDestroyed(Activity activity) {
108109

109110
@Override
110111
public void onReceive(Context context, Intent intent) {
112+
if (!Objects.equals(intent.getAction(), CONNECTIVITY_CHANGE)) {
113+
return;
114+
}
111115
boolean isConnected = isNetworkAvailable();
112116
if (isConnected && hasNetwork.compareAndSet(false, true)) {
113117
notifyListeners();
@@ -132,6 +136,7 @@ public void onConfigurationChanged(Configuration configuration) {
132136
@Override
133137
public void onLowMemory() {}
134138

139+
@SuppressWarnings("deprecation")
135140
public boolean isNetworkAvailable() {
136141
ConnectivityManager conn =
137142
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

src/main/java/com/configcat/ConfigService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ private CompletableFuture<Result<Entry>> fetchIfOlder(long threshold, boolean pr
183183
}
184184
// If we are in offline mode or the caller prefers cached values, do not initiate fetch.
185185
if (isOffline() || preferCached) {
186+
setInitialized();
186187
return CompletableFuture.completedFuture(Result.success(cachedEntry));
187188
}
188189

0 commit comments

Comments
 (0)