예제 #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);
        }
예제 #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);
        }