mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
mobile: fix switching app from background to foreground starts
a new attachment cache download group
This commit is contained in:
@@ -561,6 +561,7 @@ export const useAppEvents = () => {
|
||||
initialUrl: string;
|
||||
backupDidWait: boolean;
|
||||
isConnectingSSE: boolean;
|
||||
attachmentsCachedOfflineMode: boolean;
|
||||
}>
|
||||
>({});
|
||||
|
||||
@@ -655,7 +656,11 @@ export const useAppEvents = () => {
|
||||
}
|
||||
}
|
||||
|
||||
if (SettingsService.getProperty("offlineMode")) {
|
||||
if (
|
||||
SettingsService.getProperty("offlineMode") &&
|
||||
!refValues.current.attachmentsCachedOfflineMode
|
||||
) {
|
||||
refValues.current.attachmentsCachedOfflineMode = true;
|
||||
db.attachments.cacheAttachments().catch(() => {
|
||||
/* empty */
|
||||
});
|
||||
|
||||
@@ -63,7 +63,16 @@ export class FileStorage {
|
||||
let current = 0;
|
||||
const token = await this.tokenManager.getAccessToken();
|
||||
const total = files.length;
|
||||
const group = this.groups.downloads.get(groupId) || new Set();
|
||||
|
||||
if (this.groups.downloads.has(groupId)) {
|
||||
logger.debug("[queueDownloads] group already exists", {
|
||||
groupId
|
||||
});
|
||||
return this.groups.downloads.get(groupId);
|
||||
}
|
||||
|
||||
const group = new Set<string>();
|
||||
|
||||
files.forEach((f) => group.add(f.filename));
|
||||
this.groups.downloads.set(groupId, group);
|
||||
|
||||
@@ -143,7 +152,16 @@ export class FileStorage {
|
||||
let current = 0;
|
||||
const token = await this.tokenManager.getAccessToken();
|
||||
const total = files.length;
|
||||
const group = this.groups.uploads.get(groupId) || new Set();
|
||||
|
||||
if (this.groups.uploads.has(groupId)) {
|
||||
logger.debug("[queueUploads] group already exists", {
|
||||
groupId
|
||||
});
|
||||
return this.groups.uploads.get(groupId);
|
||||
}
|
||||
|
||||
const group = new Set<string>();
|
||||
|
||||
files.forEach((f) => group.add(f.filename));
|
||||
this.groups.uploads.set(groupId, group);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user