Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 'Always Allow' for iOS #97

Merged
merged 9 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ buck-out/

# CocoaPods
/ios/Pods/
yarn.lock
.vscode/launch.json
ios/Podfile.lock
3 changes: 3 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".MainApplication"
android:label="@string/app_name"
Expand Down
12 changes: 9 additions & 3 deletions app/services/LocationService.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GetStoreData, SetStoreData } from '../helpers/General';
import BackgroundGeolocation from '@mauron85/react-native-background-geolocation';
import { Alert, Platform } from 'react-native';

import {Alert, Platform, Linking} from 'react-native';
import {PERMISSIONS, check, RESULTS, request} from 'react-native-permissions';
import PushNotificationIOS from '@react-native-community/push-notification-ios';

import PushNotification from 'react-native-push-notification';
Expand Down Expand Up @@ -260,7 +260,13 @@ export default class LocationServices {
[
{
text: 'Yes',
onPress: () => BackgroundGeolocation.showLocationSettings(),
onPress: () => {
if (Platform.OS === 'android'){ // showLocationSettings() only works for android
BackgroundGeolocation.showLocationSettings();
} else {
Linking.openURL('App-Prefs:Privacy'); // Deeplinking method for iOS
}
},
},
{
text: 'No',
Expand Down
7 changes: 6 additions & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ target 'PrivateKit' do
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'


permissions_path = '../node_modules/react-native-permissions/ios'

pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"

pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
Expand All @@ -34,7 +39,7 @@ target 'PrivateKit' do
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'react-native-webview', :path => '../node_modules/react-native-webview'


# React Native Maps dependencies
rn_maps_path = '../node_modules/react-native-maps'
Expand Down
Loading