mirror of
https://github.com/bitwarden/mobile
synced 2026-01-05 18:13:36 +00:00
[EC-835] Add kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly on Watch Keychain (#2250)
* EC-835 Added in the Watch app keychain accessible when passcode set this device only and when the passcode is set to signal the iPhone to trigger a sync on opening the watch app * EC-835 Embed LocalAuthentication framework into the watch app to fix no such module when importing it * EC-835 Changed approach to check if Watch has passcode enabled by using Keychain accessible kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly instead of LAContext * EC-835 Fix weird error saying unassigned local variable on the CI compiler. It seems it doesn't realize of the full condition
This commit is contained in:
committed by
GitHub
parent
4347c2f81d
commit
e72932cbaa
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Bit.App.Services;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Models;
|
||||
using Bit.Core.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using WatchConnectivity;
|
||||
|
||||
@@ -11,12 +12,16 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
public class WatchDeviceService : BaseWatchDeviceService
|
||||
{
|
||||
const string ACTION_MESSAGE_KEY = "actionMessage";
|
||||
const string TRIGGER_SYNC_ACTION_KEY = "triggerSync";
|
||||
|
||||
public WatchDeviceService(ICipherService cipherService,
|
||||
IEnvironmentService environmentService,
|
||||
IStateService stateService,
|
||||
IVaultTimeoutService vaultTimeoutService)
|
||||
: base(cipherService, environmentService, stateService, vaultTimeoutService)
|
||||
{
|
||||
WCSessionManager.SharedManager.OnMessagedReceived += OnMessagedReceived;
|
||||
}
|
||||
|
||||
public override bool IsConnected => WCSessionManager.SharedManager.IsSessionActivated;
|
||||
@@ -44,5 +49,17 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
WCSessionManager.SharedManager.StartSession();
|
||||
}
|
||||
|
||||
private void OnMessagedReceived(WCSession session, Dictionary<string, object> data)
|
||||
{
|
||||
if (data != null
|
||||
&&
|
||||
data.TryGetValue(ACTION_MESSAGE_KEY, out var action)
|
||||
&&
|
||||
action as string == TRIGGER_SYNC_ACTION_KEY)
|
||||
{
|
||||
SyncDataToWatchAsync().FireAndForget();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user