mirror of
https://github.com/bitwarden/mobile
synced 2026-01-08 03:23:23 +00:00
Created device specific navigation push/pops in order to support non-modal navigation on android (so we get the back button in nav).
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user