Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.4.3 #30

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

The changelog for `Superwall`. Also see the [releases](https://github.com/superwall/react-native-superwall/releases) on GitHub.

## 1.4.3

### Enhancements

- Upgrades Android SDK to 1.5.1 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.5.1)
- Upgrades iOS SDK to 3.12.0 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.12.0)

### Fixes

- Fixes issue where accessing configuration state before configuring would cause a crash.

## 1.4.2

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ dependencies {
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation "com.superwall.sdk:superwall-android:1.3.1"
implementation "com.superwall.sdk:superwall-android:1.5.1"
implementation 'com.android.billingclient:billing:6.1.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import com.superwallreactnative.models.toJson
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.flow.first
import com.superwall.sdk.config.models.ConfigurationStatus

class SuperwallReactNativeModule(private val reactContext: ReactApplicationContext) :
ReactContextBaseJavaModule(reactContext) {
Expand Down Expand Up @@ -187,7 +189,12 @@ class SuperwallReactNativeModule(private val reactContext: ReactApplicationConte

@ReactMethod
fun getConfigurationStatus(promise: Promise) {
promise.resolve(Superwall.instance.configurationState.asString())
CoroutineScope(Dispatchers.IO).launch {
if(!Superwall.hasInitialized.first())
promise.resolve(ConfigurationStatus.Pending.asString())
else
promise.resolve(Superwall.instance.configurationState.asString())
}
}

@ReactMethod
Expand Down Expand Up @@ -253,14 +260,17 @@ class SuperwallReactNativeModule(private val reactContext: ReactApplicationConte
@ReactMethod
fun confirmAllAssignments(promise: Promise) {
CoroutineScope(Dispatchers.IO).launch {
val result = Superwall.instance.confirmAllAssignments()
val array = Arguments.createArray()
result.forEach { assignment ->
array.pushMap(assignment.toJson())
}
launch(Dispatchers.Main) {
promise.resolve(array)
}
Superwall.instance.confirmAllAssignments().fold({
launch(Dispatchers.Main) {
val array = Arguments.createArray()
it.forEach { assignment ->
array.pushMap(assignment.toJson())
}
promise.resolve(array)
}
},{
promise.reject("Error", it.message)
})
}
}

Expand All @@ -271,10 +281,13 @@ class SuperwallReactNativeModule(private val reactContext: ReactApplicationConte
promise: Promise
) {
CoroutineScope(Dispatchers.IO).launch {
val result = Superwall.instance.getPresentationResult(event, params?.toHashMap())
launch(Dispatchers.Main) {
promise.resolve(result.toJson())
}
Superwall.instance.getPresentationResult(event, params?.toHashMap()).fold({
launch(Dispatchers.Main) {
promise.resolve(it.toJson())
}
},{
promise.reject("Error", it.message)
})
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.superwall.sdk.paywall.presentation.PaywallInfo
import com.superwallreactnative.models.SuperwallEvent
import com.superwallreactnative.models.convertMapToReadableMap
import com.superwallreactnative.models.toJson
import java.net.URL
import java.net.URI
import android.net.Uri

class SuperwallDelegateBridge(
Expand Down Expand Up @@ -86,7 +86,7 @@ class SuperwallDelegateBridge(
.emit("didPresentPaywall", data)
}

override fun paywallWillOpenURL(url: URL) {
override fun paywallWillOpenURL(url: URI) {
val data = Arguments.createMap().apply {
putString("url", url.toString())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,24 @@ class SuperwallEvent {
map.putString("event", "paywallWebviewLoadFallback")
map.putMap("paywallInfo", superwallEvent.paywallInfo.toJson())
}
is SuperwallEvent.ErrorThrown -> {
map.putString("event", "errorThrown")
}
is SuperwallEvent.ConfigFail -> {
map.putString("event", "configFail")
}
is SuperwallEvent.ConfirmAllAssignments -> {
map.putString("event", "confirmAllAssignments")
}
is SuperwallEvent.PaywallResourceLoadFail -> {
map.putString("event", "paywallResourceLoadFail")
map.putString("url", superwallEvent.url.toString())
map.putString("error", superwallEvent.error)
}
is SuperwallEvent.ShimmerViewComplete -> {
map.putString("event", "shimmerViewComplete")
}
is SuperwallEvent.ShimmerViewStart -> {
map.putString("event", "shimmerViewStart")
}
else -> {}
}
return map
}
Expand Down
14 changes: 7 additions & 7 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1118,14 +1118,14 @@ PODS:
- PurchasesHybridCommon (= 9.7.2)
- React-Core
- SocketRocket (0.6.1)
- Superscript (0.1.12)
- Superscript (0.1.16)
- superwall-react-native (1.4.2):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- SuperwallKit (= 3.11.1)
- SuperwallKit (3.11.1):
- Superscript (= 0.1.12)
- SuperwallKit (= 3.12.0)
- SuperwallKit (3.12.0):
- Superscript (= 0.1.16)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -1392,9 +1392,9 @@ SPEC CHECKSUMS:
RevenueCat: 7be0d7bde9efb2fc1ebd1888522c55bb4f9feb18
RNPurchases: 06957eb2f35bd7bb336d32fccf3534d45a3fda8a
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Superscript: 1ed1b4364f93bd16be05d085bba7357dbab95c83
superwall-react-native: 9505d6e29c25c9d53f0e053545bad52a3081fc53
SuperwallKit: ff739c94ebc351ae210c8b0f0b3931e930d74053
Superscript: 17e2597de5e1ddfa132e217b33d1eb8eddf13e0f
superwall-react-native: 45c2c0e4a0b9599b008a1d7a6d1e7c66a129d2e0
SuperwallKit: 9abe07053249c596af9875a3b857236068a79edc
Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312

PODFILE CHECKSUM: 76fced934770e056b70a3087a2bc377b3556bae1
Expand Down
4 changes: 4 additions & 0 deletions ios/Json/SuperwallEventInfo+Json.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ extension SuperwallEvent {
return ["event": "adServicesTokenRequestFail", "error": error.localizedDescription]
case .adServicesTokenRequestComplete(token: let token):
return ["event": "adServicesTokenRequestComplete", "token": token]
case .shimmerViewStart:
return ["event": "shimmerViewStart"]
case .shimmerViewComplete:
return ["event": "shimmerViewComplete"]
}
}
}
4 changes: 1 addition & 3 deletions ios/Json/SuperwallOptions+Json.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ extension SuperwallOptions {
let networkEnvironment = NetworkEnvironment.fromJson(networkEnvironmentValue),
let isExternalDataCollectionEnabled = dictionary["isExternalDataCollectionEnabled"] as? Bool,
let loggingValue = dictionary["logging"] as? [String: Any],
let logging = Logging.fromJson(loggingValue),
let collectAdServicesAttribution = dictionary["collectAdServicesAttribution"] as? Bool
let logging = Logging.fromJson(loggingValue)
else {
return nil
}
Expand All @@ -25,7 +24,6 @@ extension SuperwallOptions {
superwallOptions.localeIdentifier = localeIdentifier
superwallOptions.isGameControllerEnabled = isGameControllerEnabled
superwallOptions.logging = logging
superwallOptions.collectAdServicesAttribution = collectAdServicesAttribution

return superwallOptions
}
Expand Down
4 changes: 4 additions & 0 deletions src/public/SuperwallEventInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export enum EventType {
adServicesTokenRequestStart = "adServicesTokenRequestStart",
adServicesTokenRequestFail = "adServicesTokenRequestFail",
adServicesTokenRequestComplete = "adServicesTokenRequestComplete"
shimmerViewStart = "shimmerViewStart"
shimmerViewComplete = "shimmerViewComplete"
}

export class SuperwallEvent {
Expand Down Expand Up @@ -151,6 +153,8 @@ export class SuperwallEvent {
case EventType.adServicesTokenRequestStart:
case EventType.errorThrown:
case EventType.confirmAllAssignments:
case EventType.shimmerViewStart:
case EventType.shimmerViewComplete:
return new SuperwallEvent({ type: eventType });
case EventType.restoreFail:
return new SuperwallEvent({
Expand Down
2 changes: 1 addition & 1 deletion superwall-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/superwall-me/Superwall-React-Native.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift}"
s.dependency "SuperwallKit", '3.11.1'
s.dependency "SuperwallKit", '3.12.0'

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
Expand Down
Loading