mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
Add Site Prompt
This commit is contained in:
parent
e03cf94441
commit
2574e0cba5
5 changed files with 52 additions and 11 deletions
|
@ -93,6 +93,8 @@ namespace Bit.App.Migration
|
||||||
settingsShim.GetValueOrDefault("setting:disableAutoCopyTotp", false));
|
settingsShim.GetValueOrDefault("setting:disableAutoCopyTotp", false));
|
||||||
await storageService.SaveAsync(Constants.DisableFaviconKey,
|
await storageService.SaveAsync(Constants.DisableFaviconKey,
|
||||||
settingsShim.GetValueOrDefault("setting:disableWebsiteIcons", false));
|
settingsShim.GetValueOrDefault("setting:disableWebsiteIcons", false));
|
||||||
|
await storageService.SaveAsync(Constants.AddSitePromptShownKey,
|
||||||
|
settingsShim.GetValueOrDefault("addedSiteAlert", false));
|
||||||
await storageService.SaveAsync(Constants.PushInitialPromptShownKey,
|
await storageService.SaveAsync(Constants.PushInitialPromptShownKey,
|
||||||
settingsShim.GetValueOrDefault("push:initialPromptShown", false));
|
settingsShim.GetValueOrDefault("push:initialPromptShown", false));
|
||||||
await storageService.SaveAsync(Constants.PushCurrentTokenKey,
|
await storageService.SaveAsync(Constants.PushCurrentTokenKey,
|
||||||
|
|
|
@ -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.Enums;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
@ -7,8 +12,11 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
public partial class AddEditPage : BaseContentPage
|
public partial class AddEditPage : BaseContentPage
|
||||||
{
|
{
|
||||||
private AddEditPageViewModel _vm;
|
|
||||||
private readonly AppOptions _appOptions;
|
private readonly AppOptions _appOptions;
|
||||||
|
private readonly IStorageService _storageService;
|
||||||
|
private readonly IDeviceActionService _deviceActionService;
|
||||||
|
|
||||||
|
private AddEditPageViewModel _vm;
|
||||||
private bool _fromAutofill;
|
private bool _fromAutofill;
|
||||||
|
|
||||||
public AddEditPage(
|
public AddEditPage(
|
||||||
|
@ -21,6 +29,8 @@ namespace Bit.App.Pages
|
||||||
bool fromAutofill = false,
|
bool fromAutofill = false,
|
||||||
AppOptions appOptions = null)
|
AppOptions appOptions = null)
|
||||||
{
|
{
|
||||||
|
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
|
||||||
|
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||||
_appOptions = appOptions;
|
_appOptions = appOptions;
|
||||||
_fromAutofill = fromAutofill;
|
_fromAutofill = fromAutofill;
|
||||||
FromAutofillFramework = _appOptions?.FromAutofillFramework ?? false;
|
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()
|
protected override void OnDisappearing()
|
||||||
|
|
12
src/App/Resources/AppResources.Designer.cs
generated
12
src/App/Resources/AppResources.Designer.cs
generated
|
@ -558,9 +558,9 @@ namespace Bit.App.Resources {
|
||||||
/// <summary>
|
/// <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 "Tools" screen..
|
/// 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 "Tools" screen..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string BitwardenAppExtensionAlert {
|
public static string BitwardenAppExtensionAlert2 {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("BitwardenAppExtensionAlert", resourceCulture);
|
return ResourceManager.GetString("BitwardenAppExtensionAlert2", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,9 +594,9 @@ namespace Bit.App.Resources {
|
||||||
/// <summary>
|
/// <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 "Tools" screen..
|
/// 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 "Tools" screen..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string BitwardenAutofillAlert {
|
public static string BitwardenAutofillAlert2 {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("BitwardenAutofillAlert", resourceCulture);
|
return ResourceManager.GetString("BitwardenAutofillAlert2", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,9 +630,9 @@ namespace Bit.App.Resources {
|
||||||
/// <summary>
|
/// <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 "Tools" screen..
|
/// 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 "Tools" screen..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string BitwardenAutofillServiceAlert {
|
public static string BitwardenAutofillServiceAlert2 {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("BitwardenAutofillServiceAlert", resourceCulture);
|
return ResourceManager.GetString("BitwardenAutofillServiceAlert2", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,7 +411,7 @@
|
||||||
<data name="BitwardenAppExtension" xml:space="preserve">
|
<data name="BitwardenAppExtension" xml:space="preserve">
|
||||||
<value>Bitwarden App Extension</value>
|
<value>Bitwarden App Extension</value>
|
||||||
</data>
|
</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>
|
<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>
|
||||||
<data name="BitwardenAppExtensionDescription" xml:space="preserve">
|
<data name="BitwardenAppExtensionDescription" xml:space="preserve">
|
||||||
|
@ -779,7 +779,7 @@
|
||||||
<data name="Beta" xml:space="preserve">
|
<data name="Beta" xml:space="preserve">
|
||||||
<value>Beta</value>
|
<value>Beta</value>
|
||||||
</data>
|
</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>
|
<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>
|
||||||
<data name="Autofill" xml:space="preserve">
|
<data name="Autofill" xml:space="preserve">
|
||||||
|
@ -1343,7 +1343,7 @@
|
||||||
<data name="PasswordAutofill" xml:space="preserve">
|
<data name="PasswordAutofill" xml:space="preserve">
|
||||||
<value>Password AutoFill</value>
|
<value>Password AutoFill</value>
|
||||||
</data>
|
</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>
|
<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>
|
||||||
<data name="InvalidEmail" xml:space="preserve">
|
<data name="InvalidEmail" xml:space="preserve">
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
public static string LastClipboardValueKey = "lastClipboardValue";
|
public static string LastClipboardValueKey = "lastClipboardValue";
|
||||||
public static string LastBuildKey = "lastBuild";
|
public static string LastBuildKey = "lastBuild";
|
||||||
public static string OldUserIdKey = "userId";
|
public static string OldUserIdKey = "userId";
|
||||||
|
public static string AddSitePromptShownKey = "addSitePromptShown";
|
||||||
public const int SelectFileRequestCode = 42;
|
public const int SelectFileRequestCode = 42;
|
||||||
public const int SelectFilePermissionRequestCode = 43;
|
public const int SelectFilePermissionRequestCode = 43;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue