Add Site Prompt

This commit is contained in:
Kyle Spearrin 2019-06-03 23:00:48 -04:00
parent e03cf94441
commit 2574e0cba5
5 changed files with 52 additions and 11 deletions

View File

@ -93,6 +93,8 @@ namespace Bit.App.Migration
settingsShim.GetValueOrDefault("setting:disableAutoCopyTotp", false));
await storageService.SaveAsync(Constants.DisableFaviconKey,
settingsShim.GetValueOrDefault("setting:disableWebsiteIcons", false));
await storageService.SaveAsync(Constants.AddSitePromptShownKey,
settingsShim.GetValueOrDefault("addedSiteAlert", false));
await storageService.SaveAsync(Constants.PushInitialPromptShownKey,
settingsShim.GetValueOrDefault("push:initialPromptShown", false));
await storageService.SaveAsync(Constants.PushCurrentTokenKey,

View File

@ -1,5 +1,10 @@
using Bit.App.Models;
using Bit.App.Abstractions;
using Bit.App.Models;
using Bit.App.Resources;
using Bit.Core;
using Bit.Core.Abstractions;
using Bit.Core.Enums;
using Bit.Core.Utilities;
using System.Collections.Generic;
using Xamarin.Forms;
@ -7,8 +12,11 @@ namespace Bit.App.Pages
{
public partial class AddEditPage : BaseContentPage
{
private AddEditPageViewModel _vm;
private readonly AppOptions _appOptions;
private readonly IStorageService _storageService;
private readonly IDeviceActionService _deviceActionService;
private AddEditPageViewModel _vm;
private bool _fromAutofill;
public AddEditPage(
@ -21,6 +29,8 @@ namespace Bit.App.Pages
bool fromAutofill = false,
AppOptions appOptions = null)
{
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
_appOptions = appOptions;
_fromAutofill = fromAutofill;
FromAutofillFramework = _appOptions?.FromAutofillFramework ?? false;
@ -147,6 +157,34 @@ namespace Bit.App.Pages
}
}
}
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);
}
}
}
}
protected override void OnDisappearing()

View File

@ -558,9 +558,9 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to The easiest way to add new logins to your vault is from the Bitwarden App Extension. Learn more about using the Bitwarden App Extension by navigating to the &quot;Tools&quot; screen..
/// </summary>
public static string BitwardenAppExtensionAlert {
public static string BitwardenAppExtensionAlert2 {
get {
return ResourceManager.GetString("BitwardenAppExtensionAlert", resourceCulture);
return ResourceManager.GetString("BitwardenAppExtensionAlert2", resourceCulture);
}
}
@ -594,9 +594,9 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to The easiest way to add new logins to your vault is by using the Bitwarden Password AutoFill extension. Learn more about using the Bitwarden Password AutoFill extension by navigating to the &quot;Tools&quot; screen..
/// </summary>
public static string BitwardenAutofillAlert {
public static string BitwardenAutofillAlert2 {
get {
return ResourceManager.GetString("BitwardenAutofillAlert", resourceCulture);
return ResourceManager.GetString("BitwardenAutofillAlert2", resourceCulture);
}
}
@ -630,9 +630,9 @@ namespace Bit.App.Resources {
/// <summary>
/// Looks up a localized string similar to The easiest way to add new logins to your vault is from the Bitwarden Auto-fill Service. Learn more about using the Bitwarden Auto-fill Service by navigating to the &quot;Tools&quot; screen..
/// </summary>
public static string BitwardenAutofillServiceAlert {
public static string BitwardenAutofillServiceAlert2 {
get {
return ResourceManager.GetString("BitwardenAutofillServiceAlert", resourceCulture);
return ResourceManager.GetString("BitwardenAutofillServiceAlert2", resourceCulture);
}
}

View File

@ -411,7 +411,7 @@
<data name="BitwardenAppExtension" xml:space="preserve">
<value>Bitwarden App Extension</value>
</data>
<data name="BitwardenAppExtensionAlert" xml:space="preserve">
<data name="BitwardenAppExtensionAlert2" xml:space="preserve">
<value>The easiest way to add new logins to your vault is from the Bitwarden App Extension. Learn more about using the Bitwarden App Extension by navigating to the "Tools" screen.</value>
</data>
<data name="BitwardenAppExtensionDescription" xml:space="preserve">
@ -779,7 +779,7 @@
<data name="Beta" xml:space="preserve">
<value>Beta</value>
</data>
<data name="BitwardenAutofillServiceAlert" xml:space="preserve">
<data name="BitwardenAutofillServiceAlert2" xml:space="preserve">
<value>The easiest way to add new logins to your vault is from the Bitwarden Auto-fill Service. Learn more about using the Bitwarden Auto-fill Service by navigating to the "Tools" screen.</value>
</data>
<data name="Autofill" xml:space="preserve">
@ -1343,7 +1343,7 @@
<data name="PasswordAutofill" xml:space="preserve">
<value>Password AutoFill</value>
</data>
<data name="BitwardenAutofillAlert" xml:space="preserve">
<data name="BitwardenAutofillAlert2" xml:space="preserve">
<value>The easiest way to add new logins to your vault is by using the Bitwarden Password AutoFill extension. Learn more about using the Bitwarden Password AutoFill extension by navigating to the "Tools" screen.</value>
</data>
<data name="InvalidEmail" xml:space="preserve">

View File

@ -27,6 +27,7 @@
public static string LastClipboardValueKey = "lastClipboardValue";
public static string LastBuildKey = "lastBuild";
public static string OldUserIdKey = "userId";
public static string AddSitePromptShownKey = "addSitePromptShown";
public const int SelectFileRequestCode = 42;
public const int SelectFilePermissionRequestCode = 43;
}