commit
afc357c385
|
@ -11,3 +11,5 @@ export enum PLAN_PERIOD {
|
|||
MONTH = 'month',
|
||||
YEAR = 'year',
|
||||
}
|
||||
|
||||
export const SYNC_INTERVAL_IN_MICROSECONDS = 1000 * 60 * 5; // 5 minutes
|
||||
|
|
|
@ -105,6 +105,8 @@ import { User } from 'types/user';
|
|||
import { getData, LS_KEYS } from 'utils/storage/localStorage';
|
||||
import { CenteredFlex } from 'components/Container';
|
||||
import { checkConnectivity } from 'utils/error/ui';
|
||||
import { SYNC_INTERVAL_IN_MICROSECONDS } from 'constants/gallery';
|
||||
import ElectronService from 'services/electron/common';
|
||||
import uploadManager from 'services/upload/uploadManager';
|
||||
|
||||
export const DeadCenter = styled('div')`
|
||||
|
@ -262,6 +264,12 @@ export default function Gallery() {
|
|||
setIsFirstLoad(false);
|
||||
setJustSignedUp(false);
|
||||
setIsFirstFetch(false);
|
||||
setInterval(() => {
|
||||
syncWithRemote(false, true);
|
||||
}, SYNC_INTERVAL_IN_MICROSECONDS);
|
||||
ElectronService.registerForegroundEventListener(() =>
|
||||
syncWithRemote(false, true)
|
||||
);
|
||||
};
|
||||
main();
|
||||
}, []);
|
||||
|
|
|
@ -39,6 +39,11 @@ class ElectronService {
|
|||
return this.electronAPIs.logRendererProcessMemoryUsage(message);
|
||||
}
|
||||
}
|
||||
registerForegroundEventListener(onForeground: () => void) {
|
||||
if (this.electronAPIs?.registerForegroundEventListener) {
|
||||
this.electronAPIs.registerForegroundEventListener(onForeground);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new ElectronService();
|
||||
|
|
|
@ -93,4 +93,5 @@ export interface ElectronAPIs {
|
|||
maxSize: number
|
||||
) => Promise<Uint8Array>;
|
||||
logRendererProcessMemoryUsage: (message: string) => Promise<void>;
|
||||
registerForegroundEventListener: (onForeground: () => void) => void;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue