do not attempt autofill on android 4.4

This commit is contained in:
Kyle Spearrin 2017-09-08 09:16:21 -04:00
parent d4f3577f5e
commit 3a5378d201
5 changed files with 25 additions and 5 deletions

View file

@ -70,7 +70,11 @@ namespace Bit.Android
public override void OnAccessibilityEvent(AccessibilityEvent e) public override void OnAccessibilityEvent(AccessibilityEvent e)
{ {
var powerManager = (PowerManager)GetSystemService(PowerService); var powerManager = (PowerManager)GetSystemService(PowerService);
if(!powerManager.IsInteractive) if(Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch && !powerManager.IsInteractive)
{
return;
}
else if(Build.VERSION.SdkInt < BuildVersionCodes.Lollipop && !powerManager.IsScreenOn)
{ {
return; return;
} }
@ -337,11 +341,15 @@ namespace Bit.Android
intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop); intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.UpdateCurrent); var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.UpdateCurrent);
var notificationContent = Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch ?
App.Resources.AppResources.BitwardenAutofillServiceNotificationContent :
App.Resources.AppResources.BitwardenAutofillServiceNotificationContentOld;
var builder = new Notification.Builder(this); var builder = new Notification.Builder(this);
builder.SetSmallIcon(Resource.Drawable.notification_sm) builder.SetSmallIcon(Resource.Drawable.notification_sm)
.SetContentTitle(App.Resources.AppResources.BitwardenAutofillService) .SetContentTitle(App.Resources.AppResources.BitwardenAutofillService)
.SetContentText(App.Resources.AppResources.BitwardenAutofillServiceNotificationContent) .SetContentText(notificationContent)
.SetTicker(App.Resources.AppResources.BitwardenAutofillServiceNotificationContent) .SetTicker(notificationContent)
.SetWhen(now) .SetWhen(now)
.SetContentIntent(pendingIntent); .SetContentIntent(pendingIntent);

View file

@ -205,7 +205,7 @@ namespace Bit.App.Pages
return; return;
} }
if(Uri.StartsWith("http") && _deviceInfoService.Version < 21) if(_deviceInfoService.Version < 21)
{ {
MoreClickedAsync(login); MoreClickedAsync(login);
} }

View file

@ -403,7 +403,7 @@ namespace Bit.App.Pages
} }
else if(selection == AppResources.Autofill) else if(selection == AppResources.Autofill)
{ {
if(Uri.StartsWith("http") && _deviceInfoService.Version < 21) if(_deviceInfoService.Version < 21)
{ {
MoreClickedAsync(login); MoreClickedAsync(login);
} }

View file

@ -439,6 +439,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Tap this notification to view logins from your vault..
/// </summary>
public static string BitwardenAutofillServiceNotificationContentOld {
get {
return ResourceManager.GetString("BitwardenAutofillServiceNotificationContentOld", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Open Accessibility Settings. /// Looks up a localized string similar to Open Accessibility Settings.
/// </summary> /// </summary>

View file

@ -1027,4 +1027,7 @@
<data name="WebVaultUrl" xml:space="preserve"> <data name="WebVaultUrl" xml:space="preserve">
<value>Web Vault Server URL</value> <value>Web Vault Server URL</value>
</data> </data>
<data name="BitwardenAutofillServiceNotificationContentOld" xml:space="preserve">
<value>Tap this notification to view logins from your vault.</value>
</data>
</root> </root>