File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
app/src/main/java/ro/code4/monitorizarevot/ui/splashscreen Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -15,26 +15,33 @@ class SplashScreenViewModel : BaseViewModel() {
1515 private val sharedPreferences: SharedPreferences by inject()
1616 private val repository: Repository by inject()
1717 private val loginLiveData = SingleLiveEvent <LoginStatus >()
18+ private val remoteConfig = runCatching { FirebaseRemoteConfig .getInstance() }.getOrNull()
1819
1920 fun loginLiveData (): LiveData <LoginStatus > = loginLiveData
2021
2122 init {
2223 remoteConfiguration()
24+ checkLogin()
2325 }
2426
2527 private fun remoteConfiguration () {
28+ remoteConfig?.let {
29+ it.apply {
30+ val minInterval = if (BuildConfig .DEBUG ) 0 else 3600L
31+ val configSettings = FirebaseRemoteConfigSettings .Builder ()
32+ .setMinimumFetchIntervalInSeconds(minInterval)
33+ .build()
2634
27- FirebaseRemoteConfig .getInstance().apply {
28- val configSettings = FirebaseRemoteConfigSettings .Builder ()
29- .build()
30- setConfigSettingsAsync(configSettings)
31- setDefaultsAsync(R .xml.remote_config_defaults)
32- fetchAndActivate()
33- .addOnCompleteListener {
34- checkResetDB()
35- }
35+ setConfigSettingsAsync(configSettings)
36+ setDefaultsAsync(R .xml.remote_config_defaults)
37+ fetchAndActivate()
38+ .addOnCompleteListener {
39+ checkResetDB()
40+ }
41+ }
3642 }
37- checkLogin()
43+
44+
3845 }
3946
4047 private fun checkLogin () {
You can’t perform that action at this time.
0 commit comments