2021-02-03 22:24:49 +01:00
|
|
|
import { DatePipe } from "@angular/common";
|
2021-02-18 19:10:10 +01:00
|
|
|
import { Component } from "@angular/core";
|
2021-02-03 22:24:49 +01:00
|
|
|
|
2022-02-24 20:50:19 +01:00
|
|
|
import { AddEditComponent as BaseAddEditComponent } from "jslib-angular/components/send/add-edit.component";
|
2021-06-07 19:26:36 +02:00
|
|
|
import { EnvironmentService } from "jslib-common/abstractions/environment.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 { MessagingService } from "jslib-common/abstractions/messaging.service";
|
|
|
|
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
|
|
|
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
|
|
|
import { SendService } from "jslib-common/abstractions/send.service";
|
2021-12-15 23:32:00 +01:00
|
|
|
import { StateService } from "jslib-common/abstractions/state.service";
|
2021-02-03 22:24:49 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-send-add-edit",
|
|
|
|
templateUrl: "add-edit.component.html",
|
|
|
|
})
|
|
|
|
export class AddEditComponent extends BaseAddEditComponent {
|
|
|
|
constructor(
|
|
|
|
i18nService: I18nService,
|
|
|
|
platformUtilsService: PlatformUtilsService,
|
|
|
|
environmentService: EnvironmentService,
|
|
|
|
datePipe: DatePipe,
|
2021-12-15 23:32:00 +01:00
|
|
|
sendService: SendService,
|
|
|
|
stateService: StateService,
|
2021-10-21 11:10:36 +02:00
|
|
|
messagingService: MessagingService,
|
|
|
|
policyService: PolicyService,
|
|
|
|
logService: LogService
|
|
|
|
) {
|
2021-02-03 22:24:49 +01:00
|
|
|
super(
|
|
|
|
i18nService,
|
|
|
|
platformUtilsService,
|
|
|
|
environmentService,
|
2021-12-15 23:32:00 +01:00
|
|
|
datePipe,
|
|
|
|
sendService,
|
|
|
|
messagingService,
|
|
|
|
policyService,
|
|
|
|
logService,
|
|
|
|
stateService
|
|
|
|
);
|
2021-02-09 21:57:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async refresh() {
|
2021-02-16 19:11:14 +01:00
|
|
|
this.password = null;
|
2021-02-09 21:57:10 +01:00
|
|
|
const send = await this.loadSend();
|
|
|
|
this.send = await send.decrypt();
|
2021-02-10 20:15:10 +01:00
|
|
|
this.hasPassword = this.send.password != null && this.send.password.trim() !== "";
|
2021-02-16 17:52:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cancel() {
|
|
|
|
this.onCancelled.emit(this.send);
|
2021-02-03 22:24:49 +01:00
|
|
|
}
|
2021-02-18 19:03:20 +01:00
|
|
|
|
2021-05-12 22:38:02 +02:00
|
|
|
async copyLinkToClipboard(link: string) {
|
2021-02-18 19:03:20 +01:00
|
|
|
super.copyLinkToClipboard(link);
|
|
|
|
this.platformUtilsService.showToast(
|
|
|
|
"success",
|
|
|
|
null,
|
|
|
|
this.i18nService.t("valueCopied", this.i18nService.t("sendLink"))
|
|
|
|
);
|
|
|
|
}
|
2021-02-03 22:24:49 +01:00
|
|
|
}
|