UNPKG

1.28 kBJavaScriptView Raw
1import createService from './service';
2import {
3 Platform,
4 PermissionsAndroid
5} from 'react-native';
6import { parameters } from './endPoints';
7const endpoints = {
8}
9
10const googleApiKey = 'AIzaSyCbpZxMj8LfOzVQ7wnOdLXWH-bYhpweERU';
11const googleAndroidKey = 'AIzaSyCwvnIvZAm3UQoaiw8q687cLWfLf6SiW9Q';
12export default {
13 getApiKey: async () => {
14 return Promise.resolve().then(() => googleApiKey);
15 },
16 getDirectionsKey: async () => {
17 if (Platform.OS === 'android') {
18 return Promise.resolve().then(() => googleAndroidKey);
19 }
20 return Promise.resolve().then(() => googleApiKey);
21 },
22 checkLocationPermision: async () => {
23 if (Platform.OS === 'android') {
24 return PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION).then(res => {
25 console.log(res);
26 if (!res) {
27 return PermissionsAndroid.request(
28 PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
29 {
30 'title': 'Location Needed',
31 'message': 'We need your location so we can provide service.'
32 });
33 }
34 });
35 }
36 }
37};
\No newline at end of file