示例#1
0
        private async Task SetMainPageAsync()
        {
            var authed = await _userService.IsAuthenticatedAsync();

            if (authed)
            {
                if (await _lockService.IsLockedAsync())
                {
                    Current.MainPage = new NavigationPage(new LockPage(_appOptions));
                }
                else if (_appOptions.FromAutofillFramework && _appOptions.SaveType.HasValue)
                {
                    Current.MainPage = new NavigationPage(new AddEditPage(appOptions: _appOptions));
                }
                else if (_appOptions.Uri != null)
                {
                    Current.MainPage = new NavigationPage(new AutofillCiphersPage(_appOptions));
                }
                else
                {
                    Current.MainPage = new TabsPage(_appOptions);
                }
            }
            else
            {
                Current.MainPage = new HomePage();
            }
        }
示例#2
0
        protected async override void OnSleep()
        {
            System.Diagnostics.Debug.WriteLine("XF App: OnSleep");
            if (Device.RuntimePlatform == Device.Android)
            {
                var isLocked = await _lockService.IsLockedAsync();

                if (!isLocked)
                {
                    await _storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow);
                }
                SetTabsPageFromAutofill(isLocked);
                await SleptAsync();
            }
        }
示例#3
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;
            }

            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);
        }
示例#4
0
 public Task <bool> IsLocked()
 {
     return(_lockService.IsLockedAsync());
 }