diff --git a/src/app/send/add-edit.component.html b/src/app/send/add-edit.component.html index 3a052531e1a..e23b8932736 100644 --- a/src/app/send/add-edit.component.html +++ b/src/app/send/add-edit.component.html @@ -12,7 +12,8 @@
-
@@ -34,7 +35,7 @@
- +
@@ -62,13 +63,14 @@ + name="DeletionDate" [(ngModel)]="deletionDate" required *ngIf="deletionDateSelect === 0" + placeholder="MM/DD/YYYY HH:MM AM/PM">
+ [(ngModel)]="deletionDate" required placeholder="MM/DD/YYYY HH:MM AM/PM">
+
{{'deletionDateDesc' | i18n}}
@@ -85,12 +87,13 @@ + *ngIf="expirationDateSelect === 0" placeholder="MM/DD/YYYY HH:MM AM/PM">
+ [(ngModel)]="expirationDate" placeholder="MM/DD/YYYY HH:MM AM/PM">
+
{{'expirationDateDesc' | i18n}}
@@ -98,6 +101,7 @@ +
{{'maxAccessCountDesc' | i18n}}
@@ -111,11 +115,13 @@ +
{{'sendPasswordDesc' | i18n}}
+
{{'sendNotesDesc' | i18n}}
@@ -124,6 +130,7 @@
+

{{'share' | i18n}}

diff --git a/src/app/send/add-edit.component.ts b/src/app/send/add-edit.component.ts index cce9e747da8..8c6af65a823 100644 --- a/src/app/send/add-edit.component.ts +++ b/src/app/send/add-edit.component.ts @@ -10,11 +10,12 @@ import { Component } from '@angular/core'; import { SendType } from 'jslib/enums/sendType'; -import { ApiService } from 'jslib/abstractions/api.service'; import { EnvironmentService } from 'jslib/abstractions/environment.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; +import { MessagingService } from 'jslib/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { SendService } from 'jslib/abstractions/send.service'; +import { UserService } from 'jslib/abstractions/user.service'; import { SendView } from 'jslib/models/view/sendView'; import { SendFileView } from 'jslib/models/view/sendFileView'; @@ -22,8 +23,6 @@ import { SendTextView } from 'jslib/models/view/sendTextView'; import { Send } from 'jslib/models/domain/send'; -import { SendData } from 'jslib/models/data/sendData'; - @Component({ selector: 'app-send-add-edit', templateUrl: 'add-edit.component.html', @@ -52,10 +51,13 @@ export class AddEditComponent { expirationDateOptions: any[]; deletionDateSelect = 168; expirationDateSelect: number = null; + canAccessPremium = true; + premiumRequiredAlertShown = false; constructor(private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private environmentService: EnvironmentService, private datePipe: DatePipe, - private sendService: SendService) { + private sendService: SendService, private userService: UserService, + private messagingService: MessagingService) { this.typeOptions = [ { name: i18nService.t('sendTypeFile'), value: SendType.File }, { name: i18nService.t('sendTypeText'), value: SendType.Text }, @@ -87,6 +89,11 @@ export class AddEditComponent { this.title = this.i18nService.t('createSend'); } + this.canAccessPremium = await this.userService.canAccessPremium(); + if (!this.canAccessPremium) { + this.type = SendType.Text; + } + if (this.send == null) { if (this.editMode) { const send = await this.loadSend(); @@ -194,6 +201,13 @@ export class AddEditComponent { } catch { } } + typeChanged() { + if (!this.canAccessPremium && this.send.type == SendType.File && !this.premiumRequiredAlertShown) { + this.premiumRequiredAlertShown = true; + this.messagingService.send('premiumRequired'); + } + } + protected async loadSend(): Promise { return this.sendService.get(this.sendId); } diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 234208f1a25..6f05f75bda7 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -3319,15 +3319,35 @@ "deletionDate": { "message": "Deletion Date" }, + "deletionDateDesc": { + "message": "The Send will be permanently deleted on the specified date and time.", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." + }, "expirationDate": { "message": "Expiration Date" }, + "expirationDateDesc": { + "message": "If set, access to this Send will expire on the specified date and time.", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." + }, "maxAccessCount": { "message": "Maximum Access Count" }, + "maxAccessCountDesc": { + "message": "If set, users will no longer be able to access this send once the maximum access count is reached.", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." + }, "currentAccessCount": { "message": "Current Access Count" }, + "sendPasswordDesc": { + "message": "Optionally require a password for users to access this Send.", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." + }, + "sendNotesDesc": { + "message": "Private notes about this Send.", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." + }, "disabled": { "message": "Disabled" }, @@ -3565,5 +3585,9 @@ }, "custom": { "message": "Custom" + }, + "textHiddenByDefault": { + "message": "When accessing the Send, hide the text by default", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." } }