From 84326811dda7d25324afaca980ff95ecdb52712b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 4 Jul 2016 23:11:44 -0400 Subject: [PATCH] Redid a few thigns on extension page with messaging. Added reanable button. Updated refresh icon to orange --- src/App/Pages/Tools/ToolsExtensionPage.cs | 45 +++++++++++------- .../Pages/Tools/ToolsPasswordGeneratorPage.cs | 1 - src/iOS/AppDelegate.cs | 6 +-- src/iOS/Resources/refresh.png | Bin 1017 -> 1017 bytes src/iOS/Resources/refresh@2x.png | Bin 1675 -> 1675 bytes src/iOS/Resources/refresh@3x.png | Bin 2229 -> 2229 bytes 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/App/Pages/Tools/ToolsExtensionPage.cs b/src/App/Pages/Tools/ToolsExtensionPage.cs index 1541a1f73..26ebb492e 100644 --- a/src/App/Pages/Tools/ToolsExtensionPage.cs +++ b/src/App/Pages/Tools/ToolsExtensionPage.cs @@ -58,8 +58,8 @@ namespace Bit.App.Pages var notStartedButton = new Button { Text = "Enable App Extension", - Command = new Command(() => ActivateExtension()), - VerticalOptions = LayoutOptions.End, + Command = new Command(() => ShowExtension()), + VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.Fill, Style = (Style)Application.Current.Resources["btn-primary"] }; @@ -105,8 +105,8 @@ namespace Bit.App.Pages var notActivatedButton = new Button { Text = "Enable App Extension", - Command = new Command(() => ActivateExtension()), - VerticalOptions = LayoutOptions.End, + Command = new Command(() => ShowExtension()), + VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.Fill, Style = (Style)Application.Current.Resources["btn-primary"] }; @@ -139,7 +139,8 @@ namespace Bit.App.Pages VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, - LineBreakMode = LineBreakMode.WordWrap + LineBreakMode = LineBreakMode.WordWrap, + Margin = new Thickness(0, 10, 0, 0) }; var activatedImage = new Image @@ -153,17 +154,26 @@ namespace Bit.App.Pages { Text = "See Supported Apps", Command = new Command(() => Device.OpenUri(new Uri("https://bitwarden.com"))), - VerticalOptions = LayoutOptions.End, + VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.Fill, Style = (Style)Application.Current.Resources["btn-primary"] }; + var activatedButtonReenable = new Button + { + Text = "Re-enable App Extension", + Command = new Command(() => ShowExtension()), + VerticalOptions = LayoutOptions.End, + HorizontalOptions = LayoutOptions.Fill, + Style = (Style)Application.Current.Resources["btn-primaryAccent"] + }; + var activatedStackLayout = new StackLayout { Orientation = StackOrientation.Vertical, - Spacing = 20, + Spacing = 10, Padding = new Thickness(30, 40), - Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton } + Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton, activatedButtonReenable } }; activatedStackLayout.SetBinding(IsVisibleProperty, m => m.StartedAndActivated); @@ -181,17 +191,20 @@ namespace Bit.App.Pages Title = "App Extension"; Content = stackLayout; BindingContext = Model; - - MessagingCenter.Subscribe(Application.Current, "EnabledAppExtension", (sender, enabled) => - { - Model.Started = true; - Model.Activated = enabled; - }); } - private void ActivateExtension() + private void ShowExtension() { - MessagingCenter.Send(Application.Current, "ShowAppExtension"); + MessagingCenter.Send(Application.Current, "ShowAppExtension", this); + } + + public void EnabledExtension(bool enabled) + { + Model.Started = true; + if(!Model.Activated && enabled) + { + Model.Activated = enabled; + } } } } diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs index 5cf5a7509..f7e279fa8 100644 --- a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs +++ b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs @@ -65,7 +65,6 @@ namespace Bit.App.Pages EnableScrolling = false, Intent = TableIntent.Settings, HasUnevenRows = true, - NoFooter = true, Root = new TableRoot { new TableSection diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 6aacf26c4..8f16e3209 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -23,6 +23,7 @@ using Bit.iOS.Core.Services; using PushNotification.Plugin; using Plugin.DeviceInfo; using Plugin.Connectivity.Abstractions; +using Bit.App.Pages; namespace Bit.iOS { @@ -52,7 +53,7 @@ namespace Bit.iOS UINavigationBar.Appearance.ShadowImage = new UIImage(); UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); - MessagingCenter.Subscribe(Xamarin.Forms.Application.Current, "ShowAppExtension", (sender) => + MessagingCenter.Subscribe(Xamarin.Forms.Application.Current, "ShowAppExtension", (sender, page) => { var itemProvider = new NSItemProvider(new NSDictionary(), "com.8bit.bitwarden.extension-setup"); var extensionItem = new NSExtensionItem(); @@ -60,8 +61,7 @@ namespace Bit.iOS var activityViewController = new UIActivityViewController(new NSExtensionItem[] { extensionItem }, null); activityViewController.CompletionHandler = (activityType, completed) => { - MessagingCenter.Send(Xamarin.Forms.Application.Current, "EnabledAppExtension", - completed && activityType == "com.8bit.bitwarden.find-login-action-extension"); + page.EnabledExtension(completed && activityType == "com.8bit.bitwarden.find-login-action-extension"); }; UIApplication.SharedApplication.KeyWindow.RootViewController.ModalViewController diff --git a/src/iOS/Resources/refresh.png b/src/iOS/Resources/refresh.png index 5ddde5968226e151ea889d91675f48f22689b1d2..8a58337940fb9cdc9b25e1823a3a4fe0157e1cad 100644 GIT binary patch delta 395 xcmey#{*!%zPW|iUWdn)o2iE%K_4M}r{5MSI3=9laB|(0{42(>hS26}L0RTFd0dN2S delta 395 wcmey#{*!%zPW|RdKL--k53Kc*>gnzKj5sGb1_p+zk|4ie21cgMD;Wcr0A;2cjsO4v diff --git a/src/iOS/Resources/refresh@2x.png b/src/iOS/Resources/refresh@2x.png index 9c264dd7489897a5b77300d61cd8759298df95d4..687eabc3a779babe13c2570c97181a32e4591d65 100644 GIT binary patch delta 523 zcmeC??dF}JQ~!E-*+8QDfwg{l{eb#@c^SRK->fS61p@=al9C|5UsDw0 delta 523 zcmeC??dF}JQ@?rA&w)hs18e=H`T_O*q@VN-|ET)RLktWIOG<+Lf*BZ@m^W)MC9?nk D6$W_; diff --git a/src/iOS/Resources/refresh@3x.png b/src/iOS/Resources/refresh@3x.png index 1778dc21831e2f5b96848de1ad160f64cf5371fb..f492ee5c76eb4148a6c9df31beb0143b2684d3ef 100644 GIT binary patch delta 563 ucmdlgxK(h1PW|iUWdn)o2iE%K^#khrIc;KlYS0#_^T5U{+zG&U)$`@l*R@C3TK{4