-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathRemoteConfigInitializer.kt
More file actions
28 lines (25 loc) · 931 Bytes
/
RemoteConfigInitializer.kt
File metadata and controls
28 lines (25 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.simplecityapps.shuttle.appinitializers
import android.app.Application
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.simplecityapps.shuttle.di.AppCoroutineScope
import com.simplecityapps.shuttle.persistence.GeneralPreferenceManager
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.tasks.await
class RemoteConfigInitializer
@Inject
constructor(
private val preferenceManager: GeneralPreferenceManager,
private val remoteConfig: FirebaseRemoteConfig,
@AppCoroutineScope private val coroutineScope: CoroutineScope
) : AppInitializer {
override fun init(application: Application) {
if (preferenceManager.firebaseAnalyticsEnabled) {
coroutineScope.launch {
remoteConfig.fetchAndActivate().await()
}
}
}
override fun priority(): Int = 1
}