1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-27 03:52:57 +02:00

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
{
MainPage = new LoginNavigationPage();
MainPage = new HomePage();
}
MainPage.BackgroundColor = Color.FromHex("ecf0f5");

View File

@ -90,6 +90,7 @@
<Compile Include="Models\Page\PinPageModel.cs" />
<Compile Include="Models\Site.cs" />
<Compile Include="Models\Page\VaultViewSitePageModel.cs" />
<Compile Include="Pages\HomePage.cs" />
<Compile Include="Pages\SettingsPinPage.cs" />
<Compile Include="Pages\LockPinPage.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();
await Navigation.PopModalAsync();
Application.Current.MainPage = new LoginNavigationPage();
Application.Current.MainPage = new HomePage();
}
public async Task CheckFingerprintAsync()

View File

@ -103,7 +103,7 @@ namespace Bit.App.Pages
_authService.LogOut();
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()
: base(new LoginPage())
{
BarBackgroundColor = Color.FromHex("3c8dbc");
BarTextColor = Color.FromHex("ffffff");
BarBackgroundColor = Color.Transparent;
BarTextColor = Color.FromHex("333333");
Title = AppResources.LogInNoun;
}
}

View File

@ -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";
}
}
}

View File

@ -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)