add send link copy (#11160)

This commit is contained in:
Jordan Aasen 2024-09-19 12:59:25 -07:00 committed by GitHub
parent ca1dce4625
commit 01f668e648
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View File

@ -21,6 +21,19 @@
[originalSendView]="originalSendView"
></tools-send-file-details>
<bit-form-field *ngIf="sendLink">
<bit-label>{{ "sendLink" | i18n }}</bit-label>
<input bitInput type="text" [value]="sendLink" readonly />
<button
type="button"
bitSuffix
showToast
bitIconButton="bwi-clone"
[appCopyClick]="sendLink"
[appA11yTitle]="'copySendLink' | i18n"
></button>
</bit-form-field>
<bit-form-field>
<bit-label>{{ "deletionDate" | i18n }}</bit-label>
<bit-select

View File

@ -1,8 +1,10 @@
import { CommonModule, DatePipe } from "@angular/common";
import { Component, OnInit } from "@angular/core";
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
import { firstValueFrom } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import {
@ -47,17 +49,27 @@ import { SendTextDetailsComponent } from "./send-text-details.component";
export class SendDetailsComponent extends BaseSendDetailsComponent implements OnInit {
FileSendType = SendType.File;
TextSendType = SendType.Text;
sendLink: string | null = null;
constructor(
protected sendFormContainer: SendFormContainer,
protected formBuilder: FormBuilder,
protected i18nService: I18nService,
protected datePipe: DatePipe,
protected environmentService: EnvironmentService,
) {
super(sendFormContainer, formBuilder, i18nService, datePipe);
}
async getSendLink() {}
async ngOnInit() {
await super.ngOnInit();
if (!this.originalSendView) {
return;
}
const env = await firstValueFrom(this.environmentService.environment$);
this.sendLink =
env.getSendUrl() + this.originalSendView.accessId + "/" + this.originalSendView.urlB64Key;
}
}