Class Configuration
java.lang.Object
nz.co.electricbolt.appfiguratelibrary.Configuration
Subclass Configuration, then implement properties to configure using the Appfigurate app (Emulator or Google Play
Store) with the
BooleanProperty
,
IntPropertyEdit
,
IntPropertyList
,
IntPropertyListEdit
,
IntPropertySlider
,
FloatPropertyEdit
,
FloatPropertyList
,
FloatPropertyListEdit
,
FloatPropertySlider
,
DoublePropertyEdit
,
DoublePropertyList
,
DoublePropertyListEdit
,
DoublePropertySlider
,
StringPropertyEdit
,
StringPropertyList
,
StringPropertyListEdit
,
EncryptedStringPropertyListEdit
,
RemoteBooleanProperty
,
RemoteIntPropertyEdit
,
RemoteDoublePropertyEdit
or
RemoteStringPropertyEdit
annotations. You must override the publicKey
, reset
and
allowInvalidSignatures
methods.-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Return true if invalid signatures are allowed to apply configuration (Debug builds), or false if only a correct signature is acceptable (Release builds).void
automationAction
(String action) Executes the action specified when automation testing using Espresso.void
Applies configuration properties to the app when automation testing using Espresso.void
Resets configuration properties to factory defaults (the values specified in yourreset()
method) when automation testing using Espresso.Returns the textual representation of all properties.String[]
Optionally override to return a list of environment tags in the order you want them to appear in a segmented control in the Appfigurate Configure app screen.Returns the textual representation of all properties that have non default values.abstract String
Override to return the public key for this application.Returns a dictionary of remote property default values as set in thereset()
method.abstract void
reset()
Set default values into your properties.static Configuration
The singleton instance of the Configuration subclass.
-
Method Details
-
allowInvalidSignatures
public abstract boolean allowInvalidSignatures()Return true if invalid signatures are allowed to apply configuration (Debug builds), or false if only a correct signature is acceptable (Release builds).> Java example
@Override public boolean allowInvalidSignatures() { return BuildConfig.DEBUG; }
> Kotlin exampleoverride fun allowInvalidSignatures(): Boolean { return BuildConfig.DEBUG }
- Returns:
- true if invalid signatures are allowed.
-
reset
public abstract void reset()Set default values into your properties. You should ensure that all reset values conform to minimum and maximum values, list entries and regular expressions. Any reset values not conforming will be output to the console.public void reset() { this.decibelLimit = 5.1f; this.foregroundColorHex = "fa3bcc"; }
-
publicKey
Override to return the public key for this application. Use the Appfigurate app (Emulator or Google Play Store) to output the public key.> Java example (abbreviated)
@Override public String publicKey() { // 41 36 87 71 0D 05 return "-----BEGIN PUBLIC KEY-----\n" + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ\n" ... + "ywIDAQAB\n" + "-----END PUBLIC KEY-----\n"; }
> Kotlin example (abbreviated)override fun publicKey(): String { // 41 36 87 71 0D 05 return """ -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4TZnKfGeXttN7Rr3eiAZ ... ywIDAQAB -----END PUBLIC KEY----- """.trimIndent() }
- Returns:
- public key
-
environmentTags
Optionally override to return a list of environment tags in the order you want them to appear in a segmented control in the Appfigurate Configure app screen.AppfigurateLibraryException
will be thrown if there are environment tags specified in the values ofIntPropertyList
,IntPropertyListEdit
,FloatPropertyList
,FloatPropertyListEdit
,DoublePropertyList
,DoublePropertyListEdit
,StringPropertyList
,StringPropertyListEdit
,EncryptedStringPropertyListEdit
annotations that are not returned in the list from this method.> Java example
@override String[] environmentTags() { return {"Dev", "Test", "Prod"} }
> Kotlin exampleoverride fun environmentTags() -> String[] { return {"Dev", "Test", "Prod"} }
- Returns:
- array of environment tags.
-
modifications
Returns the textual representation of all properties that have non default values. Property names are shortened to camel case and appended with the non default value, except for String properties which omit the property name. Example: "userInteractionTimeout=60.0" would be returned as "UIT=60.0".- Returns:
- textual representation of non default values
-
description
Returns the textual representation of all properties. Property names are shortened to camel case and appended with the value, except for String properties which omit the property name. Example: "debugLog=5" would be returned as "DL=5".- Returns:
- textual representation of all properties
-
automationApply
public void automationApply()Applies configuration properties to the app when automation testing using Espresso. TheallowInvalidSignatures()
method must return true. The standard "Configuration applied" dialog will be suppressed. -
automationReset
public void automationReset()Resets configuration properties to factory defaults (the values specified in yourreset()
method) when automation testing using Espresso. TheallowInvalidSignatures()
method must return true. The standard "Configuration reset" dialog will be suppressed. -
automationAction
Executes the action specified when automation testing using Espresso. TheallowInvalidSignatures()
method must return true. The standard "Configuration reset" dialog will be suppressed.- Parameters:
action
- action to execute.
-
remoteDefaults
Returns a dictionary of remote property default values as set in thereset()
method. Used when integrating with select third party remote configuration providers. See alsoAppfigurate.fetchRemoteConfiguration(nz.co.electricbolt.appfiguratelibrary.Appfigurate.FetchRemoteConfiguration)
.> Java Firebase Remote Config example
this.remoteConfig.setDefaultsAsync(Configuration.sharedConfiguration().remoteDefaults());
> Kotlin Firebase Remote Config examplethis.remoteConfig.setDefaultsAsync(Configuration.sharedConfiguration().remoteDefaults())
- Returns:
- dictionary of remote property default values.