1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Mobile: Added support for ResourceFetcher service

This commit is contained in:
Laurent Cozic
2018-10-09 22:01:50 +01:00
parent 3bdf621026
commit 069dce69cd
3 changed files with 22 additions and 8 deletions

View File

@ -51,6 +51,7 @@ const { reducer, defaultState } = require('lib/reducer.js');
const { FileApiDriverLocal } = require('lib/file-api-driver-local.js');
const DropdownAlert = require('react-native-dropdownalert').default;
const ShareExtension = require('react-native-share-extension').default;
const ResourceFetcher = require('lib/services/ResourceFetcher');
const SyncTargetRegistry = require('lib/SyncTargetRegistry.js');
const SyncTargetOneDrive = require('lib/SyncTargetOneDrive.js');
@ -138,6 +139,10 @@ const generalMiddleware = store => next => async (action) => {
DecryptionWorker.instance().scheduleStart();
}
if (action.type === 'SYNC_CREATED_RESOURCE') {
ResourceFetcher.instance().queueDownload(action.id);
}
return result;
}
@ -488,6 +493,10 @@ async function initialize(dispatch) {
ResourceService.runInBackground();
ResourceFetcher.instance().setFileApi(() => { return reg.syncTarget().fileApi() });
ResourceFetcher.instance().setLogger(reg.logger());
ResourceFetcher.instance().start();
reg.scheduleSync().then(() => {
// Wait for the first sync before updating the notifications, since synchronisation
// might change the notifications.