improve: only show 'Add "domain.tld" as an application for mailto links?' message after login (firefox shows the message on every reload otherwise).

This commit is contained in:
Sergey Mosin 2023-07-04 14:26:31 -04:00
parent c75c0e9ed1
commit ceeb55acf2

View file

@ -177,6 +177,7 @@ export class AppUser extends AbstractApp {
}
logout() {
localStorage.removeItem('register_protocol_offered');
Remote.request('Logout', () => rl.logoutReload(Settings.app('customLogoutLink')));
}
@ -253,12 +254,15 @@ export class AppUser extends AbstractApp {
setTimeout(() => mailToHelper(SettingsGet('mailToEmail')), 500);
// When auto-login is active
navigator.registerProtocolHandler?.(
'mailto',
location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s',
(SettingsGet('title') || 'SnappyMail')
);
if (!localStorage.getItem('register_protocol_offered')) {
// When auto-login is active
navigator.registerProtocolHandler?.(
'mailto',
location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s',
(SettingsGet('title') || 'SnappyMail')
);
localStorage.setItem('register_protocol_offered', '1');
}
} else {
this.logout();