Beispiel #1
0
        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, ApplicationContext);

            parser.Parse();

            if (_storageService == null)
            {
                _storageService = ServiceContainer.Resolve <IStorageService>("storageService");
            }

            var shouldAutofill = await parser.ShouldAutofillAsync(_storageService);

            if (!shouldAutofill)
            {
                return;
            }

            var inlineAutofillEnabled = await _storageService.GetAsync <bool?>(Constants.InlineAutofillEnabledKey) ?? true;

            if (_vaultTimeoutService == null)
            {
                _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            }

            List <FilledItem> items = null;
            await _vaultTimeoutService.CheckVaultTimeoutAsync();

            var locked = await _vaultTimeoutService.IsLockedAsync();

            if (!locked)
            {
                if (_cipherService == null)
                {
                    _cipherService = ServiceContainer.Resolve <ICipherService>("cipherService");
                }
                items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService);
            }

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

            callback.OnSuccess(response);
        }
Beispiel #2
0
        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, ApplicationContext);

            parser.Parse();

            if (!parser.ShouldAutofill)
            {
                return;
            }

            if (_lockService == null)
            {
                _lockService = ServiceContainer.Resolve <ILockService>("lockService");
            }

            List <FilledItem> items = null;
            var locked = await _lockService.IsLockedAsync();

            if (!locked)
            {
                if (_cipherService == null)
                {
                    _cipherService = ServiceContainer.Resolve <ICipherService>("cipherService");
                }
                items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService);
            }

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

            callback.OnSuccess(response);
        }
Beispiel #3
0
        public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal,
                                                 FillCallback callback)
        {
            try
            {
                var structure = request.FillContexts?.LastOrDefault()?.Structure;
                if (structure == null)
                {
                    return;
                }

                var parser = new Parser(structure, ApplicationContext);
                parser.Parse();

                if (_storageService == null)
                {
                    _storageService = ServiceContainer.Resolve <IStorageService>("storageService");
                }

                var shouldAutofill = await parser.ShouldAutofillAsync(_storageService);

                if (!shouldAutofill)
                {
                    return;
                }

                var inlineAutofillEnabled = await _storageService.GetAsync <bool?>(Constants.InlineAutofillEnabledKey) ?? true;

                if (_vaultTimeoutService == null)
                {
                    _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
                }

                List <FilledItem> items = null;
                await _vaultTimeoutService.CheckVaultTimeoutAsync();

                var locked = await _vaultTimeoutService.IsLockedAsync();

                if (!locked)
                {
                    if (_cipherService == null)
                    {
                        _cipherService = ServiceContainer.Resolve <ICipherService>("cipherService");
                    }
                    items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService);
                }

                // build response
                var response          = AutofillHelpers.CreateFillResponse(parser, items, locked, inlineAutofillEnabled, request);
                var disableSavePrompt = await _storageService.GetAsync <bool?>(Constants.AutofillDisableSavePromptKey);

                if (!disableSavePrompt.GetValueOrDefault())
                {
                    AutofillHelpers.AddSaveInfo(parser, request, response, parser.FieldCollection);
                }
                callback.OnSuccess(response.Build());
            }
            catch (Exception e)
            {
#if !FDROID
                Crashes.TrackError(e);
#endif
            }
        }