From 8847991bba4c552bc1fef0ce91b0a0c8e13b2242 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 26 Jan 2018 11:48:43 -0500 Subject: [PATCH] show attachments properly if an organization --- src/App/Pages/Vault/VaultAttachmentsPage.cs | 27 ++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/App/Pages/Vault/VaultAttachmentsPage.cs b/src/App/Pages/Vault/VaultAttachmentsPage.cs index 58b1a4660..92eab0f7d 100644 --- a/src/App/Pages/Vault/VaultAttachmentsPage.cs +++ b/src/App/Pages/Vault/VaultAttachmentsPage.cs @@ -49,6 +49,7 @@ namespace Bit.App.Pages public Label FileLabel { get; set; } public ExtendedTableView NewTable { get; set; } public Label NoDataLabel { get; set; } + public ToolbarItem SaveToolbarItem { get; set; } private void Init() { @@ -110,11 +111,6 @@ namespace Bit.App.Pages VerticalOptions = LayoutOptions.FillAndExpand }; - if(_tokenService.TokenPremium) - { - ListView.Footer = NewTable; - } - NoDataLabel = new Label { Text = AppResources.NoAttachments, @@ -130,7 +126,7 @@ namespace Bit.App.Pages Margin = new Thickness(0, 40, 0, 0) }; - var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => + SaveToolbarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async () => { if(_lastAction.LastActionWasRecent() || _cipher == null) { @@ -183,11 +179,6 @@ namespace Bit.App.Pages Title = AppResources.Attachments; Content = ListView; - if(_tokenService.TokenPremium) - { - ToolbarItems.Add(saveToolBarItem); - } - if(Device.RuntimePlatform == Device.iOS) { ListView.RowHeight = -1; @@ -209,10 +200,18 @@ namespace Bit.App.Pages ListView.ItemSelected += AttachmentSelected; await LoadAttachmentsAsync(); - if(_tokenService.TokenPremium && !_canUseAttachments) + if(_cipher != null && (_tokenService.TokenPremium || _cipher.OrganizationId != null)) { - await ShowUpdateKeyAsync(); + ToolbarItems.Add(SaveToolbarItem); + ListView.Footer = NewTable; + + if(!_canUseAttachments) + { + await ShowUpdateKeyAsync(); + } } + + // TODO: else show alert about needing premium membership } protected override void OnDisappearing() @@ -314,7 +313,7 @@ namespace Bit.App.Pages private async Task ShowUpdateKeyAsync() { - var confirmed = await DisplayAlert(AppResources.FeatureUnavailable, AppResources.UpdateKey, + var confirmed = await DisplayAlert(AppResources.FeatureUnavailable, AppResources.UpdateKey, AppResources.LearnMore, AppResources.Cancel); if(confirmed) {