bitwarden-estensione-browser/apps/browser/src/popup/app.component.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

268 lines
8.8 KiB
TypeScript
Raw Normal View History

2018-04-04 04:14:54 +02:00
import { ChangeDetectorRef, Component, NgZone, OnInit, SecurityContext } from "@angular/core";
2018-10-03 05:33:56 +02:00
import { DomSanitizer } from "@angular/platform-browser";
2018-04-09 15:51:22 +02:00
import { NavigationEnd, Router, RouterOutlet } from "@angular/router";
2021-12-07 20:42:18 +01:00
import { IndividualConfig, ToastrService } from "ngx-toastr";
import Swal, { SweetAlertIcon } from "sweetalert2";
2021-12-21 15:43:35 +01:00
2022-06-14 17:10:53 +02:00
import { AuthService } from "@bitwarden/common/abstractions/auth.service";
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
2021-12-21 15:43:35 +01:00
2022-02-24 18:14:04 +01:00
import { BrowserApi } from "../browser/browserApi";
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
import { StateService } from "../services/abstractions/state.service";
2021-12-21 15:43:35 +01:00
2018-04-08 06:30:04 +02:00
import { routerTransition } from "./app-routing.animations";
2018-04-04 04:14:54 +02:00
@Component({
selector: "app-root",
styles: [],
2018-04-08 06:30:04 +02:00
animations: [routerTransition],
template: ` <div [@routerTransition]="getState(o)">
2018-04-08 06:30:04 +02:00
<router-outlet #o="outlet"></router-outlet>
</div>`,
2018-04-04 04:14:54 +02:00
})
2018-04-06 21:33:20 +02:00
export class AppComponent implements OnInit {
private lastActivity: number = null;
private activeUserId: string;
2021-12-21 15:43:35 +01:00
2021-12-07 20:42:18 +01:00
constructor(
private toastrService: ToastrService,
2018-04-06 21:33:20 +02:00
private broadcasterService: BroadcasterService,
private authService: AuthService,
2018-04-09 20:17:58 +02:00
private i18nService: I18nService,
private router: Router,
2018-04-10 23:14:10 +02:00
private stateService: StateService,
private messagingService: MessagingService,
2018-10-03 05:33:56 +02:00
private changeDetectorRef: ChangeDetectorRef,
private ngZone: NgZone,
private sanitizer: DomSanitizer,
private platformUtilsService: PlatformUtilsService
2021-12-21 15:43:35 +01:00
) {}
async ngOnInit() {
// Component states must not persist between closing and reopening the popup, otherwise they become dead objects
// Clear them aggressively to make sure this doesn't occur
await this.clearComponentStates();
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
this.stateService.activeAccount.subscribe((userId) => {
this.activeUserId = userId;
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
});
2018-04-04 04:14:54 +02:00
2018-04-06 21:33:20 +02:00
this.ngZone.runOutsideAngular(() => {
window.onmousedown = () => this.recordActivity();
window.ontouchstart = () => this.recordActivity();
window.onclick = () => this.recordActivity();
window.onscroll = () => this.recordActivity();
window.onkeypress = () => this.recordActivity();
2021-12-21 15:43:35 +01:00
});
2021-12-07 20:42:18 +01:00
(window as any).bitwardenPopupMainMessageListener = async (
msg: any,
sender: any,
2018-04-06 21:33:20 +02:00
sendResponse: any
2021-12-21 15:43:35 +01:00
) => {
2018-04-06 21:33:20 +02:00
if (msg.command === "doneLoggingOut") {
this.ngZone.run(async () => {
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
this.authService.logOut(async () => {
2018-04-10 23:14:10 +02:00
if (msg.expired) {
2018-04-06 21:33:20 +02:00
this.showToast({
type: "warning",
2018-04-09 20:17:58 +02:00
title: this.i18nService.t("loggedOut"),
text: this.i18nService.t("loginExpired"),
2021-12-21 15:43:35 +01:00
});
}
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
if (this.stateService.activeAccount.getValue() == null) {
this.router.navigate(["home"]);
}
2021-12-21 15:43:35 +01:00
});
2018-10-03 05:33:56 +02:00
this.changeDetectorRef.detectChanges();
2021-12-21 15:43:35 +01:00
});
} else if (msg.command === "authBlocked") {
2019-04-18 16:11:01 +02:00
this.ngZone.run(() => {
this.router.navigate(["home"]);
2021-12-21 15:43:35 +01:00
});
} else if (msg.command === "locked") {
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
if (msg.userId == null || msg.userId === (await this.stateService.getUserId())) {
this.ngZone.run(() => {
this.router.navigate(["lock"]);
});
}
2018-04-10 20:20:03 +02:00
} else if (msg.command === "showDialog") {
await this.showDialog(msg);
2018-10-03 05:33:56 +02:00
} else if (msg.command === "showToast") {
2018-10-03 15:51:14 +02:00
this.ngZone.run(() => {
this.showToast(msg);
2021-12-21 15:43:35 +01:00
});
} else if (msg.command === "reloadProcess") {
const windowReload =
this.platformUtilsService.isSafari() ||
this.platformUtilsService.isFirefox() ||
this.platformUtilsService.isOpera();
2018-04-14 04:08:24 +02:00
if (windowReload) {
// Wait to make sure background has reloaded first.
window.setTimeout(() => BrowserApi.reloadExtension(window), 2000);
}
2018-04-12 20:24:42 +02:00
} else if (msg.command === "reloadPopup") {
this.ngZone.run(() => {
this.router.navigate(["/"]);
});
2019-08-17 02:48:01 +02:00
} else if (msg.command === "convertAccountToKeyConnector") {
2018-10-03 15:51:14 +02:00
this.ngZone.run(async () => {
this.router.navigate(["/remove-password"]);
2018-04-09 20:17:58 +02:00
});
2020-09-15 16:50:45 +02:00
} else {
msg.webExtSender = sender;
this.broadcasterService.send(msg);
2021-12-21 15:43:35 +01:00
}
};
BrowserApi.messageListener("app.component", (window as any).bitwardenPopupMainMessageListener);
2021-12-21 15:43:35 +01:00
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
this.router.events.subscribe(async (event) => {
if (event instanceof NavigationEnd) {
const url = event.urlAfterRedirects || event.url || "";
2021-12-21 15:43:35 +01:00
if (
url.startsWith("/tabs/") &&
(window as any).previousPopupUrl != null &&
(window as any).previousPopupUrl.startsWith("/tabs/")
2021-12-21 15:43:35 +01:00
) {
await this.clearComponentStates();
}
2018-04-06 21:33:20 +02:00
if (url.startsWith("/tabs/")) {
[Account Switching] Base changes for account switching (#2250) * Pull in jslib * Create new state models * Create browser specific stateService * Remove registration deprecated services, register stateService * Replace usage of deprecated services (user, constants) * Add missing properties to BrowserGroupingsComponentState * Remove StorageService from initFactory * Clear the correct state * Add null check when restoring send-grouping state * add remember email * Initialize stateservice in services.module * Fix 'lock now' not working * Comment to remove setting defaults on install * Pull jslib * Remove setting defaults on install * Bump jslib * Pass the current userId to services when logging out * Bump jslib * Override vaultTimeout default on account addition * Pull latest jslib * Retrieve vaultTimeout from stateService * Record activity per Account * Add userId to logout and add fallback if not present * Register AccountFactory * Pass userId in messages * Base changes for account switching di fixes (#2280) * [bug] Null checks on Account init * [bug] Use same stateService instance for all operations We override the stateService in browser, but currently don't pull the background service into popup and allow jslib to create its own instance of the base StateService for jslib services. This causes a split in in memory state between the three isntances that results in many errors, namely locking not working. * [chore] Update jslib * Pull in jslib * Pull in jslib * Pull in latest jslib to multiple stateservice inits * Check vault states before executing processReload * Adjust iterator * Update native messaging to include the userId (#2290) * Re-Add UserVerificationService * Fix email not being remembered by base component * Improve readability of reloadProcess * Removed unneeded null check * Fix constructor dependency (stateService) * Added missing await * Simplify dependency registration * Fixed typos * Reverted back to simple loop * Use vaultTimeoutService to retrieve Timeout Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com>
2022-01-27 22:22:51 +01:00
await this.stateService.setAddEditCipherInfo(null);
2018-04-06 21:33:20 +02:00
}
(window as any).previousPopupUrl = url;
2018-04-06 21:33:20 +02:00
// Clear route direction after animation (400ms)
2018-10-03 15:51:14 +02:00
if ((window as any).routeDirection != null) {
2021-12-07 20:42:18 +01:00
window.setTimeout(() => {
(window as any).routeDirection = null;
2018-10-03 05:33:56 +02:00
}, 400);
}
2021-12-21 15:43:35 +01:00
}
});
}
2018-10-03 05:33:56 +02:00
getState(outlet: RouterOutlet) {
if (outlet.activatedRouteData.state === "ciphers") {
2021-12-07 20:42:18 +01:00
const routeDirection =
2018-10-03 05:33:56 +02:00
(window as any).routeDirection != null ? (window as any).routeDirection : "";
2021-12-21 15:43:35 +01:00
return (
2021-12-07 20:42:18 +01:00
"ciphers_direction=" +
routeDirection +
2021-12-21 15:43:35 +01:00
"_" +
2021-12-07 20:42:18 +01:00
(outlet.activatedRoute.queryParams as any).value.folderId +
2021-12-21 15:43:35 +01:00
"_" +
2021-12-07 20:42:18 +01:00
(outlet.activatedRoute.queryParams as any).value.collectionId
);
} else {
return outlet.activatedRouteData.state;
2018-10-03 05:33:56 +02:00
}
2021-12-21 15:43:35 +01:00
}
2018-10-03 05:33:56 +02:00
private async recordActivity() {
if (this.activeUserId == null) {
return;
}
const now = new Date().getTime();
if (this.lastActivity != null && now - this.lastActivity < 250) {
2018-04-13 05:18:51 +02:00
return;
}
this.lastActivity = now;
await this.stateService.setLastActive(now, { userId: this.activeUserId });
2021-12-21 15:43:35 +01:00
}
private showToast(msg: any) {
let message = "";
2021-12-21 15:43:35 +01:00
const options: Partial<IndividualConfig> = {};
2021-12-21 15:43:35 +01:00
if (typeof msg.text === "string") {
message = msg.text;
} else if (msg.text.length === 1) {
message = msg.text[0];
2021-12-21 15:43:35 +01:00
} else {
msg.text.forEach(
(t: string) =>
(message += "<p>" + this.sanitizer.sanitize(SecurityContext.HTML, t) + "</p>")
2021-12-21 15:43:35 +01:00
);
2021-12-07 20:42:18 +01:00
options.enableHtml = true;
2021-12-21 15:43:35 +01:00
}
2018-10-03 05:33:56 +02:00
if (msg.options != null) {
if (msg.options.trustedHtml === true) {
2021-12-07 20:42:18 +01:00
options.enableHtml = true;
2021-12-21 15:43:35 +01:00
}
if (msg.options.timeout != null && msg.options.timeout > 0) {
options.timeOut = msg.options.timeout;
2018-04-13 05:18:51 +02:00
}
2021-12-21 15:43:35 +01:00
}
2018-04-13 05:18:51 +02:00
this.toastrService.show(message, msg.title, options, "toast-" + msg.type);
2021-12-21 15:43:35 +01:00
}
2018-04-13 05:18:51 +02:00
private async showDialog(msg: any) {
let iconClasses: string = null;
const type = msg.type;
if (type != null) {
// If you add custom types to this part, the type to SweetAlertIcon cast below needs to be changed.
switch (type) {
2018-04-13 05:18:51 +02:00
case "success":
iconClasses = "bwi-check text-success";
2021-12-21 15:43:35 +01:00
break;
case "warning":
iconClasses = "bwi-exclamation-triangle text-warning";
2021-12-21 15:43:35 +01:00
break;
2018-04-13 05:18:51 +02:00
case "error":
iconClasses = "bwi-error text-danger";
2021-12-21 15:43:35 +01:00
break;
case "info":
iconClasses = "bwi-info-circle text-info";
2018-04-13 05:18:51 +02:00
break;
2021-12-21 15:43:35 +01:00
default:
break;
2018-04-13 05:18:51 +02:00
}
}
2021-12-21 15:43:35 +01:00
const cancelText = msg.cancelText;
const confirmText = msg.confirmText;
const confirmed = await Swal.fire({
heightAuto: false,
buttonsStyling: false,
icon: type as SweetAlertIcon, // required to be any of the SweetAlertIcons to output the iconHtml.
iconHtml:
iconClasses != null ? `<i class="swal-custom-icon bwi ${iconClasses}"></i>` : undefined,
text: msg.text,
2020-10-19 16:50:25 +02:00
html: msg.html,
titleText: msg.title,
showCancelButton: cancelText != null,
cancelButtonText: cancelText,
showConfirmButton: true,
confirmButtonText: confirmText == null ? this.i18nService.t("ok") : confirmText,
timer: 300000,
2021-12-21 15:43:35 +01:00
});
this.messagingService.send("showDialogResolve", {
2018-04-13 05:18:51 +02:00
dialogId: msg.dialogId,
confirmed: confirmed.value,
2021-12-21 15:43:35 +01:00
});
}
private async clearComponentStates() {
if (!(await this.stateService.getIsAuthenticated())) {
return;
}
await Promise.all([
this.stateService.setBrowserGroupingComponentState(null),
this.stateService.setBrowserCipherComponentState(null),
this.stateService.setBrowserSendComponentState(null),
this.stateService.setBrowserSendTypeComponentState(null),
]);
}
2018-04-04 04:14:54 +02:00
}