diff --git a/src/App/App.cs b/src/App/App.cs
index 793e16796..4706f18a5 100644
--- a/src/App/App.cs
+++ b/src/App/App.cs
@@ -124,7 +124,7 @@ namespace Bit.App
SetMainPageFromAutofill();
- if(Device.OS == TargetPlatform.Android && !TopPageIsLock())
+ if(Device.RuntimePlatform == Device.Android && !TopPageIsLock())
{
_lockService.UpdateLastActivity();
}
@@ -141,7 +141,7 @@ namespace Bit.App
// Handle when your app resumes
Debug.WriteLine("OnResume");
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
await CheckLockAsync(false);
}
@@ -152,7 +152,7 @@ namespace Bit.App
lockPinPage.PinControl.Entry.FocusWithDelay();
}
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
await Task.Run(() => FullSyncAsync()).ConfigureAwait(false);
}
@@ -160,7 +160,7 @@ namespace Bit.App
private void SetMainPageFromAutofill()
{
- if(Device.OS == TargetPlatform.Android && !string.IsNullOrWhiteSpace(_uri))
+ if(Device.RuntimePlatform == Device.Android && !string.IsNullOrWhiteSpace(_uri))
{
Task.Run(() =>
{
@@ -386,7 +386,7 @@ namespace Bit.App
Debug.WriteLine("====================================");
// This lookup NOT required for Windows platforms - the Culture will be automatically set
- if(Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
{
var ci = _localizeService.GetCurrentCultureInfo();
AppResources.Culture = ci;
diff --git a/src/App/App.csproj b/src/App/App.csproj
index 2cb81d816..f9a2cfc3b 100644
--- a/src/App/App.csproj
+++ b/src/App/App.csproj
@@ -275,6 +275,7 @@
+
diff --git a/src/App/Controls/ExtendedButton.cs b/src/App/Controls/ExtendedButton.cs
index d0d3733d0..9ccc0bc59 100644
--- a/src/App/Controls/ExtendedButton.cs
+++ b/src/App/Controls/ExtendedButton.cs
@@ -1,4 +1,5 @@
using Bit.App.Enums;
+using Bit.App.Utilities;
using System;
using Xamarin.Forms;
@@ -10,7 +11,7 @@ namespace Bit.App.Controls
BindableProperty.Create(nameof(Padding), typeof(Thickness), typeof(ExtendedButton), default(Thickness));
public static readonly BindableProperty UppercaseProperty =
BindableProperty.Create(nameof(Uppercase), typeof(bool), typeof(ExtendedButton),
- Device.OnPlatform(iOS: false, Android: true, WinPhone: false));
+ Helpers.OnPlatform(iOS: false, Android: true, WinPhone: false));
public Thickness Padding
{
diff --git a/src/App/Controls/ExtendedEntry.cs b/src/App/Controls/ExtendedEntry.cs
index 97cb1844c..f855175a7 100644
--- a/src/App/Controls/ExtendedEntry.cs
+++ b/src/App/Controls/ExtendedEntry.cs
@@ -8,7 +8,7 @@ namespace Bit.App.Controls
{
public ExtendedEntry()
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
PlaceholderColor = Color.FromHex("c7c7cd");
}
diff --git a/src/App/Controls/ExtendedTextCell.cs b/src/App/Controls/ExtendedTextCell.cs
index eb595bdec..7276fe1f2 100644
--- a/src/App/Controls/ExtendedTextCell.cs
+++ b/src/App/Controls/ExtendedTextCell.cs
@@ -7,7 +7,7 @@ namespace Bit.App.Controls
{
public ExtendedTextCell()
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
TextColor = Color.Black;
}
diff --git a/src/App/Controls/FormEntryCell.cs b/src/App/Controls/FormEntryCell.cs
index c4a869a1f..879124e3a 100644
--- a/src/App/Controls/FormEntryCell.cs
+++ b/src/App/Controls/FormEntryCell.cs
@@ -87,7 +87,7 @@ namespace Bit.App.Controls
VerticalOptions = LayoutOptions.CenterAndExpand
};
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
var deviceInfo = Resolver.Resolve();
if(useLabelAsPlaceholder)
@@ -125,7 +125,7 @@ namespace Bit.App.Controls
Button = new ExtendedButton();
imageStackLayout.Children.Add(Button);
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
Button.Padding = new Thickness(0);
Button.BackgroundColor = Color.Transparent;
diff --git a/src/App/Controls/FormPickerCell.cs b/src/App/Controls/FormPickerCell.cs
index a7f3d7112..c3ff1223c 100644
--- a/src/App/Controls/FormPickerCell.cs
+++ b/src/App/Controls/FormPickerCell.cs
@@ -34,7 +34,7 @@ namespace Bit.App.Controls
stackLayout.Children.Add(Label);
stackLayout.Children.Add(Picker);
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
stackLayout.Spacing = 0;
}
diff --git a/src/App/Controls/LabeledDetailCell.cs b/src/App/Controls/LabeledDetailCell.cs
index 9e6161915..fd47efff8 100644
--- a/src/App/Controls/LabeledDetailCell.cs
+++ b/src/App/Controls/LabeledDetailCell.cs
@@ -51,7 +51,7 @@ namespace Bit.App.Controls
Grid.SetColumnSpan(Detail, 2);
Grid.SetRowSpan(Button, 2);
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
Label.TextColor = Color.Black;
}
diff --git a/src/App/Controls/LabeledValueCell.cs b/src/App/Controls/LabeledValueCell.cs
index bcc867db8..c84e967e3 100644
--- a/src/App/Controls/LabeledValueCell.cs
+++ b/src/App/Controls/LabeledValueCell.cs
@@ -41,7 +41,7 @@ namespace Bit.App.Controls
LineBreakMode = LineBreakMode.TailTruncation
};
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
Value.TextColor = Color.Black;
}
@@ -82,7 +82,7 @@ namespace Bit.App.Controls
buttonStackLayout.Children.Add(Button2);
}
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
buttonStackLayout.Spacing = 5;
diff --git a/src/App/Controls/PinControl.cs b/src/App/Controls/PinControl.cs
index 68fa54ad0..91eeb6a10 100644
--- a/src/App/Controls/PinControl.cs
+++ b/src/App/Controls/PinControl.cs
@@ -1,4 +1,5 @@
-using System;
+using Bit.App.Utilities;
+using System;
using Xamarin.Forms;
namespace Bit.App.Controls
@@ -13,7 +14,7 @@ namespace Bit.App.Controls
{
HorizontalTextAlignment = TextAlignment.Center,
FontSize = 35,
- FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier")
+ FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier")
};
Entry = new ExtendedEntry
@@ -23,7 +24,7 @@ namespace Bit.App.Controls
Margin = new Thickness(0, int.MaxValue, 0, 0)
};
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
Label.TextColor = Color.Black;
}
diff --git a/src/App/Controls/StepperCell.cs b/src/App/Controls/StepperCell.cs
index a23f66674..a0de6f3ac 100644
--- a/src/App/Controls/StepperCell.cs
+++ b/src/App/Controls/StepperCell.cs
@@ -1,4 +1,5 @@
-using Xamarin.Forms;
+using Bit.App.Utilities;
+using Xamarin.Forms;
namespace Bit.App.Controls
{
@@ -39,13 +40,13 @@ namespace Bit.App.Controls
Orientation = StackOrientation.Horizontal,
Children = { Label, StepperValueLabel, Stepper },
Spacing = 15,
- Padding = Device.OnPlatform(
+ Padding = Helpers.OnPlatform(
iOS: new Thickness(15, 8),
Android: new Thickness(15, 2),
WinPhone: new Thickness(15, 8))
};
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
Label.TextColor = Color.Black;
}
diff --git a/src/App/Controls/VaultListViewCell.cs b/src/App/Controls/VaultListViewCell.cs
index 37f1d368c..04995d8dc 100644
--- a/src/App/Controls/VaultListViewCell.cs
+++ b/src/App/Controls/VaultListViewCell.cs
@@ -12,9 +12,9 @@ namespace Bit.App.Controls
public VaultListViewCell(Action moreClickedAction)
{
SetBinding(LoginParameterProperty, new Binding("."));
- Label.SetBinding(Label.TextProperty, l => l.Name);
- Detail.SetBinding(Label.TextProperty, l => l.Username);
- LabelIcon.SetBinding(VisualElement.IsVisibleProperty, l => l.Shared);
+ Label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Name));
+ Detail.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Username));
+ LabelIcon.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Login.Shared));
Button.Image = "more";
Button.Command = new Command(() => moreClickedAction?.Invoke(LoginParameter));
diff --git a/src/App/Models/Api/Request/DeviceRequest.cs b/src/App/Models/Api/Request/DeviceRequest.cs
index b543a2a4b..1ae298cbb 100644
--- a/src/App/Models/Api/Request/DeviceRequest.cs
+++ b/src/App/Models/Api/Request/DeviceRequest.cs
@@ -12,7 +12,7 @@ namespace Bit.App.Models.Api
{
Identifier = appIdService.AppId;
Name = deviceInfoService.Model;
- Type = Device.OS == TargetPlatform.Android ? DeviceType.Android : DeviceType.iOS;
+ Type = Device.RuntimePlatform == Device.Android ? DeviceType.Android : DeviceType.iOS;
}
public DeviceType Type { get; set; }
diff --git a/src/App/Models/Page/VaultViewLoginPageModel.cs b/src/App/Models/Page/VaultViewLoginPageModel.cs
index af0cb6574..8b8b8ce52 100644
--- a/src/App/Models/Page/VaultViewLoginPageModel.cs
+++ b/src/App/Models/Page/VaultViewLoginPageModel.cs
@@ -13,7 +13,6 @@ namespace Bit.App.Models.Page
private string _uri;
private string _notes;
private bool _revealPassword;
- private string _uriHost;
public VaultViewLoginPageModel() { }
@@ -44,7 +43,7 @@ namespace Bit.App.Models.Page
{
get
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
var length = Username?.Length ?? 0;
@@ -79,7 +78,7 @@ namespace Bit.App.Models.Page
{
get
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
var length = Password?.Length ?? 0;
@@ -121,11 +120,6 @@ namespace Bit.App.Models.Page
return null;
}
- if(_uriHost != null)
- {
- return _uriHost;
- }
-
Uri uri;
if(!System.Uri.TryCreate(Uri, UriKind.Absolute, out uri))
{
diff --git a/src/App/Pages/Lock/BaseLockPage.cs b/src/App/Pages/Lock/BaseLockPage.cs
index a438be309..027cbf998 100644
--- a/src/App/Pages/Lock/BaseLockPage.cs
+++ b/src/App/Pages/Lock/BaseLockPage.cs
@@ -20,7 +20,7 @@ namespace Bit.App.Pages
protected override bool OnBackButtonPressed()
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
MessagingCenter.Send(Application.Current, "BackgroundApp");
}
diff --git a/src/App/Pages/Lock/LockPasswordPage.cs b/src/App/Pages/Lock/LockPasswordPage.cs
index d89d50329..73e017b2b 100644
--- a/src/App/Pages/Lock/LockPasswordPage.cs
+++ b/src/App/Pages/Lock/LockPasswordPage.cs
@@ -6,6 +6,7 @@ using Xamarin.Forms;
using XLabs.Ioc;
using Bit.App.Controls;
using System.Linq;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -29,7 +30,7 @@ namespace Bit.App.Pages
public void Init()
{
- var padding = Device.OnPlatform(
+ var padding = Helpers.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
@@ -74,7 +75,7 @@ namespace Bit.App.Pages
var scrollView = new ScrollView { Content = stackLayout };
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
diff --git a/src/App/Pages/Lock/LockPinPage.cs b/src/App/Pages/Lock/LockPinPage.cs
index 4cd6cd5ce..df796c0a1 100644
--- a/src/App/Pages/Lock/LockPinPage.cs
+++ b/src/App/Pages/Lock/LockPinPage.cs
@@ -38,8 +38,8 @@ namespace Bit.App.Pages
};
PinControl = new PinControl();
- PinControl.Label.SetBinding(Label.TextProperty, s => s.LabelText);
- PinControl.Entry.SetBinding(Entry.TextProperty, s => s.PIN);
+ PinControl.Label.SetBinding(Label.TextProperty, nameof(PinPageModel.LabelText));
+ PinControl.Entry.SetBinding(Entry.TextProperty, nameof(PinPageModel.PIN));
var logoutButton = new ExtendedButton
{
diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs
index 4a4d23540..d1788b0b8 100644
--- a/src/App/Pages/LoginPage.cs
+++ b/src/App/Pages/LoginPage.cs
@@ -8,6 +8,7 @@ using Acr.UserDialogs;
using System.Threading.Tasks;
using Plugin.Settings.Abstractions;
using PushNotification.Plugin.Abstractions;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -42,7 +43,7 @@ namespace Bit.App.Pages
{
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
- var padding = Device.OnPlatform(
+ var padding = Helpers.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
@@ -97,12 +98,12 @@ namespace Bit.App.Pages
var layout = new StackLayout
{
Children = { table, forgotPasswordButton },
- Spacing = Device.OnPlatform(iOS: 0, Android: 10, WinPhone: 0)
+ Spacing = Helpers.OnPlatform(iOS: 0, Android: 10, WinPhone: 0)
};
var scrollView = new ScrollView { Content = layout };
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
@@ -197,7 +198,7 @@ namespace Bit.App.Pages
_googleAnalyticsService.TrackAppEvent("LoggedIn");
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
_pushNotification.Register();
}
diff --git a/src/App/Pages/LoginTwoFactorPage.cs b/src/App/Pages/LoginTwoFactorPage.cs
index 306843b82..4abfe12b3 100644
--- a/src/App/Pages/LoginTwoFactorPage.cs
+++ b/src/App/Pages/LoginTwoFactorPage.cs
@@ -8,6 +8,7 @@ using Acr.UserDialogs;
using System.Threading.Tasks;
using PushNotification.Plugin.Abstractions;
using Bit.App.Models;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -42,7 +43,7 @@ namespace Bit.App.Pages
private void Init()
{
- var padding = Device.OnPlatform(
+ var padding = Helpers.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
@@ -97,7 +98,7 @@ namespace Bit.App.Pages
var scrollView = new ScrollView { Content = layout };
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
@@ -158,7 +159,7 @@ namespace Bit.App.Pages
_googleAnalyticsService.TrackAppEvent("LoggedIn From Two-step");
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
_pushNotification.Register();
}
diff --git a/src/App/Pages/PasswordHintPage.cs b/src/App/Pages/PasswordHintPage.cs
index 2c9303841..9881556ac 100644
--- a/src/App/Pages/PasswordHintPage.cs
+++ b/src/App/Pages/PasswordHintPage.cs
@@ -8,6 +8,7 @@ using Xamarin.Forms;
using XLabs.Ioc;
using Acr.UserDialogs;
using System.Threading.Tasks;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -29,7 +30,7 @@ namespace Bit.App.Pages
private void Init()
{
- var padding = Device.OnPlatform(
+ var padding = Helpers.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
@@ -73,7 +74,7 @@ namespace Bit.App.Pages
var scrollView = new ScrollView { Content = layout };
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs
index f332e6a00..b0f8987f9 100644
--- a/src/App/Pages/RegisterPage.cs
+++ b/src/App/Pages/RegisterPage.cs
@@ -8,6 +8,7 @@ using Xamarin.Forms;
using XLabs.Ioc;
using Acr.UserDialogs;
using System.Threading.Tasks;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -43,7 +44,7 @@ namespace Bit.App.Pages
{
MessagingCenter.Send(Application.Current, "ShowStatusBar", true);
- var padding = Device.OnPlatform(
+ var padding = Helpers.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(15, 8),
WinPhone: new Thickness(15, 20));
@@ -121,7 +122,7 @@ namespace Bit.App.Pages
await Register();
}, ToolbarItemOrder.Default, 0);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = table2.RowHeight = -1;
table.EstimatedRowHeight = table2.EstimatedRowHeight = 70;
diff --git a/src/App/Pages/Settings/SettingsAboutPage.cs b/src/App/Pages/Settings/SettingsAboutPage.cs
index b847673a6..cbb2b61bb 100644
--- a/src/App/Pages/Settings/SettingsAboutPage.cs
+++ b/src/App/Pages/Settings/SettingsAboutPage.cs
@@ -66,7 +66,7 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 44;
@@ -78,7 +78,7 @@ namespace Bit.App.Pages
Spacing = 0
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
diff --git a/src/App/Pages/Settings/SettingsAddFolderPage.cs b/src/App/Pages/Settings/SettingsAddFolderPage.cs
index ea93c2f24..665a4e77f 100644
--- a/src/App/Pages/Settings/SettingsAddFolderPage.cs
+++ b/src/App/Pages/Settings/SettingsAddFolderPage.cs
@@ -49,7 +49,7 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
@@ -105,7 +105,7 @@ namespace Bit.App.Pages
Title = AppResources.AddFolder;
Content = table;
ToolbarItems.Add(saveToolBarItem);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
diff --git a/src/App/Pages/Settings/SettingsCreditsPage.cs b/src/App/Pages/Settings/SettingsCreditsPage.cs
index 84413c29a..2b701f992 100644
--- a/src/App/Pages/Settings/SettingsCreditsPage.cs
+++ b/src/App/Pages/Settings/SettingsCreditsPage.cs
@@ -2,6 +2,7 @@
using Bit.App.Controls;
using Xamarin.Forms;
using Bit.App.Resources;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -37,7 +38,7 @@ Fingerprint by masterpage.com from the Noun Project")
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 100;
@@ -61,14 +62,14 @@ Fingerprint by masterpage.com from the Noun Project")
var layout = new StackLayout
{
Children = { label },
- Padding = Device.OnPlatform(
+ Padding = Helpers.OnPlatform(
iOS: new Thickness(15, 20),
Android: new Thickness(16, 20),
WinPhone: new Thickness(15, 20)),
BackgroundColor = Color.White
};
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
label.TextColor = Color.Black;
}
diff --git a/src/App/Pages/Settings/SettingsEditFolderPage.cs b/src/App/Pages/Settings/SettingsEditFolderPage.cs
index ec77aa0cb..6e9659dc1 100644
--- a/src/App/Pages/Settings/SettingsEditFolderPage.cs
+++ b/src/App/Pages/Settings/SettingsEditFolderPage.cs
@@ -66,7 +66,7 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
mainTable.RowHeight = -1;
mainTable.EstimatedRowHeight = 70;
@@ -119,7 +119,7 @@ namespace Bit.App.Pages
Title = AppResources.EditFolder;
Content = mainTable;
ToolbarItems.Add(saveToolBarItem);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
diff --git a/src/App/Pages/Settings/SettingsFeaturesPage.cs b/src/App/Pages/Settings/SettingsFeaturesPage.cs
index a0944d422..38adb502d 100644
--- a/src/App/Pages/Settings/SettingsFeaturesPage.cs
+++ b/src/App/Pages/Settings/SettingsFeaturesPage.cs
@@ -78,7 +78,7 @@ namespace Bit.App.Pages
Spacing = 0
};
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
AutofillAlwaysCell = new ExtendedSwitchCell
{
@@ -161,7 +161,7 @@ namespace Bit.App.Pages
Content = StackLayout
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
analyticsTable.RowHeight = -1;
analyticsTable.EstimatedRowHeight = 70;
diff --git a/src/App/Pages/Settings/SettingsHelpPage.cs b/src/App/Pages/Settings/SettingsHelpPage.cs
index 9b86f2b41..a1df0d99d 100644
--- a/src/App/Pages/Settings/SettingsHelpPage.cs
+++ b/src/App/Pages/Settings/SettingsHelpPage.cs
@@ -102,7 +102,7 @@ namespace Bit.App.Pages
Spacing = 0
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
@@ -165,7 +165,7 @@ namespace Bit.App.Pages
VerticalOptions = LayoutOptions.Start;
NoFooter = true;
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
RowHeight = -1;
EstimatedRowHeight = 44;
diff --git a/src/App/Pages/Settings/SettingsListFoldersPage.cs b/src/App/Pages/Settings/SettingsListFoldersPage.cs
index 7b0ebb422..080625d0b 100644
--- a/src/App/Pages/Settings/SettingsListFoldersPage.cs
+++ b/src/App/Pages/Settings/SettingsListFoldersPage.cs
@@ -41,7 +41,7 @@ namespace Bit.App.Pages
ItemTemplate = new DataTemplate(() => new SettingsFolderListViewCell(this))
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
@@ -102,7 +102,7 @@ namespace Bit.App.Pages
{
public SettingsFolderListViewCell(SettingsListFoldersPage page)
{
- this.SetBinding(TextProperty, s => s.Name);
+ this.SetBinding(TextProperty, nameof(SettingsFolderPageModel.Name));
}
}
}
diff --git a/src/App/Pages/Settings/SettingsPage.cs b/src/App/Pages/Settings/SettingsPage.cs
index a65935491..eaf17c406 100644
--- a/src/App/Pages/Settings/SettingsPage.cs
+++ b/src/App/Pages/Settings/SettingsPage.cs
@@ -8,6 +8,7 @@ using Acr.UserDialogs;
using Plugin.Settings.Abstractions;
using Plugin.Fingerprint.Abstractions;
using PushNotification.Plugin.Abstractions;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -81,7 +82,7 @@ namespace Bit.App.Pages
if(_fingerprint.IsAvailable)
{
- var fingerprintName = Device.OnPlatform(iOS: AppResources.TouchID, Android: AppResources.Fingerprint,
+ var fingerprintName = Helpers.OnPlatform(iOS: AppResources.TouchID, Android: AppResources.Fingerprint,
WinPhone: AppResources.Fingerprint);
FingerprintCell = new ExtendedSwitchCell
{
@@ -151,7 +152,7 @@ namespace Bit.App.Pages
HelpCell
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
RateCellLong = new LongDetailViewCell(AppResources.RateTheApp, AppResources.RateTheAppDescriptionAppStore);
otherSection.Add(RateCellLong);
@@ -328,12 +329,12 @@ namespace Bit.App.Pages
private void RateCell_Tapped(object sender, EventArgs e)
{
_googleAnalyticsService.TrackAppEvent("OpenedSetting", "RateApp");
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
Device.OpenUri(new Uri($"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews" +
"?id=1137397744&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software"));
}
- else if(Device.OS == TargetPlatform.Android)
+ else if(Device.RuntimePlatform == Device.Android)
{
MessagingCenter.Send(Application.Current, "RateApp");
}
@@ -484,7 +485,7 @@ namespace Bit.App.Pages
Intent = TableIntent.Settings;
HasUnevenRows = true;
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
RowHeight = -1;
EstimatedRowHeight = 44;
diff --git a/src/App/Pages/Settings/SettingsPinPage.cs b/src/App/Pages/Settings/SettingsPinPage.cs
index b117ee5cd..0575d27e3 100644
--- a/src/App/Pages/Settings/SettingsPinPage.cs
+++ b/src/App/Pages/Settings/SettingsPinPage.cs
@@ -42,8 +42,8 @@ namespace Bit.App.Pages
};
PinControl = new PinControl();
- PinControl.Label.SetBinding(Label.TextProperty, s => s.LabelText);
- PinControl.Entry.SetBinding(Entry.TextProperty, s => s.PIN);
+ PinControl.Label.SetBinding(Label.TextProperty, nameof(PinPageModel.LabelText));
+ PinControl.Entry.SetBinding(Entry.TextProperty, nameof(PinPageModel.PIN));
var stackLayout = new StackLayout
{
@@ -56,7 +56,7 @@ namespace Bit.App.Pages
PinControl.Label.GestureRecognizers.Add(Tgr);
instructionLabel.GestureRecognizers.Add(Tgr);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
diff --git a/src/App/Pages/Settings/SettingsSyncPage.cs b/src/App/Pages/Settings/SettingsSyncPage.cs
index 2fbc67800..6eda27905 100644
--- a/src/App/Pages/Settings/SettingsSyncPage.cs
+++ b/src/App/Pages/Settings/SettingsSyncPage.cs
@@ -57,7 +57,7 @@ namespace Bit.App.Pages
Padding = new Thickness(15, 0)
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
diff --git a/src/App/Pages/Tools/ToolsAutofillServicePage.cs b/src/App/Pages/Tools/ToolsAutofillServicePage.cs
index 887bfbeaf..aac4a7fd7 100644
--- a/src/App/Pages/Tools/ToolsAutofillServicePage.cs
+++ b/src/App/Pages/Tools/ToolsAutofillServicePage.cs
@@ -167,7 +167,7 @@ namespace Bit.App.Pages
ScrollView = new ScrollView { Content = DisabledStackLayout };
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
}
diff --git a/src/App/Pages/Tools/ToolsExtensionPage.cs b/src/App/Pages/Tools/ToolsExtensionPage.cs
index 5e23893f4..b6a5d0a97 100644
--- a/src/App/Pages/Tools/ToolsExtensionPage.cs
+++ b/src/App/Pages/Tools/ToolsExtensionPage.cs
@@ -81,7 +81,7 @@ namespace Bit.App.Pages
VerticalOptions = LayoutOptions.FillAndExpand
};
- notStartedStackLayout.SetBinding(IsVisibleProperty, m => m.NotStarted);
+ notStartedStackLayout.SetBinding(IsVisibleProperty, nameof(AppExtensionPageModel.NotStarted));
// Not Activated
@@ -132,7 +132,7 @@ namespace Bit.App.Pages
VerticalOptions = LayoutOptions.FillAndExpand
};
- notActivatedStackLayout.SetBinding(IsVisibleProperty, m => m.StartedAndNotActivated);
+ notActivatedStackLayout.SetBinding(IsVisibleProperty, nameof(AppExtensionPageModel.StartedAndNotActivated));
// Activated
@@ -197,7 +197,7 @@ namespace Bit.App.Pages
Children = { activatedLabel, activatedSublabel, activatedImage, activatedButton, activatedButtonReenable }
};
- activatedStackLayout.SetBinding(IsVisibleProperty, m => m.StartedAndActivated);
+ activatedStackLayout.SetBinding(IsVisibleProperty, nameof(AppExtensionPageModel.StartedAndActivated));
var stackLayout = new StackLayout
{
@@ -205,7 +205,7 @@ namespace Bit.App.Pages
VerticalOptions = LayoutOptions.FillAndExpand
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
}
diff --git a/src/App/Pages/Tools/ToolsPage.cs b/src/App/Pages/Tools/ToolsPage.cs
index b5219825f..9ffdb285d 100644
--- a/src/App/Pages/Tools/ToolsPage.cs
+++ b/src/App/Pages/Tools/ToolsPage.cs
@@ -40,7 +40,7 @@ namespace Bit.App.Pages
var section = new TableSection(" ") { GeneratorCell };
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ExtensionCell = new ToolsViewCell(AppResources.BitwardenAppExtension,
AppResources.BitwardenAppExtensionDescription, "upload");
@@ -68,7 +68,7 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 100;
@@ -163,7 +163,7 @@ namespace Bit.App.Pages
Text = labelText
};
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
label.TextColor = Color.Black;
}
diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs
index 9b299030e..bd60ec64a 100644
--- a/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs
+++ b/src/App/Pages/Tools/ToolsPasswordGeneratorPage.cs
@@ -7,6 +7,7 @@ using Bit.App.Resources;
using Plugin.Settings.Abstractions;
using Xamarin.Forms;
using XLabs.Ioc;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -48,14 +49,14 @@ namespace Bit.App.Pages
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
Margin = new Thickness(15, 40, 15, 40),
HorizontalTextAlignment = TextAlignment.Center,
- FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier"),
+ FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier"),
LineBreakMode = LineBreakMode.TailTruncation,
VerticalOptions = LayoutOptions.Start
};
Tgr = new TapGestureRecognizer();
Password.GestureRecognizers.Add(Tgr);
- Password.SetBinding(Label.TextProperty, m => m.Password);
+ Password.SetBinding(Label.TextProperty, nameof(PasswordGeneratorPageModel.Password));
SliderCell = new SliderViewCell(this, _passwordGenerationService, _settings);
SettingsCell = new ExtendedTextCell { Text = AppResources.MoreSettings, ShowDisclousure = true };
@@ -86,7 +87,7 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 44;
@@ -248,21 +249,21 @@ namespace Bit.App.Pages
Style = (Style)Application.Current.Resources["text-muted"]
};
- Value.SetBinding(Label.TextProperty, m => m.Length);
+ Value.SetBinding(Label.TextProperty, nameof(PasswordGeneratorPageModel.Length));
var stackLayout = new StackLayout
{
Orientation = StackOrientation.Horizontal,
Spacing = 15,
Children = { label, LengthSlider, Value },
- Padding = Device.OnPlatform(
+ Padding = Helpers.OnPlatform(
iOS: new Thickness(15, 8),
Android: new Thickness(16, 10),
WinPhone: new Thickness(15, 8))
};
stackLayout.AdjustPaddingForDevice();
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
label.TextColor = Color.Black;
}
diff --git a/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs b/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs
index 8d2b5d173..98b5eedeb 100644
--- a/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs
+++ b/src/App/Pages/Tools/ToolsPasswordGeneratorSettingsPage.cs
@@ -96,7 +96,7 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 44;
diff --git a/src/App/Pages/Vault/VaultAddLoginPage.cs b/src/App/Pages/Vault/VaultAddLoginPage.cs
index 0771e2978..77b5d39c9 100644
--- a/src/App/Pages/Vault/VaultAddLoginPage.cs
+++ b/src/App/Pages/Vault/VaultAddLoginPage.cs
@@ -10,6 +10,7 @@ using Plugin.Connectivity.Abstractions;
using Xamarin.Forms;
using XLabs.Ioc;
using Plugin.Settings.Abstractions;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -62,7 +63,7 @@ namespace Bit.App.Pages
PasswordCell.Button.Image = "eye";
PasswordCell.Entry.DisableAutocapitalize = true;
PasswordCell.Entry.Autocorrect = false;
- PasswordCell.Entry.FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
+ PasswordCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
UsernameCell = new FormEntryCell(AppResources.Username, nextElement: PasswordCell.Entry);
UsernameCell.Entry.DisableAutocapitalize = true;
@@ -124,12 +125,12 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
}
- else if(Device.OS == TargetPlatform.Android)
+ else if(Device.RuntimePlatform == Device.Android)
{
PasswordCell.Button.WidthRequest = 40;
}
@@ -200,7 +201,7 @@ namespace Bit.App.Pages
Title = AppResources.AddLogin;
Content = table;
ToolbarItems.Add(saveToolBarItem);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
@@ -226,12 +227,12 @@ namespace Bit.App.Pages
if(!_fromAutofill && !_settings.GetValueOrDefault(AddedLoginAlertKey, false))
{
_settings.AddOrUpdateValue(AddedLoginAlertKey, true);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
DisplayAlert(AppResources.BitwardenAppExtension, AppResources.BitwardenAppExtensionAlert,
AppResources.Ok);
}
- else if(Device.OS == TargetPlatform.Android && !_appInfoService.AutofillServiceEnabled)
+ else if(Device.RuntimePlatform == Device.Android && !_appInfoService.AutofillServiceEnabled)
{
DisplayAlert(AppResources.BitwardenAutofillService, AppResources.BitwardenAutofillServiceAlert,
AppResources.Ok);
diff --git a/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs b/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs
index 2fb9b62e7..809f85eb4 100644
--- a/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs
+++ b/src/App/Pages/Vault/VaultAutofillListLoginsPage.cs
@@ -106,7 +106,7 @@ namespace Bit.App.Pages
(VaultListPageModel.Login l) => MoreClickedAsync(l)))
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ListView.RowHeight = -1;
}
@@ -325,7 +325,7 @@ namespace Bit.App.Pages
VerticalTextAlignment = TextAlignment.Center
};
- label.SetBinding(Label.TextProperty, s => s.Name);
+ label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.AutofillGrouping.Name));
var grid = new ContentView
{
diff --git a/src/App/Pages/Vault/VaultEditLoginPage.cs b/src/App/Pages/Vault/VaultEditLoginPage.cs
index 4d3526692..eeb46b80e 100644
--- a/src/App/Pages/Vault/VaultEditLoginPage.cs
+++ b/src/App/Pages/Vault/VaultEditLoginPage.cs
@@ -8,6 +8,7 @@ using Bit.App.Resources;
using Plugin.Connectivity.Abstractions;
using Xamarin.Forms;
using XLabs.Ioc;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -60,7 +61,7 @@ namespace Bit.App.Pages
PasswordCell.Button.Image = "eye";
PasswordCell.Entry.DisableAutocapitalize = true;
PasswordCell.Entry.Autocorrect = false;
- PasswordCell.Entry.FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
+ PasswordCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
UsernameCell = new FormEntryCell(AppResources.Username, nextElement: PasswordCell.Entry);
UsernameCell.Entry.Text = login.Username?.Decrypt(login.OrganizationId);
@@ -135,12 +136,12 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
table.RowHeight = -1;
table.EstimatedRowHeight = 70;
}
- else if(Device.OS == TargetPlatform.Android)
+ else if(Device.RuntimePlatform == Device.Android)
{
PasswordCell.Button.WidthRequest = 40;
}
@@ -206,7 +207,7 @@ namespace Bit.App.Pages
Title = AppResources.EditLogin;
Content = table;
ToolbarItems.Add(saveToolBarItem);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
diff --git a/src/App/Pages/Vault/VaultListLoginsPage.cs b/src/App/Pages/Vault/VaultListLoginsPage.cs
index 4ba377da8..77ab081e7 100644
--- a/src/App/Pages/Vault/VaultListLoginsPage.cs
+++ b/src/App/Pages/Vault/VaultListLoginsPage.cs
@@ -95,7 +95,7 @@ namespace Bit.App.Pages
(VaultListPageModel.Login l) => MoreClickedAsync(l)))
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ListView.RowHeight = -1;
}
@@ -107,7 +107,7 @@ namespace Bit.App.Pages
CancelButtonColor = Color.FromHex("3c8dbc")
};
// Bug with searchbar on android 7, ref https://bugzilla.xamarin.com/show_bug.cgi?id=43975
- if(Device.OS == TargetPlatform.Android && _deviceInfoService.Version >= 24)
+ if(Device.RuntimePlatform == Device.Android && _deviceInfoService.Version >= 24)
{
Search.HeightRequest = 50;
}
@@ -239,7 +239,7 @@ namespace Bit.App.Pages
_filterResultsCancellationTokenSource = FetchAndLoadVault();
}
- if(_connectivity.IsConnected && Device.OS == TargetPlatform.iOS && !_favorites)
+ if(_connectivity.IsConnected && Device.RuntimePlatform == Device.iOS && !_favorites)
{
var pushPromptShow = _settings.GetValueOrDefault(Constants.PushInitialPromptShown, false);
Action registerAction = () =>
@@ -512,7 +512,7 @@ namespace Bit.App.Pages
VerticalTextAlignment = TextAlignment.Center
};
- label.SetBinding(Label.TextProperty, s => s.Name);
+ label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Folder.Name));
var grid = new Grid
{
diff --git a/src/App/Pages/Vault/VaultViewLoginPage.cs b/src/App/Pages/Vault/VaultViewLoginPage.cs
index cc283e325..4c9061471 100644
--- a/src/App/Pages/Vault/VaultViewLoginPage.cs
+++ b/src/App/Pages/Vault/VaultViewLoginPage.cs
@@ -7,6 +7,7 @@ using Bit.App.Resources;
using Xamarin.Forms;
using XLabs.Ioc;
using System.Threading.Tasks;
+using Bit.App.Utilities;
namespace Bit.App.Pages
{
@@ -41,44 +42,44 @@ namespace Bit.App.Pages
{
EditItem = new EditLoginToolBarItem(this, _loginId);
ToolbarItems.Add(EditItem);
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this));
}
// Name
var nameCell = new LabeledValueCell(AppResources.Name);
- nameCell.Value.SetBinding(Label.TextProperty, s => s.Name);
+ nameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Name));
// Username
UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
- UsernameCell.Value.SetBinding(Label.TextProperty, s => s.Username);
- UsernameCell.Value.SetBinding(Label.FontSizeProperty, s => s.UsernameFontSize);
+ UsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Username));
+ UsernameCell.Value.SetBinding(Label.FontSizeProperty, nameof(VaultViewLoginPageModel.UsernameFontSize));
UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));
// Password
PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
button2Text: AppResources.Copy);
- PasswordCell.Value.SetBinding(Label.TextProperty, s => s.MaskedPassword);
- PasswordCell.Value.SetBinding(Label.FontSizeProperty, s => s.PasswordFontSize);
- PasswordCell.Button1.SetBinding(Button.ImageProperty, s => s.ShowHideImage);
- if(Device.OS == TargetPlatform.iOS)
+ PasswordCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.MaskedPassword));
+ PasswordCell.Value.SetBinding(Label.FontSizeProperty, nameof(VaultViewLoginPageModel.PasswordFontSize));
+ PasswordCell.Value.SetBinding(Button.ImageProperty, nameof(VaultViewLoginPageModel.ShowHideImage));
+ if(Device.RuntimePlatform == Device.iOS)
{
PasswordCell.Button1.Margin = new Thickness(10, 0);
}
PasswordCell.Button1.Command = new Command(() => Model.RevealPassword = !Model.RevealPassword);
PasswordCell.Button2.Command = new Command(() => Copy(Model.Password, AppResources.Password));
- PasswordCell.Value.FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
+ PasswordCell.Value.FontFamily = Helpers.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");
// URI
UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
- UriCell.Value.SetBinding(Label.TextProperty, s => s.UriHost);
- UriCell.Button1.SetBinding(IsVisibleProperty, s => s.ShowLaunch);
+ UriCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.UriHost));
+ UriCell.Value.SetBinding(IsVisibleProperty, nameof(VaultViewLoginPageModel.ShowLaunch));
UriCell.Button1.Command = new Command(() => Device.OpenUri(new Uri(Model.Uri)));
// Notes
NotesCell = new LabeledValueCell();
- NotesCell.Value.SetBinding(Label.TextProperty, s => s.Notes);
+ NotesCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Notes));
NotesCell.Value.LineBreakMode = LineBreakMode.WordWrap;
LoginInformationSection = new TableSection(AppResources.LoginInformation)
@@ -104,12 +105,12 @@ namespace Bit.App.Pages
}
};
- if(Device.OS == TargetPlatform.iOS)
+ if(Device.RuntimePlatform == Device.iOS)
{
Table.RowHeight = -1;
Table.EstimatedRowHeight = 70;
}
- else if(Device.OS == TargetPlatform.Android)
+ else if(Device.RuntimePlatform == Device.Android)
{
// NOTE: This is going to cause problems with i18n strings since various languages have difference string sizes
PasswordCell.Button1.WidthRequest = 40;
diff --git a/src/App/Utilities/Extentions.cs b/src/App/Utilities/Extentions.cs
index 2c9f0bf13..295bbb424 100644
--- a/src/App/Utilities/Extentions.cs
+++ b/src/App/Utilities/Extentions.cs
@@ -39,7 +39,7 @@ namespace Bit.App
public static void FocusWithDelay(this Entry entry, int delay = 1000)
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
Task.Run(async () =>
{
@@ -65,7 +65,7 @@ namespace Bit.App
public static void AdjustMarginsForDevice(this View view)
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
var deviceInfo = Resolver.Resolve();
if(deviceInfo.Version < 21)
@@ -85,7 +85,7 @@ namespace Bit.App
public static void AdjustPaddingForDevice(this Layout view)
{
- if(Device.OS == TargetPlatform.Android)
+ if(Device.RuntimePlatform == Device.Android)
{
var deviceInfo = Resolver.Resolve();
if(deviceInfo.Scale == 1) // mdpi
@@ -114,7 +114,7 @@ namespace Bit.App
System.Diagnostics.Debug.WriteLine("Last action occurred recently.");
return true;
}
-
+
return false;
}
}
diff --git a/src/App/Utilities/Helpers.cs b/src/App/Utilities/Helpers.cs
new file mode 100644
index 000000000..dcd0894f4
--- /dev/null
+++ b/src/App/Utilities/Helpers.cs
@@ -0,0 +1,26 @@
+using System;
+using Xamarin.Forms;
+
+namespace Bit.App.Utilities
+{
+ public static class Helpers
+ {
+ public static T OnPlatform(T iOS = default(T), T Android = default(T),
+ T WinPhone = default(T), T Windows = default(T))
+ {
+ switch(Device.RuntimePlatform)
+ {
+ case Device.iOS:
+ return iOS;
+ case Device.Android:
+ return Android;
+ case Device.WinPhone:
+ return WinPhone;
+ case Device.Windows:
+ return Windows;
+ default:
+ throw new Exception("Unsupported platform.");
+ }
+ }
+ }
+}
diff --git a/test/Android.Test/Android.Test.csproj b/test/Android.Test/Android.Test.csproj
index 7bf17e30d..a57d2a5a3 100644
--- a/test/Android.Test/Android.Test.csproj
+++ b/test/Android.Test/Android.Test.csproj
@@ -122,10 +122,10 @@
-
+
-
+