11package at .tomtasche .reader .nonfree ;
22
3- import android .net .Uri ;
4-
5- import com .google .android .gms .tasks .OnCompleteListener ;
6- import com .google .android .gms .tasks .Task ;
7- import com .google .firebase .remoteconfig .FirebaseRemoteConfig ;
8-
93import java .util .LinkedList ;
104import java .util .List ;
11- import java .util .concurrent .TimeoutException ;
12-
13- import androidx .annotation .NonNull ;
14-
15- import at .tomtasche .reader .R ;
16- import at .tomtasche .reader .ui .activity .MainActivity ;
175
186public class ConfigManager {
197
208 private boolean enabled ;
219
2210 private boolean loaded ;
2311
24- private FirebaseRemoteConfig remoteConfig ;
25-
2612 private final List <Runnable > callbacks ;
2713
2814 public ConfigManager () {
@@ -34,19 +20,13 @@ public void initialize() {
3420 return ;
3521 }
3622
37- remoteConfig = FirebaseRemoteConfig .getInstance ();
38- remoteConfig .fetchAndActivate ().addOnCompleteListener (new OnCompleteListener <Boolean >() {
39- @ Override
40- public void onComplete (@ NonNull Task <Boolean > task ) {
41- synchronized (callbacks ) {
42- loaded = true ;
23+ synchronized (callbacks ) {
24+ loaded = true ;
4325
44- for (Runnable callback : callbacks ) {
45- callback .run ();
46- }
47- }
26+ for (Runnable callback : callbacks ) {
27+ callback .run ();
4828 }
49- });
29+ }
5030 }
5131
5232 public boolean isLoaded () {
@@ -80,7 +60,7 @@ public void run() {
8060 }
8161 }
8262
83- boolean value = remoteConfig . getBoolean (key );
63+ boolean value = getBooleanConfig (key );
8464 configListener .onConfig (key , value );
8565 }
8666
@@ -89,7 +69,7 @@ public boolean getBooleanConfig(String key) {
8969 return false ;
9070 }
9171
92- return remoteConfig . getBoolean ( key ) ;
72+ return false ;
9373 }
9474
9575 public interface ConfigListener <T > {
0 commit comments