set main page

This commit is contained in:
Kyle Spearrin 2019-04-19 16:40:20 -04:00
parent 7f2c265965
commit a4cbf3bee3

View file

@ -6,8 +6,8 @@ using Bit.App.Utilities;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.StyleSheets;
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
@ -31,17 +31,7 @@ namespace Bit.App
SetCulture();
ThemeManager.SetTheme("light");
MainPage = new HomePage();
_userService.IsAuthenticatedAsync().ContinueWith(async authed =>
{
if(await authed)
{
Current.MainPage = new TabsPage();
}
else
{
Current.MainPage = new HomePage();
}
});
var mainPageTask = SetMainPageAsync();
ServiceContainer.Resolve<MobilePlatformUtilsService>("platformUtilsService").Init();
_broadcasterService.Subscribe(nameof(App), async (message) =>
@ -88,5 +78,18 @@ namespace Bit.App
new System.Globalization.HijriCalendar();
new System.Globalization.UmAlQuraCalendar();
}
private async Task SetMainPageAsync()
{
var authed = await _userService.IsAuthenticatedAsync();
if(authed)
{
Current.MainPage = new TabsPage();
}
else
{
Current.MainPage = new HomePage();
}
}
}
}