mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Revamp Mobile/Desktop switcher without completely reloading.
Remove switcher from login page, it became useless.
This commit is contained in:
parent
292f3289ac
commit
d7994ddab6
35 changed files with 159 additions and 202 deletions
|
|
@ -3,9 +3,9 @@ import ko from 'ko';
|
|||
import {
|
||||
doc,
|
||||
$htmlCL,
|
||||
elementById,
|
||||
leftPanelDisabled,
|
||||
Settings,
|
||||
isMobile
|
||||
Settings
|
||||
} from 'Common/Globals';
|
||||
|
||||
import { KeyState } from 'Common/Enums';
|
||||
|
|
@ -49,7 +49,7 @@ export class AbstractApp {
|
|||
* @returns {boolean}
|
||||
*/
|
||||
download(link) {
|
||||
if (isMobile()) {
|
||||
if (ThemeStore.isMobile()) {
|
||||
open(link, '_self');
|
||||
focus();
|
||||
} else {
|
||||
|
|
@ -110,7 +110,7 @@ export class AbstractApp {
|
|||
register('Select', SelectComponent);
|
||||
register('TextArea', TextAreaComponent);
|
||||
register('CheckboxSimple', CheckboxComponent, 'CheckboxComponent');
|
||||
if (isMobile() || !Settings.app('materialDesign')) {
|
||||
if (/*ThemeStore.isMobile() || */!Settings.app('materialDesign')) {
|
||||
register('Checkbox', CheckboxComponent);
|
||||
} else {
|
||||
register('Checkbox', CheckboxMaterialDesignComponent, 'CheckboxMaterialDesignComponent');
|
||||
|
|
@ -118,11 +118,8 @@ export class AbstractApp {
|
|||
|
||||
initOnStartOrLangChange();
|
||||
|
||||
if (isMobile()) {
|
||||
leftPanelDisabled(true);
|
||||
} else {
|
||||
window.addEventListener('resize', () => leftPanelDisabled(767 >= window.innerWidth));
|
||||
}
|
||||
leftPanelDisabled(ThemeStore.isMobile());
|
||||
addEventListener('resize', () => leftPanelDisabled(ThemeStore.isMobile() || 767 >= innerWidth));
|
||||
|
||||
leftPanelDisabled.valueHasMutated();
|
||||
|
||||
|
|
@ -134,9 +131,8 @@ export class AbstractApp {
|
|||
* @returns {void}
|
||||
*/
|
||||
hideLoading() {
|
||||
const id = id => doc.getElementById(id);
|
||||
id('rl-content').hidden = false;
|
||||
id('rl-loading').remove();
|
||||
elementById('rl-content').hidden = false;
|
||||
elementById('rl-loading').remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,14 @@ import {
|
|||
ClientSideKeyName
|
||||
} from 'Common/EnumsUser';
|
||||
|
||||
import { doc, createElement, $htmlCL, Settings, leftPanelDisabled, isMobile } from 'Common/Globals';
|
||||
import {
|
||||
doc,
|
||||
elementById,
|
||||
createElement,
|
||||
$htmlCL,
|
||||
Settings,
|
||||
leftPanelDisabled
|
||||
} from 'Common/Globals';
|
||||
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
|
||||
|
|
@ -50,6 +57,7 @@ import FolderStore from 'Stores/User/Folder';
|
|||
import PgpStore from 'Stores/User/Pgp';
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
import QuotaStore from 'Stores/User/Quota';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
import * as Local from 'Storage/Client';
|
||||
|
||||
|
|
@ -866,18 +874,18 @@ class AppUser extends AbstractApp {
|
|||
(bDisable || !$htmlCL.contains('rl-bottom-preview-pane')) ? null : 'height');
|
||||
};
|
||||
if (top && bottom) {
|
||||
fDisable(false);
|
||||
fDisable(ThemeStore.isMobile());
|
||||
addEventListener('rl-layout', e => fDisable(Layout.BottomPreview !== e.detail));
|
||||
}
|
||||
}
|
||||
|
||||
initVerticalLayoutResizer() {
|
||||
const left = doc.getElementById('rl-left'),
|
||||
right = doc.getElementById('rl-right'),
|
||||
const left = elementById('rl-left'),
|
||||
right = elementById('rl-right'),
|
||||
fDisable = bDisable =>
|
||||
this.setLayoutResizer(left, right, ClientSideKeyName.FolderListSize, bDisable ? null : 'width');
|
||||
if (left && right) {
|
||||
fDisable(false);
|
||||
fDisable(ThemeStore.isMobile());
|
||||
leftPanelDisabled.subscribe(value => fDisable(value));
|
||||
}
|
||||
}
|
||||
|
|
@ -1022,9 +1030,7 @@ class AppUser extends AbstractApp {
|
|||
}, 500);
|
||||
}
|
||||
|
||||
if (!isMobile()) {
|
||||
setTimeout(() => this.initVerticalLayoutResizer(), 1);
|
||||
}
|
||||
setTimeout(() => this.initVerticalLayoutResizer(), 1);
|
||||
} else {
|
||||
this.logout();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue