Return to settings after setting password
This commit is contained in:
parent
23fd0376ba
commit
a8ef0206d9
@ -7,6 +7,7 @@ import Button from "../../../button";
|
||||
import PopupConfirmAction from "../../../popups/confirmAction";
|
||||
import SidebarSlider, { SliderSuperTab } from "../../../slider";
|
||||
import { wrapSticker } from "../../../wrappers";
|
||||
import AppSettingsTab from "../settings";
|
||||
import AppTwoStepVerificationEnterPasswordTab from "./enterPassword";
|
||||
|
||||
export default class AppTwoStepVerificationTab extends SliderSuperTab {
|
||||
@ -67,7 +68,10 @@ export default class AppTwoStepVerificationTab extends SliderSuperTab {
|
||||
const popup = new PopupConfirmAction('popup-disable-password', [{
|
||||
text: 'DISABLE',
|
||||
callback: () => {
|
||||
passwordManager.updateSettings({currentPassword: this.plainPassword});
|
||||
passwordManager.updateSettings({currentPassword: this.plainPassword}).then(() => {
|
||||
this.slider.sliceTabsUntilTab(AppSettingsTab, this);
|
||||
this.close();
|
||||
});
|
||||
},
|
||||
isDanger: true,
|
||||
}], {
|
||||
|
@ -4,6 +4,7 @@ import appStickersManager from "../../../../lib/appManagers/appStickersManager";
|
||||
import Button from "../../../button";
|
||||
import SidebarSlider, { SliderSuperTab } from "../../../slider";
|
||||
import { wrapSticker } from "../../../wrappers";
|
||||
import AppSettingsTab from "../settings";
|
||||
|
||||
export default class AppTwoStepVerificationSetTab extends SliderSuperTab {
|
||||
constructor(slider: SidebarSlider) {
|
||||
@ -49,9 +50,11 @@ export default class AppTwoStepVerificationSetTab extends SliderSuperTab {
|
||||
const btnReturn = Button('btn-primary btn-color-primary', {text: 'RETURN TO SETTINGS'});
|
||||
|
||||
attachClickEvent(btnReturn, (e) => {
|
||||
|
||||
this.close();
|
||||
});
|
||||
|
||||
this.slider.sliceTabsUntilTab(AppSettingsTab, this);
|
||||
|
||||
inputWrapper.append(btnReturn);
|
||||
|
||||
inputContent.append(inputWrapper);
|
||||
|
@ -2,7 +2,7 @@ import { attachClickEvent } from "../helpers/dom";
|
||||
import { horizontalMenu } from "./horizontalMenu";
|
||||
import { TransitionSlider } from "./transition";
|
||||
import appNavigationController, { NavigationItem } from "./appNavigationController";
|
||||
import SliderSuperTab, { SliderTab } from "./sliderTab";
|
||||
import SliderSuperTab, { SliderSuperTabConstructable, SliderTab } from "./sliderTab";
|
||||
|
||||
const TRANSITION_TIME = 250;
|
||||
|
||||
@ -105,6 +105,18 @@ export default class SidebarSlider {
|
||||
this.onCloseTab(id, undefined);
|
||||
}
|
||||
|
||||
public sliceTabsUntilTab(tabConstructor: SliderSuperTabConstructable, preserveTab: SliderSuperTab) {
|
||||
for(let i = this.historyTabIds.length - 1; i >= 0; --i) {
|
||||
const tab = this.historyTabIds[i];
|
||||
if(tab === preserveTab) continue;
|
||||
else if(tab instanceof tabConstructor) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.removeTabFromHistory(tab);
|
||||
}
|
||||
}
|
||||
|
||||
public onCloseTab(id: number | SliderSuperTab, animate: boolean) {
|
||||
const tab: SliderTab = id instanceof SliderSuperTab ? id : this.tabs.get(id);
|
||||
if(tab) {
|
||||
|
@ -9,6 +9,10 @@ export interface SliderTab {
|
||||
onCloseAfterTimeout?: () => void
|
||||
}
|
||||
|
||||
export interface SliderSuperTabConstructable {
|
||||
new(slider: SidebarSlider, destroyable: boolean): SliderSuperTab;
|
||||
}
|
||||
|
||||
export default class SliderSuperTab implements SliderTab {
|
||||
public container: HTMLElement;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user