autofill service WIP

This commit is contained in:
Kyle Spearrin 2017-01-28 23:58:26 -05:00
parent 45c516ea3f
commit 64fd8e3be9
9 changed files with 35 additions and 37 deletions

View file

@ -746,6 +746,21 @@
<ItemGroup>
<AndroidEnvironment Include="EnvironmentVariables.txt" />
</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="..\..\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">

View file

@ -22,6 +22,7 @@ namespace Bit.Android
_lastQueriedUri = Intent.GetStringExtra("uri");
var intent = new Intent(this, typeof(MainActivity));
intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
intent.PutExtra("uri", _lastQueriedUri);
StartActivityForResult(intent, 123);
}

View file

@ -132,36 +132,15 @@ namespace Bit.Android
intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);
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);
//TODO icon
//TODO plugin icon
builder.SetSmallIcon(Resource.Drawable.icon)
builder.SetSmallIcon(Resource.Drawable.notification_sm)
.SetContentText("Tap this notification to autofill a login from your bitwarden vault.")
.SetContentTitle("bitwarden Autofill Service")
.SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis())
.SetTicker("Tap this notification to autofill a login from your bitwarden vault.")
.SetVisibility(NotificationVisibility.Secret)
.SetContentIntent(pendingIntent);
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
notificationManager.Notify(AutoFillNotificationId, builder.Build());
}

View file

@ -2727,41 +2727,44 @@ namespace Bit.Android
// aapt resource value: 0x7f0200df
public const int mr_ic_play_light = 2130837727;
// aapt resource value: 0x7f0200eb
public const int notification_template_icon_bg = 2130837739;
// 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
public const int refresh = 2130837729;
public const int plus = 2130837729;
// aapt resource value: 0x7f0200e2
public const int roundedbg = 2130837730;
public const int refresh = 2130837730;
// aapt resource value: 0x7f0200e3
public const int roundedbgdark = 2130837731;
public const int roundedbg = 2130837731;
// aapt resource value: 0x7f0200e4
public const int splash_screen = 2130837732;
public const int roundedbgdark = 2130837732;
// aapt resource value: 0x7f0200e5
public const int star = 2130837733;
public const int splash_screen = 2130837733;
// aapt resource value: 0x7f0200e6
public const int star_selected = 2130837734;
public const int star = 2130837734;
// aapt resource value: 0x7f0200e7
public const int tools = 2130837735;
public const int star_selected = 2130837735;
// aapt resource value: 0x7f0200e8
public const int tools_selected = 2130837736;
public const int tools = 2130837736;
// aapt resource value: 0x7f0200e9
public const int upload = 2130837737;
public const int tools_selected = 2130837737;
// 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()
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B