From 92764eeae040f35a90502434cd8db78340d2def5 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 26 Jun 2019 10:05:31 -0400 Subject: [PATCH] hide status bar on homepage for ios --- src/App/Pages/Accounts/EnvironmentPage.xaml.cs | 12 +++++++++--- src/App/Pages/Accounts/HomePage.xaml.cs | 12 ++++++++++++ src/App/Pages/Accounts/LoginPage.xaml.cs | 12 +++++++++--- src/App/Pages/Accounts/RegisterPage.xaml.cs | 12 +++++++++--- src/iOS/AppDelegate.cs | 3 ++- 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/App/Pages/Accounts/EnvironmentPage.xaml.cs b/src/App/Pages/Accounts/EnvironmentPage.xaml.cs index 9f32d8b57..3e6e7b209 100644 --- a/src/App/Pages/Accounts/EnvironmentPage.xaml.cs +++ b/src/App/Pages/Accounts/EnvironmentPage.xaml.cs @@ -1,14 +1,19 @@ -using System; +using Bit.Core.Abstractions; +using Bit.Core.Utilities; +using System; using Xamarin.Forms; namespace Bit.App.Pages { public partial class EnvironmentPage : BaseContentPage { - private EnvironmentPageViewModel _vm; + private readonly IMessagingService _messagingService; + private readonly EnvironmentPageViewModel _vm; public EnvironmentPage() { + _messagingService = ServiceContainer.Resolve("messagingService"); + _messagingService.Send("showStatusBar", true); InitializeComponent(); _vm = BindingContext as EnvironmentPageViewModel; _vm.Page = this; @@ -33,10 +38,11 @@ namespace Bit.App.Pages } } - private async void Close_Clicked(object sender, System.EventArgs e) + private async void Close_Clicked(object sender, EventArgs e) { if(DoOnce()) { + _messagingService.Send("showStatusBar", false); await Navigation.PopModalAsync(); } } diff --git a/src/App/Pages/Accounts/HomePage.xaml.cs b/src/App/Pages/Accounts/HomePage.xaml.cs index 19af20143..b76ca6a71 100644 --- a/src/App/Pages/Accounts/HomePage.xaml.cs +++ b/src/App/Pages/Accounts/HomePage.xaml.cs @@ -1,4 +1,6 @@ using Bit.App.Utilities; +using Bit.Core.Abstractions; +using Bit.Core.Utilities; using System; using System.Threading.Tasks; using Xamarin.Forms; @@ -7,8 +9,12 @@ namespace Bit.App.Pages { public partial class HomePage : BaseContentPage { + private IMessagingService _messagingService; + public HomePage() { + _messagingService = ServiceContainer.Resolve("messagingService"); + _messagingService.Send("showStatusBar", false); InitializeComponent(); var theme = ThemeManager.GetTheme(Device.RuntimePlatform == Device.Android); var darkbasedTheme = theme == "dark" || theme == "black" || theme == "nord"; @@ -21,6 +27,12 @@ namespace Bit.App.Pages await Navigation.PushModalAsync(new NavigationPage(new LoginPage(email))); } + protected override void OnAppearing() + { + base.OnAppearing(); + _messagingService.Send("showStatusBar", false); + } + private void LogIn_Clicked(object sender, EventArgs e) { if(DoOnce()) diff --git a/src/App/Pages/Accounts/LoginPage.xaml.cs b/src/App/Pages/Accounts/LoginPage.xaml.cs index 3913bcdef..0a26702d4 100644 --- a/src/App/Pages/Accounts/LoginPage.xaml.cs +++ b/src/App/Pages/Accounts/LoginPage.xaml.cs @@ -1,14 +1,19 @@ -using System; +using Bit.Core.Abstractions; +using Bit.Core.Utilities; +using System; using Xamarin.Forms; namespace Bit.App.Pages { public partial class LoginPage : BaseContentPage { - private LoginPageViewModel _vm; + private readonly IMessagingService _messagingService; + private readonly LoginPageViewModel _vm; public LoginPage(string email = null) { + _messagingService = ServiceContainer.Resolve("messagingService"); + _messagingService.Send("showStatusBar", true); InitializeComponent(); _vm = BindingContext as LoginPageViewModel; _vm.Page = this; @@ -55,10 +60,11 @@ namespace Bit.App.Pages } } - private async void Close_Clicked(object sender, System.EventArgs e) + private async void Close_Clicked(object sender, EventArgs e) { if(DoOnce()) { + _messagingService.Send("showStatusBar", false); await Navigation.PopModalAsync(); } } diff --git a/src/App/Pages/Accounts/RegisterPage.xaml.cs b/src/App/Pages/Accounts/RegisterPage.xaml.cs index 54d95eb73..8254b9ad9 100644 --- a/src/App/Pages/Accounts/RegisterPage.xaml.cs +++ b/src/App/Pages/Accounts/RegisterPage.xaml.cs @@ -1,14 +1,19 @@ -using System; +using Bit.Core.Abstractions; +using Bit.Core.Utilities; +using System; using Xamarin.Forms; namespace Bit.App.Pages { public partial class RegisterPage : BaseContentPage { - private RegisterPageViewModel _vm; + private readonly IMessagingService _messagingService; + private readonly RegisterPageViewModel _vm; public RegisterPage(HomePage homePage) { + _messagingService = ServiceContainer.Resolve("messagingService"); + _messagingService.Send("showStatusBar", true); InitializeComponent(); _vm = BindingContext as RegisterPageViewModel; _vm.Page = this; @@ -51,10 +56,11 @@ namespace Bit.App.Pages } } - private async void Close_Clicked(object sender, System.EventArgs e) + private async void Close_Clicked(object sender, EventArgs e) { if(DoOnce()) { + _messagingService.Send("showStatusBar", false); await Navigation.PopModalAsync(); } } diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 5b0dc9655..08e602334 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -80,7 +80,8 @@ namespace Bit.iOS } else if(message.Command == "showStatusBar") { - UIApplication.SharedApplication.SetStatusBarHidden(!(bool)message.Data, false); + Device.BeginInvokeOnMainThread(() => + UIApplication.SharedApplication.SetStatusBarHidden(!(bool)message.Data, false)); } else if(message.Command == "syncCompleted") {