mirror of
https://github.com/bitwarden/mobile
synced 2025-12-13 14:53:18 +00:00
SG-210 Account Switching in Autofill (iOS) (#1909)
* SG-210 Set up account switching on Autofill iOS * SG-210 Fix refresh after sync on autofill ciphers, also added account switching on lock view on autofill. Also fix possible crash when scrolling when no items were displayed and also fixed navigation when login in on an automatically logged out account. * SG-210 Added reference on iOS.Core project * Fix formatting on AccountManager * SG-210 Fix background color for dark theme
This commit is contained in:
committed by
GitHub
parent
88b406544b
commit
fba407f3b6
44
src/iOS.Core/Utilities/ImageSourceExtensions.cs
Normal file
44
src/iOS.Core/Utilities/ImageSourceExtensions.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Internals;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
public static class ImageSourceExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the native image from the ImageSource.
|
||||
/// Taken from https://github.com/xamarin/Xamarin.Forms/blob/02dee20dfa1365d0104758e534581d1fa5958990/Xamarin.Forms.Platform.iOS/Renderers/ImageElementManager.cs#L264
|
||||
/// </summary>
|
||||
public static async Task<UIImage> GetNativeImageAsync(this ImageSource source, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
if (source == null || source.IsEmpty)
|
||||
return null;
|
||||
|
||||
var handler = Xamarin.Forms.Internals.Registrar.Registered.GetHandlerForObject<IImageSourceHandler>(source);
|
||||
if (handler == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
float scale = (float)UIScreen.MainScreen.Scale;
|
||||
|
||||
return await handler.LoadImageAsync(source, scale: scale, cancelationToken: cancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Log.Warning("Image loading", "Image load cancelled");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warning("Image loading", $"Image load failed: {ex}");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user