1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-27 08:21:03 +02:00

Various improvements

This commit is contained in:
Laurent Cozic 2017-07-15 23:47:11 +01:00
parent 472dee05ea
commit 22cb2fdfbe
11 changed files with 34 additions and 11 deletions

View File

@ -39,6 +39,15 @@ class Application {
return this.currentFolder_;
}
async refreshCurrentFolder() {
let newFolder = null;
if (this.currentFolder_) newFolder = await Folder.load(this.currentFolder_.id);
if (!newFolder) newFolder = await Folder.defaultFolder();
this.switchCurrentFolder(newFolder);
}
updatePrompt() {
if (!this.showPromptString_) return '';

View File

@ -44,6 +44,9 @@ class Command extends BaseCommand {
await sync.start(options);
vorpalUtils.redrawDone();
await app().refreshCurrentFolder();
this.log(_('Done.'));
}

View File

@ -7,7 +7,7 @@
"url": "https://github.com/laurent22/joplin"
},
"url": "git://github.com/laurent22/joplin.git",
"version": "0.8.41",
"version": "0.8.42",
"bin": {
"joplin": "./main_launcher.js"
},

View File

@ -90,8 +90,8 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion 16
targetSdkVersion 22
versionCode 13
versionName "0.9.0"
versionCode 14
versionName "0.9.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}

View File

@ -30,6 +30,7 @@ class NotesScreenUtils {
static async openDefaultNoteList() {
const selectedFolder = await Folder.defaultFolder();
if (selectedFolder) {
this.openNoteList(selectedFolder.id);
} else {

View File

@ -23,7 +23,6 @@ class NotesScreenComponent extends BaseScreenComponent {
dialogs.confirm(this, _('Delete notebook?')).then((ok) => {
if (!ok) return;
Folder.delete(folderId).then(() => {
return NotesScreenUtils.openDefaultNoteList();
}).catch((error) => {
@ -51,6 +50,12 @@ class NotesScreenComponent extends BaseScreenComponent {
render() {
let folder = Folder.byId(this.props.folders, this.props.selectedFolderId);
if (!folder) {
NotesScreenUtils.openDefaultNoteList();
return null;
}
let title = folder ? folder.title : null;
const addFolderNoteButtons = folder.id != Folder.conflictFolderId();

View File

@ -108,7 +108,7 @@ class SideMenuContentComponent extends Component {
);
}
items.push(<View style={{ height: 50, flex: -1 }} key='divider_1'></View>); // DIVIDER
if (items.length) items.push(<View style={{ height: 50, flex: -1 }} key='divider_1'></View>); // DIVIDER
items.push(<Button title="Synchronize" onPress={() => { this.synchronize_press() }} key='synchronize' />);

View File

@ -65,7 +65,9 @@ class BaseItem extends BaseModel {
static async syncedCount() {
const ItemClass = this.itemClass(this.modelType());
const r = await this.db().selectOne('SELECT count(*) as total FROM `' + ItemClass.tableName() + '` WHERE updated_time <= sync_time');
let sql = 'SELECT count(*) as total FROM `' + ItemClass.tableName() + '` WHERE updated_time <= sync_time';
if (this.modelType() == BaseModel.TYPE_NOTE) sql += ' AND is_conflict = 0';
const r = await this.db().selectOne(sql);
return r.total;
}

View File

@ -170,8 +170,8 @@ class OneDriveApi {
if (error.message == 'Network request failed') {
// Unfortunately the error 'Network request failed' doesn't have a type
// or error code, so hopefully that message won't change and is not localized
this.logger().info('Got error below - retrying...');
this.logger().info(error);
this.logger().warn('Got error below - retrying...');
this.logger().warn(error);
await time.sleep((i + 1) * 3);
continue;
} else {
@ -202,8 +202,8 @@ class OneDriveApi {
// type: 'system',
// errno: 'EAGAIN',
// code: 'EAGAIN' }
this.logger().info('Got error below - retrying...');
this.logger().info(error);
this.logger().warn('Got error below - retrying...');
this.logger().warn(error);
await time.sleep((i + 1) * 3);
continue;
} else if (error.code == 'itemNotFound' && method == 'DELETE') {

View File

@ -26,8 +26,10 @@ class ReportService {
syncedCount += o.synced;
}
let conflictedCount = await Note.conflictedCount();
output.total = {
total: itemCount,
total: itemCount - conflictedCount,
synced: syncedCount,
};

View File

@ -120,6 +120,7 @@ const reducer = (state = defaultState, action) => {
// If the current screen is already the requested screen, don't do anything
} else {
newState.route = action;
if (action.routeName == 'Welcome') navHistory = [];
navHistory.push(action);
}