mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-23 11:45:38 +01:00
clearup yubikey reading on ios
This commit is contained in:
parent
d3003efe72
commit
d3646e10a5
9
src/App/Resources/AppResources.Designer.cs
generated
9
src/App/Resources/AppResources.Designer.cs
generated
@ -1590,6 +1590,15 @@ namespace Bit.App.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Hold your Yubikey near the top of the device..
|
||||
/// </summary>
|
||||
public static string HoldYubikeyNearTop {
|
||||
get {
|
||||
return ResourceManager.GetString("HoldYubikeyNearTop", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host.
|
||||
/// </summary>
|
||||
|
@ -1293,4 +1293,7 @@
|
||||
<value>Organization</value>
|
||||
<comment>An entity of multiple related people (ex. a team or business organization).</comment>
|
||||
</data>
|
||||
<data name="HoldYubikeyNearTop" xml:space="preserve">
|
||||
<value>Hold your Yubikey near the top of the device.</value>
|
||||
</data>
|
||||
</root>
|
@ -21,6 +21,7 @@ using FFImageLoading.Forms.Touch;
|
||||
using SimpleInjector;
|
||||
using XLabs.Ioc.SimpleInjectorContainer;
|
||||
using CoreNFC;
|
||||
using Bit.App.Resources;
|
||||
|
||||
namespace Bit.iOS
|
||||
{
|
||||
@ -120,21 +121,26 @@ namespace Bit.iOS
|
||||
|
||||
if(listen)
|
||||
{
|
||||
var del = new NFCReaderDelegate((success, message) =>
|
||||
_nfcSession?.InvalidateSession();
|
||||
_nfcSession?.Dispose();
|
||||
_nfcSession = null;
|
||||
_nfcSession = new NFCNdefReaderSession(new NFCReaderDelegate((success, message) =>
|
||||
{
|
||||
Debug.WriteLine((success ? "SUCCESS! " : "ERROR! ") + message);
|
||||
if(success)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
MessagingCenter.Send(Xamarin.Forms.Application.Current, "GotYubiKeyOTP", message);
|
||||
}
|
||||
});
|
||||
|
||||
_nfcSession = new NFCNdefReaderSession(del, null, true);
|
||||
}
|
||||
}), null, true);
|
||||
_nfcSession.AlertMessage = AppResources.HoldYubikeyNearTop;
|
||||
_nfcSession.BeginSession();
|
||||
}
|
||||
else
|
||||
{
|
||||
_nfcSession?.InvalidateSession();
|
||||
_nfcSession?.Dispose();
|
||||
_nfcSession = null;
|
||||
}
|
||||
});
|
||||
|
@ -34,12 +34,10 @@ namespace Bit.iOS
|
||||
|
||||
foreach(var result in results)
|
||||
{
|
||||
Debug.WriteLine("READ TAG: " + result);
|
||||
var matches = _otpPattern.Matches(result);
|
||||
if(matches.Count > 0 && matches[0].Groups.Count > 1)
|
||||
{
|
||||
var otp = matches[0].Groups[1].ToString();
|
||||
Debug.WriteLine("TAG IS MATCH: " + otp);
|
||||
_callback.Invoke(true, otp);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user