From 1b73748d520612a0363003eec7997bf6129d7646 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 21 Jun 2016 23:54:51 -0400 Subject: [PATCH] Stubbed out new HomePage for landing on when logged out. --- src/App/App.cs | 2 +- src/App/App.csproj | 1 + src/App/Pages/HomePage.cs | 79 ++++++++++++++++++++++++++++ src/App/Pages/LockFingerprintPage.cs | 2 +- src/App/Pages/LockPinPage.cs | 2 +- src/App/Pages/LoginNavigationPage.cs | 4 +- src/App/Pages/LoginPage.cs | 8 ++- src/App/Pages/SettingsPage.cs | 2 +- 8 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 src/App/Pages/HomePage.cs diff --git a/src/App/App.cs b/src/App/App.cs index bb6e7dc4c..60412212d 100644 --- a/src/App/App.cs +++ b/src/App/App.cs @@ -39,7 +39,7 @@ namespace Bit.App } else { - MainPage = new LoginNavigationPage(); + MainPage = new HomePage(); } MainPage.BackgroundColor = Color.FromHex("ecf0f5"); diff --git a/src/App/App.csproj b/src/App/App.csproj index d6b55ac64..7715c5259 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -90,6 +90,7 @@ + diff --git a/src/App/Pages/HomePage.cs b/src/App/Pages/HomePage.cs new file mode 100644 index 000000000..8c766e21e --- /dev/null +++ b/src/App/Pages/HomePage.cs @@ -0,0 +1,79 @@ +using System; +using System.Threading.Tasks; +using Acr.UserDialogs; +using Bit.App.Abstractions; +using Bit.App.Resources; +using Xamarin.Forms; +using XLabs.Ioc; +using Plugin.Settings.Abstractions; + +namespace Bit.App.Pages +{ + public class HomePage : ContentPage + { + private readonly IAuthService _authService; + private readonly IUserDialogs _userDialogs; + private readonly ISettings _settings; + + public HomePage() + { + _authService = Resolver.Resolve(); + _userDialogs = Resolver.Resolve(); + _settings = Resolver.Resolve(); + + Init(); + } + + + public void Init() + { + var logo = new Image + { + Source = "logo", + VerticalOptions = LayoutOptions.CenterAndExpand, + HorizontalOptions = LayoutOptions.Center + }; + + var message = new Label + { + Text = "Welcome!", + VerticalOptions = LayoutOptions.CenterAndExpand, + HorizontalOptions = LayoutOptions.Center + }; + + var createAccountButton = new Button + { + Text = "Create Account", + //Command = new Command(async () => await LogoutAsync()), + VerticalOptions = LayoutOptions.End, + HorizontalOptions = LayoutOptions.CenterAndExpand, + Style = (Style)Application.Current.Resources["btn-default"] + }; + + var loginButton = new Button + { + Text = AppResources.LogIn, + Command = new Command(async () => await LoginAsync()), + VerticalOptions = LayoutOptions.End, + HorizontalOptions = LayoutOptions.CenterAndExpand, + Style = (Style)Application.Current.Resources["btn-default"] + }; + + var buttonStackLayout = new StackLayout + { + Padding = new Thickness(30, 40), + Spacing = 10, + Children = { logo, message, createAccountButton, loginButton } + }; + + Title = "bitwarden"; + Content = buttonStackLayout; + BackgroundImage = "bg.png"; + } + + public async Task LoginAsync() + { + await Navigation.PushModalAsync(new LoginNavigationPage()); + } + } +} diff --git a/src/App/Pages/LockFingerprintPage.cs b/src/App/Pages/LockFingerprintPage.cs index abe608b50..c110052bd 100644 --- a/src/App/Pages/LockFingerprintPage.cs +++ b/src/App/Pages/LockFingerprintPage.cs @@ -82,7 +82,7 @@ namespace Bit.App.Pages _authService.LogOut(); await Navigation.PopModalAsync(); - Application.Current.MainPage = new LoginNavigationPage(); + Application.Current.MainPage = new HomePage(); } public async Task CheckFingerprintAsync() diff --git a/src/App/Pages/LockPinPage.cs b/src/App/Pages/LockPinPage.cs index 7d60a0fc2..4c3fafe1a 100644 --- a/src/App/Pages/LockPinPage.cs +++ b/src/App/Pages/LockPinPage.cs @@ -103,7 +103,7 @@ namespace Bit.App.Pages _authService.LogOut(); await Navigation.PopModalAsync(); - Application.Current.MainPage = new LoginNavigationPage(); + Application.Current.MainPage = new HomePage(); } } } diff --git a/src/App/Pages/LoginNavigationPage.cs b/src/App/Pages/LoginNavigationPage.cs index a7c110c88..9718a2146 100644 --- a/src/App/Pages/LoginNavigationPage.cs +++ b/src/App/Pages/LoginNavigationPage.cs @@ -8,8 +8,8 @@ namespace Bit.App.Pages public LoginNavigationPage() : base(new LoginPage()) { - BarBackgroundColor = Color.FromHex("3c8dbc"); - BarTextColor = Color.FromHex("ffffff"); + BarBackgroundColor = Color.Transparent; + BarTextColor = Color.FromHex("333333"); Title = AppResources.LogInNoun; } } diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index 110ae7b89..59cb02718 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -5,6 +5,7 @@ using System.Reflection.Emit; using System.Text; using Bit.App.Abstractions; using Bit.App.Behaviors; +using Bit.App.Controls; using Bit.App.Models.Api; using Bit.App.Resources; using Plugin.DeviceInfo.Abstractions; @@ -88,9 +89,14 @@ namespace Bit.App.Pages stackLayout.Children.Add(masterPasswordEntry); stackLayout.Children.Add(loginButton); + if(Device.OS == TargetPlatform.iOS) + { + ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel")); + } + Title = AppResources.LogIn; Content = stackLayout; - NavigationPage.SetHasNavigationBar(this, false); + BackgroundImage = "bg.png"; } } } diff --git a/src/App/Pages/SettingsPage.cs b/src/App/Pages/SettingsPage.cs index 0cf56231a..039a93744 100644 --- a/src/App/Pages/SettingsPage.cs +++ b/src/App/Pages/SettingsPage.cs @@ -177,7 +177,7 @@ namespace Bit.App.Pages } _authService.LogOut(); - Application.Current.MainPage = new LoginNavigationPage(); + Application.Current.MainPage = new HomePage(); } private async void ChangeMasterPasswordCell_Tapped(object sender, EventArgs e)