Control showing status bar for home page

This commit is contained in:
Kyle Spearrin 2016-07-23 15:32:11 -04:00
parent 3b7ade30a8
commit 4a136315d5
6 changed files with 37 additions and 13 deletions

View file

@ -6,9 +6,11 @@ namespace Bit.App.Controls
public class DismissModalToolBarItem : ToolbarItem public class DismissModalToolBarItem : ToolbarItem
{ {
private readonly ContentPage _page; 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; _page = page;
Text = text ?? "Close"; Text = text ?? "Close";
Clicked += ClickedItem; Clicked += ClickedItem;
@ -17,6 +19,7 @@ namespace Bit.App.Controls
private async void ClickedItem(object sender, EventArgs e) private async void ClickedItem(object sender, EventArgs e)
{ {
_cancelClickedAction?.Invoke();
await _page.Navigation.PopModalAsync(); await _page.Navigation.PopModalAsync();
} }
} }

View file

@ -27,6 +27,8 @@ namespace Bit.App.Pages
public void Init() public void Init()
{ {
MessagingCenter.Send(Application.Current, "ShowStatusBar", false);
var logo = new Image var logo = new Image
{ {
Source = "logo", Source = "logo",
@ -74,6 +76,12 @@ namespace Bit.App.Pages
Content = new ScrollView { Content = buttonStackLayout }; Content = new ScrollView { Content = buttonStackLayout };
} }
protected override void OnAppearing()
{
base.OnAppearing();
MessagingCenter.Send(Application.Current, "ShowStatusBar", false);
}
public async Task LoginAsync() public async Task LoginAsync()
{ {
await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage())); await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage()));

View file

@ -38,6 +38,8 @@ namespace Bit.App.Pages
private void Init() private void Init()
{ {
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
var padding = new Thickness(15, 20); var padding = new Thickness(15, 20);
PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true,
@ -87,7 +89,10 @@ namespace Bit.App.Pages
{ {
table.RowHeight = -1; table.RowHeight = -1;
table.EstimatedRowHeight = 70; 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 () => var loginToolbarItem = new ToolbarItem(AppResources.LogIn, null, async () =>
@ -104,6 +109,7 @@ namespace Bit.App.Pages
protected override void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
EmailCell.Entry.Focus(); EmailCell.Entry.Focus();
} }
@ -111,6 +117,7 @@ namespace Bit.App.Pages
{ {
await LogIn(); await LogIn();
} }
private async Task ForgotPasswordAsync() private async Task ForgotPasswordAsync()
{ {
await Navigation.PushAsync(new PasswordHintPage()); await Navigation.PushAsync(new PasswordHintPage());

View file

@ -33,6 +33,8 @@ namespace Bit.App.Pages
private void Init() private void Init()
{ {
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
var padding = new Thickness(15, 20); var padding = new Thickness(15, 20);
PasswordHintCell = new FormEntryCell("Master Password Hint (optional)", useLabelAsPlaceholder: true, 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.RowHeight = table2.RowHeight = table2.RowHeight = -1;
table.EstimatedRowHeight = table2.EstimatedRowHeight = table2.EstimatedRowHeight = 70; 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); ToolbarItems.Add(loginToolbarItem);
@ -128,6 +133,7 @@ namespace Bit.App.Pages
protected override void OnAppearing() protected override void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
EmailCell.Entry.Focus(); EmailCell.Entry.Focus();
} }

View file

@ -96,6 +96,14 @@ namespace Bit.iOS
modal.PresentViewController(activityViewController, true, null); modal.PresentViewController(activityViewController, true, null);
}); });
UIApplication.SharedApplication.StatusBarHidden = false;
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
MessagingCenter.Subscribe<Xamarin.Forms.Application, bool>(Xamarin.Forms.Application.Current, "ShowStatusBar", (sender, show) =>
{
UIApplication.SharedApplication.SetStatusBarHidden(!show, false);
});
return base.FinishedLaunching(app, options); return base.FinishedLaunching(app, options);
} }

View file

@ -65,19 +65,11 @@
<string>com.8bit.bitwarden.url</string> <string>com.8bit.bitwarden.url</string>
</dict> </dict>
</array> </array>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleBlack</string>
<key>Translucent</key>
<true/>
</dict>
</dict>
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>
<string>remote-notification</string> <string>remote-notification</string>
</array> </array>
<key>UIStatusBarHidden</key>
<true/>
</dict> </dict>
</plist> </plist>