-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
28 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
29 changes: 23 additions & 6 deletions
29
...src/main/java/com/urbanairship/android/framework/proxy/proxies/FeatureFlagManagerProxy.kt
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 |
---|---|---|
@@ -1,16 +1,33 @@ | ||
package com.urbanairship.android.framework.proxy.proxies | ||
|
||
import com.urbanairship.featureflag.FeatureFlag | ||
import com.urbanairship.featureflag.FeatureFlagManager | ||
import com.urbanairship.json.JsonSerializable | ||
import com.urbanairship.json.JsonValue | ||
import com.urbanairship.json.jsonMapOf | ||
|
||
public class FeatureFlagManagerProxy internal constructor(private val featureFlagManagerProvider: () -> FeatureFlagManager) { | ||
public suspend fun flag(name: String): JsonValue { | ||
public suspend fun flag(name: String): FeatureFlagProxy { | ||
val flag = featureFlagManagerProvider().flag(name).getOrThrow() | ||
return jsonMapOf( | ||
"isEligible" to flag.isEligible, | ||
"exists" to flag.exists, | ||
"variables" to flag.variables | ||
).toJsonValue() | ||
return FeatureFlagProxy(flag) | ||
} | ||
|
||
public fun trackInteraction(flag: FeatureFlagProxy) { | ||
featureFlagManagerProvider().trackInteraction(flag.original) | ||
} | ||
} | ||
|
||
public data class FeatureFlagProxy( | ||
internal val original: FeatureFlag, | ||
) : JsonSerializable { | ||
|
||
public constructor(jsonValue: JsonValue): this( | ||
FeatureFlag.fromJson(jsonValue) | ||
) | ||
override fun toJsonValue(): JsonValue = jsonMapOf( | ||
"isEligible" to original.isEligible, | ||
"exists" to original.exists, | ||
"variables" to original.variables, | ||
"_internal" to original | ||
).toJsonValue() | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
PODS: | ||
- Airship (17.3.1): | ||
- Airship/Automation (= 17.3.1) | ||
- Airship/Basement (= 17.3.1) | ||
- Airship/Core (= 17.3.1) | ||
- Airship/FeatureFlags (= 17.3.1) | ||
- Airship/MessageCenter (= 17.3.1) | ||
- Airship/PreferenceCenter (= 17.3.1) | ||
- Airship/Automation (17.3.1): | ||
- Airship (17.5.0): | ||
- Airship/Automation (= 17.5.0) | ||
- Airship/Basement (= 17.5.0) | ||
- Airship/Core (= 17.5.0) | ||
- Airship/FeatureFlags (= 17.5.0) | ||
- Airship/MessageCenter (= 17.5.0) | ||
- Airship/PreferenceCenter (= 17.5.0) | ||
- Airship/Automation (17.5.0): | ||
- Airship/Core | ||
- Airship/Basement (17.3.1) | ||
- Airship/Core (17.3.1): | ||
- Airship/Basement (17.5.0) | ||
- Airship/Core (17.5.0): | ||
- Airship/Basement | ||
- Airship/FeatureFlags (17.3.1): | ||
- Airship/FeatureFlags (17.5.0): | ||
- Airship/Core | ||
- Airship/MessageCenter (17.3.1): | ||
- Airship/MessageCenter (17.5.0): | ||
- Airship/Core | ||
- Airship/PreferenceCenter (17.3.1): | ||
- Airship/PreferenceCenter (17.5.0): | ||
- Airship/Core | ||
|
||
DEPENDENCIES: | ||
- Airship (= 17.3.1) | ||
- Airship (= 17.5.0) | ||
|
||
SPEC REPOS: | ||
trunk: | ||
- Airship | ||
|
||
SPEC CHECKSUMS: | ||
Airship: a8ec7140cca677696f10f605749c18248d818117 | ||
Airship: 9a0748772a8b31c7cf8d57062797dbe36f460fa4 | ||
|
||
PODFILE CHECKSUM: e424bf7ba9de09d671cb81ca366bcbd9c2aae18a | ||
PODFILE CHECKSUM: dfd8441890bc60fc647a2df304c66aa69a1d33ed | ||
|
||
COCOAPODS: 1.12.1 | ||
COCOAPODS: 1.11.3 |