mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-26 12:16:07 +01:00
Added register page and accounts repo. Switch to color instead of bg image.
This commit is contained in:
parent
e7fef012b8
commit
e38dbff152
@ -128,6 +128,7 @@ namespace Bit.Android
|
|||||||
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<IDeviceApiRepository, DeviceApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<IDeviceApiRepository, DeviceApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
|
.RegisterType<IAccountsApiRepository, AccountsApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
// Other
|
// Other
|
||||||
.RegisterInstance(CrossDeviceInfo.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossDeviceInfo.Current, new ContainerControlledLifetimeManager())
|
||||||
.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
|
||||||
|
10
src/App/Abstractions/Repositories/IAccountsApiRepository.cs
Normal file
10
src/App/Abstractions/Repositories/IAccountsApiRepository.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bit.App.Models.Api;
|
||||||
|
|
||||||
|
namespace Bit.App.Abstractions
|
||||||
|
{
|
||||||
|
public interface IAccountsApiRepository
|
||||||
|
{
|
||||||
|
Task<ApiResult> PostRegisterAsync(RegisterRequest requestObj);
|
||||||
|
}
|
||||||
|
}
|
@ -42,8 +42,6 @@ namespace Bit.App
|
|||||||
MainPage = new HomePage();
|
MainPage = new HomePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainPage.BackgroundColor = Color.FromHex("ecf0f5");
|
|
||||||
|
|
||||||
MessagingCenter.Subscribe<Application, bool>(Current, "Lock", async (sender, args) =>
|
MessagingCenter.Subscribe<Application, bool>(Current, "Lock", async (sender, args) =>
|
||||||
{
|
{
|
||||||
await CheckLockAsync(args);
|
await CheckLockAsync(args);
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Abstractions\Repositories\IAccountsApiRepository.cs" />
|
||||||
<Compile Include="Abstractions\Repositories\IDeviceApiRepository.cs" />
|
<Compile Include="Abstractions\Repositories\IDeviceApiRepository.cs" />
|
||||||
<Compile Include="Abstractions\Services\IAppIdService.cs" />
|
<Compile Include="Abstractions\Services\IAppIdService.cs" />
|
||||||
<Compile Include="Abstractions\Services\IAuthService.cs" />
|
<Compile Include="Abstractions\Services\IAuthService.cs" />
|
||||||
@ -70,6 +71,7 @@
|
|||||||
<Compile Include="Models\Api\Request\DeviceTokenRequest.cs" />
|
<Compile Include="Models\Api\Request\DeviceTokenRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\FolderRequest.cs" />
|
<Compile Include="Models\Api\Request\FolderRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\DeviceRequest.cs" />
|
<Compile Include="Models\Api\Request\DeviceRequest.cs" />
|
||||||
|
<Compile Include="Models\Api\Request\RegisterRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\SiteRequest.cs" />
|
<Compile Include="Models\Api\Request\SiteRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\TokenRequest.cs" />
|
<Compile Include="Models\Api\Request\TokenRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\TokenTwoFactorRequest.cs" />
|
<Compile Include="Models\Api\Request\TokenTwoFactorRequest.cs" />
|
||||||
@ -91,6 +93,7 @@
|
|||||||
<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\HomePage.cs" />
|
||||||
|
<Compile Include="Pages\RegisterPage.cs" />
|
||||||
<Compile Include="Pages\SettingsPinPage.cs" />
|
<Compile Include="Pages\SettingsPinPage.cs" />
|
||||||
<Compile Include="Pages\LockPinPage.cs" />
|
<Compile Include="Pages\LockPinPage.cs" />
|
||||||
<Compile Include="Pages\MainPage.cs" />
|
<Compile Include="Pages\MainPage.cs" />
|
||||||
@ -102,6 +105,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Abstractions\Repositories\ISiteRepository.cs" />
|
<Compile Include="Abstractions\Repositories\ISiteRepository.cs" />
|
||||||
<Compile Include="Repositories\ApiRepository.cs" />
|
<Compile Include="Repositories\ApiRepository.cs" />
|
||||||
|
<Compile Include="Repositories\AccountsApiRepository.cs" />
|
||||||
<Compile Include="Repositories\BaseApiRepository.cs" />
|
<Compile Include="Repositories\BaseApiRepository.cs" />
|
||||||
<Compile Include="Abstractions\Repositories\IApiRepository.cs" />
|
<Compile Include="Abstractions\Repositories\IApiRepository.cs" />
|
||||||
<Compile Include="Abstractions\Repositories\IFolderApiRepository.cs" />
|
<Compile Include="Abstractions\Repositories\IFolderApiRepository.cs" />
|
||||||
|
@ -38,4 +38,38 @@ namespace Bit.App.Models.Api
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ApiResult
|
||||||
|
{
|
||||||
|
private List<ApiError> m_errors = new List<ApiError>();
|
||||||
|
|
||||||
|
public bool Succeeded { get; private set; }
|
||||||
|
public IEnumerable<ApiError> Errors => m_errors;
|
||||||
|
public HttpStatusCode StatusCode { get; private set; }
|
||||||
|
|
||||||
|
public static ApiResult Success(HttpStatusCode statusCode)
|
||||||
|
{
|
||||||
|
return new ApiResult
|
||||||
|
{
|
||||||
|
Succeeded = true,
|
||||||
|
StatusCode = statusCode
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApiResult Failed(HttpStatusCode statusCode, params ApiError[] errors)
|
||||||
|
{
|
||||||
|
var result = new ApiResult
|
||||||
|
{
|
||||||
|
Succeeded = false,
|
||||||
|
StatusCode = statusCode
|
||||||
|
};
|
||||||
|
|
||||||
|
if(errors != null)
|
||||||
|
{
|
||||||
|
result.m_errors.AddRange(errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
10
src/App/Models/Api/Request/RegisterRequest.cs
Normal file
10
src/App/Models/Api/Request/RegisterRequest.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Bit.App.Models.Api
|
||||||
|
{
|
||||||
|
public class RegisterRequest
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Email { get; set; }
|
||||||
|
public string MasterPasswordHash { get; set; }
|
||||||
|
public string MasterPasswordHint { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -25,7 +25,6 @@ namespace Bit.App.Pages
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
var logo = new Image
|
var logo = new Image
|
||||||
@ -48,7 +47,7 @@ namespace Bit.App.Pages
|
|||||||
var createAccountButton = new Button
|
var createAccountButton = new Button
|
||||||
{
|
{
|
||||||
Text = "Create Account",
|
Text = "Create Account",
|
||||||
//Command = new Command(async () => await RegisterAsync()),
|
Command = new Command(async () => await RegisterAsync()),
|
||||||
VerticalOptions = LayoutOptions.End,
|
VerticalOptions = LayoutOptions.End,
|
||||||
HorizontalOptions = LayoutOptions.Fill,
|
HorizontalOptions = LayoutOptions.Fill,
|
||||||
Style = (Style)Application.Current.Resources["btn-primary"],
|
Style = (Style)Application.Current.Resources["btn-primary"],
|
||||||
@ -74,12 +73,17 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
Title = "bitwarden";
|
Title = "bitwarden";
|
||||||
Content = buttonStackLayout;
|
Content = buttonStackLayout;
|
||||||
BackgroundImage = "bg.png";
|
BackgroundColor = Color.FromHex("ecf0f5");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LoginAsync()
|
public async Task LoginAsync()
|
||||||
{
|
{
|
||||||
await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage()));
|
await Navigation.PushModalAsync(new ExtendedNavigationPage(new LoginPage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task RegisterAsync()
|
||||||
|
{
|
||||||
|
await Navigation.PushModalAsync(new ExtendedNavigationPage(new RegisterPage()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,9 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
var table = new ExtendedTableView
|
var table = new ExtendedTableView
|
||||||
{
|
{
|
||||||
|
BackgroundColor = Color.FromHex("ecf0f5"),
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
EnableScrolling = false,
|
EnableScrolling = true,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
EnableSelection = false,
|
EnableSelection = false,
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
@ -73,6 +74,7 @@ namespace Bit.App.Pages
|
|||||||
ToolbarItems.Add(loginToolbarItem);
|
ToolbarItems.Add(loginToolbarItem);
|
||||||
Title = AppResources.Bitwarden;
|
Title = AppResources.Bitwarden;
|
||||||
Content = table;
|
Content = table;
|
||||||
|
BackgroundColor = Color.FromHex("ecf0f5");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnAppearing()
|
protected override void OnAppearing()
|
||||||
|
144
src/App/Pages/RegisterPage.cs
Normal file
144
src/App/Pages/RegisterPage.cs
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Bit.App.Abstractions;
|
||||||
|
using Bit.App.Controls;
|
||||||
|
using Bit.App.Models.Api;
|
||||||
|
using Bit.App.Resources;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using XLabs.Ioc;
|
||||||
|
using Acr.UserDialogs;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bit.App.Pages
|
||||||
|
{
|
||||||
|
public class RegisterPage : ContentPage
|
||||||
|
{
|
||||||
|
private ICryptoService _cryptoService;
|
||||||
|
private IUserDialogs _userDialogs;
|
||||||
|
private IAccountsApiRepository _accountsApiRepository;
|
||||||
|
|
||||||
|
public RegisterPage()
|
||||||
|
{
|
||||||
|
_cryptoService = Resolver.Resolve<ICryptoService>();
|
||||||
|
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
||||||
|
_accountsApiRepository = Resolver.Resolve<IAccountsApiRepository>();
|
||||||
|
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormEntryCell NameCell { get; set; }
|
||||||
|
public FormEntryCell EmailCell { get; set; }
|
||||||
|
public FormEntryCell PasswordCell { get; set; }
|
||||||
|
public FormEntryCell ConfirmPasswordCell { get; set; }
|
||||||
|
public FormEntryCell PasswordHintCell { get; set; }
|
||||||
|
|
||||||
|
private void Init()
|
||||||
|
{
|
||||||
|
PasswordHintCell = new FormEntryCell("Master Password Hint (optional)");
|
||||||
|
ConfirmPasswordCell = new FormEntryCell("Re-type Master Password", IsPassword: true, nextElement: PasswordHintCell.Entry);
|
||||||
|
PasswordCell = new FormEntryCell(AppResources.MasterPassword, IsPassword: true, nextElement: ConfirmPasswordCell.Entry);
|
||||||
|
NameCell = new FormEntryCell("Your Name", nextElement: PasswordCell.Entry);
|
||||||
|
EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: NameCell.Entry, entryKeyboard: Keyboard.Email);
|
||||||
|
|
||||||
|
PasswordHintCell.Entry.ReturnType = Enums.ReturnType.Done;
|
||||||
|
PasswordHintCell.Entry.Completed += Entry_Completed;
|
||||||
|
|
||||||
|
var table = new ExtendedTableView
|
||||||
|
{
|
||||||
|
BackgroundColor = Color.FromHex("ecf0f5"),
|
||||||
|
Intent = TableIntent.Settings,
|
||||||
|
EnableScrolling = true,
|
||||||
|
HasUnevenRows = true,
|
||||||
|
EnableSelection = false,
|
||||||
|
Root = new TableRoot
|
||||||
|
{
|
||||||
|
new TableSection()
|
||||||
|
{
|
||||||
|
EmailCell,
|
||||||
|
NameCell,
|
||||||
|
PasswordCell,
|
||||||
|
ConfirmPasswordCell,
|
||||||
|
PasswordHintCell
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var loginToolbarItem = new ToolbarItem("Submit", null, async () =>
|
||||||
|
{
|
||||||
|
await Register();
|
||||||
|
}, ToolbarItemOrder.Default, 0);
|
||||||
|
|
||||||
|
if(Device.OS == TargetPlatform.iOS)
|
||||||
|
{
|
||||||
|
table.RowHeight = -1;
|
||||||
|
table.EstimatedRowHeight = 70;
|
||||||
|
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarItems.Add(loginToolbarItem);
|
||||||
|
Title = "Create Account";
|
||||||
|
Content = table;
|
||||||
|
BackgroundColor = Color.FromHex("ecf0f5");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
EmailCell.Entry.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Entry_Completed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Register();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Register()
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(EmailCell.Entry.Text))
|
||||||
|
{
|
||||||
|
await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, AppResources.EmailAddress), AppResources.Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(string.IsNullOrWhiteSpace(NameCell.Entry.Text))
|
||||||
|
{
|
||||||
|
await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, "Your Name"), AppResources.Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(string.IsNullOrWhiteSpace(PasswordCell.Entry.Text))
|
||||||
|
{
|
||||||
|
await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, "Your Name"), AppResources.Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ConfirmPasswordCell.Entry.Text != PasswordCell.Entry.Text)
|
||||||
|
{
|
||||||
|
await DisplayAlert(AppResources.AnErrorHasOccurred, "Password confirmation is not correct.", AppResources.Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var key = _cryptoService.MakeKeyFromPassword(PasswordCell.Entry.Text, EmailCell.Entry.Text);
|
||||||
|
var request = new RegisterRequest
|
||||||
|
{
|
||||||
|
Name = NameCell.Entry.Text,
|
||||||
|
Email = EmailCell.Entry.Text,
|
||||||
|
MasterPasswordHash = _cryptoService.HashPasswordBase64(key, PasswordCell.Entry.Text),
|
||||||
|
MasterPasswordHint = !string.IsNullOrWhiteSpace(PasswordHintCell.Entry.Text) ? PasswordHintCell.Entry.Text : null
|
||||||
|
};
|
||||||
|
|
||||||
|
var responseTask = _accountsApiRepository.PostRegisterAsync(request);
|
||||||
|
_userDialogs.ShowLoading("Creating account...", MaskType.Black);
|
||||||
|
var response = await responseTask;
|
||||||
|
_userDialogs.HideLoading();
|
||||||
|
if(!response.Succeeded)
|
||||||
|
{
|
||||||
|
await DisplayAlert(AppResources.AnErrorHasOccurred, response.Errors.FirstOrDefault()?.Message, AppResources.Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_userDialogs.SuccessToast("Account Created", "Your new account has been created! You may now log in.");
|
||||||
|
await Navigation.PopModalAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
src/App/Repositories/AccountsApiRepository.cs
Normal file
30
src/App/Repositories/AccountsApiRepository.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bit.App.Abstractions;
|
||||||
|
using Bit.App.Models.Api;
|
||||||
|
|
||||||
|
namespace Bit.App.Repositories
|
||||||
|
{
|
||||||
|
public class AccountsApiRepository : BaseApiRepository, IAccountsApiRepository
|
||||||
|
{
|
||||||
|
protected override string ApiRoute => "accounts";
|
||||||
|
|
||||||
|
public virtual async Task<ApiResult> PostRegisterAsync(RegisterRequest requestObj)
|
||||||
|
{
|
||||||
|
var requestMessage = new TokenHttpRequestMessage(requestObj)
|
||||||
|
{
|
||||||
|
Method = HttpMethod.Post,
|
||||||
|
RequestUri = new Uri(Client.BaseAddress, string.Concat(ApiRoute, "/register")),
|
||||||
|
};
|
||||||
|
|
||||||
|
var response = await Client.SendAsync(requestMessage);
|
||||||
|
if(!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
return await HandleErrorAsync(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ApiResult.Success(response.StatusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bit.App.Models.Api;
|
using Bit.App.Models.Api;
|
||||||
using ModernHttpClient;
|
using ModernHttpClient;
|
||||||
@ -26,6 +24,30 @@ namespace Bit.App.Repositories
|
|||||||
public async Task<ApiResult<T>> HandleErrorAsync<T>(HttpResponseMessage response)
|
public async Task<ApiResult<T>> HandleErrorAsync<T>(HttpResponseMessage response)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
var errors = await ParseErrorsAsync(response);
|
||||||
|
return ApiResult<T>.Failed(response.StatusCode, errors.ToArray());
|
||||||
|
}
|
||||||
|
catch(JsonReaderException)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
return ApiResult<T>.Failed(response.StatusCode, new ApiError { Message = "An unknown error has occured." });
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ApiResult> HandleErrorAsync(HttpResponseMessage response)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var errors = await ParseErrorsAsync(response);
|
||||||
|
return ApiResult.Failed(response.StatusCode, errors.ToArray());
|
||||||
|
}
|
||||||
|
catch(JsonReaderException)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
return ApiResult.Failed(response.StatusCode, new ApiError { Message = "An unknown error has occured." });
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<List<ApiError>> ParseErrorsAsync(HttpResponseMessage response)
|
||||||
{
|
{
|
||||||
var errors = new List<ApiError>();
|
var errors = new List<ApiError>();
|
||||||
if(response.StatusCode == System.Net.HttpStatusCode.BadRequest)
|
if(response.StatusCode == System.Net.HttpStatusCode.BadRequest)
|
||||||
@ -42,12 +64,7 @@ namespace Bit.App.Repositories
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiResult<T>.Failed(response.StatusCode, errors.ToArray());
|
return errors;
|
||||||
}
|
|
||||||
catch(JsonReaderException)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
return ApiResult<T>.Failed(response.StatusCode, new ApiError { Message = "An unknown error has occured." });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace Bit.iOS.Extension
|
|||||||
public override void ViewDidLoad()
|
public override void ViewDidLoad()
|
||||||
{
|
{
|
||||||
base.ViewDidLoad();
|
base.ViewDidLoad();
|
||||||
View.BackgroundColor = UIColor.FromPatternImage(new UIImage("bg.png"));
|
View.BackgroundColor = new UIColor(red: 0.93f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
|
||||||
_context.ExtContext = ExtensionContext;
|
_context.ExtContext = ExtensionContext;
|
||||||
|
|
||||||
if(!Resolver.IsSet)
|
if(!Resolver.IsSet)
|
||||||
|
@ -62,7 +62,7 @@ namespace Bit.iOS
|
|||||||
|
|
||||||
var backgroundView = new UIView(UIApplication.SharedApplication.KeyWindow.Frame)
|
var backgroundView = new UIView(UIApplication.SharedApplication.KeyWindow.Frame)
|
||||||
{
|
{
|
||||||
BackgroundColor = UIColor.FromPatternImage(new UIImage("bg.png"))
|
BackgroundColor = new UIColor(red: 0.93f, green: 0.94f, blue: 0.96f, alpha: 1.0f)
|
||||||
};
|
};
|
||||||
|
|
||||||
var imageView = new UIImageView(new UIImage("logo.png"))
|
var imageView = new UIImageView(new UIImage("logo.png"))
|
||||||
@ -188,6 +188,7 @@ namespace Bit.iOS
|
|||||||
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<IDeviceApiRepository, DeviceApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<IDeviceApiRepository, DeviceApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
|
.RegisterType<IAccountsApiRepository, AccountsApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
// Other
|
// Other
|
||||||
.RegisterInstance(CrossDeviceInfo.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossDeviceInfo.Current, new ContainerControlledLifetimeManager())
|
||||||
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
|
||||||
|
@ -12,22 +12,15 @@
|
|||||||
<viewControllerLayoutGuide type="bottom" id="3"/>
|
<viewControllerLayoutGuide type="bottom" id="3"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="6">
|
<view key="view" contentMode="scaleToFill" id="6">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
<color key="backgroundColor" customColorSpace="calibratedWhite" colorSpace="calibratedRGB" red="0.92549019607843142" green="0.94117647058823528" blue="0.96078431372549022" alpha="1"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" id="11" translatesAutoresizingMaskIntoConstraints="NO" image="bg.png">
|
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="16" translatesAutoresizingMaskIntoConstraints="NO" image="logo.png" misplaced="YES">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
|
||||||
</imageView>
|
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="16" translatesAutoresizingMaskIntoConstraints="NO" image="logo.png">
|
|
||||||
<rect key="frame" x="159" y="278" width="282" height="44"/>
|
<rect key="frame" x="159" y="278" width="282" height="44"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint id="12" firstItem="11" firstAttribute="top" secondItem="6" secondAttribute="top"/>
|
|
||||||
<constraint id="13" firstItem="6" firstAttribute="bottom" secondItem="11" secondAttribute="bottom"/>
|
|
||||||
<constraint id="14" firstItem="11" firstAttribute="leading" secondItem="6" secondAttribute="leading"/>
|
|
||||||
<constraint id="15" firstItem="6" firstAttribute="trailing" secondItem="11" secondAttribute="trailing"/>
|
|
||||||
<constraint id="19" firstItem="16" firstAttribute="centerY" secondItem="6" secondAttribute="centerY"/>
|
<constraint id="19" firstItem="16" firstAttribute="centerY" secondItem="6" secondAttribute="centerY"/>
|
||||||
<constraint id="20" firstItem="6" firstAttribute="centerX" secondItem="16" secondAttribute="centerX"/>
|
<constraint id="20" firstItem="6" firstAttribute="centerX" secondItem="16" secondAttribute="centerX"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@ -65,6 +58,13 @@
|
|||||||
<image name="ion_chevron_right.png" width="14" height="14"/>
|
<image name="ion_chevron_right.png" width="14" height="14"/>
|
||||||
<image name="ion_plus.png" width="22" height="22"/>
|
<image name="ion_plus.png" width="22" height="22"/>
|
||||||
<image name="logo.png" width="282" height="44"/>
|
<image name="logo.png" width="282" height="44"/>
|
||||||
|
<image name="cogs.png" width="25" height="25"/>
|
||||||
|
<image name="eye.png" width="22" height="22"/>
|
||||||
|
<image name="eye_slash.png" width="22" height="22"/>
|
||||||
|
<image name="more.png" width="64" height="64"/>
|
||||||
|
<image name="more_selected.png" width="28" height="28"/>
|
||||||
|
<image name="plus.png" width="18" height="18"/>
|
||||||
|
<image name="star.png" width="22" height="22"/>
|
||||||
</resources>
|
</resources>
|
||||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||||
<simulatedScreenMetrics key="destination" type="retina47"/>
|
<simulatedScreenMetrics key="destination" type="retina47"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user