-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from superwall/develop
1.3.3.
- Loading branch information
Showing
20 changed files
with
172 additions
and
40 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
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
14 changes: 14 additions & 0 deletions
14
android/src/main/java/com/superwallreactnative/models/ConfirmedAssignments.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.superwallreactnative.models | ||
|
||
import com.facebook.react.bridge.Arguments | ||
import com.facebook.react.bridge.ReadableMap | ||
|
||
import com.superwall.sdk.models.triggers.Experiment | ||
import com.superwall.sdk.models.assignment.ConfirmedAssignment | ||
|
||
fun ConfirmedAssignment.toJson(): ReadableMap { | ||
val assignmentMap = Arguments.createMap() | ||
assignmentMap.putString("experimentId", this.experimentId) | ||
assignmentMap.putMap("variant", this.variant.toJson()) | ||
return assignmentMap | ||
} |
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
15 changes: 15 additions & 0 deletions
15
android/src/main/java/com/superwallreactnative/models/Variant.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.superwallreactnative.models | ||
|
||
import com.facebook.react.bridge.Arguments | ||
import com.facebook.react.bridge.ReadableMap | ||
import com.superwall.sdk.models.triggers.Experiment | ||
|
||
|
||
fun Experiment.Variant.toJson(): ReadableMap { | ||
val variantMap = Arguments.createMap() | ||
variantMap.putString("id", this.id) | ||
variantMap.putString("type", this.type.toString()) | ||
variantMap.putString("paywallId", this.paywallId) | ||
|
||
return variantMap | ||
} |
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,11 @@ | ||
import Foundation | ||
import SuperwallKit | ||
|
||
extension ConfirmedAssignment { | ||
func toJson() -> [String: Any] { | ||
return [ | ||
"experimentId": experimentId, | ||
"variant": variant.toJson(), | ||
] | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import SuperwallKit | ||
|
||
extension Experiment.Variant { | ||
func toJson() -> [String: Any] { | ||
return [ | ||
"id": self.id, | ||
"type": self.type.toJson(), | ||
"paywallId": self.paywallId, | ||
] | ||
} | ||
} | ||
|
||
extension Experiment.Variant.VariantType { | ||
func toJson() -> String { | ||
switch self { | ||
case .treatment: | ||
return "TREATMENT" | ||
case .holdout: | ||
return "HOLDOUT" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Variant } from './Experiment'; | ||
|
||
export class ConfirmedAssignment { | ||
experimentId: String; | ||
variant: Variant; | ||
|
||
constructor(experimentId: String, variant: Variant) { | ||
this.experimentId = experimentId; | ||
this.variant = variant; | ||
} | ||
|
||
static fromJson(json: any): ConfirmedAssignment { | ||
return new ConfirmedAssignment( | ||
json.experimentId, | ||
Variant.fromJson(json.variant) | ||
); | ||
} | ||
} |
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