set main page

This commit is contained in:
Kyle Spearrin 2019-04-19 16:40:20 -04:00
parent 7f2c265965
commit a4cbf3bee3
1 changed files with 15 additions and 12 deletions

View File

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