mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: cancel attachments caching on disabling offline mode
This commit is contained in:
committed by
Abdullah Atta
parent
02fdec74ce
commit
5357be4741
@@ -209,10 +209,13 @@ class SettingStore extends BaseStore<SettingStore> {
|
||||
await desktop?.updater.toggleAutoUpdates.mutate({ enabled: !autoUpdates });
|
||||
};
|
||||
|
||||
toggleFullOfflineMode = async () => {
|
||||
toggleFullOfflineMode = () => {
|
||||
const isFullOfflineMode = this.get().isFullOfflineMode;
|
||||
this.set({ isFullOfflineMode: !isFullOfflineMode });
|
||||
Config.set("fullOfflineMode", !isFullOfflineMode);
|
||||
|
||||
if (isFullOfflineMode) db.fs().cancel("offline-mode");
|
||||
else db.attachments.cacheAttachments();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -208,11 +208,9 @@ class Sync {
|
||||
if (this.uncachedAttachments.length > 0 && options.offlineMode) {
|
||||
await this.db
|
||||
.fs()
|
||||
.queueDownloads(
|
||||
this.uncachedAttachments,
|
||||
"download-uncached-attachments",
|
||||
{ readOnDownload: false }
|
||||
);
|
||||
.queueDownloads(this.uncachedAttachments, "offline-mode", {
|
||||
readOnDownload: false
|
||||
});
|
||||
this.uncachedAttachments = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ export class Attachments implements ICollection {
|
||||
filename: a.hash,
|
||||
chunkSize: a.chunkSize
|
||||
})),
|
||||
"download-all-attachments",
|
||||
"offline-mode",
|
||||
{ readOnDownload: false }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user