Stubbed out new HomePage for landing on when logged out.

This commit is contained in:
Kyle Spearrin 2016-06-21 23:54:51 -04:00
parent 4cfa8e2dee
commit 1b73748d52
8 changed files with 93 additions and 7 deletions

View file

@ -39,7 +39,7 @@ namespace Bit.App
} }
else else
{ {
MainPage = new LoginNavigationPage(); MainPage = new HomePage();
} }
MainPage.BackgroundColor = Color.FromHex("ecf0f5"); MainPage.BackgroundColor = Color.FromHex("ecf0f5");

View file

@ -90,6 +90,7 @@
<Compile Include="Models\Page\PinPageModel.cs" /> <Compile Include="Models\Page\PinPageModel.cs" />
<Compile Include="Models\Site.cs" /> <Compile Include="Models\Site.cs" />
<Compile Include="Models\Page\VaultViewSitePageModel.cs" /> <Compile Include="Models\Page\VaultViewSitePageModel.cs" />
<Compile Include="Pages\HomePage.cs" />
<Compile Include="Pages\SettingsPinPage.cs" /> <Compile Include="Pages\SettingsPinPage.cs" />
<Compile Include="Pages\LockPinPage.cs" /> <Compile Include="Pages\LockPinPage.cs" />
<Compile Include="Pages\LoginNavigationPage.cs" /> <Compile Include="Pages\LoginNavigationPage.cs" />

79
src/App/Pages/HomePage.cs Normal file
View file

@ -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<IAuthService>();
_userDialogs = Resolver.Resolve<IUserDialogs>();
_settings = Resolver.Resolve<ISettings>();
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());
}
}
}

View file

@ -82,7 +82,7 @@ namespace Bit.App.Pages
_authService.LogOut(); _authService.LogOut();
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
Application.Current.MainPage = new LoginNavigationPage(); Application.Current.MainPage = new HomePage();
} }
public async Task CheckFingerprintAsync() public async Task CheckFingerprintAsync()

View file

@ -103,7 +103,7 @@ namespace Bit.App.Pages
_authService.LogOut(); _authService.LogOut();
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
Application.Current.MainPage = new LoginNavigationPage(); Application.Current.MainPage = new HomePage();
} }
} }
} }

View file

@ -8,8 +8,8 @@ namespace Bit.App.Pages
public LoginNavigationPage() public LoginNavigationPage()
: base(new LoginPage()) : base(new LoginPage())
{ {
BarBackgroundColor = Color.FromHex("3c8dbc"); BarBackgroundColor = Color.Transparent;
BarTextColor = Color.FromHex("ffffff"); BarTextColor = Color.FromHex("333333");
Title = AppResources.LogInNoun; Title = AppResources.LogInNoun;
} }
} }

View file

@ -5,6 +5,7 @@ using System.Reflection.Emit;
using System.Text; using System.Text;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Behaviors; using Bit.App.Behaviors;
using Bit.App.Controls;
using Bit.App.Models.Api; using Bit.App.Models.Api;
using Bit.App.Resources; using Bit.App.Resources;
using Plugin.DeviceInfo.Abstractions; using Plugin.DeviceInfo.Abstractions;
@ -88,9 +89,14 @@ namespace Bit.App.Pages
stackLayout.Children.Add(masterPasswordEntry); stackLayout.Children.Add(masterPasswordEntry);
stackLayout.Children.Add(loginButton); stackLayout.Children.Add(loginButton);
if(Device.OS == TargetPlatform.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
}
Title = AppResources.LogIn; Title = AppResources.LogIn;
Content = stackLayout; Content = stackLayout;
NavigationPage.SetHasNavigationBar(this, false); BackgroundImage = "bg.png";
} }
} }
} }

View file

@ -177,7 +177,7 @@ namespace Bit.App.Pages
} }
_authService.LogOut(); _authService.LogOut();
Application.Current.MainPage = new LoginNavigationPage(); Application.Current.MainPage = new HomePage();
} }
private async void ChangeMasterPasswordCell_Tapped(object sender, EventArgs e) private async void ChangeMasterPasswordCell_Tapped(object sender, EventArgs e)