2020-11-04 18:09:21 +01:00
|
|
|
import { Component, OnInit } from "@angular/core";
|
2021-11-09 19:00:01 +01:00
|
|
|
import { FormBuilder } from "@angular/forms";
|
2018-08-02 05:21:32 +02:00
|
|
|
|
2021-03-04 22:53:35 +01:00
|
|
|
import * as os from "os";
|
|
|
|
|
2021-12-06 12:03:02 +01:00
|
|
|
import { BroadcasterService } from "jslib-common/abstractions/broadcaster.service";
|
2021-06-07 19:26:36 +02:00
|
|
|
import { CryptoService } from "jslib-common/abstractions/crypto.service";
|
|
|
|
import { EventService } from "jslib-common/abstractions/event.service";
|
|
|
|
import { ExportService } from "jslib-common/abstractions/export.service";
|
|
|
|
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
2021-10-21 11:10:36 +02:00
|
|
|
import { LogService } from "jslib-common/abstractions/log.service";
|
2021-06-07 19:26:36 +02:00
|
|
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
2021-10-21 11:10:36 +02:00
|
|
|
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
2021-11-09 19:00:01 +01:00
|
|
|
import { UserVerificationService } from "jslib-common/abstractions/userVerification.service";
|
2018-08-02 05:21:32 +02:00
|
|
|
|
2021-06-07 19:26:36 +02:00
|
|
|
import { ExportComponent as BaseExportComponent } from "jslib-angular/components/export.component";
|
2018-08-02 05:21:32 +02:00
|
|
|
|
2020-11-04 18:09:21 +01:00
|
|
|
const BroadcasterSubscriptionId = "ExportComponent";
|
|
|
|
|
2018-08-02 05:21:32 +02:00
|
|
|
@Component({
|
|
|
|
selector: "app-export",
|
|
|
|
templateUrl: "export.component.html",
|
|
|
|
})
|
2020-11-04 18:09:21 +01:00
|
|
|
export class ExportComponent extends BaseExportComponent implements OnInit {
|
2018-10-03 15:42:11 +02:00
|
|
|
constructor(
|
|
|
|
cryptoService: CryptoService,
|
|
|
|
i18nService: I18nService,
|
2019-07-12 23:11:39 +02:00
|
|
|
platformUtilsService: PlatformUtilsService,
|
|
|
|
exportService: ExportService,
|
2021-09-15 20:02:17 +02:00
|
|
|
eventService: EventService,
|
|
|
|
policyService: PolicyService,
|
2021-11-09 19:00:01 +01:00
|
|
|
userVerificationService: UserVerificationService,
|
|
|
|
fb: FormBuilder,
|
|
|
|
private broadcasterService: BroadcasterService,
|
|
|
|
logService: LogService
|
|
|
|
) {
|
2021-10-21 11:10:36 +02:00
|
|
|
super(
|
|
|
|
cryptoService,
|
|
|
|
i18nService,
|
|
|
|
platformUtilsService,
|
|
|
|
exportService,
|
|
|
|
eventService,
|
2021-11-09 19:00:01 +01:00
|
|
|
policyService,
|
|
|
|
window,
|
|
|
|
logService,
|
|
|
|
userVerificationService,
|
|
|
|
fb
|
|
|
|
);
|
2020-11-04 18:09:21 +01:00
|
|
|
}
|
|
|
|
|
2020-11-04 20:00:44 +01:00
|
|
|
ngOnDestroy() {
|
|
|
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
|
|
|
}
|
|
|
|
|
2021-03-04 22:53:35 +01:00
|
|
|
async warningDialog() {
|
|
|
|
if (this.encryptedFormat) {
|
|
|
|
return await this.platformUtilsService.showDialog(
|
|
|
|
this.i18nService.t("encExportKeyWarningDesc") +
|
|
|
|
os.EOL +
|
|
|
|
os.EOL +
|
|
|
|
this.i18nService.t("encExportAccountWarningDesc"),
|
|
|
|
this.i18nService.t("confirmVaultExport"),
|
|
|
|
this.i18nService.t("exportVault"),
|
|
|
|
this.i18nService.t("cancel"),
|
|
|
|
"warning",
|
|
|
|
true
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return await this.platformUtilsService.showDialog(
|
|
|
|
this.i18nService.t("exportWarningDesc"),
|
|
|
|
this.i18nService.t("confirmVaultExport"),
|
|
|
|
this.i18nService.t("exportVault"),
|
|
|
|
this.i18nService.t("cancel"),
|
|
|
|
"warning"
|
|
|
|
);
|
|
|
|
}
|
2021-12-20 15:47:17 +01:00
|
|
|
}
|
2018-08-02 05:21:32 +02:00
|
|
|
}
|