You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Mobile: Fixes #3240: Fix geolocation
Co-authored-by: Roman Musin <musinrr@gmail.com> Squashed commit of the following: commit c3916ee544d2b59e6b0c760366a9a2b5f821b029 Author: Laurent Cozic <laurent@cozic.net> Date: Fri Jun 5 00:01:18 2020 +0100 Fixed for iOS commit959a8b59d1Author: Roman Musin <musinrr@gmail.com> Date: Thu Jun 4 21:56:43 2020 +0100 Initialize keychain service when starting mobile app commit2b322352edAuthor: Roman Musin <musinrr@gmail.com> Date: Thu Jun 4 21:32:40 2020 +0100 Mobile: fix geolocation
This commit is contained in:
		| @@ -43,6 +43,8 @@ | ||||
| 	<string>To add geo-location information to a note. Can be disabled in app.</string> | ||||
| 	<key>NSLocationWhenInUseUsageDescription</key> | ||||
| 	<string>To add geo-location information to a note. Can be disabled in app.</string> | ||||
| 	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> | ||||
| 	<string>To add geo-location information to a note. Can be disabled in app.</string> | ||||
| 	<key>NSPhotoLibraryUsageDescription</key> | ||||
| 	<string>To allow attaching images to a note</string> | ||||
| 	<key>UIAppFonts</key> | ||||
|   | ||||
| @@ -192,6 +192,8 @@ PODS: | ||||
|     - React | ||||
|   - react-native-document-picker (2.3.0): | ||||
|     - React | ||||
|   - react-native-geolocation (2.0.2): | ||||
|     - React | ||||
|   - react-native-image-picker (0.14.3): | ||||
|     - React | ||||
|   - react-native-image-resizer (1.0.0): | ||||
| @@ -276,6 +278,7 @@ DEPENDENCIES: | ||||
|   - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) | ||||
|   - react-native-camera (from `../node_modules/react-native-camera`) | ||||
|   - react-native-document-picker (from `../node_modules/react-native-document-picker`) | ||||
|   - "react-native-geolocation (from `../node_modules/@react-native-community/geolocation`)" | ||||
|   - react-native-image-picker (from `../node_modules/react-native-image-picker`) | ||||
|   - react-native-image-resizer (from `../node_modules/react-native-image-resizer`) | ||||
|   - "react-native-slider (from `../node_modules/@react-native-community/slider`)" | ||||
| @@ -340,6 +343,8 @@ EXTERNAL SOURCES: | ||||
|     :path: "../node_modules/react-native-camera" | ||||
|   react-native-document-picker: | ||||
|     :path: "../node_modules/react-native-document-picker" | ||||
|   react-native-geolocation: | ||||
|     :path: "../node_modules/@react-native-community/geolocation" | ||||
|   react-native-image-picker: | ||||
|     :path: "../node_modules/react-native-image-picker" | ||||
|   react-native-image-resizer: | ||||
| @@ -409,6 +414,7 @@ SPEC CHECKSUMS: | ||||
|   React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0 | ||||
|   react-native-camera: ea85f74cf2e501d2a91a3da7092ecdac082f18df | ||||
|   react-native-document-picker: 8508bfda34be6c24a2cbecbe515b15108658c183 | ||||
|   react-native-geolocation: cbd9d6bd06bac411eed2671810f454d4908484a8 | ||||
|   react-native-image-picker: 3693786b3d5958c8f71deed66ec068b323565e0d | ||||
|   react-native-image-resizer: aa1600566fd336a044daf9273dcec5033c1d41ca | ||||
|   react-native-slider: b2f361499888302147205f17f6fffa921a7bda70 | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| import Geolocation from '@react-native-community/geolocation'; | ||||
|  | ||||
| const Setting = require('lib/models/Setting.js'); | ||||
|  | ||||
| class GeolocationReact { | ||||
| @@ -24,7 +26,7 @@ class GeolocationReact { | ||||
| 		if (!('timeout' in options)) options.timeout = 10000; | ||||
|  | ||||
| 		return new Promise((resolve, reject) => { | ||||
| 			navigator.geolocation.getCurrentPosition( | ||||
| 			Geolocation.getCurrentPosition( | ||||
| 				data => { | ||||
| 					resolve(data); | ||||
| 				}, | ||||
|   | ||||
							
								
								
									
										5
									
								
								ReactNativeClient/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								ReactNativeClient/package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -2108,6 +2108,11 @@ | ||||
|       "resolved": "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-3.0.0.tgz", | ||||
|       "integrity": "sha512-ng6Tm537E/M42GjE4TRUxQyL8sRfClcL7bQWblOCoxPZzJ2J3bdALsjeG3vDnVCIfI/R0AeFalN9KjMt0+Z/Zg==" | ||||
|     }, | ||||
|     "@react-native-community/geolocation": { | ||||
|       "version": "2.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/@react-native-community/geolocation/-/geolocation-2.0.2.tgz", | ||||
|       "integrity": "sha512-tTNXRCgnhJBu79mulQwzabXRpDqfh/uaDqfHVpvF0nX4NTpolpy6mvTRiFg7eWFPGRArsnZz1EYp6rHfJWGgEA==" | ||||
|     }, | ||||
|     "@react-native-community/push-notification-ios": { | ||||
|       "version": "1.0.5", | ||||
|       "resolved": "https://registry.npmjs.org/@react-native-community/push-notification-ios/-/push-notification-ios-1.0.5.tgz", | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
|     "log-android": "adb logcat *:S ReactNative:V ReactNativeJS:V" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@react-native-community/geolocation": "^2.0.2", | ||||
|     "@react-native-community/push-notification-ios": "^1.0.5", | ||||
|     "@react-native-community/slider": "^2.0.8", | ||||
|     "async-mutex": "^0.1.3", | ||||
|   | ||||
| @@ -65,6 +65,9 @@ const WelcomeUtils = require('lib/WelcomeUtils'); | ||||
| const { themeStyle } = require('lib/components/global-style.js'); | ||||
| const { uuid } = require('lib/uuid.js'); | ||||
|  | ||||
| const { loadKeychainServiceAndSettings } = require('lib/services/SettingUtils'); | ||||
| const KeychainServiceDriverMobile = require('lib/services/keychain/KeychainServiceDriver.mobile').default; | ||||
|  | ||||
| const SyncTargetRegistry = require('lib/SyncTargetRegistry.js'); | ||||
| const SyncTargetOneDrive = require('lib/SyncTargetOneDrive.js'); | ||||
| const SyncTargetFilesystem = require('lib/SyncTargetFilesystem.js'); | ||||
| @@ -444,7 +447,8 @@ async function initialize(dispatch) { | ||||
|  | ||||
| 		reg.logger().info('Database is ready.'); | ||||
| 		reg.logger().info('Loading settings...'); | ||||
| 		await Setting.load(); | ||||
|  | ||||
| 		await loadKeychainServiceAndSettings(KeychainServiceDriverMobile); | ||||
|  | ||||
| 		if (!Setting.value('clientId')) Setting.setValue('clientId', uuid.create()); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user