1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-07 19:30:04 +02:00

Fixed note edition

This commit is contained in:
Laurent Cozic 2017-07-23 15:11:44 +01:00
parent 1c3bf21539
commit d05c62f69f
18 changed files with 120 additions and 113 deletions

View File

@ -15,3 +15,4 @@ tests/logs/*
tests/cli-integration/ tests/cli-integration/
*.mo *.mo
*.*~ *.*~
tests/sync

View File

@ -382,8 +382,7 @@ class Application {
reg.setLogger(this.logger_); reg.setLogger(this.logger_);
this.dbLogger_.addTarget('file', { path: profileDir + '/log-database.txt' }); this.dbLogger_.addTarget('file', { path: profileDir + '/log-database.txt' });
this.dbLogger_.setLevel(Logger.LEVEL_INFO); this.dbLogger_.setLevel(initArgs.logLevel);
//this.dbLogger_.setLevel(initArgs.logLevel);
this.syncLogger_.addTarget('file', { path: profileDir + '/log-sync.txt' }); this.syncLogger_.addTarget('file', { path: profileDir + '/log-sync.txt' });
this.syncLogger_.setLevel(initArgs.logLevel); this.syncLogger_.setLevel(initArgs.logLevel);

View File

@ -63,7 +63,7 @@ function randomWord() {
function execCommand(client, command, options = {}) { function execCommand(client, command, options = {}) {
let exePath = 'node ' + joplinAppPath; let exePath = 'node ' + joplinAppPath;
let cmd = exePath + ' --update-geolocation-disabled --env dev --profile ' + client.profileDir + ' ' + command; let cmd = exePath + ' --update-geolocation-disabled --env dev --log-level debug --profile ' + client.profileDir + ' ' + command;
logger.info(client.id + ': ' + command); logger.info(client.id + ': ' + command);
if (options.killAfter) { if (options.killAfter) {

View File

@ -60,7 +60,7 @@ msgstr ""
msgid "Synchronizing with directory \"%s\"" msgid "Synchronizing with directory \"%s\""
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/CliClient/app/app.js:422 #: /mnt/d/Web/www/joplin/CliClient/app/app.js:421
msgid "No notebook is defined. Create one with `mkbook <notebook>`." msgid "No notebook is defined. Create one with `mkbook <notebook>`."
msgstr "" msgstr ""
@ -490,16 +490,15 @@ msgstr ""
msgid "New notebook" msgid "New notebook"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:189 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:208
msgid "Log" msgid "Log"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:194 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:213
msgid "Status" msgid "Status"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Synchronize" msgid "Synchronize"
msgstr "" msgstr ""
@ -507,10 +506,6 @@ msgstr ""
msgid "Cancel synchronization" msgid "Cancel synchronization"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Cancel sync"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73
#, javascript-format #, javascript-format
msgid "The folder could not be saved: %s" msgid "The folder could not be saved: %s"
@ -521,39 +516,43 @@ msgid ""
"There is currently no notebook. Create one by clicking on the (+) button." "There is currently no notebook. Create one by clicking on the (+) button."
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:185 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:194
msgid "Untitled" msgid "Untitled"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:237
msgid "Delete note?" msgid "Delete note?"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:232 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:280
msgid "Attach file" msgid "Attach file"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:233 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:281
msgid "Delete note" msgid "Delete note"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:282
msgid "Convert to regular note" msgid "Convert to regular note"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:282
msgid "Convert to todo" msgid "Convert to todo"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:283
msgid "Hide metadata" msgid "Hide metadata"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:283
msgid "Show metadata" msgid "Show metadata"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:409 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:284
msgid "View location on map"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:435
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""

View File

@ -62,7 +62,7 @@ msgstr "Quitter le logiciel."
msgid "Synchronizing with directory \"%s\"" msgid "Synchronizing with directory \"%s\""
msgstr "Synchronisation avec dossier \"%s\"" msgstr "Synchronisation avec dossier \"%s\""
#: /mnt/d/Web/www/joplin/CliClient/app/app.js:422 #: /mnt/d/Web/www/joplin/CliClient/app/app.js:421
msgid "No notebook is defined. Create one with `mkbook <notebook>`." msgid "No notebook is defined. Create one with `mkbook <notebook>`."
msgstr "Aucun carnet n'est défini. Créez-en un avec `mkbook <carnet>`." msgstr "Aucun carnet n'est défini. Créez-en un avec `mkbook <carnet>`."
@ -526,17 +526,16 @@ msgstr ""
msgid "New notebook" msgid "New notebook"
msgstr "Supprime le carnet." msgstr "Supprime le carnet."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:189 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:208
msgid "Log" msgid "Log"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:194 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:213
#, fuzzy #, fuzzy
msgid "Status" msgid "Status"
msgstr "Etat : %s." msgstr "Etat : %s."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Synchronize" msgid "Synchronize"
msgstr "" msgstr ""
@ -545,10 +544,6 @@ msgstr ""
msgid "Cancel synchronization" msgid "Cancel synchronization"
msgstr "Commencement de la synchronisation..." msgstr "Commencement de la synchronisation..."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Cancel sync"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73
#, javascript-format #, javascript-format
msgid "The folder could not be saved: %s" msgid "The folder could not be saved: %s"
@ -559,41 +554,45 @@ msgid ""
"There is currently no notebook. Create one by clicking on the (+) button." "There is currently no notebook. Create one by clicking on the (+) button."
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:185 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:194
msgid "Untitled" msgid "Untitled"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:237
#, fuzzy #, fuzzy
msgid "Delete note?" msgid "Delete note?"
msgstr "Supprimer le carnet \"%s\" ?" msgstr "Supprimer le carnet \"%s\" ?"
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:232 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:280
msgid "Attach file" msgid "Attach file"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:233 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:281
#, fuzzy #, fuzzy
msgid "Delete note" msgid "Delete note"
msgstr "Supprime le carnet." msgstr "Supprime le carnet."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:282
msgid "Convert to regular note" msgid "Convert to regular note"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:282
msgid "Convert to todo" msgid "Convert to todo"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:283
msgid "Hide metadata" msgid "Hide metadata"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:283
msgid "Show metadata" msgid "Show metadata"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:409 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:284
msgid "View location on map"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:435
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""

View File

@ -60,7 +60,7 @@ msgstr ""
msgid "Synchronizing with directory \"%s\"" msgid "Synchronizing with directory \"%s\""
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/CliClient/app/app.js:422 #: /mnt/d/Web/www/joplin/CliClient/app/app.js:421
msgid "No notebook is defined. Create one with `mkbook <notebook>`." msgid "No notebook is defined. Create one with `mkbook <notebook>`."
msgstr "" msgstr ""
@ -490,16 +490,15 @@ msgstr ""
msgid "New notebook" msgid "New notebook"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:189 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:208
msgid "Log" msgid "Log"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:194 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:213
msgid "Status" msgid "Status"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Synchronize" msgid "Synchronize"
msgstr "" msgstr ""
@ -507,10 +506,6 @@ msgstr ""
msgid "Cancel synchronization" msgid "Cancel synchronization"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Cancel sync"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73
#, javascript-format #, javascript-format
msgid "The folder could not be saved: %s" msgid "The folder could not be saved: %s"
@ -521,39 +516,43 @@ msgid ""
"There is currently no notebook. Create one by clicking on the (+) button." "There is currently no notebook. Create one by clicking on the (+) button."
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:185 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:194
msgid "Untitled" msgid "Untitled"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:237
msgid "Delete note?" msgid "Delete note?"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:232 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:280
msgid "Attach file" msgid "Attach file"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:233 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:281
msgid "Delete note" msgid "Delete note"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:282
msgid "Convert to regular note" msgid "Convert to regular note"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:282
msgid "Convert to todo" msgid "Convert to todo"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:283
msgid "Hide metadata" msgid "Hide metadata"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:283
msgid "Show metadata" msgid "Show metadata"
msgstr "" msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:409 #: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:284
msgid "View location on map"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:435
msgid "Edit" msgid "Edit"
msgstr "" msgstr ""

View File

@ -2,7 +2,7 @@ require('source-map-support').install();
require('babel-plugin-transform-runtime'); require('babel-plugin-transform-runtime');
import { time } from 'lib/time-utils.js'; import { time } from 'lib/time-utils.js';
import { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient } from 'test-utils.js'; import { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId } from 'test-utils.js';
import { Folder } from 'lib/models/folder.js'; import { Folder } from 'lib/models/folder.js';
import { Note } from 'lib/models/note.js'; import { Note } from 'lib/models/note.js';
import { Tag } from 'lib/models/tag.js'; import { Tag } from 'lib/models/tag.js';
@ -40,7 +40,11 @@ async function localItemsSameAsRemote(locals, expect) {
expect(!!remote).toBe(true); expect(!!remote).toBe(true);
if (!remote) continue; if (!remote) continue;
if (syncTargetId() == Database.enumId('syncTarget', 'filesystem')) {
expect(remote.updated_time).toBe(Math.floor(dbItem.updated_time / 1000) * 1000);
} else {
expect(remote.updated_time).toBe(dbItem.updated_time); expect(remote.updated_time).toBe(dbItem.updated_time);
}
let remoteContent = await fileApi().get(path); let remoteContent = await fileApi().get(path);
remoteContent = dbItem.type_ == BaseModel.TYPE_NOTE ? await Note.unserialize(remoteContent) : await Folder.unserialize(remoteContent); remoteContent = dbItem.type_ == BaseModel.TYPE_NOTE ? await Note.unserialize(remoteContent) : await Folder.unserialize(remoteContent);
@ -240,7 +244,7 @@ describe('Synchronizer', function() {
expect(files.length).toBe(1); expect(files.length).toBe(1);
expect(files[0].path).toBe(Folder.systemPath(folder1)); expect(files[0].path).toBe(Folder.systemPath(folder1));
let deletedItems = await BaseItem.deletedItems(syncTargetId); let deletedItems = await BaseItem.deletedItems(syncTargetId());
expect(deletedItems.length).toBe(0); expect(deletedItems.length).toBe(0);
done(); done();
@ -262,7 +266,7 @@ describe('Synchronizer', function() {
await synchronizer().start(); await synchronizer().start();
let items = await allItems(); let items = await allItems();
expect(items.length).toBe(1); expect(items.length).toBe(1);
let deletedItems = await BaseItem.deletedItems(syncTargetId); let deletedItems = await BaseItem.deletedItems(syncTargetId());
expect(deletedItems.length).toBe(0); expect(deletedItems.length).toBe(0);
done(); done();
@ -568,7 +572,7 @@ describe('Synchronizer', function() {
await synchronizer().start(); await synchronizer().start();
await Note.save({ id: n1.id, is_conflict: 1 }); await Note.save({ id: n1.id, is_conflict: 1 });
await Note.delete(n1.id); await Note.delete(n1.id);
const deletedItems = await BaseItem.deletedItems(syncTargetId); const deletedItems = await BaseItem.deletedItems(syncTargetId());
expect(deletedItems.length).toBe(0); expect(deletedItems.length).toBe(0);

View File

@ -13,6 +13,7 @@ import { BaseItem } from 'lib/models/base-item.js';
import { Synchronizer } from 'lib/synchronizer.js'; import { Synchronizer } from 'lib/synchronizer.js';
import { FileApi } from 'lib/file-api.js'; import { FileApi } from 'lib/file-api.js';
import { FileApiDriverMemory } from 'lib/file-api-driver-memory.js'; import { FileApiDriverMemory } from 'lib/file-api-driver-memory.js';
import { FileApiDriverLocal } from 'lib/file-api-driver-local.js';
import { FsDriverNode } from '../app/fs-driver-node.js'; import { FsDriverNode } from '../app/fs-driver-node.js';
import { time } from 'lib/time-utils.js'; import { time } from 'lib/time-utils.js';
@ -28,6 +29,9 @@ Resource.fsDriver_ = fsDriver;
const logDir = __dirname + '/../tests/logs'; const logDir = __dirname + '/../tests/logs';
fs.mkdirpSync(logDir, 0o755); fs.mkdirpSync(logDir, 0o755);
const syncTarget = 'filesystem';
const syncDir = __dirname + '/../tests/sync';
const logger = new Logger(); const logger = new Logger();
logger.addTarget('file', { path: logDir + '/log.txt' }); logger.addTarget('file', { path: logDir + '/log.txt' });
logger.setLevel(Logger.LEVEL_DEBUG); logger.setLevel(Logger.LEVEL_DEBUG);
@ -41,6 +45,11 @@ BaseItem.loadClass('NoteTag', NoteTag);
Setting.setConstant('appId', 'net.cozic.joplin-cli'); Setting.setConstant('appId', 'net.cozic.joplin-cli');
Setting.setConstant('appType', 'cli'); Setting.setConstant('appType', 'cli');
function syncTargetId() {
return JoplinDatabase.enumId('syncTarget', 'filesystem');
//return JoplinDatabase.enumId('syncTarget', 'memory');
}
function sleep(n) { function sleep(n) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
@ -111,7 +120,12 @@ async function setupDatabaseAndSynchronizer(id = null) {
synchronizers_[id].setLogger(logger); synchronizers_[id].setLogger(logger);
} }
if (syncTarget == 'filesystem') {
fs.removeSync(syncDir)
fs.mkdirpSync(syncDir, 0o755);
} else {
await fileApi().format(); await fileApi().format();
}
} }
function db(id = null) { function db(id = null) {
@ -127,9 +141,17 @@ function synchronizer(id = null) {
function fileApi() { function fileApi() {
if (fileApi_) return fileApi_; if (fileApi_) return fileApi_;
if (syncTarget == 'filesystem') {
fs.removeSync(syncDir)
fs.mkdirpSync(syncDir, 0o755);
fileApi_ = new FileApi(syncDir, new FileApiDriverLocal());
fileApi_.setLogger(logger);
return fileApi_;
} else {
fileApi_ = new FileApi('/root', new FileApiDriverMemory()); fileApi_ = new FileApi('/root', new FileApiDriverMemory());
fileApi_.setLogger(logger); fileApi_.setLogger(logger);
return fileApi_; return fileApi_;
}
} }
export { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient }; export { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId };

View File

@ -51,3 +51,6 @@ buck-out/
fastlane/report.xml fastlane/report.xml
fastlane/Preview.html fastlane/Preview.html
fastlane/screenshots fastlane/screenshots
# This is generated:
locales

View File

@ -90,8 +90,8 @@ android {
applicationId "net.cozic.joplin" applicationId "net.cozic.joplin"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 22
versionCode 28 versionCode 29
versionName "0.9.15" versionName "0.9.16"
ndk { ndk {
abiFilters "armeabi-v7a", "x86" abiFilters "armeabi-v7a", "x86"
} }

View File

@ -99,53 +99,32 @@ class NoteScreenComponent extends BaseScreenComponent {
return !!Object.getOwnPropertyNames(diff).length; return !!Object.getOwnPropertyNames(diff).length;
} }
componentWillMount() { async componentWillMount() {
BackHandler.addEventListener('hardwareBackPress', this.backHandler); BackHandler.addEventListener('hardwareBackPress', this.backHandler);
let note = null;
let mode = 'view';
if (!this.props.noteId) { if (!this.props.noteId) {
let note = this.props.itemType == 'todo' ? Note.newTodo(this.props.folderId) : Note.new(this.props.folderId); note = this.props.itemType == 'todo' ? Note.newTodo(this.props.folderId) : Note.new(this.props.folderId);
this.setState({ mode = 'edit';
lastSavedNote: Object.assign({}, note),
note: note,
mode: 'edit',
});
this.refreshNoteMetadata();
} else { } else {
Note.load(this.props.noteId).then((note) => { note = await Note.load(this.props.noteId);
this.setState({
lastSavedNote: Object.assign({}, note),
note: note,
});
this.refreshNoteMetadata();
});
} }
this.refreshFolder(); this.setState({
lastSavedNote: Object.assign({}, note),
note: note,
mode: mode,
folder: await Folder.load(note.parent_id),
});
this.refreshNoteMetadata();
} }
componentWillUnmount() { componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.backHandler); BackHandler.removeEventListener('hardwareBackPress', this.backHandler);
} }
async currentFolder() {
let folderId = this.props.folderId;
if (!folderId) {
if (this.state.note && this.state.note.parent_id) folderId = this.state.note.parent_id;
}
if (!folderId) return Folder.defaultFolder();
return Folder.load(folderId);
}
async refreshFolder(folderId = null) {
if (!folderId) {
this.setState({ folder: await this.currentFolder() });
} else {
this.setState({ folder: await Folder.load(folderId) });
}
}
noteComponent_change(propName, propValue) { noteComponent_change(propName, propValue) {
let note = Object.assign({}, this.state.note); let note = Object.assign({}, this.state.note);
note[propName] = propValue; note[propName] = propValue;
@ -448,7 +427,7 @@ class NoteScreenComponent extends BaseScreenComponent {
let output = []; let output = [];
for (let i = 0; i < this.props.folders.length; i++) { for (let i = 0; i < this.props.folders.length; i++) {
let f = this.props.folders[i]; let f = this.props.folders[i];
output.push({ label: f.title, value: f.id }); output.push({ label: f.title + ' ' + f.id, value: f.id });
} }
return output; return output;
} }

View File

@ -106,6 +106,8 @@ class FileApiDriverLocal {
} }
} }
output = output.concat(deletedItems);
return { return {
hasMore: false, hasMore: false,
context: null, context: null,

View File

@ -73,9 +73,14 @@ class BaseItem extends BaseModel {
} }
// Returns the IDs of the items that have been synced at least once // Returns the IDs of the items that have been synced at least once
static async syncedItems(syncTarget) { static async syncedItemIds(syncTarget) {
if (!syncTarget) throw new Error('No syncTarget specified'); if (!syncTarget) throw new Error('No syncTarget specified');
return await this.db().selectAll('SELECT item_id, item_type FROM sync_items WHERE sync_time > 0 AND sync_target = ?', [syncTarget]); let temp = await this.db().selectAll('SELECT item_id FROM sync_items WHERE sync_time > 0 AND sync_target = ?', [syncTarget]);
let output = [];
for (let i = 0; i < temp.length; i++) {
output.push(temp[i].item_id);
}
return output;
} }
static pathToId(path) { static pathToId(path) {

View File

@ -105,6 +105,7 @@ class Synchronizer {
if (n == 'starting') continue; if (n == 'starting') continue;
if (n == 'finished') continue; if (n == 'finished') continue;
if (n == 'state') continue; if (n == 'state') continue;
if (n == 'completedTime') continue;
this.logger().info(n + ': ' + (report[n] ? report[n] : '-')); this.logger().info(n + ': ' + (report[n] ? report[n] : '-'));
} }
let folderCount = await Folder.count(); let folderCount = await Folder.count();
@ -339,13 +340,14 @@ class Synchronizer {
let allIds = null; let allIds = null;
if (!this.api().supportsDelta()) { if (!this.api().supportsDelta()) {
allIds = await BaseItem.syncedItems(syncTargetId); allIds = await BaseItem.syncedItemIds(syncTargetId);
} }
let listResult = await this.api().delta('', { let listResult = await this.api().delta('', {
context: context, context: context,
itemIds: allIds, itemIds: allIds,
}); });
let remotes = listResult.items; let remotes = listResult.items;
for (let i = 0; i < remotes.length; i++) { for (let i = 0; i < remotes.length; i++) {
if (this.cancelling()) break; if (this.cancelling()) break;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +0,0 @@
var locales = {};
locales['en_GB'] = require('./en_GB.json');
locales['fr_FR'] = require('./fr_FR.json');
module.exports = { locales: locales };

View File

@ -1 +0,0 @@
["en_GB","fr_FR"]