bitwarden-android/src/App/Pages/Settings/SettingsAboutPage.cs
Hicham Boushaba d651606800 Add UWP support (#139)
* Add UWP project, and generate services boilerplate

* SqliteService implementation and sqlite-net-pcl update (#bug https://stackoverflow.com/questions/45418669/xamarin-forms-pcl-assemly-issue)

* Important services implementation

* Create a shared project to host images for UWP (to keep code project clean)

* Add extensions to image names referenced by the pcl project

* Add DismissModalToolBarItem to modal pages

* moving UWP folders inside src folder

* Add DeviceInfoService implementation

* Remove dependency on BouncyCastle, and calculate key derivation using native support

* changes requested by project maintener

* Fix HasCamera property

* DeviceActionService implementation
2017-10-02 22:15:13 -04:00

107 lines
3 KiB
C#

using System;
using Bit.App.Controls;
using Xamarin.Forms;
using Bit.App.Abstractions;
using XLabs.Ioc;
using Bit.App.Resources;
using FFImageLoading.Forms;
namespace Bit.App.Pages
{
public class SettingsAboutPage : ExtendedContentPage
{
private readonly IAppInfoService _appInfoService;
public SettingsAboutPage()
{
_appInfoService = Resolver.Resolve<IAppInfoService>();
Init();
}
public ExtendedTextCell CreditsCell { get; set; }
public void Init()
{
var logo = new CachedImage
{
Source = "logo.png",
HorizontalOptions = LayoutOptions.Center,
WidthRequest = 282,
HeightRequest = 44
};
var versionLabel = new Label
{
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
Text = $@"{AppResources.Version} {_appInfoService.Version} ({_appInfoService.Build})
© 8bit Solutions LLC 2015-{DateTime.Now.Year}",
HorizontalTextAlignment = TextAlignment.Center
};
var logoVersionStackLayout = new StackLayout
{
Children = { logo, versionLabel },
Spacing = 20,
Padding = new Thickness(0, 40, 0, 0)
};
CreditsCell = new ExtendedTextCell
{
Text = AppResources.Credits,
ShowDisclousure = true
};
var table = new ExtendedTableView
{
VerticalOptions = LayoutOptions.Start,
EnableScrolling = false,
Intent = TableIntent.Settings,
HasUnevenRows = true,
Root = new TableRoot
{
new TableSection(" ")
{
CreditsCell
}
}
};
if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 44;
}
var stackLayout = new StackLayout
{
Children = { logoVersionStackLayout, table },
Spacing = 0
};
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
Title = AppResources.About;
Content = new ScrollView { Content = stackLayout };
}
private void RateCell_Tapped(object sender, EventArgs e)
{
Navigation.PushAsync(new SettingsCreditsPage());
}
protected override void OnAppearing()
{
base.OnAppearing();
CreditsCell.Tapped += RateCell_Tapped;
}
protected override void OnDisappearing()
{
base.OnDisappearing();
CreditsCell.Tapped -= RateCell_Tapped;
}
}
}