expo-iap 2.2.9 → 2.3.0
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/android/build.gradle +0 -5
- package/build/types/ExpoIapIos.types.d.ts +1 -0
- package/build/types/ExpoIapIos.types.d.ts.map +1 -1
- package/build/types/ExpoIapIos.types.js.map +1 -1
- package/bun.lockb +0 -0
- package/ios/ExpoIapModule.swift +7 -3
- package/package.json +1 -1
- package/plugin/build/withIAP.d.ts +1 -4
- package/plugin/build/withIAP.js +37 -32
- package/plugin/src/withIAP.ts +53 -39
- package/src/types/ExpoIapIos.types.ts +1 -0
package/android/build.gradle
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapIos.types.d.ts","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE3D,KAAK,qBAAqB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC;AACpE,KAAK,WAAW,GAAG,EAAE,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;AAElE,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC;CACtC,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,qBAAqB,CAAC;CAC3C,CAAC;AAEF,MAAM,MA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E,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapIos.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"","sourcesContent":["import {PurchaseBase, ProductBase} from '../ExpoIap.types';\n\ntype SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\ntype PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n\ntype SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionIosPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\ntype SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionIosPeriod;\n};\n\nexport type ProductIos = ProductBase & {\n displayName: string;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n subscription: SubscriptionInfo;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n};\n\nexport type Discount = {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: PaymentMode;\n subscriptionPeriod: string;\n};\n\nexport type SubscriptionProductIos = ProductIos & {\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?: PaymentMode;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n};\n\nexport type PaymentDiscount = {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n identifier: string;\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyIdentifier: string;\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n};\n\nexport type RequestPurchaseIosProps = {\n sku: string;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: PaymentDiscount;\n};\n\nexport type RequestSubscriptionIosProps = RequestPurchaseIosProps;\n\ntype SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\ntype RenewalInfo = {\n jsonRepresentation?: string;\n willAutoRenew: boolean;\n autoRenewPreference?: string;\n};\n\nexport type ProductStatusIos = {\n state: SubscriptionStatus;\n renewalInfo?: RenewalInfo;\n};\n\nexport type ProductPurchaseIos = PurchaseBase & {\n // iOS basic fields\n quantityIos?: number;\n originalTransactionDateIos?: number;\n originalTransactionIdentifierIos?: string;\n verificationResultIos?: string;\n appAccountToken?: string;\n // iOS additional fields from StoreKit 2\n expirationDateIos?: number;\n webOrderLineItemIdIos?: number;\n environmentIos?: string;\n storefrontCountryCodeIos?: string;\n appBundleIdIos?: string;\n productTypeIos?: string;\n subscriptionGroupIdIos?: string;\n isUpgradedIos?: boolean;\n ownershipTypeIos?: string;\n reasonIos?: string;\n reasonStringRepresentationIos?: string;\n transactionReasonIos?: 'PURCHASE' | 'RENEWAL' | string;\n revocationDateIos?: number;\n revocationReasonIos?: string;\n offerIos?: {\n id: string;\n type: string;\n paymentMode: string;\n };\n priceIos?: number;\n currencyIos?: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoIapIos.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"","sourcesContent":["import {PurchaseBase, ProductBase} from '../ExpoIap.types';\n\ntype SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\ntype PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n\ntype SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionIosPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\ntype SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionIosPeriod;\n};\n\nexport type ProductIos = ProductBase & {\n displayName: string;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n subscription: SubscriptionInfo;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n};\n\nexport type Discount = {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: PaymentMode;\n subscriptionPeriod: string;\n};\n\nexport type SubscriptionProductIos = ProductIos & {\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?: PaymentMode;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n};\n\nexport type PaymentDiscount = {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n identifier: string;\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyIdentifier: string;\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n};\n\nexport type RequestPurchaseIosProps = {\n sku: string;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: PaymentDiscount;\n};\n\nexport type RequestSubscriptionIosProps = RequestPurchaseIosProps;\n\ntype SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\ntype RenewalInfo = {\n jsonRepresentation?: string;\n willAutoRenew: boolean;\n autoRenewPreference?: string;\n};\n\nexport type ProductStatusIos = {\n state: SubscriptionStatus;\n renewalInfo?: RenewalInfo;\n};\n\nexport type ProductPurchaseIos = PurchaseBase & {\n // iOS basic fields\n quantityIos?: number;\n originalTransactionDateIos?: number;\n originalTransactionIdentifierIos?: string;\n verificationResultIos?: string;\n appAccountToken?: string;\n // iOS additional fields from StoreKit 2\n expirationDateIos?: number;\n webOrderLineItemIdIos?: number;\n environmentIos?: string;\n storefrontCountryCodeIos?: string;\n appBundleIdIos?: string;\n productTypeIos?: string;\n subscriptionGroupIdIos?: string;\n isUpgradedIos?: boolean;\n ownershipTypeIos?: string;\n reasonIos?: string;\n reasonStringRepresentationIos?: string;\n transactionReasonIos?: 'PURCHASE' | 'RENEWAL' | string;\n revocationDateIos?: number;\n revocationReasonIos?: string;\n offerIos?: {\n id: string;\n type: string;\n paymentMode: string;\n };\n priceIos?: number;\n currencyIos?: string;\n jwsRepresentationIos?: string;\n};\n"]}
|
package/bun.lockb
CHANGED
|
Binary file
|
package/ios/ExpoIapModule.swift
CHANGED
|
@@ -16,7 +16,7 @@ struct IapEvent {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@available(iOS 15.0, *)
|
|
19
|
-
func serializeTransaction(_ transaction: Transaction) -> [String: Any?] {
|
|
19
|
+
func serializeTransaction(_ transaction: Transaction, jwsRepresentationIos: String? = nil) -> [String: Any?] {
|
|
20
20
|
let isSubscription =
|
|
21
21
|
transaction.productType.rawValue.lowercased().contains("renewable")
|
|
22
22
|
|| transaction.expirationDate != nil
|
|
@@ -70,6 +70,10 @@ func serializeTransaction(_ transaction: Transaction) -> [String: Any?] {
|
|
|
70
70
|
"transactionReasonIos": transactionReasonIos,
|
|
71
71
|
]
|
|
72
72
|
|
|
73
|
+
if (jwsRepresentationIos != nil) {
|
|
74
|
+
purchaseMap["jwsRepresentationIos"] = jwsRepresentationIos
|
|
75
|
+
}
|
|
76
|
+
|
|
73
77
|
if #available(iOS 16.0, *) {
|
|
74
78
|
purchaseMap["environmentIos"] = transaction.environment.rawValue
|
|
75
79
|
}
|
|
@@ -321,7 +325,7 @@ public class ExpoIapModule: Module {
|
|
|
321
325
|
let signature = discountOffer?["signature"],
|
|
322
326
|
let timestamp = discountOffer?["timestamp"],
|
|
323
327
|
let uuidNonce = UUID(uuidString: nonce),
|
|
324
|
-
let signatureData =
|
|
328
|
+
let signatureData = Data(base64Encoded: signature),
|
|
325
329
|
let timestampInt = Int(timestamp)
|
|
326
330
|
{
|
|
327
331
|
options.insert(
|
|
@@ -361,7 +365,7 @@ public class ExpoIapModule: Module {
|
|
|
361
365
|
return nil
|
|
362
366
|
} else {
|
|
363
367
|
self.transactions[String(transaction.id)] = transaction
|
|
364
|
-
let serialized = serializeTransaction(transaction)
|
|
368
|
+
let serialized = serializeTransaction(transaction, jwsRepresentationIos: verification.jwsRepresentation)
|
|
365
369
|
self.sendEvent(IapEvent.PurchaseUpdated, serialized)
|
|
366
370
|
return serialized
|
|
367
371
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
}
|
|
5
|
-
declare const _default: ConfigPlugin<Props | undefined>;
|
|
2
|
+
declare const _default: ConfigPlugin<void>;
|
|
6
3
|
export default _default;
|
package/plugin/build/withIAP.js
CHANGED
|
@@ -1,65 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modifyProjectBuildGradle = void 0;
|
|
4
3
|
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
-
const config_plugins_2 = require("expo/config-plugins");
|
|
6
4
|
const pkg = require('../../package.json');
|
|
7
|
-
const
|
|
8
|
-
const lines =
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
console.warn(
|
|
12
|
-
lines.push(
|
|
5
|
+
const addLineToGradle = (content, anchor, lineToAdd, offset = 1) => {
|
|
6
|
+
const lines = content.split('\n');
|
|
7
|
+
const index = lines.findIndex((line) => line.match(anchor));
|
|
8
|
+
if (index === -1) {
|
|
9
|
+
console.warn(`Anchor "${anchor}" not found in build.gradle. Appending to end.`);
|
|
10
|
+
lines.push(lineToAdd);
|
|
13
11
|
}
|
|
14
12
|
else {
|
|
15
|
-
lines.splice(
|
|
13
|
+
lines.splice(index + offset, 0, lineToAdd);
|
|
16
14
|
}
|
|
17
15
|
return lines.join('\n');
|
|
18
16
|
};
|
|
19
|
-
const modifyProjectBuildGradle = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const modifyProjectBuildGradle = (gradle) => {
|
|
18
|
+
let modified = gradle;
|
|
19
|
+
// 1. supportLibVersion
|
|
20
|
+
const supportLib = `supportLibVersion = "28.0.0"`;
|
|
21
|
+
if (!modified.includes(supportLib)) {
|
|
22
|
+
modified = addLineToGradle(modified, /ext\s*{/, supportLib);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
// 2. billing library
|
|
25
|
+
const billingDep = ` implementation "com.android.billingclient:billing-ktx:7.0.0"`;
|
|
26
|
+
const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`;
|
|
27
|
+
if (!modified.includes(billingDep)) {
|
|
28
|
+
modified = addLineToGradle(modified, /dependencies\s*{/, billingDep);
|
|
29
|
+
}
|
|
30
|
+
if (!modified.includes(gmsDep)) {
|
|
31
|
+
modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1);
|
|
32
|
+
}
|
|
33
|
+
return modified;
|
|
25
34
|
};
|
|
26
|
-
exports.modifyProjectBuildGradle = modifyProjectBuildGradle;
|
|
27
35
|
const withIAPAndroid = (config) => {
|
|
28
36
|
config = (0, config_plugins_1.withProjectBuildGradle)(config, (config) => {
|
|
29
|
-
config.modResults.contents =
|
|
37
|
+
config.modResults.contents = modifyProjectBuildGradle(config.modResults.contents);
|
|
30
38
|
return config;
|
|
31
39
|
});
|
|
32
|
-
// Adding BILLING permission to AndroidManifest.xml
|
|
33
40
|
config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
|
|
34
|
-
console.log('Modifying AndroidManifest.xml...');
|
|
35
41
|
const manifest = config.modResults;
|
|
36
42
|
if (!manifest.manifest['uses-permission']) {
|
|
37
43
|
manifest.manifest['uses-permission'] = [];
|
|
38
44
|
}
|
|
39
45
|
const permissions = manifest.manifest['uses-permission'];
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.log('Added com.android.vending.BILLING to permissions');
|
|
46
|
+
const billingPerm = { $: { 'android:name': 'com.android.vending.BILLING' } };
|
|
47
|
+
const alreadyExists = permissions.some((p) => p.$['android:name'] === 'com.android.vending.BILLING');
|
|
48
|
+
if (!alreadyExists) {
|
|
49
|
+
permissions.push(billingPerm);
|
|
50
|
+
console.log('✅ Added com.android.vending.BILLING to AndroidManifest.xml');
|
|
46
51
|
}
|
|
47
52
|
else {
|
|
48
|
-
console.log('com.android.vending.BILLING already exists in
|
|
53
|
+
console.log('ℹ️ com.android.vending.BILLING already exists in AndroidManifest.xml');
|
|
49
54
|
}
|
|
50
55
|
return config;
|
|
51
56
|
});
|
|
52
57
|
return config;
|
|
53
58
|
};
|
|
54
|
-
const withIAP = (config,
|
|
59
|
+
const withIAP = (config, _props) => {
|
|
55
60
|
try {
|
|
56
|
-
console.log('Applying expo-iap plugin...');
|
|
57
|
-
|
|
61
|
+
console.log('🛠️ Applying expo-iap config plugin...');
|
|
62
|
+
return withIAPAndroid(config);
|
|
58
63
|
}
|
|
59
64
|
catch (error) {
|
|
60
|
-
config_plugins_1.WarningAggregator.addWarningAndroid('expo-iap', `
|
|
61
|
-
console.error('
|
|
65
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('expo-iap', `expo-iap plugin encountered an error: ${error}`);
|
|
66
|
+
console.error('expo-iap plugin error:', error);
|
|
67
|
+
return config;
|
|
62
68
|
}
|
|
63
|
-
return config;
|
|
64
69
|
};
|
|
65
|
-
exports.default = (0,
|
|
70
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withIAP, pkg.name, pkg.version);
|
package/plugin/src/withIAP.ts
CHANGED
|
@@ -2,34 +2,51 @@ import {
|
|
|
2
2
|
WarningAggregator,
|
|
3
3
|
withAndroidManifest,
|
|
4
4
|
withProjectBuildGradle,
|
|
5
|
+
ConfigPlugin,
|
|
6
|
+
createRunOncePlugin,
|
|
5
7
|
} from 'expo/config-plugins';
|
|
6
|
-
import {ConfigPlugin, createRunOncePlugin} from 'expo/config-plugins';
|
|
7
8
|
|
|
8
9
|
const pkg = require('../../package.json');
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
11
|
+
const addLineToGradle = (
|
|
12
|
+
content: string,
|
|
12
13
|
anchor: RegExp | string,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
) => {
|
|
16
|
-
const lines =
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
console.warn(
|
|
20
|
-
|
|
14
|
+
lineToAdd: string,
|
|
15
|
+
offset: number = 1,
|
|
16
|
+
): string => {
|
|
17
|
+
const lines = content.split('\n');
|
|
18
|
+
const index = lines.findIndex((line) => line.match(anchor));
|
|
19
|
+
if (index === -1) {
|
|
20
|
+
console.warn(
|
|
21
|
+
`Anchor "${anchor}" not found in build.gradle. Appending to end.`,
|
|
22
|
+
);
|
|
23
|
+
lines.push(lineToAdd);
|
|
21
24
|
} else {
|
|
22
|
-
lines.splice(
|
|
25
|
+
lines.splice(index + offset, 0, lineToAdd);
|
|
23
26
|
}
|
|
24
27
|
return lines.join('\n');
|
|
25
28
|
};
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
const modifyProjectBuildGradle = (gradle: string): string => {
|
|
31
|
+
let modified = gradle;
|
|
32
|
+
|
|
33
|
+
// 1. supportLibVersion
|
|
34
|
+
const supportLib = `supportLibVersion = "28.0.0"`;
|
|
35
|
+
if (!modified.includes(supportLib)) {
|
|
36
|
+
modified = addLineToGradle(modified, /ext\s*{/, supportLib);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 2. billing library
|
|
40
|
+
const billingDep = ` implementation "com.android.billingclient:billing-ktx:7.0.0"`;
|
|
41
|
+
const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`;
|
|
42
|
+
if (!modified.includes(billingDep)) {
|
|
43
|
+
modified = addLineToGradle(modified, /dependencies\s*{/, billingDep);
|
|
44
|
+
}
|
|
45
|
+
if (!modified.includes(gmsDep)) {
|
|
46
|
+
modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1);
|
|
31
47
|
}
|
|
32
|
-
|
|
48
|
+
|
|
49
|
+
return modified;
|
|
33
50
|
};
|
|
34
51
|
|
|
35
52
|
const withIAPAndroid: ConfigPlugin = (config) => {
|
|
@@ -40,28 +57,27 @@ const withIAPAndroid: ConfigPlugin = (config) => {
|
|
|
40
57
|
return config;
|
|
41
58
|
});
|
|
42
59
|
|
|
43
|
-
// Adding BILLING permission to AndroidManifest.xml
|
|
44
60
|
config = withAndroidManifest(config, (config) => {
|
|
45
|
-
console.log('Modifying AndroidManifest.xml...');
|
|
46
61
|
const manifest = config.modResults;
|
|
47
|
-
|
|
48
62
|
if (!manifest.manifest['uses-permission']) {
|
|
49
63
|
manifest.manifest['uses-permission'] = [];
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
const permissions = manifest.manifest['uses-permission'];
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
const billingPerm = {$: {'android:name': 'com.android.vending.BILLING'}};
|
|
68
|
+
|
|
69
|
+
const alreadyExists = permissions.some(
|
|
70
|
+
(p) => p.$['android:name'] === 'com.android.vending.BILLING',
|
|
71
|
+
);
|
|
72
|
+
if (!alreadyExists) {
|
|
73
|
+
permissions.push(billingPerm);
|
|
74
|
+
console.log(
|
|
75
|
+
'✅ Added com.android.vending.BILLING to AndroidManifest.xml',
|
|
76
|
+
);
|
|
63
77
|
} else {
|
|
64
|
-
console.log(
|
|
78
|
+
console.log(
|
|
79
|
+
'ℹ️ com.android.vending.BILLING already exists in AndroidManifest.xml',
|
|
80
|
+
);
|
|
65
81
|
}
|
|
66
82
|
|
|
67
83
|
return config;
|
|
@@ -70,20 +86,18 @@ const withIAPAndroid: ConfigPlugin = (config) => {
|
|
|
70
86
|
return config;
|
|
71
87
|
};
|
|
72
88
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const withIAP: ConfigPlugin<Props | undefined> = (config, props) => {
|
|
89
|
+
const withIAP: ConfigPlugin = (config, _props) => {
|
|
76
90
|
try {
|
|
77
|
-
console.log('Applying expo-iap plugin...');
|
|
78
|
-
|
|
91
|
+
console.log('🛠️ Applying expo-iap config plugin...');
|
|
92
|
+
return withIAPAndroid(config);
|
|
79
93
|
} catch (error) {
|
|
80
94
|
WarningAggregator.addWarningAndroid(
|
|
81
95
|
'expo-iap',
|
|
82
|
-
`
|
|
96
|
+
`expo-iap plugin encountered an error: ${error}`,
|
|
83
97
|
);
|
|
84
|
-
console.error('
|
|
98
|
+
console.error('expo-iap plugin error:', error);
|
|
99
|
+
return config;
|
|
85
100
|
}
|
|
86
|
-
return config;
|
|
87
101
|
};
|
|
88
102
|
|
|
89
103
|
export default createRunOncePlugin(withIAP, pkg.name, pkg.version);
|