Repository navigation
Expand file tree
/
Copy pathapp.plugin.js
More file actions
47 lines (46 loc) · 1.52 KB
/
Copy pathapp.plugin.js
File metadata and controls
47 lines (46 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const path = require("node:path");
const { withPlugins } = require("expo/config-plugins");
const { version } = require("./package.json");
module.exports = function withAmazonProvider(config, options = {}) {
const explicitIap = config.plugins?.some(
(plugin) => (Array.isArray(plugin) ? plugin[0] : plugin) === "expo-iap",
);
if (explicitIap || config._internal?.pluginHistory?.["expo-iap"]) {
throw new Error(
"Replace the expo-iap plugin entry with @hyodotdev/openiap-provider-amazon-example. Expo applies expo-iap only once; keeping both can select the wrong store.",
);
}
const versions = require("expo-iap/openiap-versions.json");
if (!/^1\./.test(versions.clientProtocol)) {
throw new Error(
"The Amazon community provider requires an Expo IAP build with Client Protocol 1.x support. See this package README for the pinned verification inputs.",
);
}
return withPlugins(config, [
[
"expo-iap",
{
...options,
enableLocalDev: false,
modules: {
...options.modules,
horizon: false,
amazon: {
...options.modules?.amazon,
fireOS: false,
vegaOS: false,
},
},
android: {
...options.android,
store: "amazon_example",
provider: `dev.openiap.providers:openiap-provider-amazon-example:${version}`,
},
},
],
[
"expo-build-properties",
{ android: { extraMavenRepos: [path.join(__dirname, "maven")] } },
],
]);
};