This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
ext.versionMajor = 1 | |
ext.versionMinor = 2 | |
ext.versionPatch = 3 | |
ext.versionClassifier = null | |
ext.isSnapshot = true | |
ext.minimumSdkVersion = 19 | |
android { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
ext.versionMajor = 1 | |
ext.versionMinor = 2 | |
ext.versionPatch = 3 | |
ext.versionClassifier = null | |
ext.isSnapshot = true | |
ext.minimumSdkVersion = 15 | |
ext.featureBranchPrefix = "feature/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RemoteConfigFetcherWorker(appContext: Context, workerParams: WorkerParameters) : Worker(appContext, workerParams) { | |
companion object { | |
fun enqueue(context: Context) { | |
val constraints = Constraints.Builder() | |
.setRequiredNetworkType(NetworkType.CONNECTED) | |
.build() | |
val workRequestBuilder = OneTimeWorkRequestBuilder<RemoteConfigFetcherWorker>().setConstraints(constraints) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require("firebase-functions"); | |
const admin = require("firebase-admin"); | |
admin.initializeApp(); | |
exports.pushConfig = functions.remoteConfig.onUpdate((versionMetadata) => { | |
// Create FCM payload to send data message to REMOTE_CONFIG_PUSH topic. | |
const payload = { | |
topic: "REMOTE_CONFIG_PUSH", | |
data: { | |
"REMOTE_CONFIG_STATUS": "STALE", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Firebase.remoteConfig.apply { | |
setConfigSettingsAsync(remoteConfigSettings { | |
val sharedPreferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext) | |
if (BuildConfig.DEBUG || sharedPreferences.getBoolean("remote_config_stale", false)) { | |
minimumFetchIntervalInSeconds = 0 | |
} | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onMessageReceived(remoteMessage: RemoteMessage) { | |
if (remoteMessage.getData().containsKey("REMOTE_CONFIG_STATUS")) { | |
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this) | |
sharedPreferences.edit().putBoolean("remote_config_stale", true).apply() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onNewToken(newPushToken: String) { | |
FirebaseMessaging.getInstance().subscribeToTopic("REMOTE_CONFIG_PUSH") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dipien.gradle | |
enum class GradleProperty(val defaultValue: Any?) { | |
BYE_BYE_JETIFIER_ENABLED(false) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dipien.gradle | |
import com.dipien.gradle.GradleProperty | |
import org.gradle.api.Project | |
class PropertyResolver(private val project: Project) { | |
fun getBooleanProp(gradleProperty: GradleProperty): Boolean { | |
return getBooleanProp(gradleProperty, gradleProperty.defaultValue as Boolean) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
dependencies { | |
classpath("com.dipien:bye-bye-jetifier:1.1.2") | |
} | |
} | |
ext { | |
propertyResolver = new PropertyResolver(project) | |
} |
OlderNewer