-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Evaluation Callback Option (#195)
* Add Evaluation Callback Option * fix lint * fix more lint * One more lint fix * fix tests * update test * update * update * update
- Loading branch information
1 parent
1f87006
commit 0b25b31
Showing
12 changed files
with
209 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.statsig.androidsdk | ||
|
||
open class BaseConfig( | ||
private val name: String, | ||
private val details: EvaluationDetails, | ||
) { | ||
open fun getName(): String { | ||
return this.name | ||
} | ||
|
||
open fun getEvaluationDetails(): EvaluationDetails { | ||
return this.details | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.statsig.androidsdk | ||
|
||
/** | ||
* A helper class for interfacing with Feature Gate defined in the Statsig console | ||
*/ | ||
class FeatureGate( | ||
private val name: String, | ||
private val details: EvaluationDetails, | ||
private val value: Boolean, | ||
private val rule: String = "", | ||
private val groupName: String? = null, | ||
private val secondaryExposures: Array<Map<String, String>> = arrayOf(), | ||
) : BaseConfig(name, details) { | ||
internal constructor( | ||
gateName: String, | ||
apiFeatureGate: APIFeatureGate, | ||
evalDetails: EvaluationDetails, | ||
) : this( | ||
gateName, | ||
evalDetails, | ||
apiFeatureGate.value, | ||
apiFeatureGate.ruleID, | ||
apiFeatureGate.groupName, | ||
apiFeatureGate.secondaryExposures, | ||
) | ||
|
||
fun getValue(): Boolean { | ||
return this.value | ||
} | ||
|
||
fun getRuleID(): String { | ||
return this.rule | ||
} | ||
|
||
fun getGroupName(): String? { | ||
return this.groupName | ||
} | ||
|
||
fun getSecondaryExposures(): Array<Map<String, String>> { | ||
return this.secondaryExposures | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.