mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-21 11:25:56 +01:00
update XF and revert old workarounds (#1885)
This commit is contained in:
parent
80bd8ba9d1
commit
ab6dde4a11
@ -84,7 +84,7 @@
|
||||
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.5.2" />
|
||||
<PackageReference Include="Xamarin.AndroidX.Migration" Version="1.0.8" />
|
||||
<PackageReference Include="Xamarin.Essentials">
|
||||
<Version>1.7.1</Version>
|
||||
<Version>1.7.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Firebase.Messaging">
|
||||
<Version>122.0.0</Version>
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Android.OS;
|
||||
using Android.Security.Keystore;
|
||||
using Bit.Core.Abstractions;
|
||||
using Java.Security;
|
||||
using Javax.Crypto;
|
||||
#if !FDROID
|
||||
using Microsoft.AppCenter.Crashes;
|
||||
#endif
|
||||
|
||||
namespace Bit.Droid.Services
|
||||
{
|
||||
@ -74,6 +74,9 @@ namespace Bit.Droid.Services
|
||||
catch (InvalidKeyException e)
|
||||
{
|
||||
// Fallback for old bitwarden users without a key
|
||||
#if !FDROID
|
||||
Crashes.TrackError(e);
|
||||
#endif
|
||||
CreateKey();
|
||||
}
|
||||
|
||||
@ -94,10 +97,13 @@ namespace Bit.Droid.Services
|
||||
keyGen.Init(keyGenSpec);
|
||||
keyGen.GenerateKey();
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
// Catch silently to allow biometrics to function on devices that are in a state where key generation
|
||||
// is not functioning
|
||||
#if !FDROID
|
||||
Crashes.TrackError(e);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,10 @@
|
||||
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="4.4.0" />
|
||||
<PackageReference Include="Plugin.Fingerprint" Version="2.1.4" />
|
||||
<PackageReference Include="SkiaSharp.Views.Forms" Version="2.80.3" />
|
||||
<PackageReference Include="Xamarin.CommunityToolkit" Version="2.0.0" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.1" />
|
||||
<PackageReference Include="Xamarin.CommunityToolkit" Version="2.0.1" />
|
||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.2" />
|
||||
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2337" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2401" />
|
||||
<PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" />
|
||||
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
|
@ -256,23 +256,24 @@
|
||||
x:Name="_btnOptions"
|
||||
StyleClass="box-row-button"
|
||||
TextColor="{DynamicResource PrimaryColor}"
|
||||
Margin="0" />
|
||||
Margin="0"
|
||||
Clicked="ToggleOptions_Clicked"/>
|
||||
<controls:IconButton
|
||||
x:Name="_btnOptionsUp"
|
||||
Text="{Binding Source={x:Static core:BitwardenIcons.ChevronUp}}"
|
||||
StyleClass="box-row-button"
|
||||
TextColor="{DynamicResource PrimaryColor}"
|
||||
Clicked="ToggleOptions_Clicked"
|
||||
IsVisible="False" />
|
||||
IsVisible="{Binding ShowOptions}" />
|
||||
<controls:IconButton
|
||||
x:Name="_btnOptionsDown"
|
||||
Text="{Binding Source={x:Static core:BitwardenIcons.AngleDown}}"
|
||||
StyleClass="box-row-button"
|
||||
TextColor="{DynamicResource PrimaryColor}"
|
||||
Clicked="ToggleOptions_Clicked"
|
||||
IsVisible="False" />
|
||||
IsVisible="{Binding ShowOptions, Converter={StaticResource inverseBool}}" />
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="True">
|
||||
<StackLayout IsVisible="{Binding ShowOptions}">
|
||||
<StackLayout
|
||||
StyleClass="box-row"
|
||||
Margin="0,10,0,0">
|
||||
|
@ -53,10 +53,9 @@ namespace Bit.App.Pages
|
||||
_vm.SegmentedButtonFontSize = 13;
|
||||
_vm.SegmentedButtonMargins = new Thickness(0, 10, 0, 0);
|
||||
_vm.EditorMargins = new Thickness(0, 5, 0, 0);
|
||||
// Review this when https://github.com/bitwarden/mobile/pull/1454 workaround can be reverted
|
||||
//_btnOptions.WidthRequest = 70;
|
||||
//_btnOptionsDown.WidthRequest = 30;
|
||||
//_btnOptionsUp.WidthRequest = 30;
|
||||
_btnOptions.WidthRequest = 70;
|
||||
_btnOptionsDown.WidthRequest = 30;
|
||||
_btnOptionsUp.WidthRequest = 30;
|
||||
}
|
||||
else if (Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
|
@ -732,7 +732,6 @@
|
||||
<BoxView StyleClass="box-row-separator" />
|
||||
</StackLayout>
|
||||
<controls:RepeaterView
|
||||
x:Name="_collectionsRepeaterView"
|
||||
ItemsSource="{Binding Collections}"
|
||||
IsVisible="{Binding HasCollections}">
|
||||
<controls:RepeaterView.ItemTemplate>
|
||||
|
@ -51,7 +51,6 @@ namespace Bit.App.Pages
|
||||
_vm.CipherId = cipherId;
|
||||
_vm.FolderId = folderId == "none" ? null : folderId;
|
||||
_vm.CollectionIds = collectionId != null ? new HashSet<string>(new List<string> { collectionId }) : null;
|
||||
_vm.CollectionsRepeaterView = _collectionsRepeaterView;
|
||||
_vm.Type = type;
|
||||
_vm.DefaultName = name ?? appOptions?.SaveName;
|
||||
_vm.DefaultUri = uri ?? appOptions?.Uri;
|
||||
@ -171,7 +170,6 @@ namespace Bit.App.Pages
|
||||
{
|
||||
RequestFocus(_nameEntry);
|
||||
}
|
||||
_scrollView.Scrolled += (sender, args) => _vm.HandleScroll();
|
||||
});
|
||||
// Hide password reprompt option if using key connector
|
||||
_passwordPrompt.IsVisible = !await _keyConnectorService.GetUsesKeyConnector();
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Controls;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core;
|
||||
@ -44,7 +43,6 @@ namespace Bit.App.Pages
|
||||
private int _ownershipSelectedIndex;
|
||||
private bool _hasCollections;
|
||||
private string _previousCipherId;
|
||||
private DateTime _lastHandledScrollTime;
|
||||
private List<Core.Models.View.CollectionView> _writeableCollections;
|
||||
private string[] _additionalCipherProperties = new string[]
|
||||
{
|
||||
@ -168,7 +166,7 @@ namespace Bit.App.Pages
|
||||
public ExtendedObservableCollection<LoginUriView> Uris { get; set; }
|
||||
public ExtendedObservableCollection<AddEditPageFieldViewModel> Fields { get; set; }
|
||||
public ExtendedObservableCollection<CollectionViewModel> Collections { get; set; }
|
||||
public RepeaterView CollectionsRepeaterView { get; set; }
|
||||
|
||||
public int TypeSelectedIndex
|
||||
{
|
||||
get => _typeSelectedIndex;
|
||||
@ -821,30 +819,13 @@ namespace Bit.App.Pages
|
||||
{
|
||||
var cols = _writeableCollections.Where(c => c.OrganizationId == Cipher.OrganizationId)
|
||||
.Select(c => new CollectionViewModel { Collection = c }).ToList();
|
||||
HasCollections = cols.Any();
|
||||
Collections.ResetWithRange(cols);
|
||||
Collections = new ExtendedObservableCollection<CollectionViewModel>(cols);
|
||||
}
|
||||
else
|
||||
{
|
||||
HasCollections = false;
|
||||
Collections.ResetWithRange(new List<CollectionViewModel>());
|
||||
Collections = new ExtendedObservableCollection<CollectionViewModel>(new List<CollectionViewModel>());
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleScroll()
|
||||
{
|
||||
// workaround for https://github.com/xamarin/Xamarin.Forms/issues/13607
|
||||
// required for org ownership/collections to render properly in XF4.5+
|
||||
if (!HasCollections ||
|
||||
EditMode ||
|
||||
(DateTime.Now - _lastHandledScrollTime < TimeSpan.FromMilliseconds(200)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
CollectionsRepeaterView.ItemsSource = Collections;
|
||||
_lastHandledScrollTime = DateTime.Now;
|
||||
HasCollections = Collections.Any();
|
||||
}
|
||||
|
||||
private void TriggerCipherChanged()
|
||||
|
@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Domain;
|
||||
using Bit.Core.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
@ -354,7 +352,6 @@ namespace Bit.Core.Services
|
||||
private async Task<T> GetValueAsync<T>(Storage storage, string key)
|
||||
{
|
||||
var value = await GetStorageService(storage).GetAsync<T>(key);
|
||||
Log("GET", storage, key, JsonConvert.SerializeObject(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -365,13 +362,11 @@ namespace Bit.Core.Services
|
||||
await RemoveValueAsync(storage, key);
|
||||
return;
|
||||
}
|
||||
Log("SET", storage, key, JsonConvert.SerializeObject(value));
|
||||
await GetStorageService(storage).SaveAsync(key, value);
|
||||
}
|
||||
|
||||
private async Task RemoveValueAsync(Storage storage, string key)
|
||||
{
|
||||
Log("REMOVE", storage, key, null);
|
||||
await GetStorageService(storage).RemoveAsync(key);
|
||||
}
|
||||
|
||||
@ -387,29 +382,5 @@ namespace Bit.Core.Services
|
||||
return _liteDbStorageService;
|
||||
}
|
||||
}
|
||||
|
||||
private void Log(string tag, Storage storage, string key, string value)
|
||||
{
|
||||
// TODO Remove this once all bugs are squished
|
||||
string text;
|
||||
switch (storage)
|
||||
{
|
||||
case Storage.Secure:
|
||||
text = "SECURE / ";
|
||||
break;
|
||||
case Storage.Prefs:
|
||||
text = "PREFS / ";
|
||||
break;
|
||||
default:
|
||||
text = "LITEDB / ";
|
||||
break;
|
||||
}
|
||||
text += "Key: " + key + " / ";
|
||||
if (value != null)
|
||||
{
|
||||
text += "Value: " + value;
|
||||
}
|
||||
Debug.WriteLine(text, ">>> " + tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2337" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2401" />
|
||||
<PackageReference Include="Microsoft.AppCenter.Crashes">
|
||||
<Version>4.4.0</Version>
|
||||
</PackageReference>
|
||||
|
@ -183,7 +183,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Essentials">
|
||||
<Version>1.7.1</Version>
|
||||
<Version>1.7.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
|
Loading…
Reference in New Issue
Block a user