Skip to content

Commit

Permalink
Release 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rlepinski committed Aug 4, 2023
1 parent f6b6947 commit e689455
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AirshipFrameworkProxy.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Pod::Spec.new do |s|
s.version = "4.0.0"
s.version = "4.0.1"
s.name = "AirshipFrameworkProxy"
s.summary = "Airship iOS mobile framework proxy"
s.documentation_url = "https://docs.airship.com/platform/mobile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public data class ProxyConfig(
val androidConfig: Android?
) : JsonSerializable {

public constructor(config: JsonMap) : this(defaultEnvironment = config.get("default")?.map?.let { Environment(it) },
public constructor(config: JsonMap) : this(
defaultEnvironment = config.get("default")?.map?.let { Environment(it) },
productionEnvironment = config.get("production")?.map?.let { Environment(it) },
developmentEnvironment = config.get("development")?.map?.let { Environment(it) },
site = config.get("site")?.string?.let { Utils.parseSite(it) },
Expand All @@ -36,14 +37,16 @@ public data class ProxyConfig(
isChannelCreationDelayEnabled = config.get("isChannelCreationDelayEnabled")?.boolean,
enabledFeatures = config.get("enabledFeatures")?.let { Utils.parseFeatures(it) },
autoPauseInAppAutomationOnLaunch = config.get("autoPauseInAppAutomationOnLaunch")?.boolean,
androidConfig = config.get("android")?.map?.let { Android(it) })
androidConfig = config.get("android")?.map?.let { Android(it) }
)

override fun toJsonValue(): JsonValue {
return JsonMap.newBuilder()
.put("default", defaultEnvironment)
.put("production", productionEnvironment)
.put("development", developmentEnvironment)
.put("site", site?.let { Utils.siteString(site) })
.putOpt("inProduction", inProduction)
.putOpt("initialConfigUrl", initialConfigUrl)
.putOpt("urlAllowList", urlAllowList)
.putOpt("urlAllowListScopeJavaScriptInterface", urlAllowListScopeJavaScriptInterface)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class FeatureFlagManagerProxy internal constructor(private val featureFla
public suspend fun flag(name: String): JsonValue {
val flag = featureFlagManagerProvider().flag(name).getOrThrow()
return jsonMapOf(
"is_eligible" to flag.isEligible,
"isEligible" to flag.isEligible,
"exists" to flag.exists,
"variables" to flag.variables
).toJsonValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class ProxyConfigTest {
"logLevel":"error"
},
"site":"us",
"inProduction": true,
"initialConfigUrl":"some-url",
"isChannelCreationDelayEnabled":false,
"urlAllowListScopeJavaScriptInterface":[
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]

# Airship
airshipProxy = '4.0.0'
airshipProxy = '4.0.1'
airship = '17.1.0'

# Gradle plugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ public class AirshipFeatureFlagManagerProxy {
self.featureFlagManagerProvider = featureFlagManagerProvider
}

public func flag(name: String) async throws -> FeatureFlag {
return try await self.featureFlagManager.flag(name: name)
public func flag(name: String) async throws -> FeatureFlagProxy {
let flag = try await self.featureFlagManager.flag(name: name)
return FeatureFlagProxy(isElegible: flag.isEligible, exists: flag.exists, variables: flag.variables)

}
}

// We encode `isElegible` as snake case breaking the APIs for react. This
// wraps it so we can return camelCase like all other APIs.
public struct FeatureFlagProxy: Codable {
let isElegible: Bool
let exists: Bool
let variables: AirshipJSON?
}


0 comments on commit e689455

Please sign in to comment.