1 | import createService from './service';
|
2 | import {
|
3 | Platform,
|
4 | PermissionsAndroid
|
5 | } from 'react-native';
|
6 | import { parameters } from './endPoints';
|
7 | const endpoints = {
|
8 | }
|
9 |
|
10 | const googleApiKey = 'AIzaSyCbpZxMj8LfOzVQ7wnOdLXWH-bYhpweERU';
|
11 | const googleAndroidKey = 'AIzaSyCwvnIvZAm3UQoaiw8q687cLWfLf6SiW9Q';
|
12 | export 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 |