You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Got sync to work
This commit is contained in:
@ -20,4 +20,36 @@ shared.renderTags = function(props, renderItem) {
|
||||
return tagItems;
|
||||
}
|
||||
|
||||
shared.synchronize_press = async function(comp) {
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
|
||||
const action = comp.props.syncStarted ? 'cancel' : 'start';
|
||||
|
||||
if (Setting.value('sync.target') == Setting.SYNC_TARGET_ONEDRIVE && !reg.oneDriveApi().auth()) {
|
||||
comp.props.dispatch({
|
||||
type: 'NAV_GO',
|
||||
routeName: 'OneDriveLogin',
|
||||
});
|
||||
return 'auth';
|
||||
}
|
||||
|
||||
let sync = null;
|
||||
try {
|
||||
sync = await reg.synchronizer(Setting.value('sync.target'))
|
||||
} catch (error) {
|
||||
reg.logger().info('Could not acquire synchroniser:');
|
||||
reg.logger().info(error);
|
||||
return 'error';
|
||||
}
|
||||
|
||||
if (action == 'cancel') {
|
||||
sync.cancel();
|
||||
return 'cancel';
|
||||
} else {
|
||||
reg.scheduleSync(0);
|
||||
return 'sync';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = shared;
|
Reference in New Issue
Block a user