You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Background sync support
This commit is contained in:
@@ -34,6 +34,7 @@ import { DatabaseDriverReactNative } from 'lib/database-driver-react-native';
|
||||
import { reg } from 'lib/registry.js';
|
||||
import { _, setLocale } from 'lib/locale.js';
|
||||
import RNFetchBlob from 'react-native-fetch-blob';
|
||||
import { PoorManIntervals } from 'lib/poor-man-intervals.js';
|
||||
|
||||
let defaultState = {
|
||||
notes: [],
|
||||
@@ -303,6 +304,10 @@ const reducer = (state = defaultState, action) => {
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Check the registered intervals here since we know this function
|
||||
// will be called regularly.
|
||||
PoorManIntervals.update();
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
@@ -410,6 +415,11 @@ async function initialize(dispatch, backButtonHandler) {
|
||||
return backButtonHandler();
|
||||
});
|
||||
|
||||
PoorManIntervals.setInterval(() => {
|
||||
reg.logger().info('Running background sync on timer...');
|
||||
reg.scheduleSync(1);
|
||||
}, 1000 * 60 * 5);
|
||||
|
||||
initializationState_ = 'done';
|
||||
|
||||
reg.logger().info('Application initialized');
|
||||
|
||||
Reference in New Issue
Block a user