react-native-purchases 7.2.0 → 7.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNPurchases.podspec +2 -2
- package/android/build.gradle +4 -2
- package/android/src/main/java/com/revenuecat/purchases/react/GoogleUpgradeInfo.java +19 -0
- package/android/src/main/java/com/revenuecat/purchases/react/Paywall.kt +33 -0
- package/android/src/main/java/com/revenuecat/purchases/react/RNPaywallManager.java +22 -0
- package/android/src/main/java/com/revenuecat/purchases/react/RNPaywallsModule.java +58 -0
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +27 -35
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesPackage.java +7 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/paywalls.d.ts +6 -0
- package/dist/paywalls.js +60 -0
- package/ios/RNPaywallManager.h +17 -0
- package/ios/RNPaywallManager.m +27 -0
- package/ios/RNPaywalls.h +13 -0
- package/ios/RNPaywalls.m +29 -0
- package/ios/RNPurchases.m +1 -1
- package/ios/RNPurchases.xcodeproj/project.pbxproj +12 -0
- package/package.json +2 -2
- package/scripts/docs/index.html +1 -1
package/RNPurchases.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
30
30
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
31
31
|
versionCode 1
|
|
32
|
-
versionName '7.
|
|
32
|
+
versionName '7.4.0-beta.1'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
buildTypes {
|
|
@@ -121,6 +121,8 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
121
121
|
dependencies {
|
|
122
122
|
//noinspection GradleDynamicVersion
|
|
123
123
|
api 'com.facebook.react:react-native:+'
|
|
124
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:7.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:7.4.0-beta.1'
|
|
125
125
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
126
|
+
implementation 'androidx.compose.ui:ui-android:1.5.4'
|
|
127
|
+
implementation "androidx.appcompat:appcompat:1.6.1"
|
|
126
128
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.revenuecat.purchases.react;
|
|
2
|
+
|
|
3
|
+
class GoogleUpgradeInfo {
|
|
4
|
+
private final String oldProductIdentifier;
|
|
5
|
+
private final Integer prorationMode;
|
|
6
|
+
|
|
7
|
+
public GoogleUpgradeInfo(String oldProductIdentifier, Integer prorationMode) {
|
|
8
|
+
this.oldProductIdentifier = oldProductIdentifier;
|
|
9
|
+
this.prorationMode = prorationMode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public String getOldProductIdentifier() {
|
|
13
|
+
return oldProductIdentifier;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public Integer getProrationMode() {
|
|
17
|
+
return prorationMode;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package com.revenuecat.purchases.react
|
|
2
|
+
|
|
3
|
+
import android.app.PendingIntent.getActivity
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.util.AttributeSet
|
|
6
|
+
import android.widget.ImageView
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.runtime.getValue
|
|
9
|
+
import androidx.compose.runtime.mutableStateOf
|
|
10
|
+
import androidx.compose.runtime.setValue
|
|
11
|
+
import androidx.compose.ui.platform.AbstractComposeView
|
|
12
|
+
import com.facebook.react.ReactActivity
|
|
13
|
+
import com.facebook.react.ReactActivityDelegate
|
|
14
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
15
|
+
import com.revenuecat.purchases.ui.revenuecatui.ExperimentalPreviewRevenueCatUIPurchasesAPI
|
|
16
|
+
import com.revenuecat.purchases.ui.revenuecatui.Paywall
|
|
17
|
+
import com.revenuecat.purchases.ui.revenuecatui.PaywallOptions
|
|
18
|
+
|
|
19
|
+
internal class Paywall @JvmOverloads constructor(
|
|
20
|
+
context: Context,
|
|
21
|
+
attrs: AttributeSet? = null,
|
|
22
|
+
) : AbstractComposeView(context, attrs) {
|
|
23
|
+
@OptIn(ExperimentalPreviewRevenueCatUIPurchasesAPI::class)
|
|
24
|
+
@Composable
|
|
25
|
+
override fun Content() {
|
|
26
|
+
Paywall(
|
|
27
|
+
PaywallOptions.Builder(
|
|
28
|
+
dismissRequest = {}
|
|
29
|
+
)
|
|
30
|
+
.build()
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.revenuecat.purchases.react;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.uimanager.SimpleViewManager;
|
|
6
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
7
|
+
|
|
8
|
+
public class RNPaywallManager extends SimpleViewManager<Paywall> {
|
|
9
|
+
public static final String REACT_CLASS = "RNPaywall";
|
|
10
|
+
|
|
11
|
+
@NonNull
|
|
12
|
+
@Override
|
|
13
|
+
public String getName() {
|
|
14
|
+
return REACT_CLASS;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@NonNull
|
|
18
|
+
@Override
|
|
19
|
+
protected Paywall createViewInstance(@NonNull ThemedReactContext themedReactContext) {
|
|
20
|
+
return new Paywall(themedReactContext);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
package com.revenuecat.purchases.react;
|
|
2
|
+
|
|
3
|
+
import static com.revenuecat.purchases.hybridcommon.PaywallHelpersKt.presentPaywallFromFragment;
|
|
4
|
+
|
|
5
|
+
import android.app.Activity;
|
|
6
|
+
|
|
7
|
+
import androidx.annotation.NonNull;
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
9
|
+
import androidx.annotation.OptIn;
|
|
10
|
+
import androidx.fragment.app.FragmentActivity;
|
|
11
|
+
|
|
12
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
14
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
15
|
+
import com.revenuecat.purchases.ui.revenuecatui.ExperimentalPreviewRevenueCatUIPurchasesAPI;
|
|
16
|
+
|
|
17
|
+
@OptIn(markerClass = ExperimentalPreviewRevenueCatUIPurchasesAPI.class)
|
|
18
|
+
public class RNPaywallsModule extends ReactContextBaseJavaModule {
|
|
19
|
+
public RNPaywallsModule(ReactApplicationContext reactContext) {
|
|
20
|
+
super(reactContext);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@NonNull
|
|
24
|
+
@Override
|
|
25
|
+
public String getName() {
|
|
26
|
+
return "RNPaywalls";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@ReactMethod
|
|
30
|
+
public void presentPaywall() {
|
|
31
|
+
presentPaywall(null);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@ReactMethod
|
|
35
|
+
public void presentPaywallIfNeeded(final String requiredEntitlementIdentifier) {
|
|
36
|
+
presentPaywall(requiredEntitlementIdentifier);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private void presentPaywall(final @Nullable String requiredEntitlementIdentifier) {
|
|
40
|
+
final FragmentActivity fragment = getCurrentActivityFragment();
|
|
41
|
+
if (fragment == null) {
|
|
42
|
+
// TODO: log
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
presentPaywallFromFragment(fragment, requiredEntitlementIdentifier);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private @Nullable FragmentActivity getCurrentActivityFragment() {
|
|
50
|
+
final Activity activity = getCurrentActivity();
|
|
51
|
+
|
|
52
|
+
if (activity instanceof FragmentActivity) {
|
|
53
|
+
return (FragmentActivity) activity;
|
|
54
|
+
} else {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -37,7 +37,6 @@ import java.util.ArrayList;
|
|
|
37
37
|
import java.util.HashMap;
|
|
38
38
|
import java.util.List;
|
|
39
39
|
import java.util.Map;
|
|
40
|
-
import java.util.Set;
|
|
41
40
|
|
|
42
41
|
import kotlin.UninitializedPropertyAccessException;
|
|
43
42
|
|
|
@@ -46,7 +45,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
46
45
|
private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
|
|
47
46
|
private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
|
|
48
47
|
public static final String PLATFORM_NAME = "react-native";
|
|
49
|
-
public static final String PLUGIN_VERSION = "7.
|
|
48
|
+
public static final String PLUGIN_VERSION = "7.4.0-beta.1";
|
|
50
49
|
|
|
51
50
|
private final ReactApplicationContext reactContext;
|
|
52
51
|
|
|
@@ -145,19 +144,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
145
144
|
@Nullable final ReadableMap googleInfo,
|
|
146
145
|
@Nullable final String presentedOfferingIdentifier,
|
|
147
146
|
final Promise promise) {
|
|
148
|
-
|
|
149
|
-
Integer googleProrationMode = null;
|
|
150
|
-
|
|
151
|
-
if (googleProductChangeInfo != null) {
|
|
152
|
-
// GoogleProductChangeInfo in V6 and later
|
|
153
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldProductIdentifier") ? googleProductChangeInfo.getString("oldProductIdentifier") : null;
|
|
154
|
-
googleProrationMode = googleProductChangeInfo.hasKey("prorationMode") ? googleProductChangeInfo.getInt("prorationMode") : null;
|
|
155
|
-
|
|
156
|
-
// Legacy UpgradeInfo in V5 and earlier
|
|
157
|
-
if (googleOldProductId == null) {
|
|
158
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldSKU") ? googleProductChangeInfo.getString("oldSKU") : null;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
147
|
+
GoogleUpgradeInfo googleUpgradeInfo = getUpgradeInfo(googleProductChangeInfo);
|
|
161
148
|
|
|
162
149
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
163
150
|
|
|
@@ -166,8 +153,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
166
153
|
productIdentifier,
|
|
167
154
|
type,
|
|
168
155
|
null,
|
|
169
|
-
|
|
170
|
-
|
|
156
|
+
googleUpgradeInfo.getOldProductIdentifier(),
|
|
157
|
+
googleUpgradeInfo.getProrationMode(),
|
|
171
158
|
googleIsPersonalized,
|
|
172
159
|
presentedOfferingIdentifier,
|
|
173
160
|
getOnResult(promise));
|
|
@@ -180,27 +167,16 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
180
167
|
@Nullable final String discountTimestamp,
|
|
181
168
|
@Nullable final ReadableMap googleInfo,
|
|
182
169
|
final Promise promise) {
|
|
183
|
-
|
|
184
|
-
Integer googleProrationMode = null;
|
|
170
|
+
GoogleUpgradeInfo googleUpgradeInfo = getUpgradeInfo(googleProductChangeInfo);
|
|
185
171
|
|
|
186
|
-
if (googleProductChangeInfo != null) {
|
|
187
|
-
// GoogleProductChangeInfo in V6 and later
|
|
188
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldProductIdentifier") ? googleProductChangeInfo.getString("oldProductIdentifier") : null;
|
|
189
|
-
googleProrationMode = googleProductChangeInfo.hasKey("prorationMode") ? googleProductChangeInfo.getInt("prorationMode") : null;
|
|
190
|
-
|
|
191
|
-
// Legacy UpgradeInfo in V5 and earlier
|
|
192
|
-
if (googleOldProductId == null) {
|
|
193
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldSKU") ? googleProductChangeInfo.getString("oldSKU") : null;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
172
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
197
173
|
|
|
198
174
|
CommonKt.purchasePackage(
|
|
199
175
|
getCurrentActivity(),
|
|
200
176
|
packageIdentifier,
|
|
201
177
|
offeringIdentifier,
|
|
202
|
-
|
|
203
|
-
|
|
178
|
+
googleUpgradeInfo.getOldProductIdentifier(),
|
|
179
|
+
googleUpgradeInfo.getProrationMode(),
|
|
204
180
|
googleIsPersonalized,
|
|
205
181
|
getOnResult(promise));
|
|
206
182
|
}
|
|
@@ -213,8 +189,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
213
189
|
@Nullable final ReadableMap googleInfo,
|
|
214
190
|
@Nullable final String presentedOfferingIdentifier,
|
|
215
191
|
final Promise promise) {
|
|
216
|
-
|
|
217
|
-
Integer googleProrationMode = upgradeInfo != null && upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null;
|
|
192
|
+
GoogleUpgradeInfo googleUpgradeInfo = getUpgradeInfo(upgradeInfo);
|
|
218
193
|
|
|
219
194
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
220
195
|
|
|
@@ -222,8 +197,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
222
197
|
getCurrentActivity(),
|
|
223
198
|
productIdentifer,
|
|
224
199
|
optionIdentifier,
|
|
225
|
-
|
|
226
|
-
|
|
200
|
+
googleUpgradeInfo.getOldProductIdentifier(),
|
|
201
|
+
googleUpgradeInfo.getProrationMode(),
|
|
227
202
|
googleIsPersonalized,
|
|
228
203
|
presentedOfferingIdentifier,
|
|
229
204
|
getOnResult(promise));
|
|
@@ -514,4 +489,21 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
514
489
|
};
|
|
515
490
|
}
|
|
516
491
|
|
|
492
|
+
private static GoogleUpgradeInfo getUpgradeInfo(ReadableMap upgradeInfo) {
|
|
493
|
+
String googleOldProductId = null;
|
|
494
|
+
Integer googleProrationMode = null;
|
|
495
|
+
|
|
496
|
+
if (upgradeInfo != null) {
|
|
497
|
+
// GoogleProductChangeInfo in V6 and later
|
|
498
|
+
googleOldProductId = upgradeInfo.hasKey("oldProductIdentifier") ? upgradeInfo.getString("oldProductIdentifier") : null;
|
|
499
|
+
googleProrationMode = upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null;
|
|
500
|
+
|
|
501
|
+
// Legacy UpgradeInfo in V5 and earlier
|
|
502
|
+
if (googleOldProductId == null) {
|
|
503
|
+
googleOldProductId = upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return new GoogleUpgradeInfo(googleOldProductId, googleProrationMode);
|
|
508
|
+
}
|
|
517
509
|
}
|
|
@@ -18,7 +18,10 @@ public class RNPurchasesPackage implements ReactPackage {
|
|
|
18
18
|
@NonNull
|
|
19
19
|
@Override
|
|
20
20
|
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
21
|
-
return Arrays.<NativeModule>asList(
|
|
21
|
+
return Arrays.<NativeModule>asList(
|
|
22
|
+
new RNPurchasesModule(reactContext),
|
|
23
|
+
new RNPaywallsModule(reactContext)
|
|
24
|
+
);
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
// Deprecated from RN 0.47
|
|
@@ -29,6 +32,8 @@ public class RNPurchasesPackage implements ReactPackage {
|
|
|
29
32
|
@NonNull
|
|
30
33
|
@Override
|
|
31
34
|
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
32
|
-
return
|
|
35
|
+
return Arrays.asList(
|
|
36
|
+
new RNPaywallManager()
|
|
37
|
+
);
|
|
33
38
|
}
|
|
34
39
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/paywalls.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.presentPaywallIfNeeded = exports.presentPaywall = void 0;
|
|
33
|
+
var react_native_1 = require("react-native");
|
|
34
|
+
var react_native_2 = require("react-native");
|
|
35
|
+
var react_1 = __importDefault(require("react"));
|
|
36
|
+
var RNPaywall = (0, react_native_1.requireNativeComponent)('RNPaywall');
|
|
37
|
+
var RNPaywalls = react_native_2.NativeModules.RNPaywalls;
|
|
38
|
+
var PaywallView = /** @class */ (function (_super) {
|
|
39
|
+
__extends(PaywallView, _super);
|
|
40
|
+
function PaywallView() {
|
|
41
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
42
|
+
}
|
|
43
|
+
PaywallView.prototype.render = function () {
|
|
44
|
+
return (
|
|
45
|
+
// TODO: check iOS version to fail if < 15
|
|
46
|
+
react_1.default.createElement(RNPaywall, __assign({}, this.props)));
|
|
47
|
+
};
|
|
48
|
+
return PaywallView;
|
|
49
|
+
}(react_1.default.Component));
|
|
50
|
+
exports.default = PaywallView;
|
|
51
|
+
function presentPaywall() {
|
|
52
|
+
// TODO: check iOS/Android version
|
|
53
|
+
RNPaywalls.presentPaywall();
|
|
54
|
+
}
|
|
55
|
+
exports.presentPaywall = presentPaywall;
|
|
56
|
+
function presentPaywallIfNeeded(requiredEntitlementIdentifier) {
|
|
57
|
+
// TODO: check iOS/Android version
|
|
58
|
+
RNPaywalls.presentPaywallIfNeeded(requiredEntitlementIdentifier);
|
|
59
|
+
}
|
|
60
|
+
exports.presentPaywallIfNeeded = presentPaywallIfNeeded;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNPaywallManager.h
|
|
3
|
+
// RNPurchases
|
|
4
|
+
//
|
|
5
|
+
// Created by Nacho Soto on 11/1/23.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <React/RCTViewManager.h>
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
@interface RNPaywallManager : RCTViewManager
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNPaywallManager.m
|
|
3
|
+
// RNPurchases
|
|
4
|
+
//
|
|
5
|
+
// Created by Nacho Soto on 11/1/23.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RNPaywallManager.h"
|
|
10
|
+
@import PurchasesHybridCommon;
|
|
11
|
+
|
|
12
|
+
@implementation RNPaywallManager
|
|
13
|
+
|
|
14
|
+
RCT_EXPORT_MODULE(RNPaywall)
|
|
15
|
+
|
|
16
|
+
- (UIView *)view
|
|
17
|
+
{
|
|
18
|
+
if (@available(iOS 15.0, *)) {
|
|
19
|
+
PaywallProxy *proxy = [[PaywallProxy alloc] init];
|
|
20
|
+
return proxy.vc.view;
|
|
21
|
+
} else {
|
|
22
|
+
// TODO: log something
|
|
23
|
+
return nil;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@end
|
package/ios/RNPaywalls.h
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by RNPaywalls.
|
|
3
|
+
// Copyright © 2023 RevenueCat. All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
#import <React/RCTEventEmitter.h>
|
|
7
|
+
|
|
8
|
+
@import PurchasesHybridCommon;
|
|
9
|
+
@import RevenueCat;
|
|
10
|
+
|
|
11
|
+
@interface RNPaywalls : RCTEventEmitter <RCTBridgeModule>
|
|
12
|
+
|
|
13
|
+
@end
|
package/ios/RNPaywalls.m
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
//
|
|
3
|
+
// Created by RevenueCat.
|
|
4
|
+
// Copyright © 2023 RevenueCat. All rights reserved.
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
#import "RNPaywalls.h"
|
|
8
|
+
|
|
9
|
+
@implementation RNPaywalls
|
|
10
|
+
|
|
11
|
+
RCT_EXPORT_MODULE();
|
|
12
|
+
|
|
13
|
+
RCT_EXPORT_METHOD(presentPaywall) {
|
|
14
|
+
if (@available(iOS 15.0, *)) {
|
|
15
|
+
[PaywallProxy presentPaywall];
|
|
16
|
+
} else {
|
|
17
|
+
// TODO: log
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
RCT_EXPORT_METHOD(presentPaywallIfNeeded:(NSString *)requiredEntitlementIdentifier) {
|
|
22
|
+
if (@available(iOS 15.0, *)) {
|
|
23
|
+
[PaywallProxy presentPaywallIfNeededWithRequiredEntitlementIdentifier:requiredEntitlementIdentifier];
|
|
24
|
+
} else {
|
|
25
|
+
// TODO: log
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@end
|
package/ios/RNPurchases.m
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3552B97C252CF5900098008A /* PurchasesPlugin.swift */; };
|
|
11
11
|
35BFF4DC247DDAD3008B64DA /* PurchasesHybridCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */; };
|
|
12
12
|
35D0736B20AD0F740012EB8C /* Purchases.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35D0736A20AD0F740012EB8C /* Purchases.framework */; };
|
|
13
|
+
4F72072A2AF30E7E0017395F /* RNPaywallManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7207292AF30E7E0017395F /* RNPaywallManager.m */; };
|
|
14
|
+
4F7D88D52AF9666800855875 /* RNPaywalls.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7D88D32AF9666800855875 /* RNPaywalls.m */; };
|
|
13
15
|
B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNPurchases.m */; };
|
|
14
16
|
/* End PBXBuildFile section */
|
|
15
17
|
|
|
@@ -31,6 +33,10 @@
|
|
|
31
33
|
3552B97C252CF5900098008A /* PurchasesPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchasesPlugin.swift; sourceTree = "<group>"; };
|
|
32
34
|
35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PurchasesHybridCommon.framework; sourceTree = "<group>"; };
|
|
33
35
|
35D0736A20AD0F740012EB8C /* Purchases.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Purchases.framework; sourceTree = SOURCE_ROOT; };
|
|
36
|
+
4F7207282AF30E7E0017395F /* RNPaywallManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNPaywallManager.h; sourceTree = "<group>"; };
|
|
37
|
+
4F7207292AF30E7E0017395F /* RNPaywallManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNPaywallManager.m; sourceTree = "<group>"; };
|
|
38
|
+
4F7D88D32AF9666800855875 /* RNPaywalls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPaywalls.m; sourceTree = "<group>"; };
|
|
39
|
+
4F7D88D42AF9666800855875 /* RNPaywalls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPaywalls.h; sourceTree = "<group>"; };
|
|
34
40
|
B3E7B5881CC2AC0600A0062D /* RNPurchases.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPurchases.h; sourceTree = "<group>"; };
|
|
35
41
|
B3E7B5891CC2AC0600A0062D /* RNPurchases.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPurchases.m; sourceTree = "<group>"; };
|
|
36
42
|
/* End PBXFileReference section */
|
|
@@ -71,6 +77,10 @@
|
|
|
71
77
|
35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */,
|
|
72
78
|
B3E7B5881CC2AC0600A0062D /* RNPurchases.h */,
|
|
73
79
|
B3E7B5891CC2AC0600A0062D /* RNPurchases.m */,
|
|
80
|
+
4F7207282AF30E7E0017395F /* RNPaywallManager.h */,
|
|
81
|
+
4F7207292AF30E7E0017395F /* RNPaywallManager.m */,
|
|
82
|
+
4F7D88D42AF9666800855875 /* RNPaywalls.h */,
|
|
83
|
+
4F7D88D32AF9666800855875 /* RNPaywalls.m */,
|
|
74
84
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
75
85
|
35493AC8202D4BCD004DFA39 /* Frameworks */,
|
|
76
86
|
3552B97B252CF5900098008A /* RNPurchases-Bridging-Header.h */,
|
|
@@ -136,8 +146,10 @@
|
|
|
136
146
|
isa = PBXSourcesBuildPhase;
|
|
137
147
|
buildActionMask = 2147483647;
|
|
138
148
|
files = (
|
|
149
|
+
4F7D88D52AF9666800855875 /* RNPaywalls.m in Sources */,
|
|
139
150
|
B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */,
|
|
140
151
|
3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */,
|
|
152
|
+
4F72072A2AF30E7E0017395F /* RNPaywallManager.m in Sources */,
|
|
141
153
|
);
|
|
142
154
|
runOnlyForDeploymentPostprocessing = 0;
|
|
143
155
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-purchases",
|
|
3
3
|
"title": "React Native Purchases",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.4.0-beta.1",
|
|
5
5
|
"description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -95,6 +95,6 @@
|
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@revenuecat/purchases-typescript-internal": "7.
|
|
98
|
+
"@revenuecat/purchases-typescript-internal": "7.3.1"
|
|
99
99
|
}
|
|
100
100
|
}
|
package/scripts/docs/index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html>
|
|
4
4
|
<head>
|
|
5
|
-
<meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/7.
|
|
5
|
+
<meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/7.4.0-beta.1/" />
|
|
6
6
|
</head>
|
|
7
7
|
<body>
|
|
8
8
|
</body>
|