diff --git a/src/App/App.cs b/src/App/App.cs index de5cad9d1..6fb94a646 100644 --- a/src/App/App.cs +++ b/src/App/App.cs @@ -56,7 +56,7 @@ namespace Bit.App } else { - MainPage = new HomePage(); + MainPage = new ExtendedNavigationPage(new HomePage()); } MessagingCenter.Subscribe(Current, "Resumed", async (sender, args) => @@ -203,7 +203,7 @@ namespace Bit.App _googleAnalyticsService.TrackAppEvent("LoggedOut"); _googleAnalyticsService.RefreshUserId(); - Current.MainPage = new HomePage(); + Current.MainPage = new ExtendedNavigationPage(new HomePage()); if(!string.IsNullOrWhiteSpace(logoutMessage)) { _userDialogs.Toast(logoutMessage); diff --git a/src/App/Pages/HomePage.cs b/src/App/Pages/HomePage.cs index d27d31e9e..a60427af7 100644 --- a/src/App/Pages/HomePage.cs +++ b/src/App/Pages/HomePage.cs @@ -77,6 +77,7 @@ namespace Bit.App.Pages }; Title = "bitwarden"; + NavigationPage.SetHasNavigationBar(this, false); Content = new ScrollView { Content = buttonStackLayout }; } @@ -88,18 +89,18 @@ namespace Bit.App.Pages public async Task LoginAsync() { - await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage())); + await Navigation.PushForDeviceAsync(new LoginPage()); } public async Task RegisterAsync() { - await Navigation.PushModalAsync(new ExtendedNavigationPage(new RegisterPage(this))); + await Navigation.PushForDeviceAsync(new RegisterPage(this)); } public async Task DismissRegisterAndLoginAsync(string email) { - await Navigation.PopModalAsync(); - await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage(email))); + await Navigation.PopForDeviceAsync(); + await Navigation.PushForDeviceAsync(new LoginPage(email)); _userDialogs.Toast("Your new account has been created! You may now log in."); } } diff --git a/src/App/Pages/Settings/SettingsAddFolderPage.cs b/src/App/Pages/Settings/SettingsAddFolderPage.cs index 30781e068..a3087af8f 100644 --- a/src/App/Pages/Settings/SettingsAddFolderPage.cs +++ b/src/App/Pages/Settings/SettingsAddFolderPage.cs @@ -79,7 +79,7 @@ namespace Bit.App.Pages if(saveResult.Succeeded) { - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); _userDialogs.Toast("New folder created."); _googleAnalyticsService.TrackAppEvent("CreatedFolder"); } diff --git a/src/App/Pages/Settings/SettingsEditFolderPage.cs b/src/App/Pages/Settings/SettingsEditFolderPage.cs index 77521bc89..ce46dc5be 100644 --- a/src/App/Pages/Settings/SettingsEditFolderPage.cs +++ b/src/App/Pages/Settings/SettingsEditFolderPage.cs @@ -93,7 +93,7 @@ namespace Bit.App.Pages if(saveResult.Succeeded) { - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); _userDialogs.Toast("Folder updated."); _googleAnalyticsService.TrackAppEvent("EditedFolder"); } @@ -147,7 +147,7 @@ namespace Bit.App.Pages if(deleteTask.Succeeded) { - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); _userDialogs.Toast("Folder deleted."); } else if(deleteTask.Errors.Count() > 0) diff --git a/src/App/Pages/Settings/SettingsListFoldersPage.cs b/src/App/Pages/Settings/SettingsListFoldersPage.cs index 608a80072..e10d14b08 100644 --- a/src/App/Pages/Settings/SettingsListFoldersPage.cs +++ b/src/App/Pages/Settings/SettingsListFoldersPage.cs @@ -55,11 +55,11 @@ namespace Bit.App.Pages Folders.ResetWithRange(pageFolders); } - private void FolderSelected(object sender, SelectedItemChangedEventArgs e) + private async void FolderSelected(object sender, SelectedItemChangedEventArgs e) { var folder = e.SelectedItem as SettingsFolderPageModel; - var page = new ExtendedNavigationPage(new SettingsEditFolderPage(folder.Id)); - Navigation.PushModalAsync(page); + var page = new SettingsEditFolderPage(folder.Id); + await Navigation.PushForDeviceAsync(page); } private class AddFolderToolBarItem : ToolbarItem @@ -76,8 +76,8 @@ namespace Bit.App.Pages private async void ClickedItem(object sender, EventArgs e) { - var page = new ExtendedNavigationPage(new SettingsAddFolderPage()); - await _page.Navigation.PushModalAsync(page); + var page = new SettingsAddFolderPage(); + await _page.Navigation.PushForDeviceAsync(page); } } diff --git a/src/App/Pages/Tools/ToolsPage.cs b/src/App/Pages/Tools/ToolsPage.cs index 6d50cd7d0..96154f62b 100644 --- a/src/App/Pages/Tools/ToolsPage.cs +++ b/src/App/Pages/Tools/ToolsPage.cs @@ -52,7 +52,7 @@ namespace Bit.App.Pages "Use the bitwarden accessibility service to auto-fill your logins.", "upload"); autofillServiceCell.Tapped += (object sender, EventArgs e) => { - Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage())); + Navigation.PushAsync(new ToolsAutofillServicePage()); }; section.Add(autofillServiceCell); } @@ -81,9 +81,9 @@ namespace Bit.App.Pages Content = table; } - private void GeneratorCell_Tapped(object sender, EventArgs e) + private async void GeneratorCell_Tapped(object sender, EventArgs e) { - Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsPasswordGeneratorPage())); + await Navigation.PushForDeviceAsync(new ToolsPasswordGeneratorPage()); } private void WebCell_Tapped(object sender, EventArgs e) diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs index 3ee148775..01491901c 100644 --- a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs +++ b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs @@ -112,7 +112,7 @@ namespace Bit.App.Pages { _googleAnalyticsService.TrackAppEvent("SelectedGeneratedPassword"); _passwordValueAction(Password.Text); - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); }, ToolbarItemOrder.Default, 0); ToolbarItems.Add(selectToolBarItem); diff --git a/src/App/Pages/Vault/VaultAddSitePage.cs b/src/App/Pages/Vault/VaultAddSitePage.cs index d4c356c8e..c250aabd4 100644 --- a/src/App/Pages/Vault/VaultAddSitePage.cs +++ b/src/App/Pages/Vault/VaultAddSitePage.cs @@ -146,7 +146,7 @@ namespace Bit.App.Pages _userDialogs.HideLoading(); if(saveTask.Succeeded) { - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); _userDialogs.Toast("New site created."); _googleAnalyticsService.TrackAppEvent("CreatedSite"); } @@ -187,14 +187,14 @@ namespace Bit.App.Pages } } - private void GenerateCell_Tapped(object sender, EventArgs e) + private async void GenerateCell_Tapped(object sender, EventArgs e) { var page = new ToolsPasswordGeneratorPage((password) => { PasswordCell.Entry.Text = password; _userDialogs.Toast("Password generated."); }); - Navigation.PushModalAsync(new ExtendedNavigationPage(page)); + await Navigation.PushForDeviceAsync(page); } private void AlertNoConnection() diff --git a/src/App/Pages/Vault/VaultEditSitePage.cs b/src/App/Pages/Vault/VaultEditSitePage.cs index 02d03eaad..4e757d96b 100644 --- a/src/App/Pages/Vault/VaultEditSitePage.cs +++ b/src/App/Pages/Vault/VaultEditSitePage.cs @@ -176,7 +176,7 @@ namespace Bit.App.Pages if(saveTask.Succeeded) { - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); _userDialogs.Toast("Site updated."); _googleAnalyticsService.TrackAppEvent("EditedSite"); } @@ -222,7 +222,7 @@ namespace Bit.App.Pages PasswordCell.Entry.Text = password; _userDialogs.Toast("Password generated."); }); - await Navigation.PushModalAsync(new ExtendedNavigationPage(page)); + await Navigation.PushForDeviceAsync(page); } private async void DeleteCell_Tapped(object sender, EventArgs e) @@ -244,7 +244,7 @@ namespace Bit.App.Pages if(deleteTask.Succeeded) { - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); _userDialogs.Toast("Site deleted."); _googleAnalyticsService.TrackAppEvent("DeletedSite"); } diff --git a/src/App/Pages/Vault/VaultListSitesPage.cs b/src/App/Pages/Vault/VaultListSitesPage.cs index f2929411c..d5c95a283 100644 --- a/src/App/Pages/Vault/VaultListSitesPage.cs +++ b/src/App/Pages/Vault/VaultListSitesPage.cs @@ -354,11 +354,11 @@ namespace Bit.App.Pages }); } - private void SiteSelected(object sender, SelectedItemChangedEventArgs e) + private async void SiteSelected(object sender, SelectedItemChangedEventArgs e) { var site = e.SelectedItem as VaultListPageModel.Site; - var page = new ExtendedNavigationPage(new VaultViewSitePage(site.Id)); - Navigation.PushModalAsync(page); + var page = new VaultViewSitePage(site.Id); + await Navigation.PushForDeviceAsync(page); } private async void MoreClickedAsync(VaultListPageModel.Site site) @@ -382,13 +382,13 @@ namespace Bit.App.Pages if(selection == AppResources.View) { - var page = new ExtendedNavigationPage(new VaultViewSitePage(site.Id)); - await Navigation.PushModalAsync(page); + var page = new VaultViewSitePage(site.Id); + await Navigation.PushForDeviceAsync(page); } else if(selection == AppResources.Edit) { - var page = new ExtendedNavigationPage(new VaultEditSitePage(site.Id)); - await Navigation.PushModalAsync(page); + var page = new VaultEditSitePage(site.Id); + await Navigation.PushForDeviceAsync(page); } else if(selection == AppResources.CopyPassword) { @@ -412,8 +412,8 @@ namespace Bit.App.Pages private async void AddSite() { - var page = new ExtendedNavigationPage(new VaultAddSitePage()); - await Navigation.PushModalAsync(page); + var page = new VaultAddSitePage(); + await Navigation.PushForDeviceAsync(page); } private class AddSiteToolBarItem : ToolbarItem diff --git a/src/App/Pages/Vault/VaultViewSitePage.cs b/src/App/Pages/Vault/VaultViewSitePage.cs index aa40a37e4..027aeddc9 100644 --- a/src/App/Pages/Vault/VaultViewSitePage.cs +++ b/src/App/Pages/Vault/VaultViewSitePage.cs @@ -116,7 +116,7 @@ namespace Bit.App.Pages var site = await _siteService.GetByIdAsync(_siteId); if(site == null) { - await Navigation.PopModalAsync(); + await Navigation.PopForDeviceAsync(); return; } @@ -182,8 +182,8 @@ namespace Bit.App.Pages private async void ClickedItem(object sender, EventArgs e) { - var page = new ExtendedNavigationPage(new VaultEditSitePage(_siteId)); - await _page.Navigation.PushModalAsync(page); + var page = new VaultEditSitePage(_siteId); + await _page.Navigation.PushForDeviceAsync(page); } } } diff --git a/src/App/Utilities/Extentions.cs b/src/App/Utilities/Extentions.cs index 41fbb57ae..071ed2228 100644 --- a/src/App/Utilities/Extentions.cs +++ b/src/App/Utilities/Extentions.cs @@ -3,6 +3,8 @@ using Bit.App.Abstractions; using Bit.App.Models; using Xamarin.Forms; using XLabs.Ioc; +using System.Threading.Tasks; +using Bit.App.Controls; namespace Bit.App { @@ -33,9 +35,9 @@ namespace Bit.App { if(Device.OS == TargetPlatform.Android) { - System.Threading.Tasks.Task.Run(async () => + Task.Run(async () => { - await System.Threading.Tasks.Task.Delay(delay); + await Task.Delay(delay); Device.BeginInvokeOnMainThread(() => entry.Focus()); }); } @@ -45,6 +47,30 @@ namespace Bit.App } } + public static async Task PushForDeviceAsync(this INavigation navigation, Page page) + { + if(Device.OS == TargetPlatform.iOS) + { + await navigation.PushModalAsync(new ExtendedNavigationPage(page), true); + } + else + { + await navigation.PushAsync(page, true); + } + } + + public static async Task PopForDeviceAsync(this INavigation navigation) + { + if(Device.OS == TargetPlatform.iOS) + { + await navigation.PopModalAsync(true); + } + else + { + await navigation.PopAsync(true); + } + } + public static void AdjustMarginsForDevice(this View view) { if(Device.OS == TargetPlatform.Android)