react-native-okhi 1.2.0-beta.2 → 1.2.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.
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "okhiWebReactNative",
3
- "version": "1.2.0-beta.2"
3
+ "version": "1.2.1"
4
4
  }
@@ -386,7 +386,7 @@ const requestAndroidNotificationPermission = async () => {
386
386
  return true;
387
387
  }
388
388
 
389
- const status = await _reactNative.PermissionsAndroid.request(_reactNative.PermissionsAndroid.PERMISSIONS.POST_NOTIFICATION);
389
+ const status = await _reactNative.PermissionsAndroid.request(_reactNative.PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
390
390
  return status === 'granted';
391
391
  }, 'android');
392
392
  };
@@ -1 +1 @@
1
- {"version":3,"names":["isLocationServicesEnabled","isValidPlatform","OkHiNativeModule","isLocationPermissionGranted","isBackgroundLocationPermissionGrantedAndroid","sdkVersion","getSystemVersion","Number","PermissionsAndroid","PERMISSIONS","ACCESS_BACKGROUND_LOCATION","hasPermission","check","console","warn","isBackgroundLocationPermissionGrantedIOS","isBackgroundLocationPermissionGranted","fn","Platform","OS","requestLocationPermissionAndroid","status","requestMultiple","ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION","requestLocationPermissionIOS","requestLocationPermission","isGranted","errorHandler","requestBackgroundLocationPermissionAndroid","permissions","requestBackgroundLocationPermissionIOS","requestBackgroundLocationPermission","requestEnableLocationServices","isGooglePlayServicesAvailable","requestEnableGooglePlayServices","request","locationPermissionType","rationale","callback","serviceError","OkHiException","code","SERVICE_UNAVAILABLE_CODE","message","googlePlayError","handleError","error","handleGooglePlayServiceRequest","then","googlePlayStatus","handleRationaleRequest","handleRationaleAlert","alertRationale","Promise","resolve","_","Alert","alert","title","text","grantButton","label","onPress","denyButton","style","onDismiss","handlePermissionRequest","OkHiNativeEvents","removeAllListeners","addListener","permissionUpdate","whenInUseResult","initialWhenInUseResult","alwaysResult","currentStatus","retriveLocationPermissionStatus","showRationale","result","serviceStatus","enableResult","catch","openAppSettings","alwaysPerm","whenInUsePerm","requestTrackingAuthorization","canOpenProtectedAppsSettings","openProtectedAppsSettings","isAndroidNotificationGranted","POST_NOTIFICATIONS","requestAndroidNotificationPermission","existingPermissionStatus","POST_NOTIFICATION","isIOSNotificationGranted","isNotificationPermissionGranted","requestIOSNotificationPermission","requestNotificationPermission","UNSUPPORTED_PLATFORM_CODE","UNSUPPORTED_PLATFORM_MESSAGE"],"sources":["Helpers.ts"],"sourcesContent":["import { OkHiNativeModule, OkHiNativeEvents } from '../OkHiNativeModule';\nimport { Alert, Permission, PermissionsAndroid, Platform } from 'react-native';\nimport { errorHandler, isValidPlatform } from './_helpers';\nimport type {\n LocationPermissionCallback,\n LocationPermissionStatus,\n LocationRequestPermissionType,\n} from './types';\nimport { OkHiException } from './OkHiException';\n\n/**\n * Checks whether location services are enabled\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the service is available\n */\nexport const isLocationServicesEnabled = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationServicesEnabled);\n};\n\n/**\n * Checks whether when in use location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isLocationPermissionGranted = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationPermissionGranted);\n};\n\nconst isBackgroundLocationPermissionGrantedAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) {\n return true;\n }\n if (Number(sdkVersion) < 29) {\n return await isLocationPermissionGranted();\n }\n if (\n typeof PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION !==\n 'undefined'\n ) {\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION as Permission\n );\n return hasPermission;\n }\n console.warn(\n `PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION is undefined, this is an issue with the current version of RN you are running. Please consider upgrading`\n );\n return false;\n };\n\nconst isBackgroundLocationPermissionGrantedIOS = (): Promise<boolean> => {\n return OkHiNativeModule.isBackgroundLocationPermissionGranted();\n};\n\n/**\n * Checks whether background location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isBackgroundLocationPermissionGranted = (): Promise<boolean> => {\n const fn =\n Platform.OS === 'android'\n ? isBackgroundLocationPermissionGrantedAndroid\n : isBackgroundLocationPermissionGrantedIOS;\n return isValidPlatform(fn);\n};\n\nconst requestLocationPermissionAndroid = async (): Promise<boolean> => {\n const status: any = await PermissionsAndroid.requestMultiple([\n PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION as Permission,\n PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION as Permission,\n ]);\n return status['android.permission.ACCESS_FINE_LOCATION'] === 'granted';\n};\n\nconst requestLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestLocationPermission();\n};\n\n/**\n * Requests for when in use location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestLocationPermission = async (): Promise<boolean> => {\n const isGranted = await isLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestLocationPermissionAndroid\n : requestLocationPermissionIOS\n );\n};\n\nconst requestBackgroundLocationPermissionAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) return true;\n if (Number(sdkVersion) >= 29) {\n const permissions: any = [\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION,\n ];\n const status: any = await PermissionsAndroid.requestMultiple(permissions);\n return (\n status['android.permission.ACCESS_BACKGROUND_LOCATION'] === 'granted'\n );\n } else {\n return await requestLocationPermissionAndroid();\n }\n };\n\nconst requestBackgroundLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestBackgroundLocationPermission();\n};\n\n/**\n * Requests for background location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestBackgroundLocationPermission =\n async (): Promise<boolean> => {\n const isGranted = await isBackgroundLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestBackgroundLocationPermissionAndroid\n : requestBackgroundLocationPermissionIOS\n );\n };\n\n/**\n * Requests the user to enable location services by showing an in app modal on android and opening location settings on iOS\n * @returns {Promise<boolean>} A promise that resolves to either a boolean value on android or null on iOS\n */\nexport const requestEnableLocationServices = (): Promise<boolean | null> => {\n return isValidPlatform(OkHiNativeModule.requestEnableLocationServices);\n};\n\n/**\n * Android Only - Checks if Google Play Services is available\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const isGooglePlayServicesAvailable = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.isGooglePlayServicesAvailable,\n 'android'\n );\n};\n\n/**\n * Android Only - Requests user to enable Google Play Services\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const requestEnableGooglePlayServices = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.requestEnableGooglePlayServices,\n 'android'\n );\n};\n\n/**\n * Returns the system version of the current platform\n * @returns {Promise<boolean>} A promise that resolves either a string on iOS or number on Android\n */\nexport const getSystemVersion = (): Promise<string | number> =>\n isValidPlatform(OkHiNativeModule.getSystemVersion);\n\n/**\n * Requests location permission from the user. It'll also attempt to activate any disbaled services (Android Only)\n */\nexport const request = (\n locationPermissionType: LocationRequestPermissionType,\n rationale: {\n title: string;\n text: string;\n successButton?: { label: string };\n denyButton?: { label: string };\n } | null,\n callback: LocationPermissionCallback\n) => {\n const serviceError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Location service is currently not available. Please enable in app settings',\n });\n\n const googlePlayError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Google Play Services is currently unavailable. Please enable in settings',\n });\n\n const handleError = (error: OkHiException) => {\n callback(null, error);\n };\n\n const handleGooglePlayServiceRequest = () => {\n requestEnableGooglePlayServices().then((googlePlayStatus) => {\n if (!googlePlayStatus) {\n handleError(googlePlayError);\n } else {\n handleRationaleRequest();\n }\n });\n };\n\n const handleRationaleAlert = (alertRationale: {\n title: string;\n text: string;\n grantButton?: { label: string };\n denyButton?: { label: string };\n }) => {\n return new Promise((resolve, _) => {\n Alert.alert(\n alertRationale.title,\n alertRationale.text,\n [\n {\n text: alertRationale.grantButton\n ? alertRationale.grantButton.label\n : 'Grant',\n onPress: () => {\n resolve(true);\n },\n },\n {\n text: alertRationale.denyButton\n ? alertRationale.denyButton.label\n : 'Deny',\n onPress: () => {\n resolve(false);\n },\n style: 'cancel',\n },\n ],\n {\n onDismiss: () => {\n resolve(false);\n },\n }\n );\n });\n };\n\n const handlePermissionRequest = () => {\n if (Platform.OS === 'ios') {\n OkHiNativeEvents.removeAllListeners('onLocationPermissionStatusUpdate');\n OkHiNativeEvents.addListener(\n 'onLocationPermissionStatusUpdate',\n (permissionUpdate) => {\n callback(permissionUpdate, null);\n }\n );\n if (locationPermissionType === 'whenInUse') {\n OkHiNativeModule.requestLocationPermission();\n } else {\n OkHiNativeModule.requestBackgroundLocationPermission();\n }\n } else {\n if (locationPermissionType === 'whenInUse') {\n requestLocationPermissionAndroid().then((whenInUseResult) =>\n callback(whenInUseResult ? 'authorizedWhenInUse' : 'denied', null)\n );\n } else {\n requestLocationPermissionAndroid().then((initialWhenInUseResult) => {\n if (!initialWhenInUseResult) {\n callback('denied', null);\n } else {\n callback('authorizedWhenInUse', null);\n requestBackgroundLocationPermission().then((alwaysResult) => {\n callback(\n alwaysResult ? 'authorizedAlways' : 'authorizedWhenInUse',\n null\n );\n });\n }\n });\n }\n }\n };\n\n const handleRationaleRequest = async () => {\n const currentStatus = await retriveLocationPermissionStatus();\n let showRationale = true;\n if (\n locationPermissionType === 'whenInUse' &&\n (currentStatus === 'authorizedWhenInUse' ||\n currentStatus === 'authorizedAlways')\n ) {\n showRationale = false;\n }\n if (\n locationPermissionType === 'always' &&\n currentStatus === 'authorizedAlways'\n ) {\n showRationale = false;\n }\n if (rationale && showRationale) {\n const result = await handleRationaleAlert(rationale);\n if (!result) {\n callback('rationaleDissmissed', null);\n } else {\n handlePermissionRequest();\n }\n } else {\n handlePermissionRequest();\n }\n };\n\n isLocationServicesEnabled()\n .then((serviceStatus) => {\n if (!serviceStatus && Platform.OS === 'ios') {\n handleError(serviceError);\n } else if (!serviceStatus && Platform.OS === 'android') {\n requestEnableLocationServices()\n .then((enableResult) => {\n if (!enableResult) {\n handleError(serviceError);\n } else {\n handleGooglePlayServiceRequest();\n }\n })\n .catch(handleError);\n } else {\n if (Platform.OS === 'ios') {\n handleRationaleRequest();\n } else {\n handleGooglePlayServiceRequest();\n }\n }\n })\n .catch(handleError);\n};\n\n/**\n * Open the device's app settings.\n */\nexport const openAppSettings = () => {\n OkHiNativeModule.openAppSettings();\n};\n\n/**\n * Retrives the location permission status from the device\n */\nexport const retriveLocationPermissionStatus =\n async (): Promise<LocationPermissionStatus> => {\n if (Platform.OS === 'ios') {\n return OkHiNativeModule.retriveLocationPermissionStatus() as Promise<LocationPermissionStatus>;\n }\n const alwaysPerm = await isBackgroundLocationPermissionGranted();\n if (alwaysPerm) {\n return 'authorizedAlways';\n }\n const whenInUsePerm = await isLocationPermissionGranted();\n return whenInUsePerm ? 'authorizedWhenInUse' : 'denied';\n };\n\n/**\n * Requests tracking authorization from the user. iOS only, iOS version >= 14\n * Read more: https://developer.apple.com/app-store/user-privacy-and-data-use/\n */\nexport const requestTrackingAuthorization = async (): Promise<\n string | null\n> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.requestTrackingAuthorization();\n return result;\n }, 'ios');\n};\n\n/**\n * Checks whether current device can open \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const canOpenProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.canOpenProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\n/**\n * Opens \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const openProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.openProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\nconst isAndroidNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 33) {\n return true;\n }\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS as Permission\n );\n return hasPermission;\n }, 'android');\n};\n\nconst requestAndroidNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isAndroidNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n const status: any = await PermissionsAndroid.request(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATION as Permission\n );\n return status === 'granted';\n }, 'android');\n};\n\nconst isIOSNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n return OkHiNativeModule.isNotificationPermissionGranted();\n }, 'ios');\n};\n\nconst requestIOSNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isIOSNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n return OkHiNativeModule.requestNotificationPermission();\n }, 'ios');\n};\n\n/**\n * Checks whether notification permission is granted on both android and ios devices\n */\nexport const isNotificationPermissionGranted = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return isAndroidNotificationGranted();\n } else if (Platform.OS === 'ios') {\n return isIOSNotificationGranted();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n\n/**\n * Requests notification permission from both android and ios devices\n */\nexport const requestNotificationPermission = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return requestAndroidNotificationPermission();\n } else if (Platform.OS === 'ios') {\n return requestIOSNotificationPermission();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AAEA;AACA;AACA;AACA;AACO,MAAMA,yBAAyB,GAAG,MAAwB;EAC/D,OAAO,IAAAC,wBAAA,EAAgBC,kCAAA,CAAiBF,yBAAjC,CAAP;AACD,CAFM;AAIP;AACA;AACA;AACA;;;;;AACO,MAAMG,2BAA2B,GAAG,MAAwB;EACjE,OAAO,IAAAF,wBAAA,EAAgBC,kCAAA,CAAiBC,2BAAjC,CAAP;AACD,CAFM;;;;AAIP,MAAMC,4CAA4C,GAChD,YAA8B;EAC5B,MAAMC,UAAU,GAAG,MAAMH,kCAAA,CAAiBI,gBAAjB,EAAzB;;EACA,IAAIC,MAAM,CAACF,UAAD,CAAN,GAAqB,EAAzB,EAA6B;IAC3B,OAAO,IAAP;EACD;;EACD,IAAIE,MAAM,CAACF,UAAD,CAAN,GAAqB,EAAzB,EAA6B;IAC3B,OAAO,MAAMF,2BAA2B,EAAxC;EACD;;EACD,IACE,OAAOK,+BAAA,CAAmBC,WAAnB,CAA+BC,0BAAtC,KACA,WAFF,EAGE;IACA,MAAMC,aAAa,GAAG,MAAMH,+BAAA,CAAmBI,KAAnB,CAC1BJ,+BAAA,CAAmBC,WAAnB,CAA+BC,0BADL,CAA5B;IAGA,OAAOC,aAAP;EACD;;EACDE,OAAO,CAACC,IAAR,C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AXM;AAaP;AACA;AACA;;;;;AACO,MAAMF,6BAA6B,GAAG,YAA8B;EACzE,IAAI9E,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;IAC7B,OAAOuE,oCAAoC,EAA3C;EACD,CAFD,MAEO,IAAIxE,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;IAChC,OAAO4E,gCAAgC,EAAvC;EACD,CAFM,MAEA;IACL,MAAM,IAAItD,4BAAJ,CAAkB;MACtBC,IAAI,EAAED,4BAAA,CAAcwD,yBADE;MAEtBrD,OAAO,EAAEH,4BAAA,CAAcyD;IAFD,CAAlB,CAAN;EAID;AACF,CAXM"}
1
+ {"version":3,"names":["isLocationServicesEnabled","isValidPlatform","OkHiNativeModule","isLocationPermissionGranted","isBackgroundLocationPermissionGrantedAndroid","sdkVersion","getSystemVersion","Number","PermissionsAndroid","PERMISSIONS","ACCESS_BACKGROUND_LOCATION","hasPermission","check","console","warn","isBackgroundLocationPermissionGrantedIOS","isBackgroundLocationPermissionGranted","fn","Platform","OS","requestLocationPermissionAndroid","status","requestMultiple","ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION","requestLocationPermissionIOS","requestLocationPermission","isGranted","errorHandler","requestBackgroundLocationPermissionAndroid","permissions","requestBackgroundLocationPermissionIOS","requestBackgroundLocationPermission","requestEnableLocationServices","isGooglePlayServicesAvailable","requestEnableGooglePlayServices","request","locationPermissionType","rationale","callback","serviceError","OkHiException","code","SERVICE_UNAVAILABLE_CODE","message","googlePlayError","handleError","error","handleGooglePlayServiceRequest","then","googlePlayStatus","handleRationaleRequest","handleRationaleAlert","alertRationale","Promise","resolve","_","Alert","alert","title","text","grantButton","label","onPress","denyButton","style","onDismiss","handlePermissionRequest","OkHiNativeEvents","removeAllListeners","addListener","permissionUpdate","whenInUseResult","initialWhenInUseResult","alwaysResult","currentStatus","retriveLocationPermissionStatus","showRationale","result","serviceStatus","enableResult","catch","openAppSettings","alwaysPerm","whenInUsePerm","requestTrackingAuthorization","canOpenProtectedAppsSettings","openProtectedAppsSettings","isAndroidNotificationGranted","POST_NOTIFICATIONS","requestAndroidNotificationPermission","existingPermissionStatus","isIOSNotificationGranted","isNotificationPermissionGranted","requestIOSNotificationPermission","requestNotificationPermission","UNSUPPORTED_PLATFORM_CODE","UNSUPPORTED_PLATFORM_MESSAGE"],"sources":["Helpers.ts"],"sourcesContent":["import { OkHiNativeModule, OkHiNativeEvents } from '../OkHiNativeModule';\nimport { Alert, Permission, PermissionsAndroid, Platform } from 'react-native';\nimport { errorHandler, isValidPlatform } from './_helpers';\nimport type {\n LocationPermissionCallback,\n LocationPermissionStatus,\n LocationRequestPermissionType,\n} from './types';\nimport { OkHiException } from './OkHiException';\n\n/**\n * Checks whether location services are enabled\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the service is available\n */\nexport const isLocationServicesEnabled = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationServicesEnabled);\n};\n\n/**\n * Checks whether when in use location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isLocationPermissionGranted = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationPermissionGranted);\n};\n\nconst isBackgroundLocationPermissionGrantedAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) {\n return true;\n }\n if (Number(sdkVersion) < 29) {\n return await isLocationPermissionGranted();\n }\n if (\n typeof PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION !==\n 'undefined'\n ) {\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION as Permission\n );\n return hasPermission;\n }\n console.warn(\n `PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION is undefined, this is an issue with the current version of RN you are running. Please consider upgrading`\n );\n return false;\n };\n\nconst isBackgroundLocationPermissionGrantedIOS = (): Promise<boolean> => {\n return OkHiNativeModule.isBackgroundLocationPermissionGranted();\n};\n\n/**\n * Checks whether background location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isBackgroundLocationPermissionGranted = (): Promise<boolean> => {\n const fn =\n Platform.OS === 'android'\n ? isBackgroundLocationPermissionGrantedAndroid\n : isBackgroundLocationPermissionGrantedIOS;\n return isValidPlatform(fn);\n};\n\nconst requestLocationPermissionAndroid = async (): Promise<boolean> => {\n const status: any = await PermissionsAndroid.requestMultiple([\n PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION as Permission,\n PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION as Permission,\n ]);\n return status['android.permission.ACCESS_FINE_LOCATION'] === 'granted';\n};\n\nconst requestLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestLocationPermission();\n};\n\n/**\n * Requests for when in use location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestLocationPermission = async (): Promise<boolean> => {\n const isGranted = await isLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestLocationPermissionAndroid\n : requestLocationPermissionIOS\n );\n};\n\nconst requestBackgroundLocationPermissionAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) return true;\n if (Number(sdkVersion) >= 29) {\n const permissions: any = [\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION,\n ];\n const status: any = await PermissionsAndroid.requestMultiple(permissions);\n return (\n status['android.permission.ACCESS_BACKGROUND_LOCATION'] === 'granted'\n );\n } else {\n return await requestLocationPermissionAndroid();\n }\n };\n\nconst requestBackgroundLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestBackgroundLocationPermission();\n};\n\n/**\n * Requests for background location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestBackgroundLocationPermission =\n async (): Promise<boolean> => {\n const isGranted = await isBackgroundLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestBackgroundLocationPermissionAndroid\n : requestBackgroundLocationPermissionIOS\n );\n };\n\n/**\n * Requests the user to enable location services by showing an in app modal on android and opening location settings on iOS\n * @returns {Promise<boolean>} A promise that resolves to either a boolean value on android or null on iOS\n */\nexport const requestEnableLocationServices = (): Promise<boolean | null> => {\n return isValidPlatform(OkHiNativeModule.requestEnableLocationServices);\n};\n\n/**\n * Android Only - Checks if Google Play Services is available\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const isGooglePlayServicesAvailable = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.isGooglePlayServicesAvailable,\n 'android'\n );\n};\n\n/**\n * Android Only - Requests user to enable Google Play Services\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const requestEnableGooglePlayServices = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.requestEnableGooglePlayServices,\n 'android'\n );\n};\n\n/**\n * Returns the system version of the current platform\n * @returns {Promise<boolean>} A promise that resolves either a string on iOS or number on Android\n */\nexport const getSystemVersion = (): Promise<string | number> =>\n isValidPlatform(OkHiNativeModule.getSystemVersion);\n\n/**\n * Requests location permission from the user. It'll also attempt to activate any disbaled services (Android Only)\n */\nexport const request = (\n locationPermissionType: LocationRequestPermissionType,\n rationale: {\n title: string;\n text: string;\n successButton?: { label: string };\n denyButton?: { label: string };\n } | null,\n callback: LocationPermissionCallback\n) => {\n const serviceError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Location service is currently not available. Please enable in app settings',\n });\n\n const googlePlayError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Google Play Services is currently unavailable. Please enable in settings',\n });\n\n const handleError = (error: OkHiException) => {\n callback(null, error);\n };\n\n const handleGooglePlayServiceRequest = () => {\n requestEnableGooglePlayServices().then((googlePlayStatus) => {\n if (!googlePlayStatus) {\n handleError(googlePlayError);\n } else {\n handleRationaleRequest();\n }\n });\n };\n\n const handleRationaleAlert = (alertRationale: {\n title: string;\n text: string;\n grantButton?: { label: string };\n denyButton?: { label: string };\n }) => {\n return new Promise((resolve, _) => {\n Alert.alert(\n alertRationale.title,\n alertRationale.text,\n [\n {\n text: alertRationale.grantButton\n ? alertRationale.grantButton.label\n : 'Grant',\n onPress: () => {\n resolve(true);\n },\n },\n {\n text: alertRationale.denyButton\n ? alertRationale.denyButton.label\n : 'Deny',\n onPress: () => {\n resolve(false);\n },\n style: 'cancel',\n },\n ],\n {\n onDismiss: () => {\n resolve(false);\n },\n }\n );\n });\n };\n\n const handlePermissionRequest = () => {\n if (Platform.OS === 'ios') {\n OkHiNativeEvents.removeAllListeners('onLocationPermissionStatusUpdate');\n OkHiNativeEvents.addListener(\n 'onLocationPermissionStatusUpdate',\n (permissionUpdate) => {\n callback(permissionUpdate, null);\n }\n );\n if (locationPermissionType === 'whenInUse') {\n OkHiNativeModule.requestLocationPermission();\n } else {\n OkHiNativeModule.requestBackgroundLocationPermission();\n }\n } else {\n if (locationPermissionType === 'whenInUse') {\n requestLocationPermissionAndroid().then((whenInUseResult) =>\n callback(whenInUseResult ? 'authorizedWhenInUse' : 'denied', null)\n );\n } else {\n requestLocationPermissionAndroid().then((initialWhenInUseResult) => {\n if (!initialWhenInUseResult) {\n callback('denied', null);\n } else {\n callback('authorizedWhenInUse', null);\n requestBackgroundLocationPermission().then((alwaysResult) => {\n callback(\n alwaysResult ? 'authorizedAlways' : 'authorizedWhenInUse',\n null\n );\n });\n }\n });\n }\n }\n };\n\n const handleRationaleRequest = async () => {\n const currentStatus = await retriveLocationPermissionStatus();\n let showRationale = true;\n if (\n locationPermissionType === 'whenInUse' &&\n (currentStatus === 'authorizedWhenInUse' ||\n currentStatus === 'authorizedAlways')\n ) {\n showRationale = false;\n }\n if (\n locationPermissionType === 'always' &&\n currentStatus === 'authorizedAlways'\n ) {\n showRationale = false;\n }\n if (rationale && showRationale) {\n const result = await handleRationaleAlert(rationale);\n if (!result) {\n callback('rationaleDissmissed', null);\n } else {\n handlePermissionRequest();\n }\n } else {\n handlePermissionRequest();\n }\n };\n\n isLocationServicesEnabled()\n .then((serviceStatus) => {\n if (!serviceStatus && Platform.OS === 'ios') {\n handleError(serviceError);\n } else if (!serviceStatus && Platform.OS === 'android') {\n requestEnableLocationServices()\n .then((enableResult) => {\n if (!enableResult) {\n handleError(serviceError);\n } else {\n handleGooglePlayServiceRequest();\n }\n })\n .catch(handleError);\n } else {\n if (Platform.OS === 'ios') {\n handleRationaleRequest();\n } else {\n handleGooglePlayServiceRequest();\n }\n }\n })\n .catch(handleError);\n};\n\n/**\n * Open the device's app settings.\n */\nexport const openAppSettings = () => {\n OkHiNativeModule.openAppSettings();\n};\n\n/**\n * Retrives the location permission status from the device\n */\nexport const retriveLocationPermissionStatus =\n async (): Promise<LocationPermissionStatus> => {\n if (Platform.OS === 'ios') {\n return OkHiNativeModule.retriveLocationPermissionStatus() as Promise<LocationPermissionStatus>;\n }\n const alwaysPerm = await isBackgroundLocationPermissionGranted();\n if (alwaysPerm) {\n return 'authorizedAlways';\n }\n const whenInUsePerm = await isLocationPermissionGranted();\n return whenInUsePerm ? 'authorizedWhenInUse' : 'denied';\n };\n\n/**\n * Requests tracking authorization from the user. iOS only, iOS version >= 14\n * Read more: https://developer.apple.com/app-store/user-privacy-and-data-use/\n */\nexport const requestTrackingAuthorization = async (): Promise<\n string | null\n> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.requestTrackingAuthorization();\n return result;\n }, 'ios');\n};\n\n/**\n * Checks whether current device can open \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const canOpenProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.canOpenProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\n/**\n * Opens \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const openProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.openProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\nconst isAndroidNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 33) {\n return true;\n }\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS as Permission\n );\n return hasPermission;\n }, 'android');\n};\n\nconst requestAndroidNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isAndroidNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n const status: any = await PermissionsAndroid.request(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS as Permission\n );\n return status === 'granted';\n }, 'android');\n};\n\nconst isIOSNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n return OkHiNativeModule.isNotificationPermissionGranted();\n }, 'ios');\n};\n\nconst requestIOSNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isIOSNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n return OkHiNativeModule.requestNotificationPermission();\n }, 'ios');\n};\n\n/**\n * Checks whether notification permission is granted on both android and ios devices\n */\nexport const isNotificationPermissionGranted = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return isAndroidNotificationGranted();\n } else if (Platform.OS === 'ios') {\n return isIOSNotificationGranted();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n\n/**\n * Requests notification permission from both android and ios devices\n */\nexport const requestNotificationPermission = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return requestAndroidNotificationPermission();\n } else if (Platform.OS === 'ios') {\n return requestIOSNotificationPermission();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AAEA;AACA;AACA;AACA;AACO,MAAMA,yBAAyB,GAAG,MAAwB;EAC/D,OAAO,IAAAC,wBAAA,EAAgBC,kCAAA,CAAiBF,yBAAjC,CAAP;AACD,CAFM;AAIP;AACA;AACA;AACA;;;;;AACO,MAAMG,2BAA2B,GAAG,MAAwB;EACjE,OAAO,IAAAF,wBAAA,EAAgBC,kCAAA,CAAiBC,2BAAjC,CAAP;AACD,CAFM;;;;AAIP,MAAMC,4CAA4C,GAChD,YAA8B;EAC5B,MAAMC,UAAU,GAAG,MAAMH,kCAAA,CAAiBI,gBAAjB,EAAzB;;EACA,IAAIC,MAAM,CAACF,UAAD,CAAN,GAAqB,EAAzB,EAA6B;IAC3B,OAAO,IAAP;EACD;;EACD,IAAIE,MAAM,CAACF,UAAD,CAAN,GAAqB,EAAzB,EAA6B;IAC3B,OAAO,MAAMF,2BAA2B,EAAxC;EACD;;EACD,IACE,OAAOK,+BAAA,CAAmBC,WAAnB,CAA+BC,0BAAtC,KACA,WAFF,EAGE;IACA,MAAMC,aAAa,GAAG,MAAMH,+BAAA,CAAmBI,KAAnB,CAC1BJ,+BAAA,CAAmBC,WAAnB,CAA+BC,0BADL,CAA5B;IAGA,OAAOC,aAAP;EACD;;EACDE,OAAO,CAACC,IAAR,CACG,oKADH;EAGA,OAAO,KAAP;AACD,CAtBH;;AAwBA,MAAMC,wCAAwC,GAAG,MAAwB;EACvE,OAAOb,kCAAA,CA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AApB,EAA+B;IAC7B,OAAOuE,oCAAoC,EAA3C;EACD,CAFD,MAEO,IAAIxE,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;IAChC,OAAO2E,gCAAgC,EAAvC;EACD,CAFM,MAEA;IACL,MAAM,IAAIrD,4BAAJ,CAAkB;MACtBC,IAAI,EAAED,4BAAA,CAAcuD,yBADE;MAEtBpD,OAAO,EAAEH,4BAAA,CAAcwD;IAFD,CAAlB,CAAN;EAID;AACF,CAXM"}
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "okhiWebReactNative",
3
- "version": "1.2.0-beta.2"
3
+ "version": "1.2.1"
4
4
  }
@@ -334,7 +334,7 @@ const requestAndroidNotificationPermission = async () => {
334
334
  return true;
335
335
  }
336
336
 
337
- const status = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATION);
337
+ const status = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
338
338
  return status === 'granted';
339
339
  }, 'android');
340
340
  };
@@ -1 +1 @@
1
- {"version":3,"names":["OkHiNativeModule","OkHiNativeEvents","Alert","PermissionsAndroid","Platform","errorHandler","isValidPlatform","OkHiException","isLocationServicesEnabled","isLocationPermissionGranted","isBackgroundLocationPermissionGrantedAndroid","sdkVersion","getSystemVersion","Number","PERMISSIONS","ACCESS_BACKGROUND_LOCATION","hasPermission","check","console","warn","isBackgroundLocationPermissionGrantedIOS","isBackgroundLocationPermissionGranted","fn","OS","requestLocationPermissionAndroid","status","requestMultiple","ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION","requestLocationPermissionIOS","requestLocationPermission","isGranted","requestBackgroundLocationPermissionAndroid","permissions","requestBackgroundLocationPermissionIOS","requestBackgroundLocationPermission","requestEnableLocationServices","isGooglePlayServicesAvailable","requestEnableGooglePlayServices","request","locationPermissionType","rationale","callback","serviceError","code","SERVICE_UNAVAILABLE_CODE","message","googlePlayError","handleError","error","handleGooglePlayServiceRequest","then","googlePlayStatus","handleRationaleRequest","handleRationaleAlert","alertRationale","Promise","resolve","_","alert","title","text","grantButton","label","onPress","denyButton","style","onDismiss","handlePermissionRequest","removeAllListeners","addListener","permissionUpdate","whenInUseResult","initialWhenInUseResult","alwaysResult","currentStatus","retriveLocationPermissionStatus","showRationale","result","serviceStatus","enableResult","catch","openAppSettings","alwaysPerm","whenInUsePerm","requestTrackingAuthorization","canOpenProtectedAppsSettings","openProtectedAppsSettings","isAndroidNotificationGranted","POST_NOTIFICATIONS","requestAndroidNotificationPermission","existingPermissionStatus","POST_NOTIFICATION","isIOSNotificationGranted","isNotificationPermissionGranted","requestIOSNotificationPermission","requestNotificationPermission","UNSUPPORTED_PLATFORM_CODE","UNSUPPORTED_PLATFORM_MESSAGE"],"sources":["Helpers.ts"],"sourcesContent":["import { OkHiNativeModule, OkHiNativeEvents } from '../OkHiNativeModule';\nimport { Alert, Permission, PermissionsAndroid, Platform } from 'react-native';\nimport { errorHandler, isValidPlatform } from './_helpers';\nimport type {\n LocationPermissionCallback,\n LocationPermissionStatus,\n LocationRequestPermissionType,\n} from './types';\nimport { OkHiException } from './OkHiException';\n\n/**\n * Checks whether location services are enabled\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the service is available\n */\nexport const isLocationServicesEnabled = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationServicesEnabled);\n};\n\n/**\n * Checks whether when in use location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isLocationPermissionGranted = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationPermissionGranted);\n};\n\nconst isBackgroundLocationPermissionGrantedAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) {\n return true;\n }\n if (Number(sdkVersion) < 29) {\n return await isLocationPermissionGranted();\n }\n if (\n typeof PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION !==\n 'undefined'\n ) {\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION as Permission\n );\n return hasPermission;\n }\n console.warn(\n `PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION is undefined, this is an issue with the current version of RN you are running. Please consider upgrading`\n );\n return false;\n };\n\nconst isBackgroundLocationPermissionGrantedIOS = (): Promise<boolean> => {\n return OkHiNativeModule.isBackgroundLocationPermissionGranted();\n};\n\n/**\n * Checks whether background location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isBackgroundLocationPermissionGranted = (): Promise<boolean> => {\n const fn =\n Platform.OS === 'android'\n ? isBackgroundLocationPermissionGrantedAndroid\n : isBackgroundLocationPermissionGrantedIOS;\n return isValidPlatform(fn);\n};\n\nconst requestLocationPermissionAndroid = async (): Promise<boolean> => {\n const status: any = await PermissionsAndroid.requestMultiple([\n PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION as Permission,\n PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION as Permission,\n ]);\n return status['android.permission.ACCESS_FINE_LOCATION'] === 'granted';\n};\n\nconst requestLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestLocationPermission();\n};\n\n/**\n * Requests for when in use location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestLocationPermission = async (): Promise<boolean> => {\n const isGranted = await isLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestLocationPermissionAndroid\n : requestLocationPermissionIOS\n );\n};\n\nconst requestBackgroundLocationPermissionAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) return true;\n if (Number(sdkVersion) >= 29) {\n const permissions: any = [\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION,\n ];\n const status: any = await PermissionsAndroid.requestMultiple(permissions);\n return (\n status['android.permission.ACCESS_BACKGROUND_LOCATION'] === 'granted'\n );\n } else {\n return await requestLocationPermissionAndroid();\n }\n };\n\nconst requestBackgroundLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestBackgroundLocationPermission();\n};\n\n/**\n * Requests for background location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestBackgroundLocationPermission =\n async (): Promise<boolean> => {\n const isGranted = await isBackgroundLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestBackgroundLocationPermissionAndroid\n : requestBackgroundLocationPermissionIOS\n );\n };\n\n/**\n * Requests the user to enable location services by showing an in app modal on android and opening location settings on iOS\n * @returns {Promise<boolean>} A promise that resolves to either a boolean value on android or null on iOS\n */\nexport const requestEnableLocationServices = (): Promise<boolean | null> => {\n return isValidPlatform(OkHiNativeModule.requestEnableLocationServices);\n};\n\n/**\n * Android Only - Checks if Google Play Services is available\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const isGooglePlayServicesAvailable = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.isGooglePlayServicesAvailable,\n 'android'\n );\n};\n\n/**\n * Android Only - Requests user to enable Google Play Services\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const requestEnableGooglePlayServices = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.requestEnableGooglePlayServices,\n 'android'\n );\n};\n\n/**\n * Returns the system version of the current platform\n * @returns {Promise<boolean>} A promise that resolves either a string on iOS or number on Android\n */\nexport const getSystemVersion = (): Promise<string | number> =>\n isValidPlatform(OkHiNativeModule.getSystemVersion);\n\n/**\n * Requests location permission from the user. It'll also attempt to activate any disbaled services (Android Only)\n */\nexport const request = (\n locationPermissionType: LocationRequestPermissionType,\n rationale: {\n title: string;\n text: string;\n successButton?: { label: string };\n denyButton?: { label: string };\n } | null,\n callback: LocationPermissionCallback\n) => {\n const serviceError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Location service is currently not available. Please enable in app settings',\n });\n\n const googlePlayError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Google Play Services is currently unavailable. Please enable in settings',\n });\n\n const handleError = (error: OkHiException) => {\n callback(null, error);\n };\n\n const handleGooglePlayServiceRequest = () => {\n requestEnableGooglePlayServices().then((googlePlayStatus) => {\n if (!googlePlayStatus) {\n handleError(googlePlayError);\n } else {\n handleRationaleRequest();\n }\n });\n };\n\n const handleRationaleAlert = (alertRationale: {\n title: string;\n text: string;\n grantButton?: { label: string };\n denyButton?: { label: string };\n }) => {\n return new Promise((resolve, _) => {\n Alert.alert(\n alertRationale.title,\n alertRationale.text,\n [\n {\n text: alertRationale.grantButton\n ? alertRationale.grantButton.label\n : 'Grant',\n onPress: () => {\n resolve(true);\n },\n },\n {\n text: alertRationale.denyButton\n ? alertRationale.denyButton.label\n : 'Deny',\n onPress: () => {\n resolve(false);\n },\n style: 'cancel',\n },\n ],\n {\n onDismiss: () => {\n resolve(false);\n },\n }\n );\n });\n };\n\n const handlePermissionRequest = () => {\n if (Platform.OS === 'ios') {\n OkHiNativeEvents.removeAllListeners('onLocationPermissionStatusUpdate');\n OkHiNativeEvents.addListener(\n 'onLocationPermissionStatusUpdate',\n (permissionUpdate) => {\n callback(permissionUpdate, null);\n }\n );\n if (locationPermissionType === 'whenInUse') {\n OkHiNativeModule.requestLocationPermission();\n } else {\n OkHiNativeModule.requestBackgroundLocationPermission();\n }\n } else {\n if (locationPermissionType === 'whenInUse') {\n requestLocationPermissionAndroid().then((whenInUseResult) =>\n callback(whenInUseResult ? 'authorizedWhenInUse' : 'denied', null)\n );\n } else {\n requestLocationPermissionAndroid().then((initialWhenInUseResult) => {\n if (!initialWhenInUseResult) {\n callback('denied', null);\n } else {\n callback('authorizedWhenInUse', null);\n requestBackgroundLocationPermission().then((alwaysResult) => {\n callback(\n alwaysResult ? 'authorizedAlways' : 'authorizedWhenInUse',\n null\n );\n });\n }\n });\n }\n }\n };\n\n const handleRationaleRequest = async () => {\n const currentStatus = await retriveLocationPermissionStatus();\n let showRationale = true;\n if (\n locationPermissionType === 'whenInUse' &&\n (currentStatus === 'authorizedWhenInUse' ||\n currentStatus === 'authorizedAlways')\n ) {\n showRationale = false;\n }\n if (\n locationPermissionType === 'always' &&\n currentStatus === 'authorizedAlways'\n ) {\n showRationale = false;\n }\n if (rationale && showRationale) {\n const result = await handleRationaleAlert(rationale);\n if (!result) {\n callback('rationaleDissmissed', null);\n } else {\n handlePermissionRequest();\n }\n } else {\n handlePermissionRequest();\n }\n };\n\n isLocationServicesEnabled()\n .then((serviceStatus) => {\n if (!serviceStatus && Platform.OS === 'ios') {\n handleError(serviceError);\n } else if (!serviceStatus && Platform.OS === 'android') {\n requestEnableLocationServices()\n .then((enableResult) => {\n if (!enableResult) {\n handleError(serviceError);\n } else {\n handleGooglePlayServiceRequest();\n }\n })\n .catch(handleError);\n } else {\n if (Platform.OS === 'ios') {\n handleRationaleRequest();\n } else {\n handleGooglePlayServiceRequest();\n }\n }\n })\n .catch(handleError);\n};\n\n/**\n * Open the device's app settings.\n */\nexport const openAppSettings = () => {\n OkHiNativeModule.openAppSettings();\n};\n\n/**\n * Retrives the location permission status from the device\n */\nexport const retriveLocationPermissionStatus =\n async (): Promise<LocationPermissionStatus> => {\n if (Platform.OS === 'ios') {\n return OkHiNativeModule.retriveLocationPermissionStatus() as Promise<LocationPermissionStatus>;\n }\n const alwaysPerm = await isBackgroundLocationPermissionGranted();\n if (alwaysPerm) {\n return 'authorizedAlways';\n }\n const whenInUsePerm = await isLocationPermissionGranted();\n return whenInUsePerm ? 'authorizedWhenInUse' : 'denied';\n };\n\n/**\n * Requests tracking authorization from the user. iOS only, iOS version >= 14\n * Read more: https://developer.apple.com/app-store/user-privacy-and-data-use/\n */\nexport const requestTrackingAuthorization = async (): Promise<\n string | null\n> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.requestTrackingAuthorization();\n return result;\n }, 'ios');\n};\n\n/**\n * Checks whether current device can open \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const canOpenProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.canOpenProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\n/**\n * Opens \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const openProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.openProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\nconst isAndroidNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 33) {\n return true;\n }\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS as Permission\n );\n return hasPermission;\n }, 'android');\n};\n\nconst requestAndroidNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isAndroidNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n const status: any = await PermissionsAndroid.request(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATION as Permission\n );\n return status === 'granted';\n }, 'android');\n};\n\nconst isIOSNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n return OkHiNativeModule.isNotificationPermissionGranted();\n }, 'ios');\n};\n\nconst requestIOSNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isIOSNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n return OkHiNativeModule.requestNotificationPermission();\n }, 'ios');\n};\n\n/**\n * Checks whether notification permission is granted on both android and ios devices\n */\nexport const isNotificationPermissionGranted = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return isAndroidNotificationGranted();\n } else if (Platform.OS === 'ios') {\n return isIOSNotificationGranted();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n\n/**\n * Requests notification permission from both android and ios devices\n */\nexport const requestNotificationPermission = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return requestAndroidNotificationPermission();\n } else if (Platform.OS === 'ios') {\n return requestIOSNotificationPermission();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n"],"mappings":"AAAA,SAASA,gBAAT,EAA2BC,gBAA3B,QAAmD,qBAAnD;AACA,SAASC,KAAT,EAA4BC,kBAA5B,EAAgDC,QAAhD,QAAgE,cAAhE;AACA,SAASC,YAAT,EAAuBC,eAAvB,QAA8C,YAA9C;AAMA,SAASC,aAAT,QAA8B,iBAA9B;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,yBAAyB,GAAG,MAAwB;EAC/D,OAAOF,eAAe,CAACN,gBAAgB,CAACQ,yBAAlB,CAAtB;AACD,CAFM;AAIP;AACA;AACA;AACA;;AACA,OAAO,MAAMC,2BAA2B,GAAG,MAAwB;EACjE,OAAOH,eAAe,CAACN,gBAAgB,CAACS,2BAAlB,CAAtB;AACD,CAFM;;AAIP,MAAMC,4CAA4C,GAChD,YAA8B;EAC5B,MAAMC,UAAU,GAAG,MAAMX,gBAAgB,CAACY,gBAAjB,EAAzB;;EACA,IAAIC,MAAM,CAACF,UAAD,CAAN,GAAqB,EAAzB,EAA6B;IAC3B,OAAO,IAAP;EACD;;EACD,IAAIE,MAAM,C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A4B,EAAnC;EACD,CAFD,MAEO,IAAIpF,QAAQ,CAACmB,EAAT,KAAgB,KAApB,EAA2B;IAChC,OAAOsE,wBAAwB,EAA/B;EACD,CAFM,MAEA;IACL,MAAM,IAAItF,aAAJ,CAAkB;MACtBqC,IAAI,EAAErC,aAAa,CAAC0F,yBADE;MAEtBnD,OAAO,EAAEvC,aAAa,CAAC2F;IAFD,CAAlB,CAAN;EAID;AACF,CAXM;AAaP;AACA;AACA;;AACA,OAAO,MAAMF,6BAA6B,GAAG,YAA8B;EACzE,IAAI5F,QAAQ,CAACmB,EAAT,KAAgB,SAApB,EAA+B;IAC7B,OAAOmE,oCAAoC,EAA3C;EACD,CAFD,MAEO,IAAItF,QAAQ,CAACmB,EAAT,KAAgB,KAApB,EAA2B;IAChC,OAAOwE,gCAAgC,EAAvC;EACD,CAFM,MAEA;IACL,MAAM,IAAIxF,aAAJ,CAAkB;MACtBqC,IAAI,EAAErC,aAAa,CAAC0F,yBADE;MAEtBnD,OAAO,EAAEvC,aAAa,CAAC2F;IAFD,CAAlB,CAAN;EAID;AACF,CAXM"}
1
+ {"version":3,"names":["OkHiNativeModule","OkHiNativeEvents","Alert","PermissionsAndroid","Platform","errorHandler","isValidPlatform","OkHiException","isLocationServicesEnabled","isLocationPermissionGranted","isBackgroundLocationPermissionGrantedAndroid","sdkVersion","getSystemVersion","Number","PERMISSIONS","ACCESS_BACKGROUND_LOCATION","hasPermission","check","console","warn","isBackgroundLocationPermissionGrantedIOS","isBackgroundLocationPermissionGranted","fn","OS","requestLocationPermissionAndroid","status","requestMultiple","ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION","requestLocationPermissionIOS","requestLocationPermission","isGranted","requestBackgroundLocationPermissionAndroid","permissions","requestBackgroundLocationPermissionIOS","requestBackgroundLocationPermission","requestEnableLocationServices","isGooglePlayServicesAvailable","requestEnableGooglePlayServices","request","locationPermissionType","rationale","callback","serviceError","code","SERVICE_UNAVAILABLE_CODE","message","googlePlayError","handleError","error","handleGooglePlayServiceRequest","then","googlePlayStatus","handleRationaleRequest","handleRationaleAlert","alertRationale","Promise","resolve","_","alert","title","text","grantButton","label","onPress","denyButton","style","onDismiss","handlePermissionRequest","removeAllListeners","addListener","permissionUpdate","whenInUseResult","initialWhenInUseResult","alwaysResult","currentStatus","retriveLocationPermissionStatus","showRationale","result","serviceStatus","enableResult","catch","openAppSettings","alwaysPerm","whenInUsePerm","requestTrackingAuthorization","canOpenProtectedAppsSettings","openProtectedAppsSettings","isAndroidNotificationGranted","POST_NOTIFICATIONS","requestAndroidNotificationPermission","existingPermissionStatus","isIOSNotificationGranted","isNotificationPermissionGranted","requestIOSNotificationPermission","requestNotificationPermission","UNSUPPORTED_PLATFORM_CODE","UNSUPPORTED_PLATFORM_MESSAGE"],"sources":["Helpers.ts"],"sourcesContent":["import { OkHiNativeModule, OkHiNativeEvents } from '../OkHiNativeModule';\nimport { Alert, Permission, PermissionsAndroid, Platform } from 'react-native';\nimport { errorHandler, isValidPlatform } from './_helpers';\nimport type {\n LocationPermissionCallback,\n LocationPermissionStatus,\n LocationRequestPermissionType,\n} from './types';\nimport { OkHiException } from './OkHiException';\n\n/**\n * Checks whether location services are enabled\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the service is available\n */\nexport const isLocationServicesEnabled = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationServicesEnabled);\n};\n\n/**\n * Checks whether when in use location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isLocationPermissionGranted = (): Promise<boolean> => {\n return isValidPlatform(OkHiNativeModule.isLocationPermissionGranted);\n};\n\nconst isBackgroundLocationPermissionGrantedAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) {\n return true;\n }\n if (Number(sdkVersion) < 29) {\n return await isLocationPermissionGranted();\n }\n if (\n typeof PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION !==\n 'undefined'\n ) {\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION as Permission\n );\n return hasPermission;\n }\n console.warn(\n `PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION is undefined, this is an issue with the current version of RN you are running. Please consider upgrading`\n );\n return false;\n };\n\nconst isBackgroundLocationPermissionGrantedIOS = (): Promise<boolean> => {\n return OkHiNativeModule.isBackgroundLocationPermissionGranted();\n};\n\n/**\n * Checks whether background location permission is granted\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const isBackgroundLocationPermissionGranted = (): Promise<boolean> => {\n const fn =\n Platform.OS === 'android'\n ? isBackgroundLocationPermissionGrantedAndroid\n : isBackgroundLocationPermissionGrantedIOS;\n return isValidPlatform(fn);\n};\n\nconst requestLocationPermissionAndroid = async (): Promise<boolean> => {\n const status: any = await PermissionsAndroid.requestMultiple([\n PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION as Permission,\n PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION as Permission,\n ]);\n return status['android.permission.ACCESS_FINE_LOCATION'] === 'granted';\n};\n\nconst requestLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestLocationPermission();\n};\n\n/**\n * Requests for when in use location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestLocationPermission = async (): Promise<boolean> => {\n const isGranted = await isLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestLocationPermissionAndroid\n : requestLocationPermissionIOS\n );\n};\n\nconst requestBackgroundLocationPermissionAndroid =\n async (): Promise<boolean> => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 23) return true;\n if (Number(sdkVersion) >= 29) {\n const permissions: any = [\n PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION,\n ];\n const status: any = await PermissionsAndroid.requestMultiple(permissions);\n return (\n status['android.permission.ACCESS_BACKGROUND_LOCATION'] === 'granted'\n );\n } else {\n return await requestLocationPermissionAndroid();\n }\n };\n\nconst requestBackgroundLocationPermissionIOS = (): Promise<boolean> => {\n return OkHiNativeModule.requestBackgroundLocationPermission();\n};\n\n/**\n * Requests for background location permission\n * @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted\n */\nexport const requestBackgroundLocationPermission =\n async (): Promise<boolean> => {\n const isGranted = await isBackgroundLocationPermissionGranted();\n if (isGranted) return isGranted;\n return errorHandler(\n Platform.OS === 'android'\n ? requestBackgroundLocationPermissionAndroid\n : requestBackgroundLocationPermissionIOS\n );\n };\n\n/**\n * Requests the user to enable location services by showing an in app modal on android and opening location settings on iOS\n * @returns {Promise<boolean>} A promise that resolves to either a boolean value on android or null on iOS\n */\nexport const requestEnableLocationServices = (): Promise<boolean | null> => {\n return isValidPlatform(OkHiNativeModule.requestEnableLocationServices);\n};\n\n/**\n * Android Only - Checks if Google Play Services is available\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const isGooglePlayServicesAvailable = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.isGooglePlayServicesAvailable,\n 'android'\n );\n};\n\n/**\n * Android Only - Requests user to enable Google Play Services\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe\n */\nexport const requestEnableGooglePlayServices = (): Promise<boolean> => {\n return isValidPlatform(\n OkHiNativeModule.requestEnableGooglePlayServices,\n 'android'\n );\n};\n\n/**\n * Returns the system version of the current platform\n * @returns {Promise<boolean>} A promise that resolves either a string on iOS or number on Android\n */\nexport const getSystemVersion = (): Promise<string | number> =>\n isValidPlatform(OkHiNativeModule.getSystemVersion);\n\n/**\n * Requests location permission from the user. It'll also attempt to activate any disbaled services (Android Only)\n */\nexport const request = (\n locationPermissionType: LocationRequestPermissionType,\n rationale: {\n title: string;\n text: string;\n successButton?: { label: string };\n denyButton?: { label: string };\n } | null,\n callback: LocationPermissionCallback\n) => {\n const serviceError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Location service is currently not available. Please enable in app settings',\n });\n\n const googlePlayError = new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message:\n 'Google Play Services is currently unavailable. Please enable in settings',\n });\n\n const handleError = (error: OkHiException) => {\n callback(null, error);\n };\n\n const handleGooglePlayServiceRequest = () => {\n requestEnableGooglePlayServices().then((googlePlayStatus) => {\n if (!googlePlayStatus) {\n handleError(googlePlayError);\n } else {\n handleRationaleRequest();\n }\n });\n };\n\n const handleRationaleAlert = (alertRationale: {\n title: string;\n text: string;\n grantButton?: { label: string };\n denyButton?: { label: string };\n }) => {\n return new Promise((resolve, _) => {\n Alert.alert(\n alertRationale.title,\n alertRationale.text,\n [\n {\n text: alertRationale.grantButton\n ? alertRationale.grantButton.label\n : 'Grant',\n onPress: () => {\n resolve(true);\n },\n },\n {\n text: alertRationale.denyButton\n ? alertRationale.denyButton.label\n : 'Deny',\n onPress: () => {\n resolve(false);\n },\n style: 'cancel',\n },\n ],\n {\n onDismiss: () => {\n resolve(false);\n },\n }\n );\n });\n };\n\n const handlePermissionRequest = () => {\n if (Platform.OS === 'ios') {\n OkHiNativeEvents.removeAllListeners('onLocationPermissionStatusUpdate');\n OkHiNativeEvents.addListener(\n 'onLocationPermissionStatusUpdate',\n (permissionUpdate) => {\n callback(permissionUpdate, null);\n }\n );\n if (locationPermissionType === 'whenInUse') {\n OkHiNativeModule.requestLocationPermission();\n } else {\n OkHiNativeModule.requestBackgroundLocationPermission();\n }\n } else {\n if (locationPermissionType === 'whenInUse') {\n requestLocationPermissionAndroid().then((whenInUseResult) =>\n callback(whenInUseResult ? 'authorizedWhenInUse' : 'denied', null)\n );\n } else {\n requestLocationPermissionAndroid().then((initialWhenInUseResult) => {\n if (!initialWhenInUseResult) {\n callback('denied', null);\n } else {\n callback('authorizedWhenInUse', null);\n requestBackgroundLocationPermission().then((alwaysResult) => {\n callback(\n alwaysResult ? 'authorizedAlways' : 'authorizedWhenInUse',\n null\n );\n });\n }\n });\n }\n }\n };\n\n const handleRationaleRequest = async () => {\n const currentStatus = await retriveLocationPermissionStatus();\n let showRationale = true;\n if (\n locationPermissionType === 'whenInUse' &&\n (currentStatus === 'authorizedWhenInUse' ||\n currentStatus === 'authorizedAlways')\n ) {\n showRationale = false;\n }\n if (\n locationPermissionType === 'always' &&\n currentStatus === 'authorizedAlways'\n ) {\n showRationale = false;\n }\n if (rationale && showRationale) {\n const result = await handleRationaleAlert(rationale);\n if (!result) {\n callback('rationaleDissmissed', null);\n } else {\n handlePermissionRequest();\n }\n } else {\n handlePermissionRequest();\n }\n };\n\n isLocationServicesEnabled()\n .then((serviceStatus) => {\n if (!serviceStatus && Platform.OS === 'ios') {\n handleError(serviceError);\n } else if (!serviceStatus && Platform.OS === 'android') {\n requestEnableLocationServices()\n .then((enableResult) => {\n if (!enableResult) {\n handleError(serviceError);\n } else {\n handleGooglePlayServiceRequest();\n }\n })\n .catch(handleError);\n } else {\n if (Platform.OS === 'ios') {\n handleRationaleRequest();\n } else {\n handleGooglePlayServiceRequest();\n }\n }\n })\n .catch(handleError);\n};\n\n/**\n * Open the device's app settings.\n */\nexport const openAppSettings = () => {\n OkHiNativeModule.openAppSettings();\n};\n\n/**\n * Retrives the location permission status from the device\n */\nexport const retriveLocationPermissionStatus =\n async (): Promise<LocationPermissionStatus> => {\n if (Platform.OS === 'ios') {\n return OkHiNativeModule.retriveLocationPermissionStatus() as Promise<LocationPermissionStatus>;\n }\n const alwaysPerm = await isBackgroundLocationPermissionGranted();\n if (alwaysPerm) {\n return 'authorizedAlways';\n }\n const whenInUsePerm = await isLocationPermissionGranted();\n return whenInUsePerm ? 'authorizedWhenInUse' : 'denied';\n };\n\n/**\n * Requests tracking authorization from the user. iOS only, iOS version >= 14\n * Read more: https://developer.apple.com/app-store/user-privacy-and-data-use/\n */\nexport const requestTrackingAuthorization = async (): Promise<\n string | null\n> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.requestTrackingAuthorization();\n return result;\n }, 'ios');\n};\n\n/**\n * Checks whether current device can open \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const canOpenProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.canOpenProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\n/**\n * Opens \"Protected Apps Settings\" available in Transsion Group android devices such as Infinix and Tecno\n * When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.\n */\nexport const openProtectedAppsSettings = (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const result = await OkHiNativeModule.openProtectedAppsSettings();\n return result;\n }, 'android');\n};\n\nconst isAndroidNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const sdkVersion = await OkHiNativeModule.getSystemVersion();\n if (Number(sdkVersion) < 33) {\n return true;\n }\n const hasPermission = await PermissionsAndroid.check(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS as Permission\n );\n return hasPermission;\n }, 'android');\n};\n\nconst requestAndroidNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isAndroidNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n const status: any = await PermissionsAndroid.request(\n PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS as Permission\n );\n return status === 'granted';\n }, 'android');\n};\n\nconst isIOSNotificationGranted = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n return OkHiNativeModule.isNotificationPermissionGranted();\n }, 'ios');\n};\n\nconst requestIOSNotificationPermission = async (): Promise<boolean> => {\n return isValidPlatform(async () => {\n const existingPermissionStatus = await isIOSNotificationGranted();\n if (existingPermissionStatus) {\n return true;\n }\n return OkHiNativeModule.requestNotificationPermission();\n }, 'ios');\n};\n\n/**\n * Checks whether notification permission is granted on both android and ios devices\n */\nexport const isNotificationPermissionGranted = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return isAndroidNotificationGranted();\n } else if (Platform.OS === 'ios') {\n return isIOSNotificationGranted();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n\n/**\n * Requests notification permission from both android and ios devices\n */\nexport const requestNotificationPermission = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n return requestAndroidNotificationPermission();\n } else if (Platform.OS === 'ios') {\n return requestIOSNotificationPermission();\n } else {\n throw new OkHiException({\n code: OkHiException.UNSUPPORTED_PLATFORM_CODE,\n message: OkHiException.UNSUPPORTED_PLATFORM_MESSAGE,\n });\n }\n};\n"],"mappings":"AAAA,SAASA,gBAAT,EAA2BC,gBAA3B,QAAmD,qBAAnD;AACA,SAASC,KAAT,EAA4BC,kBAA5B,EAAgDC,QAAhD,QAAgE,cAAhE;AACA,SAASC,YAAT,EAAuBC,eAAvB,QAA8C,YAA9C;AAMA,SAASC,aAAT,QAA8B,iBAA9B;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,yBAAyB,GAAG,MAAwB;EAC/D,OAAOF,eAAe,CAACN,gBAAgB,CAACQ,yBAAlB,CAAtB;AACD,CAFM;AAIP;AACA;AACA;AACA;;AACA,OAAO,MAAMC,2BAA2B,GAAG,MAAwB;EACjE,OAAOH,eAAe,CAACN,gBAAgB,CAACS,2BAAlB,CAAtB;AACD,CAFM;;AAIP,MAAMC,4CAA4C,GAChD,YAA8B;EAC5B,MAAMC,UAAU,GAAG,MAAMX,gBAAgB,CAACY,gBAAjB,EAAzB;;EACA,IAAIC,MAAM,CAACF,UAAD,CAAN,GAAqB,EAAzB,EAA6B;IAC3B,OAAO,IAAP;EACD;;EACD,IAA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OAAOiE,4BAA4B,EAAnC;EACD,CAFD,MAEO,IAAIpF,QAAQ,CAACmB,EAAT,KAAgB,KAApB,EAA2B;IAChC,OAAOqE,wBAAwB,EAA/B;EACD,CAFM,MAEA;IACL,MAAM,IAAIrF,aAAJ,CAAkB;MACtBqC,IAAI,EAAErC,aAAa,CAACyF,yBADE;MAEtBlD,OAAO,EAAEvC,aAAa,CAAC0F;IAFD,CAAlB,CAAN;EAID;AACF,CAXM;AAaP;AACA;AACA;;AACA,OAAO,MAAMF,6BAA6B,GAAG,YAA8B;EACzE,IAAI3F,QAAQ,CAACmB,EAAT,KAAgB,SAApB,EAA+B;IAC7B,OAAOmE,oCAAoC,EAA3C;EACD,CAFD,MAEO,IAAItF,QAAQ,CAACmB,EAAT,KAAgB,KAApB,EAA2B;IAChC,OAAOuE,gCAAgC,EAAvC;EACD,CAFM,MAEA;IACL,MAAM,IAAIvF,aAAJ,CAAkB;MACtBqC,IAAI,EAAErC,aAAa,CAACyF,yBADE;MAEtBlD,OAAO,EAAEvC,aAAa,CAAC0F;IAFD,CAAlB,CAAN;EAID;AACF,CAXM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-okhi",
3
- "version": "1.2.0-beta.2",
3
+ "version": "1.2.1",
4
4
  "description": "The OkHi React Native library enables you to collect and verify addresses from your users",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "okhiWebReactNative",
3
- "version": "1.2.0-beta.2"
3
+ "version": "1.2.1"
4
4
  }
@@ -408,7 +408,7 @@ const requestAndroidNotificationPermission = async (): Promise<boolean> => {
408
408
  return true;
409
409
  }
410
410
  const status: any = await PermissionsAndroid.request(
411
- PermissionsAndroid.PERMISSIONS.POST_NOTIFICATION as Permission
411
+ PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS as Permission
412
412
  );
413
413
  return status === 'granted';
414
414
  }, 'android');