public override void ViewDidLoad() { _lockService = ServiceContainer.Resolve <ILockService>("lockService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _userService = ServiceContainer.Resolve <IUserService>("userService"); _storageService = ServiceContainer.Resolve <IStorageService>("storageService"); _secureStorageService = ServiceContainer.Resolve <IStorageService>("secureStorageService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _pinSet = _lockService.IsPinLockSetAsync().GetAwaiter().GetResult(); _hasKey = _cryptoService.HasKeyAsync().GetAwaiter().GetResult(); _pinLock = (_pinSet.Item1 && _hasKey) || _pinSet.Item2; _fingerprintLock = _lockService.IsFingerprintLockSetAsync().GetAwaiter().GetResult(); BaseNavItem.Title = _pinLock ? AppResources.VerifyPIN : AppResources.VerifyMasterPassword; BaseCancelButton.Title = AppResources.Cancel; BaseSubmitButton.Title = AppResources.Submit; var descriptor = UIFontDescriptor.PreferredBody; MasterPasswordCell.Label.Text = _pinLock ? AppResources.PIN : AppResources.MasterPassword; MasterPasswordCell.TextField.SecureTextEntry = true; MasterPasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Go; MasterPasswordCell.TextField.ShouldReturn += (UITextField tf) => { CheckPasswordAsync().GetAwaiter().GetResult(); return(true); }; if (_pinLock) { MasterPasswordCell.TextField.KeyboardType = UIKeyboardType.NumberPad; } TableView.RowHeight = UITableView.AutomaticDimension; TableView.EstimatedRowHeight = 70; TableView.Source = new TableSource(this); TableView.AllowsSelection = true; base.ViewDidLoad(); if (_fingerprintLock) { var fingerprintButtonText = _deviceActionService.SupportsFaceId() ? AppResources.UseFaceIDToUnlock : AppResources.UseFingerprintToUnlock; // TODO: set button text var tasks = Task.Run(async() => { await Task.Delay(500); NSRunLoop.Main.BeginInvokeOnMainThread(async() => await PromptFingerprintAsync()); }); } }
public async Task InitAsync() { _supportsFingerprint = await _platformUtilsService.SupportsFingerprintAsync(); var lastSync = await _syncService.GetLastSyncAsync(); if (lastSync != null) { _lastSyncDate = string.Format("{0} {1}", lastSync.Value.ToShortDateString(), lastSync.Value.ToShortTimeString()); } var option = await _storageService.GetAsync <int?>(Constants.LockOptionKey); _lockOptionValue = _lockOptions.FirstOrDefault(o => o.Value == option).Key; var pinSet = await _lockService.IsPinLockSetAsync(); _pin = pinSet.Item1 || pinSet.Item2; _fingerprint = await _lockService.IsFingerprintLockSetAsync(); BuildList(); }