mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-11 10:10:25 +01:00
[PM-254] Set PDF Attachments in Web to download, add success toast (#10757)
* add success toast to pdf attachment download in web * update desktop attachments for toastService * removed trailing comma --------- Co-authored-by: gbubemismith <gsmithwalter@gmail.com> Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
This commit is contained in:
parent
2cfbfcbdfe
commit
89751f46d6
@ -4309,6 +4309,9 @@
|
|||||||
"enterprisePolicyRequirementsApplied": {
|
"enterprisePolicyRequirementsApplied": {
|
||||||
"message": "Enterprise policy requirements have been applied to this setting"
|
"message": "Enterprise policy requirements have been applied to this setting"
|
||||||
},
|
},
|
||||||
|
"fileSavedToDevice": {
|
||||||
|
"message": "File saved to device. Manage from your device downloads."
|
||||||
|
},
|
||||||
"showCharacterCount": {
|
"showCharacterCount": {
|
||||||
"message": "Show character count"
|
"message": "Show character count"
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
|||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-attachments",
|
selector: "app-vault-attachments",
|
||||||
@ -38,6 +38,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On
|
|||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
cipherService,
|
cipherService,
|
||||||
@ -52,6 +53,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On
|
|||||||
dialogService,
|
dialogService,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3061,5 +3061,8 @@
|
|||||||
},
|
},
|
||||||
"ssoError": {
|
"ssoError": {
|
||||||
"message": "No free ports could be found for the sso login."
|
"message": "No free ports could be found for the sso login."
|
||||||
|
},
|
||||||
|
"fileSavedToDevice": {
|
||||||
|
"message": "File saved to device. Manage from your device downloads."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
|||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-attachments",
|
selector: "app-vault-attachments",
|
||||||
@ -30,6 +30,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
|||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
cipherService,
|
cipherService,
|
||||||
@ -44,6 +45,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
|||||||
dialogService,
|
dialogService,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "emergency-access-attachments",
|
selector: "emergency-access-attachments",
|
||||||
@ -34,6 +34,7 @@ export class EmergencyAccessAttachmentsComponent extends BaseAttachmentsComponen
|
|||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
cipherService,
|
cipherService,
|
||||||
@ -48,6 +49,7 @@ export class EmergencyAccessAttachmentsComponent extends BaseAttachmentsComponen
|
|||||||
dialogService,
|
dialogService,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,14 +12,12 @@ export class WebFileDownloadService implements FileDownloadService {
|
|||||||
download(request: FileDownloadRequest): void {
|
download(request: FileDownloadRequest): void {
|
||||||
const builder = new FileDownloadBuilder(request);
|
const builder = new FileDownloadBuilder(request);
|
||||||
const a = window.document.createElement("a");
|
const a = window.document.createElement("a");
|
||||||
if (builder.downloadMethod === "save") {
|
if (!this.platformUtilsService.isSafari()) {
|
||||||
a.download = request.fileName;
|
|
||||||
} else if (!this.platformUtilsService.isSafari()) {
|
|
||||||
a.rel = "noreferrer";
|
a.rel = "noreferrer";
|
||||||
a.target = "_blank";
|
a.target = "_blank";
|
||||||
}
|
}
|
||||||
a.href = URL.createObjectURL(builder.blob);
|
a.href = URL.createObjectURL(builder.blob);
|
||||||
a.style.position = "fixed";
|
a.download = request.fileName;
|
||||||
window.document.body.appendChild(a);
|
window.document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
window.document.body.removeChild(a);
|
window.document.body.removeChild(a);
|
||||||
|
@ -12,7 +12,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-vault-attachments",
|
selector: "app-vault-attachments",
|
||||||
@ -33,6 +33,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
|||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
cipherService,
|
cipherService,
|
||||||
@ -47,6 +48,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
|||||||
dialogService,
|
dialogService,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
|
|||||||
import { CipherData } from "@bitwarden/common/vault/models/data/cipher.data";
|
import { CipherData } from "@bitwarden/common/vault/models/data/cipher.data";
|
||||||
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
||||||
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { AttachmentsComponent as BaseAttachmentsComponent } from "../individual-vault/attachments.component";
|
import { AttachmentsComponent as BaseAttachmentsComponent } from "../individual-vault/attachments.component";
|
||||||
|
|
||||||
@ -39,6 +39,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On
|
|||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
billingAccountProfileStateService: BillingAccountProfileStateService,
|
billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
accountService: AccountService,
|
accountService: AccountService,
|
||||||
|
toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
cipherService,
|
cipherService,
|
||||||
@ -52,6 +53,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On
|
|||||||
dialogService,
|
dialogService,
|
||||||
billingAccountProfileStateService,
|
billingAccountProfileStateService,
|
||||||
accountService,
|
accountService,
|
||||||
|
toastService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9070,6 +9070,9 @@
|
|||||||
"secretsManagerWithFreePasswordManagerInfo": {
|
"secretsManagerWithFreePasswordManagerInfo": {
|
||||||
"message": "Your complementary one year Password Manager subscription will upgrade to the selected plan. You will not be charged until the complimentary period is over."
|
"message": "Your complementary one year Password Manager subscription will upgrade to the selected plan. You will not be charged until the complimentary period is over."
|
||||||
},
|
},
|
||||||
|
"fileSavedToDevice": {
|
||||||
|
"message": "File saved to device. Manage from your device downloads."
|
||||||
|
},
|
||||||
"publicApi": {
|
"publicApi": {
|
||||||
"message": "Public API",
|
"message": "Public API",
|
||||||
"description": "The text, 'API', is an acronymn and should not be translated."
|
"description": "The text, 'API', is an acronymn and should not be translated."
|
||||||
|
@ -17,7 +17,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi
|
|||||||
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
|
||||||
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
||||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class AttachmentsComponent implements OnInit {
|
export class AttachmentsComponent implements OnInit {
|
||||||
@ -49,6 +49,7 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
protected dialogService: DialogService,
|
protected dialogService: DialogService,
|
||||||
protected billingAccountProfileStateService: BillingAccountProfileStateService,
|
protected billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
protected accountService: AccountService,
|
protected accountService: AccountService,
|
||||||
|
protected toastService: ToastService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@ -182,6 +183,11 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
fileName: attachment.fileName,
|
fileName: attachment.fileName,
|
||||||
blobData: decBuf,
|
blobData: decBuf,
|
||||||
});
|
});
|
||||||
|
this.toastService.showToast({
|
||||||
|
variant: "success",
|
||||||
|
title: null,
|
||||||
|
message: this.i18nService.t("fileSavedToDevice"),
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("errorOccurred"));
|
this.platformUtilsService.showToast("error", null, this.i18nService.t("errorOccurred"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user