mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
autofill service WIP
This commit is contained in:
parent
45c516ea3f
commit
64fd8e3be9
9 changed files with 35 additions and 37 deletions
|
@ -746,6 +746,21 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidEnvironment Include="EnvironmentVariables.txt" />
|
<AndroidEnvironment Include="EnvironmentVariables.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable\notification_sm.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable-hdpi\notification_sm.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable-xhdpi\notification_sm.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable-xxhdpi\notification_sm.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable-xxxhdpi\notification_sm.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace Bit.Android
|
||||||
_lastQueriedUri = Intent.GetStringExtra("uri");
|
_lastQueriedUri = Intent.GetStringExtra("uri");
|
||||||
|
|
||||||
var intent = new Intent(this, typeof(MainActivity));
|
var intent = new Intent(this, typeof(MainActivity));
|
||||||
|
intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
|
||||||
intent.PutExtra("uri", _lastQueriedUri);
|
intent.PutExtra("uri", _lastQueriedUri);
|
||||||
StartActivityForResult(intent, 123);
|
StartActivityForResult(intent, 123);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,36 +132,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 targetName = uri;
|
|
||||||
if(uri.StartsWith(AndroidAppProtocol))
|
|
||||||
{
|
|
||||||
var packageName = uri.Substring(AndroidAppProtocol.Length);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var appInfo = PackageManager.GetApplicationInfo(packageName, 0);
|
|
||||||
targetName = appInfo != null ? PackageManager.GetApplicationLabel(appInfo) : packageName;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
targetName = packageName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//targetName = KeePassLib.Utility.UrlUtil.GetHost(uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var builder = new Notification.Builder(this);
|
var builder = new Notification.Builder(this);
|
||||||
//TODO icon
|
builder.SetSmallIcon(Resource.Drawable.notification_sm)
|
||||||
//TODO plugin icon
|
|
||||||
builder.SetSmallIcon(Resource.Drawable.icon)
|
|
||||||
.SetContentText("Tap this notification to autofill a login from your bitwarden vault.")
|
.SetContentText("Tap this notification to autofill a login from your bitwarden vault.")
|
||||||
.SetContentTitle("bitwarden Autofill Service")
|
.SetContentTitle("bitwarden Autofill Service")
|
||||||
.SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis())
|
.SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis())
|
||||||
.SetTicker("Tap this notification to autofill a login from your bitwarden vault.")
|
.SetTicker("Tap this notification to autofill a login from your bitwarden vault.")
|
||||||
.SetVisibility(NotificationVisibility.Secret)
|
.SetVisibility(NotificationVisibility.Secret)
|
||||||
.SetContentIntent(pendingIntent);
|
.SetContentIntent(pendingIntent);
|
||||||
|
|
||||||
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
|
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
|
||||||
notificationManager.Notify(AutoFillNotificationId, builder.Build());
|
notificationManager.Notify(AutoFillNotificationId, builder.Build());
|
||||||
}
|
}
|
||||||
|
|
31
src/Android/Resources/Resource.Designer.cs
generated
31
src/Android/Resources/Resource.Designer.cs
generated
|
@ -2727,41 +2727,44 @@ namespace Bit.Android
|
||||||
// aapt resource value: 0x7f0200df
|
// aapt resource value: 0x7f0200df
|
||||||
public const int mr_ic_play_light = 2130837727;
|
public const int mr_ic_play_light = 2130837727;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200eb
|
|
||||||
public const int notification_template_icon_bg = 2130837739;
|
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e0
|
// aapt resource value: 0x7f0200e0
|
||||||
public const int plus = 2130837728;
|
public const int notification_sm = 2130837728;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0200ec
|
||||||
|
public const int notification_template_icon_bg = 2130837740;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e1
|
// aapt resource value: 0x7f0200e1
|
||||||
public const int refresh = 2130837729;
|
public const int plus = 2130837729;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e2
|
// aapt resource value: 0x7f0200e2
|
||||||
public const int roundedbg = 2130837730;
|
public const int refresh = 2130837730;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e3
|
// aapt resource value: 0x7f0200e3
|
||||||
public const int roundedbgdark = 2130837731;
|
public const int roundedbg = 2130837731;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e4
|
// aapt resource value: 0x7f0200e4
|
||||||
public const int splash_screen = 2130837732;
|
public const int roundedbgdark = 2130837732;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e5
|
// aapt resource value: 0x7f0200e5
|
||||||
public const int star = 2130837733;
|
public const int splash_screen = 2130837733;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e6
|
// aapt resource value: 0x7f0200e6
|
||||||
public const int star_selected = 2130837734;
|
public const int star = 2130837734;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e7
|
// aapt resource value: 0x7f0200e7
|
||||||
public const int tools = 2130837735;
|
public const int star_selected = 2130837735;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e8
|
// aapt resource value: 0x7f0200e8
|
||||||
public const int tools_selected = 2130837736;
|
public const int tools = 2130837736;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200e9
|
// aapt resource value: 0x7f0200e9
|
||||||
public const int upload = 2130837737;
|
public const int tools_selected = 2130837737;
|
||||||
|
|
||||||
// aapt resource value: 0x7f0200ea
|
// aapt resource value: 0x7f0200ea
|
||||||
public const int user = 2130837738;
|
public const int upload = 2130837738;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7f0200eb
|
||||||
|
public const int user = 2130837739;
|
||||||
|
|
||||||
static Drawable()
|
static Drawable()
|
||||||
{
|
{
|
||||||
|
|
BIN
src/Android/Resources/drawable-hdpi/notification_sm.png
Normal file
BIN
src/Android/Resources/drawable-hdpi/notification_sm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 531 B |
BIN
src/Android/Resources/drawable-xhdpi/notification_sm.png
Normal file
BIN
src/Android/Resources/drawable-xhdpi/notification_sm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 586 B |
BIN
src/Android/Resources/drawable-xxhdpi/notification_sm.png
Normal file
BIN
src/Android/Resources/drawable-xxhdpi/notification_sm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 773 B |
BIN
src/Android/Resources/drawable-xxxhdpi/notification_sm.png
Normal file
BIN
src/Android/Resources/drawable-xxxhdpi/notification_sm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
src/Android/Resources/drawable/notification_sm.png
Normal file
BIN
src/Android/Resources/drawable/notification_sm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 364 B |
Loading…
Reference in a new issue