Ensure inbox is shown when registered device is offline
This commit is contained in:
parent
4539a178c5
commit
b6954fd342
1 changed files with 22 additions and 8 deletions
|
@ -1547,24 +1547,38 @@ export async function startApp(): Promise<void> {
|
||||||
window.Whisper.events.on('online', onOnline);
|
window.Whisper.events.on('online', onOnline);
|
||||||
|
|
||||||
const onOffline = () => {
|
const onOffline = () => {
|
||||||
log.info('background: offline');
|
const { hasInitialLoadCompleted, appView } =
|
||||||
|
window.reduxStore.getState().app;
|
||||||
|
|
||||||
|
const hasAppEverBeenRegistered = Registration.everDone();
|
||||||
|
|
||||||
|
log.info('background: offline', {
|
||||||
|
connectCount,
|
||||||
|
hasInitialLoadCompleted,
|
||||||
|
appView,
|
||||||
|
hasAppEverBeenRegistered,
|
||||||
|
});
|
||||||
|
|
||||||
drop(challengeHandler?.onOffline());
|
drop(challengeHandler?.onOffline());
|
||||||
drop(AttachmentDownloadManager.stop());
|
drop(AttachmentDownloadManager.stop());
|
||||||
drop(messageReceiver?.drain());
|
drop(messageReceiver?.drain());
|
||||||
|
|
||||||
if (connectCount === 0) {
|
if (hasAppEverBeenRegistered) {
|
||||||
log.info('background: offline, never connected, showing inbox');
|
|
||||||
|
|
||||||
drop(onEmpty()); // this ensures that the loading screen is dismissed
|
|
||||||
|
|
||||||
// Switch to inbox view even if contact sync is still running
|
|
||||||
if (
|
if (
|
||||||
window.reduxStore.getState().app.appView === AppViewType.Installer
|
window.reduxStore.getState().app.appView === AppViewType.Installer
|
||||||
) {
|
) {
|
||||||
log.info('background: offline, opening inbox');
|
log.info(
|
||||||
|
'background: offline, but app has been registered before; opening inbox'
|
||||||
|
);
|
||||||
window.reduxActions.app.openInbox();
|
window.reduxActions.app.openInbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasInitialLoadCompleted) {
|
||||||
|
log.info(
|
||||||
|
'background: offline; initial load not completed; triggering onEmpty'
|
||||||
|
);
|
||||||
|
drop(onEmpty()); // this ensures that the inbox loading progress bar is dismissed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.Whisper.events.on('offline', onOffline);
|
window.Whisper.events.on('offline', onOffline);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue