react-native-map-link 3.10.0 → 3.10.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.
Files changed (2) hide show
  1. package/app.plugin.js +25 -7
  2. package/package.json +1 -1
package/app.plugin.js CHANGED
@@ -38,18 +38,36 @@ const intents = ['geo', 'waze'].map((app) => {
38
38
  * @type {import('@expo/config-plugins').ConfigPlugin}
39
39
  */
40
40
  module.exports = function withReactNativeMapLink(config) {
41
- // eslint-disable-next-line no-shadow
42
41
  config = withAndroidManifest(config, async (config) => {
43
42
  let intent = config.modResults.manifest.queries[0].intent ?? [];
44
- // @ts-expect-error unnecessary type gymnastics
45
- config.modResults.manifest.queries[0].intent = intent.concat(intents);
43
+ intents.forEach((newIntent) => {
44
+ const newScheme = newIntent.data.$['android:scheme'];
45
+ const existing = intent.some((intentItem) => {
46
+ const existingScheme =
47
+ intentItem.data?.[0]?.$?.['android:scheme'] ||
48
+ intentItem.data?.$?.['android:scheme'];
49
+ return existingScheme === newScheme;
50
+ });
51
+ if (!existing) {
52
+ intent.push(newIntent);
53
+ }
54
+ });
55
+
56
+ config.modResults.manifest.queries[0].intent = intent;
46
57
  return config;
47
58
  });
48
59
 
49
- // eslint-disable-next-line no-shadow
50
- return withInfoPlist(config, (config) => {
51
- config.modResults.LSApplicationQueriesSchemes =
52
- config.modResults.LSApplicationQueriesSchemes?.concat(schemes) ?? schemes;
60
+ config = withInfoPlist(config, (config) => {
61
+ const existing = config.modResults.LSApplicationQueriesSchemes ?? [];
62
+ schemes.forEach((scheme) => {
63
+ if (!existing.includes(scheme)) {
64
+ existing.push(scheme);
65
+ }
66
+ });
67
+
68
+ config.modResults.LSApplicationQueriesSchemes = existing;
53
69
  return config;
54
70
  });
71
+
72
+ return config;
55
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-map-link",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "description": "Open the map app of the user's choice with a specific location.",
5
5
  "source": "src/index",
6
6
  "main": "lib/index.js",