1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-05 18:13:36 +00:00

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
This commit is contained in:
Hicham Boushaba
2017-10-03 03:15:13 +01:00
committed by Kyle Spearrin
parent 5501ab9083
commit d651606800
104 changed files with 1171 additions and 72 deletions

View File

@@ -540,8 +540,8 @@
<HintPath>..\..\packages\Splat.1.6.2\lib\Portable-net45+win+wpa81+wp80\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLite-net, Version=1.4.118.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\sqlite-net-pcl.1.4.118\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
<Reference Include="SQLite-net, Version=1.5.166.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\sqlite-net-pcl.1.5.166-beta\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_green, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL">
<HintPath>..\..\packages\SQLitePCLRaw.bundle_green.1.1.8\lib\portable-net45+netcore45+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLitePCLRaw.batteries_green.dll</HintPath>

View File

@@ -43,7 +43,7 @@ namespace Bit.App.Controls
protected override SizeRequest OnSizeRequest(double widthConstraint, double heightConstraint)
{
if(!VerticalOptions.Expands)
if(!VerticalOptions.Expands && Device.RuntimePlatform != Device.Windows)
{
var reflectionService = Resolver.Resolve<IReflectionService>();
var baseBaseOnSizeRequest = reflectionService.GetVisualElementOnSizeRequest(this);

View File

@@ -102,7 +102,7 @@ namespace Bit.App.Pages
var toolbarItem = new ToolbarItem(AppResources.Save, null, async () => await SaveAsync(),
ToolbarItemOrder.Default, 0);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
table.RowHeight = table2.RowHeight = -1;
table.EstimatedRowHeight = table2.EstimatedRowHeight = 70;

View File

@@ -34,7 +34,7 @@ namespace Bit.App.Pages
var settingsButton = new Button
{
Image = "cog",
Image = "cog.png",
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.Start,
WidthRequest = 25,
@@ -46,7 +46,7 @@ namespace Bit.App.Pages
var logo = new CachedImage
{
Source = "logo",
Source = "logo.png",
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center,
WidthRequest = 282,

View File

@@ -32,7 +32,7 @@ namespace Bit.App.Pages
{
var fingerprintIcon = new ExtendedButton
{
Image = "fingerprint",
Image = "fingerprint.png",
BackgroundColor = Color.Transparent,
Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.CenterAndExpand,

View File

@@ -36,7 +36,7 @@ namespace Bit.App.Pages
WinPhone: new Thickness(15, 20));
PasswordCell = new FormEntryCell(AppResources.MasterPassword, isPassword: true,
useLabelAsPlaceholder: true, imageSource: "lock", containerPadding: padding);
useLabelAsPlaceholder: true, imageSource: "lock.png", containerPadding: padding);
PasswordCell.Entry.ReturnType = Enums.ReturnType.Go;

View File

@@ -103,7 +103,7 @@ namespace Bit.App.Pages
var scrollView = new ScrollView { Content = layout };
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;

View File

@@ -17,16 +17,16 @@ namespace Bit.App.Pages
var toolsNavigation = new ExtendedNavigationPage(new ToolsPage());
favoritesNavigation.Title = AppResources.Favorites;
favoritesNavigation.Icon = "star";
favoritesNavigation.Icon = "star.png";
vaultNavigation.Title = AppResources.MyVault;
vaultNavigation.Icon = "fa_lock";
vaultNavigation.Icon = "fa_lock.png";
toolsNavigation.Title = AppResources.Tools;
toolsNavigation.Icon = "tools";
toolsNavigation.Icon = "tools.png";
settingsNavigation.Title = AppResources.Settings;
settingsNavigation.Icon = "cogs";
settingsNavigation.Icon = "cogs.png";
Children.Add(favoritesNavigation);
Children.Add(vaultNavigation);

View File

@@ -36,7 +36,7 @@ namespace Bit.App.Pages
WinPhone: new Thickness(15, 20));
EmailCell = new FormEntryCell(AppResources.EmailAddress, entryKeyboard: Keyboard.Email,
useLabelAsPlaceholder: true, imageSource: "envelope", containerPadding: padding);
useLabelAsPlaceholder: true, imageSource: "envelope.png", containerPadding: padding);
EmailCell.Entry.ReturnType = Enums.ReturnType.Go;

View File

@@ -50,15 +50,15 @@ namespace Bit.App.Pages
WinPhone: new Thickness(15, 20));
PasswordHintCell = new FormEntryCell(AppResources.MasterPasswordHint, useLabelAsPlaceholder: true,
imageSource: "lightbulb", containerPadding: padding);
imageSource: "lightbulb.png", containerPadding: padding);
ConfirmPasswordCell = new FormEntryCell(AppResources.RetypeMasterPassword, isPassword: true,
nextElement: PasswordHintCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock",
nextElement: PasswordHintCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock.png",
containerPadding: padding);
PasswordCell = new FormEntryCell(AppResources.MasterPassword, isPassword: true,
nextElement: ConfirmPasswordCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock",
nextElement: ConfirmPasswordCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock.png",
containerPadding: padding);
EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry,
entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope",
entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope.png",
containerPadding: padding);
PasswordHintCell.Entry.ReturnType = Enums.ReturnType.Done;
@@ -122,7 +122,7 @@ namespace Bit.App.Pages
await Register();
}, ToolbarItemOrder.Default, 0);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
table.RowHeight = table2.RowHeight = -1;
table.EstimatedRowHeight = table2.EstimatedRowHeight = 70;

View File

@@ -68,7 +68,7 @@ namespace Bit.App.Pages
Children = { _zxing, _overlay }
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
}

View File

@@ -24,7 +24,7 @@ namespace Bit.App.Pages
{
var logo = new CachedImage
{
Source = "logo",
Source = "logo.png",
HorizontalOptions = LayoutOptions.Center,
WidthRequest = 282,
HeightRequest = 44
@@ -78,7 +78,7 @@ namespace Bit.App.Pages
Spacing = 0
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -105,7 +105,7 @@ namespace Bit.App.Pages
Title = AppResources.AddFolder;
Content = table;
ToolbarItems.Add(saveToolBarItem);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -119,7 +119,7 @@ namespace Bit.App.Pages
Title = AppResources.EditFolder;
Content = mainTable;
ToolbarItems.Add(saveToolBarItem);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -171,7 +171,7 @@ namespace Bit.App.Pages
Content = StackLayout
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
analyticsTable.RowHeight = -1;
analyticsTable.EstimatedRowHeight = 70;

View File

@@ -102,7 +102,7 @@ namespace Bit.App.Pages
Spacing = 0
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -40,8 +40,8 @@ namespace Bit.App.Pages
ItemsSource = Folders,
ItemTemplate = new DataTemplate(() => new SettingsFolderListViewCell(this))
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
@@ -87,7 +87,7 @@ namespace Bit.App.Pages
{
_page = page;
Text = AppResources.Add;
Icon = "plus";
Icon = "plus.png";
ClickAction = () => ClickedItem();
}

View File

@@ -56,7 +56,7 @@ namespace Bit.App.Pages
PinControl.Label.GestureRecognizers.Add(Tgr);
instructionLabel.GestureRecognizers.Add(Tgr);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -57,7 +57,7 @@ namespace Bit.App.Pages
Padding = new Thickness(15, 0)
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -123,7 +123,7 @@ namespace Bit.App.Pages
var tapNotificationImage = new CachedImage
{
Source = "accessibility_notification",
Source = "accessibility_notification.png",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
@@ -132,7 +132,7 @@ namespace Bit.App.Pages
var tapNotificationIcon = new CachedImage
{
Source = "accessibility_notification_icon",
Source = "accessibility_notification_icon.png",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,

View File

@@ -205,7 +205,7 @@ namespace Bit.App.Pages
VerticalOptions = LayoutOptions.FillAndExpand
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
}

View File

@@ -33,10 +33,10 @@ namespace Bit.App.Pages
public void Init()
{
GeneratorCell = new ToolsViewCell(AppResources.PasswordGenerator, AppResources.PasswordGeneratorDescription,
"refresh");
WebCell = new ToolsViewCell(AppResources.WebVault, AppResources.WebVaultDescription, "globe");
ShareCell = new ToolsViewCell(AppResources.ShareVault, AppResources.ShareVaultDescription, "share_tools");
ImportCell = new ToolsViewCell(AppResources.ImportLogins, AppResources.ImportLoginsDescription, "cloudup");
"refresh.png");
WebCell = new ToolsViewCell(AppResources.WebVault, AppResources.WebVaultDescription, "globe.png");
ShareCell = new ToolsViewCell(AppResources.ShareVault, AppResources.ShareVaultDescription, "share_tools.png");
ImportCell = new ToolsViewCell(AppResources.ImportLogins, AppResources.ImportLoginsDescription, "cloudup.png");
var section = new TableSection(" ") { GeneratorCell };
@@ -49,7 +49,7 @@ namespace Bit.App.Pages
else
{
AutofillCell = new ToolsViewCell(AppResources.BitwardenAutofillService,
AppResources.BitwardenAutofillServiceDescription, "upload");
AppResources.BitwardenAutofillServiceDescription, "upload.png");
section.Add(AutofillCell);
}

View File

@@ -87,7 +87,7 @@ namespace Bit.App.Pages
}
};
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 44;

View File

@@ -223,7 +223,7 @@ namespace Bit.App.Pages
Title = AppResources.AddLogin;
Content = table;
ToolbarItems.Add(saveToolBarItem);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -192,7 +192,7 @@ namespace Bit.App.Pages
ToolbarItems.Add(saveToolBarItem);
}
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ListView.RowHeight = -1;
NewTable.RowHeight = -1;

View File

@@ -159,7 +159,7 @@ namespace Bit.App.Pages
{
Content = Table;
ToolbarItems.Add(SaveToolbarItem);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
@@ -216,7 +216,7 @@ namespace Bit.App.Pages
else
{
Content = NoDataLabel;
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
}

View File

@@ -250,7 +250,7 @@ namespace Bit.App.Pages
Title = AppResources.EditLogin;
Content = table;
ToolbarItems.Add(saveToolBarItem);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}

View File

@@ -481,7 +481,7 @@ namespace Bit.App.Pages
{
_page = page;
Text = AppResources.Add;
Icon = "plus";
Icon = "plus.png";
}
}
@@ -491,7 +491,7 @@ namespace Bit.App.Pages
{
var image = new CachedImage
{
Source = "folder",
Source = "folder.png",
WidthRequest = 18,
HeightRequest = 18
};

View File

@@ -54,7 +54,7 @@ namespace Bit.App.Pages
{
EditItem = new EditLoginToolBarItem(this, _loginId);
ToolbarItems.Add(EditItem);
if(Device.RuntimePlatform == Device.iOS)
if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
{
ToolbarItems.Add(new DismissModalToolBarItem(this));
}
@@ -399,7 +399,7 @@ namespace Bit.App.Pages
_tapped = tappedAction;
Label.Text = attachment.Name;
Detail.Text = attachment.SizeName;
Icon.Source = "download";
Icon.Source = "download.png";
BackgroundColor = Color.White;
Detail.MinimumWidthRequest = 100;
}

View File

@@ -11,7 +11,7 @@
<package id="PInvoke.Windows.Core" version="0.5.97" targetFramework="portable45-net45+win8+wpa81" />
<package id="Plugin.Fingerprint" version="1.4.5" targetFramework="portable45-net45+win8+wpa81" />
<package id="Splat" version="1.6.2" targetFramework="portable45-net45+win8+wpa81" />
<package id="sqlite-net-pcl" version="1.4.118" targetFramework="portable45-net45+win8+wpa81" />
<package id="sqlite-net-pcl" version="1.5.166-beta" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.8" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLitePCLRaw.core" version="1.1.8" targetFramework="portable45-net45+win8+wpa81" />
<package id="Validation" version="2.3.7" targetFramework="portable45-net45+win8+wpa81" />