From 145482ea3014527540779481ca3ade4a64cc9d26 Mon Sep 17 00:00:00 2001
From: Matt Portune <59324545+mportune-bw@users.noreply.github.com>
Date: Fri, 20 Mar 2020 17:54:23 -0400
Subject: [PATCH] Project lib updates and migration (#789)
* Replace 3rd party FAB lib with our own code
* merged
* merged
* WIP
* WIP
* WIP
* WIP
* Updated LiteDB
* Update ZXing libs to 2.4.1
* Missing semicolon
* rename fab style to btn-fab
* Revert project guid modified by VSmac
---
src/Android/Android.csproj | 29 ++++++++----------
src/Android/Effects/FabShadowEffect.cs | 29 ++++++++++++++++++
src/Android/Effects/FixedSizeEffect.cs | 7 ++---
src/Android/Effects/SelectableLabelEffect.cs | 7 ++---
src/Android/Effects/TabBarEffect.cs | 7 ++---
src/Android/MainActivity.cs | 2 +-
src/Android/MainApplication.cs | 2 --
src/Android/Properties/AndroidManifest.xml | 4 +--
.../Renderers/ExtendedSliderRenderer.cs | 2 +-
src/Android/Resources/layout/Tabbar.axml | 2 +-
src/Android/Resources/layout/Toolbar.axml | 2 +-
src/Android/Services/DeviceActionService.cs | 4 +--
.../CustomFingerprintDialogFragment.cs | 30 -------------------
src/App/App.csproj | 10 +++----
src/App/Effects/FabShadowEffect.cs | 11 +++++++
src/App/Pages/Settings/FoldersPage.xaml | 13 +++++---
src/App/Pages/Settings/FoldersPage.xaml.cs | 4 ---
src/App/Pages/Vault/AutofillCiphersPage.xaml | 12 +++++---
.../Pages/Vault/AutofillCiphersPage.xaml.cs | 1 -
.../Vault/GroupingsPage/GroupingsPage.xaml | 12 +++++---
.../Vault/GroupingsPage/GroupingsPage.xaml.cs | 1 -
src/App/Pages/Vault/ViewPage.xaml | 12 +++++---
src/App/Pages/Vault/ViewPage.xaml.cs | 1 -
.../Services/MobilePlatformUtilsService.cs | 2 +-
src/App/Styles/Base.xaml | 23 ++++++++------
src/Core/Core.csproj | 2 +-
src/Core/Services/LiteDbStorageService.cs | 6 ++--
src/iOS/iOS.csproj | 2 +-
28 files changed, 125 insertions(+), 114 deletions(-)
create mode 100644 src/Android/Effects/FabShadowEffect.cs
delete mode 100644 src/Android/Utilities/CustomFingerprintDialogFragment.cs
create mode 100644 src/App/Effects/FabShadowEffect.cs
diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj
index 2c227c5b2..dc18ec1ac 100644
--- a/src/Android/Android.csproj
+++ b/src/Android/Android.csproj
@@ -15,11 +15,11 @@
Properties\AndroidManifest.xml
Resources
Assets
- false
v10.0
Xamarin.Android.Net.AndroidClientHandler
+ Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;BitwardenCore;Xamarin.Android.Net;Xamarin.Android.Net.OldAndroidSSLSocketFactory
true
@@ -30,10 +30,8 @@
prompt
3
None
- true
1G
- Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;BitwardenCore;Xamarin.Android.Net;Xamarin.Android.Net.OldAndroidSSLSocketFactory
false
@@ -46,8 +44,6 @@
false
armeabi-v7a;x86;x86_64;arm64-v8a
1G
- true
- Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;BitwardenCore;Xamarin.Android.Net;Xamarin.Android.Net.OldAndroidSSLSocketFactory
true
Full
@@ -63,10 +59,8 @@
FDROID
armeabi-v7a;x86;x86_64;arm64-v8a
1G
- true
false
true
- Xamarin.GooglePlayServices.Base;Xamarin.GooglePlayServices.Basement;Xamarin.GooglePlayServices.Measurement;Xamarin.GooglePlayServices.Gcm;BitwardenAndroid;BitwardenApp;BitwardenCore;Xamarin.Android.Net;Xamarin.Android.Net.OldAndroidSSLSocketFactory
Full
@@ -82,21 +76,22 @@
2.1.0.4
- 1.8.5.2
+ 1.8.6
- 1.3.1
+ 1.5.1
- 60.1142.1
+ 71.1740.0
-
-
-
-
-
+
+
+
+
+
+
- 60.1142.1
+ 71.1600.0
@@ -113,6 +108,7 @@
+
@@ -143,7 +139,6 @@
-
diff --git a/src/Android/Effects/FabShadowEffect.cs b/src/Android/Effects/FabShadowEffect.cs
new file mode 100644
index 000000000..83ce27c63
--- /dev/null
+++ b/src/Android/Effects/FabShadowEffect.cs
@@ -0,0 +1,29 @@
+using Android.Graphics.Drawables;
+using Bit.Droid.Effects;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Android;
+
+[assembly: ExportEffect(typeof(FabShadowEffect), "FabShadowEffect")]
+namespace Bit.Droid.Effects
+{
+ public class FabShadowEffect : PlatformEffect
+ {
+ protected override void OnAttached ()
+ {
+ if(Control is Android.Widget.Button button)
+ {
+ var gd = new GradientDrawable();
+ gd.SetColor(((Color)Application.Current.Resources["FabColor"]).ToAndroid());
+ gd.SetCornerRadius(100);
+
+ button.SetBackground(gd);
+ button.Elevation = 6;
+ button.TranslationZ = 20;
+ }
+ }
+
+ protected override void OnDetached ()
+ {
+ }
+ }
+}
diff --git a/src/Android/Effects/FixedSizeEffect.cs b/src/Android/Effects/FixedSizeEffect.cs
index 8d31aac8a..0143d2dd3 100644
--- a/src/Android/Effects/FixedSizeEffect.cs
+++ b/src/Android/Effects/FixedSizeEffect.cs
@@ -1,7 +1,4 @@
-using Android.Support.Design.BottomNavigation;
-using Android.Support.Design.Widget;
-using Android.Views;
-using Android.Widget;
+using Android.Widget;
using Bit.Droid.Effects;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
@@ -23,4 +20,4 @@ namespace Bit.Droid.Effects
{
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Android/Effects/SelectableLabelEffect.cs b/src/Android/Effects/SelectableLabelEffect.cs
index 7cacfb803..ded6eedd3 100644
--- a/src/Android/Effects/SelectableLabelEffect.cs
+++ b/src/Android/Effects/SelectableLabelEffect.cs
@@ -1,7 +1,4 @@
-using Android.Support.Design.BottomNavigation;
-using Android.Support.Design.Widget;
-using Android.Views;
-using Android.Widget;
+using Android.Widget;
using Bit.Droid.Effects;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
@@ -23,4 +20,4 @@ namespace Bit.Droid.Effects
{
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Android/Effects/TabBarEffect.cs b/src/Android/Effects/TabBarEffect.cs
index 4470b81ea..c2e0a7f4f 100644
--- a/src/Android/Effects/TabBarEffect.cs
+++ b/src/Android/Effects/TabBarEffect.cs
@@ -1,7 +1,6 @@
-using Android.Support.Design.BottomNavigation;
-using Android.Support.Design.Widget;
-using Android.Views;
+using Android.Views;
using Bit.Droid.Effects;
+using Google.Android.Material.BottomNavigation;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
@@ -28,4 +27,4 @@ namespace Bit.Droid.Effects
{
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs
index e913c6b50..d30cc0988 100644
--- a/src/Android/MainActivity.cs
+++ b/src/Android/MainActivity.cs
@@ -17,7 +17,7 @@ using Bit.Core.Enums;
using Android.Nfc;
using Bit.App.Utilities;
using System.Threading.Tasks;
-using Android.Support.V4.Content;
+using AndroidX.Core.Content;
namespace Bit.Droid
{
diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs
index 0460641e5..ee0ee3b3b 100644
--- a/src/Android/MainApplication.cs
+++ b/src/Android/MainApplication.cs
@@ -70,7 +70,6 @@ namespace Bit.Droid
{
ServiceContainer.Register("logService", new AndroidLogService());
- Refractored.FabControl.Droid.FloatingActionButtonViewRenderer.Init();
// Note: This might cause a race condition. Investigate more.
Task.Run(() =>
{
@@ -83,7 +82,6 @@ namespace Bit.Droid
ZXing.Net.Mobile.Forms.Android.Platform.Init();
});
CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
- CrossFingerprint.SetDialogFragmentType();
var preferencesStorage = new PreferencesStorageService(null);
var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
diff --git a/src/Android/Properties/AndroidManifest.xml b/src/Android/Properties/AndroidManifest.xml
index 8c53aa046..76376f88c 100644
--- a/src/Android/Properties/AndroidManifest.xml
+++ b/src/Android/Properties/AndroidManifest.xml
@@ -6,7 +6,7 @@
android:versionName="2.3.1"
package="com.x8bit.bitwarden">
-
+
@@ -30,7 +30,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:networkSecurityConfig="@xml/network_security_config">
diff --git a/src/Android/Renderers/ExtendedSliderRenderer.cs b/src/Android/Renderers/ExtendedSliderRenderer.cs
index 0f6962782..344d887fb 100644
--- a/src/Android/Renderers/ExtendedSliderRenderer.cs
+++ b/src/Android/Renderers/ExtendedSliderRenderer.cs
@@ -1,6 +1,6 @@
using Android.Content;
using Android.Graphics.Drawables;
-using Android.Support.V4.Content.Res;
+using AndroidX.Core.Content.Resources;
using Bit.App.Controls;
using Bit.Droid.Renderers;
using Xamarin.Forms;
diff --git a/src/Android/Resources/layout/Tabbar.axml b/src/Android/Resources/layout/Tabbar.axml
index ad1f87d81..bc2faec48 100644
--- a/src/Android/Resources/layout/Tabbar.axml
+++ b/src/Android/Resources/layout/Tabbar.axml
@@ -1,5 +1,5 @@
-
-
-
-
+
+
-
-
+
+
+
diff --git a/src/App/Effects/FabShadowEffect.cs b/src/App/Effects/FabShadowEffect.cs
new file mode 100644
index 000000000..3e75d85d9
--- /dev/null
+++ b/src/App/Effects/FabShadowEffect.cs
@@ -0,0 +1,11 @@
+using Xamarin.Forms;
+
+namespace Bit.App.Effects
+{
+ public class FabShadowEffect : RoutingEffect
+ {
+ public FabShadowEffect()
+ : base("Bitwarden.FabShadowEffect")
+ { }
+ }
+}
diff --git a/src/App/Pages/Settings/FoldersPage.xaml b/src/App/Pages/Settings/FoldersPage.xaml
index d75f67849..c4ef5714f 100644
--- a/src/App/Pages/Settings/FoldersPage.xaml
+++ b/src/App/Pages/Settings/FoldersPage.xaml
@@ -7,7 +7,7 @@
xmlns:controls="clr-namespace:Bit.App.Controls"
xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:views="clr-namespace:Bit.Core.Models.View;assembly=BitwardenCore"
- xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
+ xmlns:effects="clr-namespace:Bit.App.Effects;assembly=BitwardenApp"
x:DataType="pages:FoldersPageViewModel"
x:Name="_page"
Title="{Binding PageTitle}">
@@ -66,14 +66,19 @@
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
-
-
+
+
+
+
diff --git a/src/App/Pages/Settings/FoldersPage.xaml.cs b/src/App/Pages/Settings/FoldersPage.xaml.cs
index 2ce820e97..90b64b8f4 100644
--- a/src/App/Pages/Settings/FoldersPage.xaml.cs
+++ b/src/App/Pages/Settings/FoldersPage.xaml.cs
@@ -21,10 +21,6 @@ namespace Bit.App.Pages
ToolbarItems.Add(_closeItem);
ToolbarItems.Add(_addItem);
}
- else
- {
- _fab.Clicked = AddButton_Clicked;
- }
}
protected override async void OnAppearing()
diff --git a/src/App/Pages/Vault/AutofillCiphersPage.xaml b/src/App/Pages/Vault/AutofillCiphersPage.xaml
index e06580f85..8a310eca3 100644
--- a/src/App/Pages/Vault/AutofillCiphersPage.xaml
+++ b/src/App/Pages/Vault/AutofillCiphersPage.xaml
@@ -5,7 +5,7 @@
xmlns:pages="clr-namespace:Bit.App.Pages"
xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:controls="clr-namespace:Bit.App.Controls"
- xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
+ xmlns:effects="clr-namespace:Bit.App.Effects;assembly=BitwardenApp"
x:DataType="pages:AutofillCiphersPageViewModel"
Title="{Binding PageTitle}"
x:Name="_page">
@@ -94,12 +94,16 @@
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
-
-
+
+
+
+
diff --git a/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs b/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs
index 80adc9fc7..5589c9777 100644
--- a/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs
+++ b/src/App/Pages/Vault/AutofillCiphersPage.xaml.cs
@@ -22,7 +22,6 @@ namespace Bit.App.Pages
InitializeComponent();
_vm = BindingContext as AutofillCiphersPageViewModel;
_vm.Page = this;
- _fab.Clicked = AddButton_Clicked;
_vm.Init(appOptions);
_platformUtilsService = ServiceContainer.Resolve("platformUtilsService");
diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml
index 641a4a97c..353d3f102 100644
--- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml
+++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml
@@ -6,7 +6,6 @@
xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:effects="clr-namespace:Bit.App.Effects"
xmlns:controls="clr-namespace:Bit.App.Controls"
- xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
x:DataType="pages:GroupingsPageViewModel"
Title="{Binding PageTitle}"
x:Name="_page">
@@ -144,14 +143,19 @@
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
-
-
+
+
+
+
diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs
index 7aedf976c..284ca9b93 100644
--- a/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs
+++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPage.xaml.cs
@@ -60,7 +60,6 @@ namespace Bit.App.Pages
}
else
{
- _fab.Clicked = AddButton_Clicked;
ToolbarItems.Add(_syncItem);
ToolbarItems.Add(_lockItem);
ToolbarItems.Add(_exitItem);
diff --git a/src/App/Pages/Vault/ViewPage.xaml b/src/App/Pages/Vault/ViewPage.xaml
index bcb8f91d7..ffb6b4059 100644
--- a/src/App/Pages/Vault/ViewPage.xaml
+++ b/src/App/Pages/Vault/ViewPage.xaml
@@ -7,7 +7,6 @@
xmlns:u="clr-namespace:Bit.App.Utilities"
xmlns:controls="clr-namespace:Bit.App.Controls"
xmlns:effects="clr-namespace:Bit.App.Effects"
- xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
xmlns:views="clr-namespace:Bit.Core.Models.View;assembly=BitwardenCore"
x:DataType="pages:ViewPageViewModel"
x:Name="_page"
@@ -663,14 +662,19 @@
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/App/Pages/Vault/ViewPage.xaml.cs b/src/App/Pages/Vault/ViewPage.xaml.cs
index bc0c81c0d..a8e0bf9a7 100644
--- a/src/App/Pages/Vault/ViewPage.xaml.cs
+++ b/src/App/Pages/Vault/ViewPage.xaml.cs
@@ -33,7 +33,6 @@ namespace Bit.App.Pages
}
else
{
- _fab.Clicked = EditButton_Clicked;
_mainLayout.Padding = new Thickness(0, 0, 0, 75);
ToolbarItems.Add(_attachmentsItem);
ToolbarItems.Add(_deleteItem);
diff --git a/src/App/Services/MobilePlatformUtilsService.cs b/src/App/Services/MobilePlatformUtilsService.cs
index 13e463e6c..ab55677d5 100644
--- a/src/App/Services/MobilePlatformUtilsService.cs
+++ b/src/App/Services/MobilePlatformUtilsService.cs
@@ -218,7 +218,7 @@ namespace Bit.App.Services
var supportsFace = await _deviceActionService.SupportsFaceBiometricAsync();
text = supportsFace ? AppResources.FaceIDDirection : AppResources.FingerprintDirection;
}
- var fingerprintRequest = new AuthenticationRequestConfiguration(text)
+ var fingerprintRequest = new AuthenticationRequestConfiguration(text, text)
{
CancelTitle = AppResources.Cancel,
FallbackTitle = fallbackText
diff --git a/src/App/Styles/Base.xaml b/src/App/Styles/Base.xaml
index 9f6da9954..8fac8c525 100644
--- a/src/App/Styles/Base.xaml
+++ b/src/App/Styles/Base.xaml
@@ -1,8 +1,7 @@
+ x:Class="Bit.App.Styles.Base">
-
diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj
index 7b8caf8c8..7b97e7a39 100644
--- a/src/Core/Core.csproj
+++ b/src/Core/Core.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/src/Core/Services/LiteDbStorageService.cs b/src/Core/Services/LiteDbStorageService.cs
index d0b836673..767f456c1 100644
--- a/src/Core/Services/LiteDbStorageService.cs
+++ b/src/Core/Services/LiteDbStorageService.cs
@@ -14,7 +14,7 @@ namespace Bit.Core.Services
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
private readonly string _dbPath;
- private LiteCollection _collection;
+ private ILiteCollection _collection;
private Task _initTask;
public LiteDbStorageService(string dbPath)
@@ -36,7 +36,7 @@ namespace Bit.Core.Services
{
try
{
- var db = new LiteDatabase($"Filename={_dbPath};");
+ var db = new LiteDatabase($"Filename={_dbPath};Upgrade=true;");
_collection = db.GetCollection("json_items");
}
finally
@@ -68,7 +68,7 @@ namespace Bit.Core.Services
public async Task RemoveAsync(string key)
{
await InitAsync();
- _collection.Delete(i => i.Id == key);
+ _collection.DeleteMany(i => i.Id == key);
}
private class JsonItem
diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj
index 308523377..ab8ffb579 100644
--- a/src/iOS/iOS.csproj
+++ b/src/iOS/iOS.csproj
@@ -168,7 +168,7 @@
- 1.3.1
+ 1.5.1