UNPKG

react-native-tone-framework

Version:

TONE Telegenics is a TONE-Enabled content sharing and streaming platform for businesses to exchange marketing and mobile engagement concepts

76 lines (75 loc) 2.48 kB
"use strict"; import { PermissionsAndroid, Platform } from 'react-native'; export const locationPermission = async () => { if (Platform.OS === 'android') { try { const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, { buttonNegative: undefined, buttonNeutral: 'Cancel', buttonPositive: 'Okay', message: 'Tone Telegenics requires location permission to access offers near you', title: 'TONE Telegenics' }); if (granted === PermissionsAndroid.RESULTS.GRANTED) { console.log('Location permission granted'); return true; } else { console.log('Location permission denied'); return false; } } catch (err) { console.warn('Permission request failed', err); return false; } } return false; }; export const microphonePermission = async () => { if (Platform.OS === 'android') { try { const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO, { buttonNegative: undefined, buttonNeutral: 'Cancel', buttonPositive: 'Okay', message: 'Tone Telegenics requires microphone permission to record audio.', title: 'TONE Telegenics' }); if (granted === PermissionsAndroid.RESULTS.GRANTED) { console.log('Microphone permission granted'); return true; } else { console.log('Microphone permission denied'); return false; } } catch (err) { console.warn('Permission request failed', err); return false; } } return false; }; export const notificationPermission = async () => { if (Platform.OS === 'android') { try { const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS, { buttonNegative: undefined, buttonNeutral: 'Cancel', buttonPositive: 'Okay', message: 'Tone Telegenics requires notification permission to show offers near you', title: 'TONE Telegenics' }); if (granted === PermissionsAndroid.RESULTS.GRANTED) { console.log('Notification permission granted'); return true; } else { console.log('Notification permission denied'); return false; } } catch (err) { console.warn('Permission request failed', err); return false; } } return false; }; //# sourceMappingURL=permissions.js.map