You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Fixed geolocation bug and improved saving of notes and folders
This commit is contained in:
		| @@ -7,7 +7,7 @@ | ||||
|     "url": "https://github.com/laurent22/joplin" | ||||
|   }, | ||||
|   "url": "git://github.com/laurent22/joplin.git", | ||||
|   "version": "0.8.42", | ||||
|   "version": "0.8.43", | ||||
|   "bin": { | ||||
|     "joplin": "./main_launcher.js" | ||||
|   }, | ||||
|   | ||||
| @@ -90,8 +90,8 @@ android { | ||||
| 		applicationId "net.cozic.joplin" | ||||
| 		minSdkVersion 16 | ||||
| 		targetSdkVersion 22 | ||||
| 		versionCode 14 | ||||
| 		versionName "0.9.1" | ||||
| 		versionCode 16 | ||||
| 		versionName "0.9.3" | ||||
| 		ndk { | ||||
| 			abiFilters "armeabi-v7a", "x86" | ||||
| 		} | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|     <uses-permission android:name="android.permission.INTERNET" /> | ||||
|     <!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  --> | ||||
|     <!-- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> --> | ||||
|     <!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> --> | ||||
|     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||||
|     <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/> | ||||
|  | ||||
|     <uses-sdk | ||||
|   | ||||
| @@ -42,9 +42,23 @@ let styleObject = { | ||||
| 		fontWeight: 'bold', | ||||
| 		flex: 1, | ||||
| 	}, | ||||
| 	saveButton: { | ||||
| 		flex: 1, | ||||
| 		backgroundColor: "#0482E3", | ||||
| 		paddingLeft: 15, | ||||
| 		paddingRight: 15, | ||||
| 		marginRight: 10, | ||||
| 	}, | ||||
| 	saveButtonText: { | ||||
| 		textAlignVertical: 'center', | ||||
| 		color: "#ffffff", | ||||
| 		fontWeight: 'bold', | ||||
| 		flex: 1, | ||||
| 	}, | ||||
| }; | ||||
|  | ||||
| styleObject.backButtonDisabled = Object.assign({}, styleObject.backButton, { backgroundColor: "#c6c6c6" }); | ||||
| styleObject.saveButtonDisabled = Object.assign({}, styleObject.saveButton, { backgroundColor: "#c6c6c6" }); | ||||
|  | ||||
| const styles = StyleSheet.create(styleObject); | ||||
|  | ||||
| @@ -100,6 +114,18 @@ class ScreenHeaderComponent extends Component { | ||||
| 			); | ||||
| 		} | ||||
|  | ||||
| 		function saveButton(styles, onPress, disabled, show) { | ||||
| 			if (!show) return null; | ||||
|  | ||||
| 			return ( | ||||
| 				<TouchableOpacity onPress={onPress} disabled={disabled}> | ||||
| 					<View style={disabled ? styles.saveButtonDisabled : styles.saveButton}> | ||||
| 						<Text style={styles.saveButtonText}>Save</Text> | ||||
| 					</View> | ||||
| 				</TouchableOpacity> | ||||
| 			); | ||||
| 		} | ||||
|  | ||||
| 		let key = 0; | ||||
| 		let menuOptionComponents = []; | ||||
| 		for (let i = 0; i < this.props.menuOptions.length; i++) { | ||||
| @@ -130,6 +156,7 @@ class ScreenHeaderComponent extends Component { | ||||
| 			<View style={{ flexDirection: 'row', paddingLeft: 10, paddingTop: 10, paddingBottom: 10, paddingRight: 0, backgroundColor: '#ffffff', alignItems: 'center' }} > | ||||
| 				{ sideMenuButton(styles, () => this.sideMenuButton_press()) } | ||||
| 				{ backButton(styles, () => this.backButton_press(), !this.props.historyCanGoBack) } | ||||
| 				{ saveButton(styles, () => { if (this.props.onSaveButtonPress) this.props.onSaveButtonPress() }, this.props.saveButtonDisabled === true, this.props.showSaveButton === true) } | ||||
| 				<Text style={{ flex:1, marginLeft: 10 }} >{title}</Text> | ||||
| 			    <Menu onSelect={(value) => this.menu_select(value)}> | ||||
| 					<MenuTrigger> | ||||
|   | ||||
| @@ -83,31 +83,17 @@ class FolderScreenComponent extends BaseScreenComponent { | ||||
| 	} | ||||
|  | ||||
| 	render() { | ||||
| 		const renderActionButton = () => { | ||||
| 			let buttons = []; | ||||
|  | ||||
| 			buttons.push({ | ||||
| 				title: _('Save'), | ||||
| 				icon: 'md-checkmark', | ||||
| 				onPress: () => { | ||||
| 					this.saveFolderButton_press() | ||||
| 				}, | ||||
| 			}); | ||||
|  | ||||
| 			if (!this.isModified()) return <ActionButton style={{display:'none'}}/>; | ||||
|  | ||||
| 			let buttonIndex = this.state.mode == 'view' ? 0 : 1; | ||||
|  | ||||
| 			return <ActionButton multiStates={true} buttons={buttons} buttonIndex={0} /> | ||||
| 		} | ||||
|  | ||||
| 		const actionButtonComp = renderActionButton(); | ||||
| 		let saveButtonDisabled = !this.isModified(); | ||||
|  | ||||
| 		return ( | ||||
| 			<View style={this.styles().screen}> | ||||
| 				<ScreenHeader navState={this.props.navigation.state} /> | ||||
| 				<ScreenHeader | ||||
| 					navState={this.props.navigation.state} | ||||
| 					showSaveButton={true} | ||||
| 					saveButtonDisabled={saveButtonDisabled} | ||||
| 					onSaveButtonPress={() => this.saveFolderButton_press()} | ||||
| 				/> | ||||
| 				<TextInput autoFocus={true} value={this.state.folder.title} onChangeText={(text) => this.title_changeText(text)} /> | ||||
| 				{ actionButtonComp } | ||||
| 				<dialogs.DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/> | ||||
| 			</View> | ||||
| 		); | ||||
|   | ||||
| @@ -271,13 +271,8 @@ class NoteScreenComponent extends BaseScreenComponent { | ||||
| 			); | ||||
| 		} | ||||
|  | ||||
| 		let title = null; | ||||
| 		let noteHeaderTitle = note && note.title ? note.title : _('New note'); | ||||
| 		if (folder) { | ||||
| 			title = folder.title + ' > ' + noteHeaderTitle; | ||||
| 		} else { | ||||
| 			title = noteHeaderTitle; | ||||
| 		} | ||||
| 		let headerTitle = '' | ||||
| 		if (folder) headerTitle = folder.title; | ||||
|  | ||||
| 		const renderActionButton = () => { | ||||
| 			let buttons = []; | ||||
| @@ -290,27 +285,26 @@ class NoteScreenComponent extends BaseScreenComponent { | ||||
| 				}, | ||||
| 			}); | ||||
|  | ||||
| 			buttons.push({ | ||||
| 				title: _('Save'), | ||||
| 				icon: 'md-checkmark', | ||||
| 				onPress: () => { | ||||
| 					this.saveNoteButton_press(); | ||||
| 					return false; | ||||
| 				}, | ||||
| 			}); | ||||
| 			if (this.state.mode == 'edit') return <ActionButton style={{display:'none'}}/>; | ||||
|  | ||||
| 			if (this.state.mode == 'edit' && !this.isModified()) return <ActionButton style={{display:'none'}}/>; | ||||
|  | ||||
| 			let buttonIndex = this.state.mode == 'view' ? 0 : 1; | ||||
|  | ||||
| 			return <ActionButton multiStates={true} buttons={buttons} buttonIndex={buttonIndex} /> | ||||
| 			return <ActionButton multiStates={true} buttons={buttons} buttonIndex={0} /> | ||||
| 		} | ||||
|  | ||||
| 		const actionButtonComp = renderActionButton(); | ||||
|  | ||||
| 		let showSaveButton = this.state.mode == 'edit'; | ||||
| 		let saveButtonDisabled = !this.isModified(); | ||||
|  | ||||
| 		return ( | ||||
| 			<View style={this.styles().screen}> | ||||
| 				<ScreenHeader navState={this.props.navigation.state} menuOptions={this.menuOptions()} title={title} /> | ||||
| 				<ScreenHeader | ||||
| 					title={headerTitle} | ||||
| 					navState={this.props.navigation.state} | ||||
| 					menuOptions={this.menuOptions()} | ||||
| 					showSaveButton={showSaveButton} | ||||
| 					saveButtonDisabled={saveButtonDisabled} | ||||
| 					onSaveButtonPress={() => this.saveNoteButton_press()} | ||||
| 				/> | ||||
| 				<View style={{ flexDirection: 'row' }}> | ||||
| 					{ isTodo && <Checkbox checked={!!Number(note.todo_completed)} onChange={(checked) => { this.todoCheckbox_change(checked) }} /> }<TextInput style={{flex:1}} value={note.title} onChangeText={(text) => this.title_changeText(text)} /> | ||||
| 				</View> | ||||
|   | ||||
| @@ -16,11 +16,6 @@ class GeolocationReact { | ||||
| 	} | ||||
|  | ||||
| 	static currentPosition(options = null) { | ||||
| 		if (typeof navigator === 'undefined') { | ||||
| 			// TODO | ||||
| 			return Promise.resolve(this.currentPosition_testResponse()); | ||||
| 		} | ||||
|  | ||||
| 		if (!options) options = {}; | ||||
| 		if (!('enableHighAccuracy' in options)) options.enableHighAccuracy = true; | ||||
| 		if (!('timeout' in options)) options.timeout = 10000; | ||||
|   | ||||
| @@ -50,7 +50,7 @@ class Synchronizer { | ||||
| 		if (report.createLocal) lines.push(_('Created local items: %d.', report.createLocal)); | ||||
| 		if (report.updateLocal) lines.push(_('Updated local items: %d.', report.updateLocal)); | ||||
| 		if (report.createRemote) lines.push(_('Created remote items: %d.', report.createRemote)); | ||||
| 		if (report.updatedRemote) lines.push(_('Updated remote items: %d.', report.updatedRemote)); | ||||
| 		if (report.updateRemote) lines.push(_('Updated remote items: %d.', report.updateRemote)); | ||||
| 		if (report.deleteLocal) lines.push(_('Deleted local items: %d.', report.deleteLocal)); | ||||
| 		if (report.deleteRemote) lines.push(_('Deleted remote items: %d.', report.deleteRemote)); | ||||
| 		if (report.state) lines.push(_('State: %s.', report.state.replace(/_/g, ' '))); | ||||
| @@ -76,7 +76,7 @@ class Synchronizer { | ||||
|  | ||||
| 		if (remote) { | ||||
| 			let s = []; | ||||
| 			s.push(remote.id); | ||||
| 			s.push(remote.id ? remote.id : remote.path); | ||||
| 			if ('title' in remote) s.push('"' + remote.title + '"'); | ||||
| 			line.push('(Remote ' + s.join(', ') + ')'); | ||||
| 		} | ||||
|   | ||||
| @@ -283,7 +283,7 @@ async function initialize(dispatch, backButtonHandler) { | ||||
| 	dbLogger.addTarget('database', { database: logDatabase, source: 'm' }); | ||||
| 	if (Setting.value('env') == 'dev') dbLogger.addTarget('console'); | ||||
| 	if (Setting.value('env') == 'dev') { | ||||
| 		dbLogger.setLevel(Logger.LEVEL_DEBUG); // Set to LEVEL_DEBUG for full SQL queries | ||||
| 		dbLogger.setLevel(Logger.LEVEL_INFO); // Set to LEVEL_DEBUG for full SQL queries | ||||
| 	} else { | ||||
| 		dbLogger.setLevel(Logger.LEVEL_INFO); | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user