react-native-map-link 3.6.1 → 3.7.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/README.md CHANGED
@@ -258,6 +258,7 @@ showLocation({
258
258
  dialogMessage: 'This is the amazing dialog Message', // optional (default: 'What app would you like to use?')
259
259
  cancelText: 'This is the cancel button text', // optional (default: 'Cancel')
260
260
  appsWhiteList: ['google-maps'], // optionally you can set which apps to show (default: will show all supported apps installed on device)
261
+ appsBlackList: ['uber'], // optionally you can set which apps NOT to show (default: will show all supported apps installed on device)
261
262
  naverCallerName: 'com.example.myapp', // to link into Naver Map You should provide your appname which is the bundle ID in iOS and applicationId in android.
262
263
  appTitles: {'google-maps': 'My custom Google Maps title'}, // optionally you can override default app titles
263
264
  app: 'uber', // optionally specify specific app to use
@@ -312,6 +313,7 @@ const Demo = () => {
312
313
  googleForceLatLon: false, // optionally force GoogleMaps to use the latlon for the query instead of the title
313
314
  alwaysIncludeGoogle: true, // optional, true will always add Google Maps to iOS and open in Safari, even if app is not installed (default: false)
314
315
  appsWhiteList: ['google-maps'], // optionally you can set which apps to show (default: will show all supported apps installed on device)
316
+ appsBlackList: ['uber'], // optionally you can set which apps NOT to show (default: will show all supported apps installed on device)
315
317
  });
316
318
  setAvailableApps(result);
317
319
  })();
@@ -50,6 +50,9 @@ const Popup = ({ isVisible, showHeader = true, customHeader, customFooter, onApp
50
50
  (0, utils_1.checkNotSupportedApps)(options.appsWhiteList);
51
51
  appsData = appsData.filter((appName) => options.appsWhiteList?.includes(appName));
52
52
  }
53
+ if (options.appsBlackList && options.appsBlackList.length) {
54
+ appsData = appsData.filter((appName) => !options.appsBlackList?.includes(appName));
55
+ }
53
56
  setApps(appsData);
54
57
  setIsLoading(false);
55
58
  };
@@ -59,6 +62,7 @@ const Popup = ({ isVisible, showHeader = true, customHeader, customFooter, onApp
59
62
  options.alwaysIncludeGoogle,
60
63
  options.appTitles,
61
64
  options.appsWhiteList,
65
+ options.appsBlackList,
62
66
  options.naverCallerName,
63
67
  ]);
64
68
  const _onAppPressed = (app) => {
package/lib/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import { GetAppsProps, GetAppsResponse, MapId, ShowLocationProps } from './type'
2
2
  export type { DirectionMode, GetAppsProps, GetAppsResponse, MapId, SharedOptions, ShowLocationProps, } from './type';
3
3
  export { Popup } from './components/popup/Popup';
4
4
  export type { PopupProps } from './components/popup/Popup';
5
- export declare const showLocation: ({ latitude, longitude, address, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appTitles, naverCallerName, directionsMode, }: ShowLocationProps) => Promise<MapId | null | undefined>;
6
- export declare function getApps({ alwaysIncludeGoogle, appsWhiteList, appTitles, naverCallerName, ...rest }: GetAppsProps): Promise<GetAppsResponse[]>;
5
+ export declare const showLocation: ({ latitude, longitude, address, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appsBlackList: customAppsBlackList, appTitles, naverCallerName, directionsMode, }: ShowLocationProps) => Promise<MapId | null | undefined>;
6
+ export declare function getApps({ alwaysIncludeGoogle, appsWhiteList, appsBlackList, appTitles, naverCallerName, ...rest }: GetAppsProps): Promise<GetAppsResponse[]>;
package/lib/index.js CHANGED
@@ -6,7 +6,7 @@ const constants_1 = require("./constants");
6
6
  const utils_1 = require("./utils");
7
7
  var Popup_1 = require("./components/popup/Popup");
8
8
  Object.defineProperty(exports, "Popup", { enumerable: true, get: function () { return Popup_1.Popup; } });
9
- const showLocation = async ({ latitude, longitude, address, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appTitles, naverCallerName, directionsMode, }) => {
9
+ const showLocation = async ({ latitude, longitude, address, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appsBlackList: customAppsBlackList, appTitles, naverCallerName, directionsMode, }) => {
10
10
  const prefixes = (0, constants_1.generatePrefixes)({
11
11
  alwaysIncludeGoogle,
12
12
  naverCallerName,
@@ -59,12 +59,16 @@ const showLocation = async ({ latitude, longitude, address, sourceLatitude, sour
59
59
  const appsWhiteList = customAppsWhiteList && customAppsWhiteList.length
60
60
  ? customAppsWhiteList
61
61
  : null;
62
+ const appsBlackList = customAppsBlackList && customAppsBlackList.length
63
+ ? customAppsBlackList
64
+ : null;
62
65
  if (!app) {
63
66
  app = await (0, utils_1.askAppChoice)({
64
67
  dialogTitle,
65
68
  dialogMessage,
66
69
  cancelText,
67
70
  appsWhiteList,
71
+ appsBlackList,
68
72
  prefixes,
69
73
  appTitles: (0, constants_1.generateTitles)(appTitles),
70
74
  });
@@ -93,12 +97,15 @@ const showLocation = async ({ latitude, longitude, address, sourceLatitude, sour
93
97
  }
94
98
  };
95
99
  exports.showLocation = showLocation;
96
- async function getApps({ alwaysIncludeGoogle, appsWhiteList, appTitles, naverCallerName, ...rest }) {
100
+ async function getApps({ alwaysIncludeGoogle, appsWhiteList, appsBlackList, appTitles, naverCallerName, ...rest }) {
97
101
  let apps = await (0, utils_1.getAvailableApps)((0, constants_1.generatePrefixes)({ alwaysIncludeGoogle, naverCallerName }));
98
102
  if (appsWhiteList && appsWhiteList.length) {
99
103
  (0, utils_1.checkNotSupportedApps)(appsWhiteList);
100
104
  apps = apps.filter((appName) => appsWhiteList.includes(appName));
101
105
  }
106
+ if (appsBlackList && appsBlackList.length) {
107
+ apps = apps.filter((appName) => !appsBlackList.includes(appName));
108
+ }
102
109
  const titles = (0, constants_1.generateTitles)({ ...appTitles });
103
110
  async function open(app) {
104
111
  return (0, exports.showLocation)({
@@ -106,6 +113,7 @@ async function getApps({ alwaysIncludeGoogle, appsWhiteList, appTitles, naverCal
106
113
  app,
107
114
  alwaysIncludeGoogle,
108
115
  appsWhiteList,
116
+ appsBlackList,
109
117
  appTitles,
110
118
  naverCallerName,
111
119
  });
package/lib/type.d.ts CHANGED
@@ -34,6 +34,7 @@ export interface ShowLocationProps {
34
34
  dialogMessage?: string | null;
35
35
  cancelText?: string | null;
36
36
  appsWhiteList?: string[] | null;
37
+ appsBlackList?: string[] | null;
37
38
  appTitles?: Partial<Record<MapId, string>>;
38
39
  naverCallerName?: string;
39
40
  directionsMode?: DirectionMode;
package/lib/utils.d.ts CHANGED
@@ -4,11 +4,12 @@ export declare const isAppInstalled: (app: string, prefixes: Record<string, stri
4
4
  export declare const isSupportedApp: (app: string) => boolean;
5
5
  export declare const getNotSupportedApps: (apps: string[]) => string[];
6
6
  export declare const checkNotSupportedApps: (apps: string[]) => void;
7
- export declare const askAppChoice: ({ dialogTitle, dialogMessage, cancelText, appsWhiteList, prefixes, appTitles, }: {
7
+ export declare const askAppChoice: ({ dialogTitle, dialogMessage, cancelText, appsWhiteList, appsBlackList, prefixes, appTitles, }: {
8
8
  dialogTitle: string | null | undefined;
9
9
  dialogMessage: string | null | undefined;
10
10
  cancelText: string | null | undefined;
11
11
  appsWhiteList: string[] | null | undefined;
12
+ appsBlackList: string[] | null | undefined;
12
13
  prefixes: Record<string, string>;
13
14
  appTitles: Record<string, string> | null | undefined;
14
15
  }) => Promise<MapId | null>;
package/lib/utils.js CHANGED
@@ -47,12 +47,15 @@ const checkNotSupportedApps = (apps) => {
47
47
  }
48
48
  };
49
49
  exports.checkNotSupportedApps = checkNotSupportedApps;
50
- const askAppChoice = ({ dialogTitle, dialogMessage, cancelText, appsWhiteList, prefixes, appTitles, }) => {
50
+ const askAppChoice = ({ dialogTitle, dialogMessage, cancelText, appsWhiteList, appsBlackList, prefixes, appTitles, }) => {
51
51
  return new Promise(async (resolve) => {
52
52
  let availableApps = await (0, exports.getAvailableApps)(prefixes);
53
53
  if (appsWhiteList && appsWhiteList.length) {
54
54
  availableApps = availableApps.filter((appName) => appsWhiteList.includes(appName));
55
55
  }
56
+ if (appsBlackList && appsBlackList.length) {
57
+ availableApps = availableApps.filter((appName) => !appsBlackList.includes(appName));
58
+ }
56
59
  if (availableApps.length < 2) {
57
60
  return resolve(availableApps[0] || null);
58
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-map-link",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
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",