public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal, FillCallback callback)
        {
            var structure = request.FillContexts?.LastOrDefault()?.Structure;

            if (structure == null)
            {
                return;
            }

            var parser = new Parser(structure);

            parser.Parse();

            if (string.IsNullOrWhiteSpace(parser.Uri) || parser.Uri == "androidapp://com.x8bit.bitwarden" ||
                parser.Uri == "androidapp://android" || !parser.FieldCollection.Fillable)
            {
                return;
            }

            if (_lockService == null)
            {
                _lockService = Resolver.Resolve <ILockService>();
            }

            List <FilledItem> items = null;
            var locked = (await _lockService.GetLockTypeAsync(false)) != LockType.None;

            if (!locked)
            {
                if (_cipherService == null)
                {
                    _cipherService = Resolver.Resolve <ICipherService>();
                }

                items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService);
            }

            // build response
            var response = AutofillHelpers.BuildFillResponse(this, parser, items, locked);

            callback.OnSuccess(response);
        }
        public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal, FillCallback callback)
        {
            var structure = request.FillContexts?.LastOrDefault()?.Structure;

            if (structure == null)
            {
                return;
            }

            var parser = new Parser(structure);

            parser.Parse();

            if (!parser.ShouldAutofill)
            {
                return;
            }

            if (_lockService == null)
            {
                _lockService = Resolver.Resolve <ILockService>();
            }

            List <FilledItem> items = null;
            var locked = (await _lockService.GetLockTypeAsync(false)) != LockType.None;

            if (!locked)
            {
                if (_cipherService == null)
                {
                    _cipherService = Resolver.Resolve <ICipherService>();
                }

                items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService);
            }

            // build response
            var response = AutofillHelpers.BuildFillResponse(this, parser, items, locked);

            callback.OnSuccess(response);
        }
示例#3
0
        private async Task CheckLockAsync(bool forceLock)
        {
            if (TopPageIsLock())
            {
                // already locked
                return;
            }

            var lockType = await _lockService.GetLockTypeAsync(forceLock);

            if (lockType == Enums.LockType.None)
            {
                return;
            }

            _appSettingsService.Locked = true;
            switch (lockType)
            {
            case Enums.LockType.Fingerprint:
                await Current.MainPage.Navigation.PushModalAsync(new ExtendedNavigationPage(new LockFingerprintPage(!forceLock)), false);

                break;

            case Enums.LockType.PIN:
                await Current.MainPage.Navigation.PushModalAsync(new ExtendedNavigationPage(new LockPinPage()), false);

                break;

            case Enums.LockType.Password:
                await Current.MainPage.Navigation.PushModalAsync(new ExtendedNavigationPage(new LockPasswordPage()), false);

                break;

            default:
                break;
            }
        }