hide status bar on homepage for ios

This commit is contained in:
Kyle Spearrin 2019-06-26 10:05:31 -04:00
parent b72808ab40
commit 92764eeae0
5 changed files with 41 additions and 10 deletions

View file

@ -1,14 +1,19 @@
using System; using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using System;
using Xamarin.Forms; using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public partial class EnvironmentPage : BaseContentPage public partial class EnvironmentPage : BaseContentPage
{ {
private EnvironmentPageViewModel _vm; private readonly IMessagingService _messagingService;
private readonly EnvironmentPageViewModel _vm;
public EnvironmentPage() public EnvironmentPage()
{ {
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
_messagingService.Send("showStatusBar", true);
InitializeComponent(); InitializeComponent();
_vm = BindingContext as EnvironmentPageViewModel; _vm = BindingContext as EnvironmentPageViewModel;
_vm.Page = this; _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()) if(DoOnce())
{ {
_messagingService.Send("showStatusBar", false);
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
} }

View file

@ -1,4 +1,6 @@
using Bit.App.Utilities; using Bit.App.Utilities;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
@ -7,8 +9,12 @@ namespace Bit.App.Pages
{ {
public partial class HomePage : BaseContentPage public partial class HomePage : BaseContentPage
{ {
private IMessagingService _messagingService;
public HomePage() public HomePage()
{ {
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
_messagingService.Send("showStatusBar", false);
InitializeComponent(); InitializeComponent();
var theme = ThemeManager.GetTheme(Device.RuntimePlatform == Device.Android); var theme = ThemeManager.GetTheme(Device.RuntimePlatform == Device.Android);
var darkbasedTheme = theme == "dark" || theme == "black" || theme == "nord"; var darkbasedTheme = theme == "dark" || theme == "black" || theme == "nord";
@ -21,6 +27,12 @@ namespace Bit.App.Pages
await Navigation.PushModalAsync(new NavigationPage(new LoginPage(email))); 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) private void LogIn_Clicked(object sender, EventArgs e)
{ {
if(DoOnce()) if(DoOnce())

View file

@ -1,14 +1,19 @@
using System; using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using System;
using Xamarin.Forms; using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public partial class LoginPage : BaseContentPage public partial class LoginPage : BaseContentPage
{ {
private LoginPageViewModel _vm; private readonly IMessagingService _messagingService;
private readonly LoginPageViewModel _vm;
public LoginPage(string email = null) public LoginPage(string email = null)
{ {
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
_messagingService.Send("showStatusBar", true);
InitializeComponent(); InitializeComponent();
_vm = BindingContext as LoginPageViewModel; _vm = BindingContext as LoginPageViewModel;
_vm.Page = this; _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()) if(DoOnce())
{ {
_messagingService.Send("showStatusBar", false);
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
} }

View file

@ -1,14 +1,19 @@
using System; using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using System;
using Xamarin.Forms; using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public partial class RegisterPage : BaseContentPage public partial class RegisterPage : BaseContentPage
{ {
private RegisterPageViewModel _vm; private readonly IMessagingService _messagingService;
private readonly RegisterPageViewModel _vm;
public RegisterPage(HomePage homePage) public RegisterPage(HomePage homePage)
{ {
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
_messagingService.Send("showStatusBar", true);
InitializeComponent(); InitializeComponent();
_vm = BindingContext as RegisterPageViewModel; _vm = BindingContext as RegisterPageViewModel;
_vm.Page = this; _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()) if(DoOnce())
{ {
_messagingService.Send("showStatusBar", false);
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
} }

View file

@ -80,7 +80,8 @@ namespace Bit.iOS
} }
else if(message.Command == "showStatusBar") 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") else if(message.Command == "syncCompleted")
{ {