You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Mobile: Handle encrypted items on UI side
This commit is contained in:
		| @@ -81,6 +81,7 @@ class NoteItemComponent extends Component { | ||||
|  | ||||
| 	onPress() { | ||||
| 		if (!this.props.note) return; | ||||
| 		if (!!this.props.note.encryption_applied) return; | ||||
|  | ||||
| 		if (this.props.noteSelectionEnabled) { | ||||
| 			this.props.dispatch({ | ||||
| @@ -141,7 +142,7 @@ class NoteItemComponent extends Component { | ||||
| 								checked={checkboxChecked} | ||||
| 								onChange={(checked) => this.todoCheckbox_change(checked)} | ||||
| 							/> | ||||
| 							<Text style={listItemTextStyle}>{note.title}</Text> | ||||
| 							<Text style={listItemTextStyle}>{Note.displayTitle(note)}</Text> | ||||
| 						</View> | ||||
| 					</View> | ||||
| 				</View> | ||||
|   | ||||
| @@ -95,10 +95,13 @@ class NotesScreenComponent extends BaseScreenComponent { | ||||
| 		if (this.props.notesParentType == 'Folder') { | ||||
| 			if (this.props.selectedFolderId == Folder.conflictFolderId()) return []; | ||||
|  | ||||
| 			return [ | ||||
| 				{ title: _('Delete notebook'), onPress: () => { this.deleteFolder_onPress(this.props.selectedFolderId); } }, | ||||
| 				{ title: _('Edit notebook'), onPress: () => { this.editFolder_onPress(this.props.selectedFolderId); } }, | ||||
| 			]; | ||||
| 			const folder = this.parentItem(); | ||||
|  | ||||
| 			let output = []; | ||||
| 			if (!folder.encryption_applied) output.push({ title: _('Edit notebook'), onPress: () => { this.editFolder_onPress(this.props.selectedFolderId); } }); | ||||
| 			output.push({ title: _('Delete notebook'), onPress: () => { this.deleteFolder_onPress(this.props.selectedFolderId); } }); | ||||
|  | ||||
| 			return output; | ||||
| 		} else { | ||||
| 			return []; // For tags - TODO | ||||
| 		} | ||||
|   | ||||
| @@ -5,6 +5,7 @@ const Icon = require('react-native-vector-icons/Ionicons').default; | ||||
| const { Log } = require('lib/log.js'); | ||||
| const Tag = require('lib/models/Tag.js'); | ||||
| const Note = require('lib/models/Note.js'); | ||||
| const Folder = require('lib/models/Folder.js'); | ||||
| const Setting = require('lib/models/Setting.js'); | ||||
| const { FoldersScreenUtils } = require('lib/folders-screen-utils.js'); | ||||
| const { Synchronizer } = require('lib/synchronizer.js'); | ||||
| @@ -117,7 +118,7 @@ class SideMenuContentComponent extends Component { | ||||
| 			<TouchableOpacity key={folder.id} onPress={() => { this.folder_press(folder) }}> | ||||
| 				<View style={folderButtonStyle}> | ||||
| 					{ iconComp } | ||||
| 					<Text numberOfLines={1} style={this.styles().folderButtonText}>{folder.title}</Text> | ||||
| 					<Text numberOfLines={1} style={this.styles().folderButtonText}>{Folder.displayTitle(folder)}</Text> | ||||
| 				</View> | ||||
| 			</TouchableOpacity> | ||||
| 		); | ||||
| @@ -131,7 +132,7 @@ class SideMenuContentComponent extends Component { | ||||
| 			<TouchableOpacity key={tag.id} onPress={() => { this.tag_press(tag) }}> | ||||
| 				<View style={tagButtonStyle}> | ||||
| 					{ iconComp } | ||||
| 					<Text numberOfLines={1} style={this.styles().tagButtonText}>{tag.title}</Text> | ||||
| 					<Text numberOfLines={1} style={this.styles().tagButtonText}>{Tag.displayTitle(tag)}</Text> | ||||
| 				</View> | ||||
| 			</TouchableOpacity> | ||||
| 		); | ||||
|   | ||||
| @@ -14,8 +14,12 @@ class FsDriverRN { | ||||
| 		throw new Error('Not implemented'); | ||||
| 	} | ||||
|  | ||||
| 	move(source, dest) { | ||||
| 		throw new Error('Not implemented'); | ||||
| 	async move(source, dest) { | ||||
| 		return RNFS.moveFile(source, dest); | ||||
| 	} | ||||
|  | ||||
| 	async exists(path) { | ||||
| 		return RNFS.exists(path); | ||||
| 	} | ||||
|  | ||||
| 	async open(path, mode) { | ||||
|   | ||||
| @@ -31,6 +31,8 @@ class BaseItem extends BaseModel { | ||||
| 	static getClass(name) { | ||||
| 		for (let i = 0; i < BaseItem.syncItemDefinitions_.length; i++) { | ||||
| 			if (BaseItem.syncItemDefinitions_[i].className == name) { | ||||
| 				const classRef = BaseItem.syncItemDefinitions_[i].classRef; | ||||
| 				if (!classRef) throw new Error('Class has not been loaded: ' + name); | ||||
| 				return BaseItem.syncItemDefinitions_[i].classRef; | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
| @@ -222,7 +222,7 @@ class Setting extends BaseModel { | ||||
| 	} | ||||
|  | ||||
| 	static setObjectKey(settingKey, objectKey, value) { | ||||
| 		const o = this.value(settingKey); | ||||
| 		let o = this.value(settingKey); | ||||
| 		if (typeof o !== 'object') o = {}; | ||||
| 		o[objectKey] = value; | ||||
| 		this.setValue(settingKey, o); | ||||
|   | ||||
| @@ -20,6 +20,7 @@ const Resource = require('lib/models/Resource.js'); | ||||
| const Tag = require('lib/models/Tag.js'); | ||||
| const NoteTag = require('lib/models/NoteTag.js'); | ||||
| const BaseItem = require('lib/models/BaseItem.js'); | ||||
| const MasterKey = require('lib/models/MasterKey.js'); | ||||
| const BaseModel = require('lib/BaseModel.js'); | ||||
| const { JoplinDatabase } = require('lib/joplin-database.js'); | ||||
| const { Database } = require('lib/database.js'); | ||||
| @@ -304,6 +305,7 @@ async function initialize(dispatch) { | ||||
| 	BaseItem.loadClass('Resource', Resource); | ||||
| 	BaseItem.loadClass('Tag', Tag); | ||||
| 	BaseItem.loadClass('NoteTag', NoteTag); | ||||
| 	BaseItem.loadClass('MasterKey', MasterKey); | ||||
|  | ||||
| 	AlarmService.setDriver(new AlarmServiceDriver()); | ||||
| 	AlarmService.setLogger(mainLogger); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user