Handle the feature toggles in your Android app seamlessly!
repositories {
maven { url 'https://dl.bintray.com/suyambu/android/' }
}
dependencies {
implementation 'in.ponshere:toggler:0.0.4'
}
interface AppToggles {
@SwitchToggle(
sharedPreferencesKey = "featureA",
defaultValue = true,
fireBaseRemoteConfigKey = "featureA"
)
fun isFeatureAEnabled(): Boolean
}
class TogglerApp : Application() {
override fun onCreate() {
super.onCreate()
val appToggles = Toggler.init(this, AppToggles::class.java)
}
}
if(Toggler.get<AppToggles>().isFeatureAEnabled()) {
//enable Feature A
}
or you can also use the appToggles
instance created in application class.
if(appToggles.isFeatureAEnabled()) {
//enable Feature A
}
To show all of the toggles, use the below API. In the screen, you can easily enable/disable/change toggle values.
Toggler.showAllToggles(context)
Please fork this repository and contribute back using pull requests. Features can be requested using issues. All code, comments, and critiques are greatly appreciated.