refactor: migrate account-menu to react - implement functionality

- implement different handlers, such as set/change/remove passcode, etc.
- setup correct initial values
- rename React component
This commit is contained in:
VardanHakobyan
2021-05-31 22:15:49 +04:00
parent 1194c73c49
commit 09f62b68ae
10 changed files with 149 additions and 82 deletions

View File

@@ -18,10 +18,12 @@
ng-if='ctrl.showAccountMenu',
application='ctrl.application'
)
account-menu2(
account-menu-react(
ng-click='$event.stopPropagation()',
app-state='ctrl.appState'
application='ctrl.application'
ng-if='ctrl.showAccountMenu',
close-account-menu='ctrl.closeAccountMenu()',
)
.sk-app-bar-item
a.no-decoration.sk-label.title(

View File

@@ -62,7 +62,7 @@ class FooterViewCtrl extends PureViewCtrl<unknown, {
public user?: any
private offline = true
public showAccountMenu = false
public showAccountMenu2 = false
public showAccountMenuReact = false
private didCheckForOffline = false
private queueExtReload = false
private reloadInProgress = false
@@ -116,7 +116,7 @@ class FooterViewCtrl extends PureViewCtrl<unknown, {
this.autorun(() => {
const showBetaWarning = this.appState.showBetaWarning;
this.showAccountMenu = this.appState.accountMenu.show;
this.showAccountMenu2 = this.appState.accountMenu2.show;
this.showAccountMenuReact = this.appState.accountMenuReact.show;
this.setState({
showBetaWarning: showBetaWarning,
showDataUpgrade: !showBetaWarning
@@ -256,7 +256,7 @@ class FooterViewCtrl extends PureViewCtrl<unknown, {
this.didCheckForOffline = true;
if (this.offline && this.application.getNoteCount() === 0) {
this.appState.accountMenu.setShow(true);
this.appState.accountMenu2.setShow(true);
this.appState.accountMenuReact.setShow(true);
}
}
this.syncUpdated();
@@ -439,7 +439,7 @@ class FooterViewCtrl extends PureViewCtrl<unknown, {
accountMenuPressed() {
this.appState.accountMenu.toggleShow();
this.appState.accountMenu2.toggleShow();
this.appState.accountMenuReact.toggleShow();
this.closeAllRooms();
}
@@ -449,7 +449,7 @@ class FooterViewCtrl extends PureViewCtrl<unknown, {
closeAccountMenu() {
this.appState.accountMenu.setShow(false);
this.appState.accountMenu2.setShow(false);
this.appState.accountMenuReact.setShow(false);
}
lockApp() {
@@ -567,7 +567,7 @@ class FooterViewCtrl extends PureViewCtrl<unknown, {
return;
}
this.appState.accountMenu.setShow(false);
this.appState.accountMenu2.setShow(false);
this.appState.accountMenuReact.setShow(false);
}
}