mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-23 18:53:36 +02:00
Fixed note edition
This commit is contained in:
parent
1c3bf21539
commit
d05c62f69f
3
CliClient/.gitignore
vendored
3
CliClient/.gitignore
vendored
@ -14,4 +14,5 @@ tests/fuzzing -*
|
||||
tests/logs/*
|
||||
tests/cli-integration/
|
||||
*.mo
|
||||
*.*~
|
||||
*.*~
|
||||
tests/sync
|
@ -382,8 +382,7 @@ class Application {
|
||||
reg.setLogger(this.logger_);
|
||||
|
||||
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_.setLevel(initArgs.logLevel);
|
||||
|
@ -63,7 +63,7 @@ function randomWord() {
|
||||
|
||||
function execCommand(client, command, options = {}) {
|
||||
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);
|
||||
|
||||
if (options.killAfter) {
|
||||
|
@ -60,7 +60,7 @@ msgstr ""
|
||||
msgid "Synchronizing with directory \"%s\""
|
||||
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>`."
|
||||
msgstr ""
|
||||
|
||||
@ -490,16 +490,15 @@ msgstr ""
|
||||
msgid "New notebook"
|
||||
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"
|
||||
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"
|
||||
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:133
|
||||
msgid "Synchronize"
|
||||
msgstr ""
|
||||
|
||||
@ -507,10 +506,6 @@ msgstr ""
|
||||
msgid "Cancel synchronization"
|
||||
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
|
||||
#, javascript-format
|
||||
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."
|
||||
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"
|
||||
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?"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
msgstr ""
|
||||
|
||||
|
@ -62,7 +62,7 @@ msgstr "Quitter le logiciel."
|
||||
msgid "Synchronizing with directory \"%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>`."
|
||||
msgstr "Aucun carnet n'est défini. Créez-en un avec `mkbook <carnet>`."
|
||||
|
||||
@ -526,17 +526,16 @@ msgstr ""
|
||||
msgid "New notebook"
|
||||
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"
|
||||
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
|
||||
msgid "Status"
|
||||
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:133
|
||||
msgid "Synchronize"
|
||||
msgstr ""
|
||||
|
||||
@ -545,10 +544,6 @@ msgstr ""
|
||||
msgid "Cancel synchronization"
|
||||
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
|
||||
#, javascript-format
|
||||
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."
|
||||
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"
|
||||
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
|
||||
msgid "Delete note?"
|
||||
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"
|
||||
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
|
||||
msgid "Delete note"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
msgstr ""
|
||||
|
||||
|
@ -60,7 +60,7 @@ msgstr ""
|
||||
msgid "Synchronizing with directory \"%s\""
|
||||
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>`."
|
||||
msgstr ""
|
||||
|
||||
@ -490,16 +490,15 @@ msgstr ""
|
||||
msgid "New notebook"
|
||||
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"
|
||||
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"
|
||||
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:133
|
||||
msgid "Synchronize"
|
||||
msgstr ""
|
||||
|
||||
@ -507,10 +506,6 @@ msgstr ""
|
||||
msgid "Cancel synchronization"
|
||||
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
|
||||
#, javascript-format
|
||||
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."
|
||||
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"
|
||||
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?"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2,7 +2,7 @@ require('source-map-support').install();
|
||||
require('babel-plugin-transform-runtime');
|
||||
|
||||
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 { Note } from 'lib/models/note.js';
|
||||
import { Tag } from 'lib/models/tag.js';
|
||||
@ -40,7 +40,11 @@ async function localItemsSameAsRemote(locals, expect) {
|
||||
expect(!!remote).toBe(true);
|
||||
if (!remote) continue;
|
||||
|
||||
expect(remote.updated_time).toBe(dbItem.updated_time);
|
||||
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);
|
||||
}
|
||||
|
||||
let remoteContent = await fileApi().get(path);
|
||||
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[0].path).toBe(Folder.systemPath(folder1));
|
||||
|
||||
let deletedItems = await BaseItem.deletedItems(syncTargetId);
|
||||
let deletedItems = await BaseItem.deletedItems(syncTargetId());
|
||||
expect(deletedItems.length).toBe(0);
|
||||
|
||||
done();
|
||||
@ -262,7 +266,7 @@ describe('Synchronizer', function() {
|
||||
await synchronizer().start();
|
||||
let items = await allItems();
|
||||
expect(items.length).toBe(1);
|
||||
let deletedItems = await BaseItem.deletedItems(syncTargetId);
|
||||
let deletedItems = await BaseItem.deletedItems(syncTargetId());
|
||||
expect(deletedItems.length).toBe(0);
|
||||
|
||||
done();
|
||||
@ -568,7 +572,7 @@ describe('Synchronizer', function() {
|
||||
await synchronizer().start();
|
||||
await Note.save({ id: n1.id, is_conflict: 1 });
|
||||
await Note.delete(n1.id);
|
||||
const deletedItems = await BaseItem.deletedItems(syncTargetId);
|
||||
const deletedItems = await BaseItem.deletedItems(syncTargetId());
|
||||
|
||||
expect(deletedItems.length).toBe(0);
|
||||
|
||||
|
@ -13,6 +13,7 @@ import { BaseItem } from 'lib/models/base-item.js';
|
||||
import { Synchronizer } from 'lib/synchronizer.js';
|
||||
import { FileApi } from 'lib/file-api.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 { time } from 'lib/time-utils.js';
|
||||
|
||||
@ -28,6 +29,9 @@ Resource.fsDriver_ = fsDriver;
|
||||
const logDir = __dirname + '/../tests/logs';
|
||||
fs.mkdirpSync(logDir, 0o755);
|
||||
|
||||
const syncTarget = 'filesystem';
|
||||
const syncDir = __dirname + '/../tests/sync';
|
||||
|
||||
const logger = new Logger();
|
||||
logger.addTarget('file', { path: logDir + '/log.txt' });
|
||||
logger.setLevel(Logger.LEVEL_DEBUG);
|
||||
@ -41,6 +45,11 @@ BaseItem.loadClass('NoteTag', NoteTag);
|
||||
Setting.setConstant('appId', 'net.cozic.joplin-cli');
|
||||
Setting.setConstant('appType', 'cli');
|
||||
|
||||
function syncTargetId() {
|
||||
return JoplinDatabase.enumId('syncTarget', 'filesystem');
|
||||
//return JoplinDatabase.enumId('syncTarget', 'memory');
|
||||
}
|
||||
|
||||
function sleep(n) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
@ -111,7 +120,12 @@ async function setupDatabaseAndSynchronizer(id = null) {
|
||||
synchronizers_[id].setLogger(logger);
|
||||
}
|
||||
|
||||
await fileApi().format();
|
||||
if (syncTarget == 'filesystem') {
|
||||
fs.removeSync(syncDir)
|
||||
fs.mkdirpSync(syncDir, 0o755);
|
||||
} else {
|
||||
await fileApi().format();
|
||||
}
|
||||
}
|
||||
|
||||
function db(id = null) {
|
||||
@ -127,9 +141,17 @@ function synchronizer(id = null) {
|
||||
function fileApi() {
|
||||
if (fileApi_) return fileApi_;
|
||||
|
||||
fileApi_ = new FileApi('/root', new FileApiDriverMemory());
|
||||
fileApi_.setLogger(logger);
|
||||
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_.setLogger(logger);
|
||||
return fileApi_;
|
||||
}
|
||||
}
|
||||
|
||||
export { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient };
|
||||
export { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId };
|
3
ReactNativeClient/.gitignore
vendored
3
ReactNativeClient/.gitignore
vendored
@ -51,3 +51,6 @@ buck-out/
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
|
||||
# This is generated:
|
||||
locales
|
||||
|
@ -90,8 +90,8 @@ android {
|
||||
applicationId "net.cozic.joplin"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
versionCode 28
|
||||
versionName "0.9.15"
|
||||
versionCode 29
|
||||
versionName "0.9.16"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
|
@ -99,53 +99,32 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
return !!Object.getOwnPropertyNames(diff).length;
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
async componentWillMount() {
|
||||
BackHandler.addEventListener('hardwareBackPress', this.backHandler);
|
||||
|
||||
let note = null;
|
||||
let mode = 'view';
|
||||
if (!this.props.noteId) {
|
||||
let note = this.props.itemType == 'todo' ? Note.newTodo(this.props.folderId) : Note.new(this.props.folderId);
|
||||
this.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
note: note,
|
||||
mode: 'edit',
|
||||
});
|
||||
this.refreshNoteMetadata();
|
||||
note = this.props.itemType == 'todo' ? Note.newTodo(this.props.folderId) : Note.new(this.props.folderId);
|
||||
mode = 'edit';
|
||||
} else {
|
||||
Note.load(this.props.noteId).then((note) => {
|
||||
this.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
note: note,
|
||||
});
|
||||
this.refreshNoteMetadata();
|
||||
});
|
||||
note = await Note.load(this.props.noteId);
|
||||
}
|
||||
|
||||
this.refreshFolder();
|
||||
this.setState({
|
||||
lastSavedNote: Object.assign({}, note),
|
||||
note: note,
|
||||
mode: mode,
|
||||
folder: await Folder.load(note.parent_id),
|
||||
});
|
||||
|
||||
this.refreshNoteMetadata();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
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) {
|
||||
let note = Object.assign({}, this.state.note);
|
||||
note[propName] = propValue;
|
||||
@ -448,7 +427,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||
let output = [];
|
||||
for (let i = 0; i < this.props.folders.length; 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;
|
||||
}
|
||||
|
@ -106,6 +106,8 @@ class FileApiDriverLocal {
|
||||
}
|
||||
}
|
||||
|
||||
output = output.concat(deletedItems);
|
||||
|
||||
return {
|
||||
hasMore: false,
|
||||
context: null,
|
||||
|
@ -73,9 +73,14 @@ class BaseItem extends BaseModel {
|
||||
}
|
||||
|
||||
// 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');
|
||||
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) {
|
||||
|
@ -105,6 +105,7 @@ class Synchronizer {
|
||||
if (n == 'starting') continue;
|
||||
if (n == 'finished') continue;
|
||||
if (n == 'state') continue;
|
||||
if (n == 'completedTime') continue;
|
||||
this.logger().info(n + ': ' + (report[n] ? report[n] : '-'));
|
||||
}
|
||||
let folderCount = await Folder.count();
|
||||
@ -339,13 +340,14 @@ class Synchronizer {
|
||||
|
||||
let allIds = null;
|
||||
if (!this.api().supportsDelta()) {
|
||||
allIds = await BaseItem.syncedItems(syncTargetId);
|
||||
allIds = await BaseItem.syncedItemIds(syncTargetId);
|
||||
}
|
||||
|
||||
let listResult = await this.api().delta('', {
|
||||
context: context,
|
||||
itemIds: allIds,
|
||||
});
|
||||
|
||||
let remotes = listResult.items;
|
||||
for (let i = 0; i < remotes.length; i++) {
|
||||
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
@ -1,4 +0,0 @@
|
||||
var locales = {};
|
||||
locales['en_GB'] = require('./en_GB.json');
|
||||
locales['fr_FR'] = require('./fr_FR.json');
|
||||
module.exports = { locales: locales };
|
@ -1 +0,0 @@
|
||||
["en_GB","fr_FR"]
|
Loading…
x
Reference in New Issue
Block a user