From 4a136315d53087e0dd8443672783f6f943f4548d Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 23 Jul 2016 15:32:11 -0400 Subject: [PATCH] Control showing status bar for home page --- src/App/Controls/DismissModalToolBarItem.cs | 5 ++++- src/App/Pages/HomePage.cs | 8 ++++++++ src/App/Pages/LoginPage.cs | 9 ++++++++- src/App/Pages/RegisterPage.cs | 8 +++++++- src/iOS/AppDelegate.cs | 8 ++++++++ src/iOS/Info.plist | 12 ++---------- 6 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/App/Controls/DismissModalToolBarItem.cs b/src/App/Controls/DismissModalToolBarItem.cs index 9d9a9ce15..0488fd918 100644 --- a/src/App/Controls/DismissModalToolBarItem.cs +++ b/src/App/Controls/DismissModalToolBarItem.cs @@ -6,9 +6,11 @@ namespace Bit.App.Controls public class DismissModalToolBarItem : ToolbarItem { private readonly ContentPage _page; + private readonly Action _cancelClickedAction; - public DismissModalToolBarItem(ContentPage page, string text = null) + public DismissModalToolBarItem(ContentPage page, string text = null, Action cancelClickedAction = null) { + _cancelClickedAction = cancelClickedAction; _page = page; Text = text ?? "Close"; Clicked += ClickedItem; @@ -17,6 +19,7 @@ namespace Bit.App.Controls private async void ClickedItem(object sender, EventArgs e) { + _cancelClickedAction?.Invoke(); await _page.Navigation.PopModalAsync(); } } diff --git a/src/App/Pages/HomePage.cs b/src/App/Pages/HomePage.cs index 21ac7a245..25d20e2e2 100644 --- a/src/App/Pages/HomePage.cs +++ b/src/App/Pages/HomePage.cs @@ -27,6 +27,8 @@ namespace Bit.App.Pages public void Init() { + MessagingCenter.Send(Application.Current, "ShowStatusBar", false); + var logo = new Image { Source = "logo", @@ -74,6 +76,12 @@ namespace Bit.App.Pages Content = new ScrollView { Content = buttonStackLayout }; } + protected override void OnAppearing() + { + base.OnAppearing(); + MessagingCenter.Send(Application.Current, "ShowStatusBar", false); + } + public async Task LoginAsync() { await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage())); diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index 0250e5d49..82556f396 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -38,6 +38,8 @@ namespace Bit.App.Pages private void Init() { + MessagingCenter.Send(Application.Current, "ShowStatusBar", true); + var padding = new Thickness(15, 20); PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, @@ -87,7 +89,10 @@ namespace Bit.App.Pages { table.RowHeight = -1; table.EstimatedRowHeight = 70; - ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel")); + ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel", () => + { + MessagingCenter.Send(Application.Current, "ShowStatusBar", false); + })); } var loginToolbarItem = new ToolbarItem(AppResources.LogIn, null, async () => @@ -104,6 +109,7 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); + MessagingCenter.Send(Application.Current, "ShowStatusBar", true); EmailCell.Entry.Focus(); } @@ -111,6 +117,7 @@ namespace Bit.App.Pages { await LogIn(); } + private async Task ForgotPasswordAsync() { await Navigation.PushAsync(new PasswordHintPage()); diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index ab48edb07..1cc6183e2 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -33,6 +33,8 @@ namespace Bit.App.Pages private void Init() { + MessagingCenter.Send(Application.Current, "ShowStatusBar", true); + var padding = new Thickness(15, 20); PasswordHintCell = new FormEntryCell("Master Password Hint (optional)", useLabelAsPlaceholder: true, @@ -117,7 +119,10 @@ namespace Bit.App.Pages { table.RowHeight = table2.RowHeight = table2.RowHeight = -1; table.EstimatedRowHeight = table2.EstimatedRowHeight = table2.EstimatedRowHeight = 70; - ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel")); + ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel", () => + { + MessagingCenter.Send(Application.Current, "ShowStatusBar", false); + })); } ToolbarItems.Add(loginToolbarItem); @@ -128,6 +133,7 @@ namespace Bit.App.Pages protected override void OnAppearing() { base.OnAppearing(); + MessagingCenter.Send(Application.Current, "ShowStatusBar", true); EmailCell.Entry.Focus(); } diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index ec1b2df07..7eaa4b81b 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -96,6 +96,14 @@ namespace Bit.iOS modal.PresentViewController(activityViewController, true, null); }); + UIApplication.SharedApplication.StatusBarHidden = false; + UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; + + MessagingCenter.Subscribe(Xamarin.Forms.Application.Current, "ShowStatusBar", (sender, show) => + { + UIApplication.SharedApplication.SetStatusBarHidden(!show, false); + }); + return base.FinishedLaunching(app, options); } diff --git a/src/iOS/Info.plist b/src/iOS/Info.plist index 447a893bf..746e35aa5 100644 --- a/src/iOS/Info.plist +++ b/src/iOS/Info.plist @@ -65,19 +65,11 @@ com.8bit.bitwarden.url - UIStatusBarTintParameters - - UINavigationBar - - Style - UIBarStyleBlack - Translucent - - - UIBackgroundModes remote-notification + UIStatusBarHidden +