[PM-3588] Close duplicate single-action windows (#6091)
* close duplicate single-action windows * Use longform conditional Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com> --------- Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
This commit is contained in:
parent
3340af8084
commit
f61793b10b
|
@ -12,7 +12,6 @@ class BrowserPopoutWindowService implements BrowserPopupWindowServiceInterface {
|
||||||
};
|
};
|
||||||
|
|
||||||
async openUnlockPrompt(senderWindowId: number) {
|
async openUnlockPrompt(senderWindowId: number) {
|
||||||
await this.closeUnlockPrompt();
|
|
||||||
await this.openSingleActionPopout(
|
await this.openSingleActionPopout(
|
||||||
senderWindowId,
|
senderWindowId,
|
||||||
"popup/index.html?uilocation=popout",
|
"popup/index.html?uilocation=popout",
|
||||||
|
@ -36,8 +35,6 @@ class BrowserPopoutWindowService implements BrowserPopupWindowServiceInterface {
|
||||||
action: string;
|
action: string;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
await this.closePasswordRepromptPrompt();
|
|
||||||
|
|
||||||
const promptWindowPath =
|
const promptWindowPath =
|
||||||
"popup/index.html#/view-cipher" +
|
"popup/index.html#/view-cipher" +
|
||||||
"?uilocation=popout" +
|
"?uilocation=popout" +
|
||||||
|
@ -73,18 +70,16 @@ class BrowserPopoutWindowService implements BrowserPopupWindowServiceInterface {
|
||||||
|
|
||||||
const popupWindow = await BrowserApi.createWindow(windowOptions);
|
const popupWindow = await BrowserApi.createWindow(windowOptions);
|
||||||
|
|
||||||
if (!singleActionPopoutKey) {
|
await this.closeSingleActionPopout(singleActionPopoutKey);
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.singleActionPopoutTabIds[singleActionPopoutKey] = popupWindow?.tabs[0].id;
|
this.singleActionPopoutTabIds[singleActionPopoutKey] = popupWindow?.tabs[0].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async closeSingleActionPopout(popoutKey: string) {
|
private async closeSingleActionPopout(popoutKey: string) {
|
||||||
const tabId = this.singleActionPopoutTabIds[popoutKey];
|
const tabId = this.singleActionPopoutTabIds[popoutKey];
|
||||||
if (!tabId) {
|
|
||||||
return;
|
if (tabId) {
|
||||||
|
await BrowserApi.removeTab(tabId);
|
||||||
}
|
}
|
||||||
await BrowserApi.removeTab(tabId);
|
|
||||||
this.singleActionPopoutTabIds[popoutKey] = null;
|
this.singleActionPopoutTabIds[popoutKey] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue