Пример #1
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            if (!await AppHelpers.IsVaultTimeoutImmediateAsync())
            {
                await _vaultTimeoutService.CheckVaultTimeoutAsync();
            }
            if (await _vaultTimeoutService.IsLockedAsync())
            {
                return;
            }
            await LoadOnAppearedAsync(_scrollView, true, async() =>
            {
                var success = await _vm.LoadAsync(_appOptions);
                if (!success)
                {
                    await Navigation.PopModalAsync();
                    return;
                }
                AdjustToolbar();
                await ShowAlertsAsync();
                if (!_vm.EditMode && string.IsNullOrWhiteSpace(_vm.Cipher?.Name))
                {
                    RequestFocus(_nameEntry);
                }
                _scrollView.Scrolled += (sender, args) => _vm.HandleScroll();
            });

            // Hide password reprompt option if using key connector
            _passwordPrompt.IsVisible = !await _keyConnectorService.GetUsesKeyConnector();
        }
Пример #2
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await LoadOnAppearedAsync(_scrollView, true, () => _vm.LoadAsync(_appOptions));

            if (_vm.EditMode && Device.RuntimePlatform == Device.Android)
            {
                if (_vm.Cipher.OrganizationId == null)
                {
                    if (ToolbarItems.Contains(_collectionsItem))
                    {
                        ToolbarItems.Remove(_collectionsItem);
                    }
                    if (!ToolbarItems.Contains(_shareItem))
                    {
                        ToolbarItems.Insert(2, _shareItem);
                    }
                }
                else
                {
                    if (ToolbarItems.Contains(_shareItem))
                    {
                        ToolbarItems.Remove(_shareItem);
                    }
                    if (!ToolbarItems.Contains(_collectionsItem))
                    {
                        ToolbarItems.Insert(2, _collectionsItem);
                    }
                }
            }
        }
Пример #3
0
 protected override async void OnAppearing()
 {
     base.OnAppearing();
     await LoadOnAppearedAsync(_scrollView, true, async() =>
     {
         var success = await _vm.LoadAsync(_appOptions);
         if (!success)
         {
             await Navigation.PopModalAsync();
             return;
         }
         AdjustToolbar();
         await ShowAlertsAsync();
         if (!_vm.EditMode && string.IsNullOrWhiteSpace(_vm.Cipher?.Name))
         {
             RequestFocus(_nameEntry);
         }
     });
 }
Пример #4
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await LoadOnAppearedAsync(_scrollView, true, async() =>
            {
                var success = await _vm.LoadAsync(_appOptions);
                if (!success)
                {
                    await Navigation.PopModalAsync();
                }
                else if (!_vm.EditMode && string.IsNullOrWhiteSpace(_vm.Cipher.Name))
                {
                    RequestFocus(_nameEntry);
                }
            });

            if (_vm.EditMode && Device.RuntimePlatform == Device.Android)
            {
                if (_vm.Cipher.OrganizationId == null)
                {
                    if (ToolbarItems.Contains(_collectionsItem))
                    {
                        ToolbarItems.Remove(_collectionsItem);
                    }
                    if (!ToolbarItems.Contains(_shareItem))
                    {
                        ToolbarItems.Insert(2, _shareItem);
                    }
                }
                else
                {
                    if (ToolbarItems.Contains(_shareItem))
                    {
                        ToolbarItems.Remove(_shareItem);
                    }
                    if (!ToolbarItems.Contains(_collectionsItem))
                    {
                        ToolbarItems.Insert(2, _collectionsItem);
                    }
                }
            }
            if (!_vm.EditMode)
            {
                var addLoginShown = await _storageService.GetAsync <bool?>(Constants.AddSitePromptShownKey);

                if (_vm.Cipher.Type == CipherType.Login && !_fromAutofill && !addLoginShown.GetValueOrDefault())
                {
                    await _storageService.SaveAsync(Constants.AddSitePromptShownKey, true);

                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        if (_deviceActionService.SystemMajorVersion() < 12)
                        {
                            await DisplayAlert(AppResources.BitwardenAppExtension,
                                               AppResources.BitwardenAppExtensionAlert2, AppResources.Ok);
                        }
                        else
                        {
                            await DisplayAlert(AppResources.PasswordAutofill,
                                               AppResources.BitwardenAutofillAlert2, AppResources.Ok);
                        }
                    }
                    else if (Device.RuntimePlatform == Device.Android &&
                             !_deviceActionService.AutofillAccessibilityServiceRunning() &&
                             !_deviceActionService.AutofillServiceEnabled())
                    {
                        await DisplayAlert(AppResources.BitwardenAutofillService,
                                           AppResources.BitwardenAutofillServiceAlert2, AppResources.Ok);
                    }
                }
            }
        }