From c408614a85d68a53297709344d4c3ff1bfab1e1f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 21 May 2016 12:32:34 -0400 Subject: [PATCH] added lock fingerprint page. added view for ios to hide app when backgrounded from multitask window. --- src/Android/Android.csproj | 8 + src/Android/MainActivity.cs | 12 +- src/Android/Properties/AndroidManifest.xml | 1 + src/Android/Resources/Resource.Designer.cs | 434 +++++++++++---------- src/Android/packages.config | 1 + src/App/App.cs | 32 +- src/App/App.csproj | 9 + src/App/Pages/LockFingerprintPage.cs | 79 ++++ src/App/packages.config | 1 + src/iOS/AppDelegate.cs | 72 +++- src/iOS/iOS.csproj | 16 +- src/iOS/packages.config | 1 + 12 files changed, 451 insertions(+), 215 deletions(-) create mode 100644 src/App/Pages/LockFingerprintPage.cs diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 8564acf68..640c1b329 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -118,6 +118,14 @@ ..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\MonoAndroid10\Plugin.Connectivity.Abstractions.dll True + + ..\..\packages\Plugin.Fingerprint.1.1.1-beta\lib\MonoAndroid\Plugin.Fingerprint.dll + True + + + ..\..\packages\Plugin.Fingerprint.1.1.1-beta\lib\MonoAndroid\Plugin.Fingerprint.Abstractions.dll + True + ..\..\packages\Xam.Plugins.Settings.2.1.0\lib\MonoAndroid10\Plugin.Settings.dll True diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index 413e85360..e1c327b3d 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -16,6 +16,9 @@ using Plugin.Settings; using Plugin.Connectivity; using Acr.UserDialogs; using Bit.App.Repositories; +using Plugin.Fingerprint; +using Plugin.Fingerprint.Abstractions; +using Plugin.Settings.Abstractions; namespace Bit.Android { @@ -33,7 +36,11 @@ namespace Bit.Android SetIoc(); } - LoadApplication(new App.App(Resolver.Resolve(), Resolver.Resolve())); + LoadApplication(new App.App( + Resolver.Resolve(), + Resolver.Resolve(), + Resolver.Resolve(), + Resolver.Resolve())); } private void SetIoc() @@ -60,7 +67,8 @@ namespace Bit.Android // Other .RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager()) .RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager()) - .RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager()); + .RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager()) + .RegisterInstance(CrossFingerprint.Current, new ContainerControlledLifetimeManager()); Resolver.SetResolver(new UnityResolver(container)); diff --git a/src/Android/Properties/AndroidManifest.xml b/src/Android/Properties/AndroidManifest.xml index 641055128..3abd5cf3a 100644 --- a/src/Android/Properties/AndroidManifest.xml +++ b/src/Android/Properties/AndroidManifest.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/src/Android/Resources/Resource.Designer.cs b/src/Android/Resources/Resource.Designer.cs index 055b01506..49cc23e53 100644 --- a/src/Android/Resources/Resource.Designer.cs +++ b/src/Android/Resources/Resource.Designer.cs @@ -64,6 +64,10 @@ namespace Bit.Android global::AndroidHUD.Resource.Styleable.ProgressWheel_ahTextColor = global::Bit.Android.Resource.Styleable.ProgressWheel_ahTextColor; global::AndroidHUD.Resource.Styleable.ProgressWheel_ahTextSize = global::Bit.Android.Resource.Styleable.ProgressWheel_ahTextSize; global::ModernHttpClient.Resource.String.library_name = global::Bit.Android.Resource.String.library_name; + global::Plugin.Fingerprint.Resource.Drawable.fingerprint_white = global::Bit.Android.Resource.Drawable.fingerprint_white; + global::Plugin.Fingerprint.Resource.Id.fingerprint_btnCancel = global::Bit.Android.Resource.Id.fingerprint_btnCancel; + global::Plugin.Fingerprint.Resource.Id.fingerprint_txtReason = global::Bit.Android.Resource.Id.fingerprint_txtReason; + global::Plugin.Fingerprint.Resource.Layout.FingerprintDialog = global::Bit.Android.Resource.Layout.FingerprintDialog; global::Splat.Resource.String.library_name = global::Bit.Android.Resource.String.library_name; global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::Bit.Android.Resource.Attribute.actionBarSize; } @@ -2045,277 +2049,280 @@ namespace Bit.Android public const int fa_folder_open = 2130837581; // aapt resource value: 0x7f02004e - public const int ic_audiotrack = 2130837582; + public const int fingerprint_white = 2130837582; // aapt resource value: 0x7f02004f - public const int ic_audiotrack_light = 2130837583; + public const int ic_audiotrack = 2130837583; // aapt resource value: 0x7f020050 - public const int ic_bluetooth_grey = 2130837584; + public const int ic_audiotrack_light = 2130837584; // aapt resource value: 0x7f020051 - public const int ic_bluetooth_white = 2130837585; + public const int ic_bluetooth_grey = 2130837585; // aapt resource value: 0x7f020052 - public const int ic_cast_dark = 2130837586; + public const int ic_bluetooth_white = 2130837586; // aapt resource value: 0x7f020053 - public const int ic_cast_disabled_light = 2130837587; + public const int ic_cast_dark = 2130837587; // aapt resource value: 0x7f020054 - public const int ic_cast_grey = 2130837588; + public const int ic_cast_disabled_light = 2130837588; // aapt resource value: 0x7f020055 - public const int ic_cast_light = 2130837589; + public const int ic_cast_grey = 2130837589; // aapt resource value: 0x7f020056 - public const int ic_cast_off_light = 2130837590; + public const int ic_cast_light = 2130837590; // aapt resource value: 0x7f020057 - public const int ic_cast_on_0_light = 2130837591; + public const int ic_cast_off_light = 2130837591; // aapt resource value: 0x7f020058 - public const int ic_cast_on_1_light = 2130837592; + public const int ic_cast_on_0_light = 2130837592; // aapt resource value: 0x7f020059 - public const int ic_cast_on_2_light = 2130837593; + public const int ic_cast_on_1_light = 2130837593; // aapt resource value: 0x7f02005a - public const int ic_cast_on_light = 2130837594; + public const int ic_cast_on_2_light = 2130837594; // aapt resource value: 0x7f02005b - public const int ic_cast_white = 2130837595; + public const int ic_cast_on_light = 2130837595; // aapt resource value: 0x7f02005c - public const int ic_close_dark = 2130837596; + public const int ic_cast_white = 2130837596; // aapt resource value: 0x7f02005d - public const int ic_close_light = 2130837597; + public const int ic_close_dark = 2130837597; // aapt resource value: 0x7f02005e - public const int ic_collapse = 2130837598; + public const int ic_close_light = 2130837598; // aapt resource value: 0x7f02005f - public const int ic_collapse_00000 = 2130837599; + public const int ic_collapse = 2130837599; // aapt resource value: 0x7f020060 - public const int ic_collapse_00001 = 2130837600; + public const int ic_collapse_00000 = 2130837600; // aapt resource value: 0x7f020061 - public const int ic_collapse_00002 = 2130837601; + public const int ic_collapse_00001 = 2130837601; // aapt resource value: 0x7f020062 - public const int ic_collapse_00003 = 2130837602; + public const int ic_collapse_00002 = 2130837602; // aapt resource value: 0x7f020063 - public const int ic_collapse_00004 = 2130837603; + public const int ic_collapse_00003 = 2130837603; // aapt resource value: 0x7f020064 - public const int ic_collapse_00005 = 2130837604; + public const int ic_collapse_00004 = 2130837604; // aapt resource value: 0x7f020065 - public const int ic_collapse_00006 = 2130837605; + public const int ic_collapse_00005 = 2130837605; // aapt resource value: 0x7f020066 - public const int ic_collapse_00007 = 2130837606; + public const int ic_collapse_00006 = 2130837606; // aapt resource value: 0x7f020067 - public const int ic_collapse_00008 = 2130837607; + public const int ic_collapse_00007 = 2130837607; // aapt resource value: 0x7f020068 - public const int ic_collapse_00009 = 2130837608; + public const int ic_collapse_00008 = 2130837608; // aapt resource value: 0x7f020069 - public const int ic_collapse_00010 = 2130837609; + public const int ic_collapse_00009 = 2130837609; // aapt resource value: 0x7f02006a - public const int ic_collapse_00011 = 2130837610; + public const int ic_collapse_00010 = 2130837610; // aapt resource value: 0x7f02006b - public const int ic_collapse_00012 = 2130837611; + public const int ic_collapse_00011 = 2130837611; // aapt resource value: 0x7f02006c - public const int ic_collapse_00013 = 2130837612; + public const int ic_collapse_00012 = 2130837612; // aapt resource value: 0x7f02006d - public const int ic_collapse_00014 = 2130837613; + public const int ic_collapse_00013 = 2130837613; // aapt resource value: 0x7f02006e - public const int ic_collapse_00015 = 2130837614; + public const int ic_collapse_00014 = 2130837614; // aapt resource value: 0x7f02006f - public const int ic_errorstatus = 2130837615; + public const int ic_collapse_00015 = 2130837615; // aapt resource value: 0x7f020070 - public const int ic_expand = 2130837616; + public const int ic_errorstatus = 2130837616; // aapt resource value: 0x7f020071 - public const int ic_expand_00000 = 2130837617; + public const int ic_expand = 2130837617; // aapt resource value: 0x7f020072 - public const int ic_expand_00001 = 2130837618; + public const int ic_expand_00000 = 2130837618; // aapt resource value: 0x7f020073 - public const int ic_expand_00002 = 2130837619; + public const int ic_expand_00001 = 2130837619; // aapt resource value: 0x7f020074 - public const int ic_expand_00003 = 2130837620; + public const int ic_expand_00002 = 2130837620; // aapt resource value: 0x7f020075 - public const int ic_expand_00004 = 2130837621; + public const int ic_expand_00003 = 2130837621; // aapt resource value: 0x7f020076 - public const int ic_expand_00005 = 2130837622; + public const int ic_expand_00004 = 2130837622; // aapt resource value: 0x7f020077 - public const int ic_expand_00006 = 2130837623; + public const int ic_expand_00005 = 2130837623; // aapt resource value: 0x7f020078 - public const int ic_expand_00007 = 2130837624; + public const int ic_expand_00006 = 2130837624; // aapt resource value: 0x7f020079 - public const int ic_expand_00008 = 2130837625; + public const int ic_expand_00007 = 2130837625; // aapt resource value: 0x7f02007a - public const int ic_expand_00009 = 2130837626; + public const int ic_expand_00008 = 2130837626; // aapt resource value: 0x7f02007b - public const int ic_expand_00010 = 2130837627; + public const int ic_expand_00009 = 2130837627; // aapt resource value: 0x7f02007c - public const int ic_expand_00011 = 2130837628; + public const int ic_expand_00010 = 2130837628; // aapt resource value: 0x7f02007d - public const int ic_expand_00012 = 2130837629; + public const int ic_expand_00011 = 2130837629; // aapt resource value: 0x7f02007e - public const int ic_expand_00013 = 2130837630; + public const int ic_expand_00012 = 2130837630; // aapt resource value: 0x7f02007f - public const int ic_expand_00014 = 2130837631; + public const int ic_expand_00013 = 2130837631; // aapt resource value: 0x7f020080 - public const int ic_expand_00015 = 2130837632; + public const int ic_expand_00014 = 2130837632; // aapt resource value: 0x7f020081 - public const int ic_media_pause = 2130837633; + public const int ic_expand_00015 = 2130837633; // aapt resource value: 0x7f020082 - public const int ic_media_play = 2130837634; + public const int ic_media_pause = 2130837634; // aapt resource value: 0x7f020083 - public const int ic_media_route_disabled_mono_dark = 2130837635; + public const int ic_media_play = 2130837635; // aapt resource value: 0x7f020084 - public const int ic_media_route_off_mono_dark = 2130837636; + public const int ic_media_route_disabled_mono_dark = 2130837636; // aapt resource value: 0x7f020085 - public const int ic_media_route_on_0_mono_dark = 2130837637; + public const int ic_media_route_off_mono_dark = 2130837637; // aapt resource value: 0x7f020086 - public const int ic_media_route_on_1_mono_dark = 2130837638; + public const int ic_media_route_on_0_mono_dark = 2130837638; // aapt resource value: 0x7f020087 - public const int ic_media_route_on_2_mono_dark = 2130837639; + public const int ic_media_route_on_1_mono_dark = 2130837639; // aapt resource value: 0x7f020088 - public const int ic_media_route_on_mono_dark = 2130837640; + public const int ic_media_route_on_2_mono_dark = 2130837640; // aapt resource value: 0x7f020089 - public const int ic_pause_dark = 2130837641; + public const int ic_media_route_on_mono_dark = 2130837641; // aapt resource value: 0x7f02008a - public const int ic_pause_light = 2130837642; + public const int ic_pause_dark = 2130837642; // aapt resource value: 0x7f02008b - public const int ic_play_dark = 2130837643; + public const int ic_pause_light = 2130837643; // aapt resource value: 0x7f02008c - public const int ic_play_light = 2130837644; + public const int ic_play_dark = 2130837644; // aapt resource value: 0x7f02008d - public const int ic_speaker_dark = 2130837645; + public const int ic_play_light = 2130837645; // aapt resource value: 0x7f02008e - public const int ic_speaker_group_dark = 2130837646; + public const int ic_speaker_dark = 2130837646; // aapt resource value: 0x7f02008f - public const int ic_speaker_group_light = 2130837647; + public const int ic_speaker_group_dark = 2130837647; // aapt resource value: 0x7f020090 - public const int ic_speaker_light = 2130837648; + public const int ic_speaker_group_light = 2130837648; // aapt resource value: 0x7f020091 - public const int ic_successstatus = 2130837649; + public const int ic_speaker_light = 2130837649; // aapt resource value: 0x7f020092 - public const int ic_tv_dark = 2130837650; + public const int ic_successstatus = 2130837650; // aapt resource value: 0x7f020093 - public const int ic_tv_light = 2130837651; + public const int ic_tv_dark = 2130837651; // aapt resource value: 0x7f020094 - public const int icon = 2130837652; + public const int ic_tv_light = 2130837652; // aapt resource value: 0x7f020095 - public const int ion_chevron_right = 2130837653; + public const int icon = 2130837653; // aapt resource value: 0x7f020096 - public const int ion_plus = 2130837654; + public const int ion_chevron_right = 2130837654; // aapt resource value: 0x7f020097 - public const int mr_dialog_material_background_dark = 2130837655; + public const int ion_plus = 2130837655; // aapt resource value: 0x7f020098 - public const int mr_dialog_material_background_light = 2130837656; + public const int mr_dialog_material_background_dark = 2130837656; // aapt resource value: 0x7f020099 - public const int mr_ic_audiotrack_light = 2130837657; + public const int mr_dialog_material_background_light = 2130837657; // aapt resource value: 0x7f02009a - public const int mr_ic_cast_dark = 2130837658; + public const int mr_ic_audiotrack_light = 2130837658; // aapt resource value: 0x7f02009b - public const int mr_ic_cast_light = 2130837659; + public const int mr_ic_cast_dark = 2130837659; // aapt resource value: 0x7f02009c - public const int mr_ic_close_dark = 2130837660; + public const int mr_ic_cast_light = 2130837660; // aapt resource value: 0x7f02009d - public const int mr_ic_close_light = 2130837661; + public const int mr_ic_close_dark = 2130837661; // aapt resource value: 0x7f02009e - public const int mr_ic_media_route_connecting_mono_dark = 2130837662; + public const int mr_ic_close_light = 2130837662; // aapt resource value: 0x7f02009f - public const int mr_ic_media_route_connecting_mono_light = 2130837663; + public const int mr_ic_media_route_connecting_mono_dark = 2130837663; // aapt resource value: 0x7f0200a0 - public const int mr_ic_media_route_mono_dark = 2130837664; + public const int mr_ic_media_route_connecting_mono_light = 2130837664; // aapt resource value: 0x7f0200a1 - public const int mr_ic_media_route_mono_light = 2130837665; + public const int mr_ic_media_route_mono_dark = 2130837665; // aapt resource value: 0x7f0200a2 - public const int mr_ic_pause_dark = 2130837666; + public const int mr_ic_media_route_mono_light = 2130837666; // aapt resource value: 0x7f0200a3 - public const int mr_ic_pause_light = 2130837667; + public const int mr_ic_pause_dark = 2130837667; // aapt resource value: 0x7f0200a4 - public const int mr_ic_play_dark = 2130837668; + public const int mr_ic_pause_light = 2130837668; // aapt resource value: 0x7f0200a5 - public const int mr_ic_play_light = 2130837669; - - // aapt resource value: 0x7f0200a8 - public const int notification_template_icon_bg = 2130837672; + public const int mr_ic_play_dark = 2130837669; // aapt resource value: 0x7f0200a6 - public const int roundedbg = 2130837670; + public const int mr_ic_play_light = 2130837670; + + // aapt resource value: 0x7f0200a9 + public const int notification_template_icon_bg = 2130837673; // aapt resource value: 0x7f0200a7 - public const int roundedbgdark = 2130837671; + public const int roundedbg = 2130837671; + + // aapt resource value: 0x7f0200a8 + public const int roundedbgdark = 2130837672; static Drawable() { @@ -2330,8 +2337,8 @@ namespace Bit.Android public partial class Id { - // aapt resource value: 0x7f07008f - public const int action0 = 2131165327; + // aapt resource value: 0x7f070091 + public const int action0 = 2131165329; // aapt resource value: 0x7f07005a public const int action_bar = 2131165274; @@ -2357,8 +2364,8 @@ namespace Bit.Android // aapt resource value: 0x7f07005b public const int action_context_bar = 2131165275; - // aapt resource value: 0x7f070093 - public const int action_divider = 2131165331; + // aapt resource value: 0x7f070095 + public const int action_divider = 2131165333; // aapt resource value: 0x7f070003 public const int action_menu_divider = 2131165187; @@ -2393,8 +2400,8 @@ namespace Bit.Android // aapt resource value: 0x7f070044 public const int buttonPanel = 2131165252; - // aapt resource value: 0x7f070090 - public const int cancel_action = 2131165328; + // aapt resource value: 0x7f070092 + public const int cancel_action = 2131165330; // aapt resource value: 0x7f07002b public const int center = 2131165227; @@ -2408,8 +2415,8 @@ namespace Bit.Android // aapt resource value: 0x7f070052 public const int checkbox = 2131165266; - // aapt resource value: 0x7f070096 - public const int chronometer = 2131165334; + // aapt resource value: 0x7f070098 + public const int chronometer = 2131165336; // aapt resource value: 0x7f070033 public const int clip_horizontal = 2131165235; @@ -2459,8 +2466,8 @@ namespace Bit.Android // aapt resource value: 0x7f07001c public const int end = 2131165212; - // aapt resource value: 0x7f07009b - public const int end_padder = 2131165339; + // aapt resource value: 0x7f07009d + public const int end_padder = 2131165341; // aapt resource value: 0x7f070023 public const int enterAlways = 2131165219; @@ -2486,6 +2493,12 @@ namespace Bit.Android // aapt resource value: 0x7f07002e public const int fill_vertical = 2131165230; + // aapt resource value: 0x7f070073 + public const int fingerprint_btnCancel = 2131165299; + + // aapt resource value: 0x7f070072 + public const int fingerprint_txtReason = 2131165298; + // aapt resource value: 0x7f070038 public const int @fixed = 2131165240; @@ -2504,8 +2517,8 @@ namespace Bit.Android // aapt resource value: 0x7f07003f public const int image = 2131165247; - // aapt resource value: 0x7f07009a - public const int info = 2131165338; + // aapt resource value: 0x7f07009c + public const int info = 2131165340; // aapt resource value: 0x7f070000 public const int item_touch_helper_previous_elevation = 2131165184; @@ -2513,11 +2526,11 @@ namespace Bit.Android // aapt resource value: 0x7f07002f public const int left = 2131165231; - // aapt resource value: 0x7f070094 - public const int line1 = 2131165332; + // aapt resource value: 0x7f070096 + public const int line1 = 2131165334; - // aapt resource value: 0x7f070098 - public const int line3 = 2131165336; + // aapt resource value: 0x7f07009a + public const int line3 = 2131165338; // aapt resource value: 0x7f07000b public const int listMode = 2131165195; @@ -2525,17 +2538,17 @@ namespace Bit.Android // aapt resource value: 0x7f070041 public const int list_item = 2131165249; + // aapt resource value: 0x7f070076 + public const int loadingImage = 2131165302; + // aapt resource value: 0x7f070074 - public const int loadingImage = 2131165300; + public const int loadingProgressBar = 2131165300; - // aapt resource value: 0x7f070072 - public const int loadingProgressBar = 2131165298; + // aapt resource value: 0x7f070077 + public const int loadingProgressWheel = 2131165303; - // aapt resource value: 0x7f070075 - public const int loadingProgressWheel = 2131165301; - - // aapt resource value: 0x7f070092 - public const int media_actions = 2131165330; + // aapt resource value: 0x7f070094 + public const int media_actions = 2131165332; // aapt resource value: 0x7f07001d public const int middle = 2131165213; @@ -2543,77 +2556,77 @@ namespace Bit.Android // aapt resource value: 0x7f070037 public const int mini = 2131165239; - // aapt resource value: 0x7f070081 - public const int mr_art = 2131165313; - - // aapt resource value: 0x7f070076 - public const int mr_chooser_list = 2131165302; - - // aapt resource value: 0x7f070079 - public const int mr_chooser_route_desc = 2131165305; - - // aapt resource value: 0x7f070077 - public const int mr_chooser_route_icon = 2131165303; + // aapt resource value: 0x7f070083 + public const int mr_art = 2131165315; // aapt resource value: 0x7f070078 - public const int mr_chooser_route_name = 2131165304; - - // aapt resource value: 0x7f07007e - public const int mr_close = 2131165310; - - // aapt resource value: 0x7f070084 - public const int mr_control_divider = 2131165316; - - // aapt resource value: 0x7f07008a - public const int mr_control_play_pause = 2131165322; - - // aapt resource value: 0x7f07008d - public const int mr_control_subtitle = 2131165325; - - // aapt resource value: 0x7f07008c - public const int mr_control_title = 2131165324; - - // aapt resource value: 0x7f07008b - public const int mr_control_title_container = 2131165323; - - // aapt resource value: 0x7f07007f - public const int mr_custom_control = 2131165311; - - // aapt resource value: 0x7f070080 - public const int mr_default_control = 2131165312; + public const int mr_chooser_list = 2131165304; // aapt resource value: 0x7f07007b - public const int mr_dialog_area = 2131165307; + public const int mr_chooser_route_desc = 2131165307; + + // aapt resource value: 0x7f070079 + public const int mr_chooser_route_icon = 2131165305; // aapt resource value: 0x7f07007a - public const int mr_expandable_area = 2131165306; + public const int mr_chooser_route_name = 2131165306; - // aapt resource value: 0x7f07008e - public const int mr_group_expand_collapse = 2131165326; - - // aapt resource value: 0x7f070082 - public const int mr_media_main_control = 2131165314; - - // aapt resource value: 0x7f07007d - public const int mr_name = 2131165309; - - // aapt resource value: 0x7f070083 - public const int mr_playback_control = 2131165315; - - // aapt resource value: 0x7f07007c - public const int mr_title_bar = 2131165308; - - // aapt resource value: 0x7f070085 - public const int mr_volume_control = 2131165317; + // aapt resource value: 0x7f070080 + public const int mr_close = 2131165312; // aapt resource value: 0x7f070086 - public const int mr_volume_group_list = 2131165318; + public const int mr_control_divider = 2131165318; + + // aapt resource value: 0x7f07008c + public const int mr_control_play_pause = 2131165324; + + // aapt resource value: 0x7f07008f + public const int mr_control_subtitle = 2131165327; + + // aapt resource value: 0x7f07008e + public const int mr_control_title = 2131165326; + + // aapt resource value: 0x7f07008d + public const int mr_control_title_container = 2131165325; + + // aapt resource value: 0x7f070081 + public const int mr_custom_control = 2131165313; + + // aapt resource value: 0x7f070082 + public const int mr_default_control = 2131165314; + + // aapt resource value: 0x7f07007d + public const int mr_dialog_area = 2131165309; + + // aapt resource value: 0x7f07007c + public const int mr_expandable_area = 2131165308; + + // aapt resource value: 0x7f070090 + public const int mr_group_expand_collapse = 2131165328; + + // aapt resource value: 0x7f070084 + public const int mr_media_main_control = 2131165316; + + // aapt resource value: 0x7f07007f + public const int mr_name = 2131165311; + + // aapt resource value: 0x7f070085 + public const int mr_playback_control = 2131165317; + + // aapt resource value: 0x7f07007e + public const int mr_title_bar = 2131165310; + + // aapt resource value: 0x7f070087 + public const int mr_volume_control = 2131165319; // aapt resource value: 0x7f070088 - public const int mr_volume_item_icon = 2131165320; + public const int mr_volume_group_list = 2131165320; - // aapt resource value: 0x7f070089 - public const int mr_volume_slider = 2131165321; + // aapt resource value: 0x7f07008a + public const int mr_volume_item_icon = 2131165322; + + // aapt resource value: 0x7f07008b + public const int mr_volume_slider = 2131165323; // aapt resource value: 0x7f070016 public const int multiply = 2131165206; @@ -2741,8 +2754,8 @@ namespace Bit.Android // aapt resource value: 0x7f070031 public const int start = 2131165233; - // aapt resource value: 0x7f070091 - public const int status_bar_latest_event_content = 2131165329; + // aapt resource value: 0x7f070093 + public const int status_bar_latest_event_content = 2131165331; // aapt resource value: 0x7f070065 public const int submit_area = 2131165285; @@ -2750,20 +2763,20 @@ namespace Bit.Android // aapt resource value: 0x7f07000d public const int tabMode = 2131165197; - // aapt resource value: 0x7f070099 - public const int text = 2131165337; + // aapt resource value: 0x7f07009b + public const int text = 2131165339; - // aapt resource value: 0x7f070097 - public const int text2 = 2131165335; + // aapt resource value: 0x7f070099 + public const int text2 = 2131165337; // aapt resource value: 0x7f07004d public const int textSpacerNoButtons = 2131165261; - // aapt resource value: 0x7f070073 - public const int textViewStatus = 2131165299; + // aapt resource value: 0x7f070075 + public const int textViewStatus = 2131165301; - // aapt resource value: 0x7f070095 - public const int time = 2131165333; + // aapt resource value: 0x7f070097 + public const int time = 2131165335; // aapt resource value: 0x7f070043 public const int title = 2131165251; @@ -2789,8 +2802,8 @@ namespace Bit.Android // aapt resource value: 0x7f07000a public const int view_offset_helper = 2131165194; - // aapt resource value: 0x7f070087 - public const int volume_item_container = 2131165319; + // aapt resource value: 0x7f070089 + public const int volume_item_container = 2131165321; // aapt resource value: 0x7f070022 public const int withText = 2131165218; @@ -2985,67 +2998,70 @@ namespace Bit.Android public const int design_navigation_menu_item = 2130903076; // aapt resource value: 0x7f030025 - public const int loading = 2130903077; + public const int FingerprintDialog = 2130903077; // aapt resource value: 0x7f030026 - public const int loadingimage = 2130903078; + public const int loading = 2130903078; // aapt resource value: 0x7f030027 - public const int loadingprogress = 2130903079; + public const int loadingimage = 2130903079; // aapt resource value: 0x7f030028 - public const int mr_chooser_dialog = 2130903080; + public const int loadingprogress = 2130903080; // aapt resource value: 0x7f030029 - public const int mr_chooser_list_item = 2130903081; + public const int mr_chooser_dialog = 2130903081; // aapt resource value: 0x7f03002a - public const int mr_controller_material_dialog_b = 2130903082; + public const int mr_chooser_list_item = 2130903082; // aapt resource value: 0x7f03002b - public const int mr_controller_volume_item = 2130903083; + public const int mr_controller_material_dialog_b = 2130903083; // aapt resource value: 0x7f03002c - public const int mr_playback_control = 2130903084; + public const int mr_controller_volume_item = 2130903084; // aapt resource value: 0x7f03002d - public const int mr_volume_control = 2130903085; + public const int mr_playback_control = 2130903085; // aapt resource value: 0x7f03002e - public const int notification_media_action = 2130903086; + public const int mr_volume_control = 2130903086; // aapt resource value: 0x7f03002f - public const int notification_media_cancel_action = 2130903087; + public const int notification_media_action = 2130903087; // aapt resource value: 0x7f030030 - public const int notification_template_big_media = 2130903088; + public const int notification_media_cancel_action = 2130903088; // aapt resource value: 0x7f030031 - public const int notification_template_big_media_narrow = 2130903089; + public const int notification_template_big_media = 2130903089; // aapt resource value: 0x7f030032 - public const int notification_template_lines = 2130903090; + public const int notification_template_big_media_narrow = 2130903090; // aapt resource value: 0x7f030033 - public const int notification_template_media = 2130903091; + public const int notification_template_lines = 2130903091; // aapt resource value: 0x7f030034 - public const int notification_template_part_chronometer = 2130903092; + public const int notification_template_media = 2130903092; // aapt resource value: 0x7f030035 - public const int notification_template_part_time = 2130903093; + public const int notification_template_part_chronometer = 2130903093; // aapt resource value: 0x7f030036 - public const int select_dialog_item_material = 2130903094; + public const int notification_template_part_time = 2130903094; // aapt resource value: 0x7f030037 - public const int select_dialog_multichoice_material = 2130903095; + public const int select_dialog_item_material = 2130903095; // aapt resource value: 0x7f030038 - public const int select_dialog_singlechoice_material = 2130903096; + public const int select_dialog_multichoice_material = 2130903096; // aapt resource value: 0x7f030039 - public const int support_simple_spinner_dropdown_item = 2130903097; + public const int select_dialog_singlechoice_material = 2130903097; + + // aapt resource value: 0x7f03003a + public const int support_simple_spinner_dropdown_item = 2130903098; static Layout() { diff --git a/src/Android/packages.config b/src/Android/packages.config index 6b0f2a16d..deea20d25 100644 --- a/src/Android/packages.config +++ b/src/Android/packages.config @@ -4,6 +4,7 @@ + diff --git a/src/App/App.cs b/src/App/App.cs index 06b6a33a1..30a7c176a 100644 --- a/src/App/App.cs +++ b/src/App/App.cs @@ -5,6 +5,10 @@ using System.Text; using Bit.App.Abstractions; using Bit.App.Pages; using Xamarin.Forms; +using System.Diagnostics; +using Plugin.Fingerprint.Abstractions; +using System.Threading.Tasks; +using Plugin.Settings.Abstractions; namespace Bit.App { @@ -12,11 +16,19 @@ namespace Bit.App { private readonly IDatabaseService _databaseService; private readonly IAuthService _authService; + private readonly IFingerprint _fingerprint; + private readonly ISettings _settings; - public App(IAuthService authService, IDatabaseService databaseService) + public App( + IAuthService authService, + IDatabaseService databaseService, + IFingerprint fingerprint, + ISettings settings) { _databaseService = databaseService; _authService = authService; + _fingerprint = fingerprint; + _settings = settings; if(authService.IsAuthenticated) { @@ -28,22 +40,40 @@ namespace Bit.App } MainPage.BackgroundColor = Color.FromHex("ecf0f5"); + + MessagingCenter.Subscribe(this, "Lock", async (sender) => + { + await CheckLockAsync(); + }); } protected override void OnStart() { // Handle when your app starts + CheckLockAsync(); _databaseService.CreateTables(); + + Debug.WriteLine("OnStart"); } protected override void OnSleep() { // Handle when your app sleeps + Debug.WriteLine("OnSleep"); } protected override void OnResume() { // Handle when your app resumes + Debug.WriteLine("OnResume"); + } + + private async Task CheckLockAsync() + { + if(_authService.IsAuthenticated && Current.MainPage.Navigation.ModalStack.LastOrDefault() as LockFingerprintPage == null) + { + await Current.MainPage.Navigation.PushModalAsync(new LockFingerprintPage(), false); + } } } } diff --git a/src/App/App.csproj b/src/App/App.csproj index 4f15384fc..129542958 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -83,6 +83,7 @@ + @@ -168,6 +169,14 @@ ..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\portable-net45+wp80+wp81+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+Xamarin.Mac20+UAP10\Plugin.Connectivity.Abstractions.dll True + + ..\..\packages\Plugin.Fingerprint.1.1.1-beta\lib\portable-net45+win8+wpa81+wp8\Plugin.Fingerprint.dll + True + + + ..\..\packages\Plugin.Fingerprint.1.1.1-beta\lib\portable-net45+win8+wpa81+wp8\Plugin.Fingerprint.Abstractions.dll + True + ..\..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.dll True diff --git a/src/App/Pages/LockFingerprintPage.cs b/src/App/Pages/LockFingerprintPage.cs new file mode 100644 index 000000000..eb2338c79 --- /dev/null +++ b/src/App/Pages/LockFingerprintPage.cs @@ -0,0 +1,79 @@ +using System; +using System.Threading.Tasks; +using Acr.UserDialogs; +using Bit.App.Abstractions; +using Bit.App.Controls; +using Bit.App.Resources; +using Plugin.Connectivity.Abstractions; +using Xamarin.Forms; +using XLabs.Ioc; +using Plugin.Fingerprint.Abstractions; +using Plugin.Settings.Abstractions; + +namespace Bit.App.Pages +{ + public class LockFingerprintPage : ContentPage + { + private readonly IFingerprint _fingerprint; + private readonly IAuthService _authService; + private readonly IUserDialogs _userDialogs; + private readonly ISettings _settings; + + public LockFingerprintPage() + { + _fingerprint = Resolver.Resolve(); + _authService = Resolver.Resolve(); + _userDialogs = Resolver.Resolve(); + _settings = Resolver.Resolve(); + + Init(); + } + + public void Init() + { + CheckFingerprintAsync(); + + var fingerprintButton = new Button + { + Text = "Use Fingerprint to Unlock", + Command = new Command(async () => await CheckFingerprintAsync()), + VerticalOptions = LayoutOptions.EndAndExpand + }; + + var logoutButton = new Button + { + Text = AppResources.LogOut, + Command = new Command(async () => await LogoutAsync()), + VerticalOptions = LayoutOptions.End + }; + + var stackLayout = new StackLayout { Padding = new Thickness( 30, 40), Spacing = 10 }; + stackLayout.Children.Add(fingerprintButton); + stackLayout.Children.Add(logoutButton); + + Title = "Verify Fingerprint"; + Content = stackLayout; + } + + public async Task LogoutAsync() + { + if(!await _userDialogs.ConfirmAsync("Are you sure you want to log out?", null, AppResources.Yes, AppResources.Cancel)) + { + return; + } + + _authService.LogOut(); + await Navigation.PopModalAsync(); + Application.Current.MainPage = new LoginNavigationPage(); + } + + public async Task CheckFingerprintAsync() + { + var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify."); + if(result.Authenticated) + { + await Navigation.PopModalAsync(); + } + } + } +} diff --git a/src/App/packages.config b/src/App/packages.config index df0760244..ff119692e 100644 --- a/src/App/packages.config +++ b/src/App/packages.config @@ -4,6 +4,7 @@ + diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 135db2db1..bfbe05950 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -14,6 +14,11 @@ using Plugin.Settings; using Plugin.Connectivity; using Acr.UserDialogs; using Bit.App.Repositories; +using Plugin.Fingerprint; +using Plugin.Fingerprint.Abstractions; +using Plugin.Settings.Abstractions; +using System.Diagnostics; +using Xamarin.Forms; namespace Bit.iOS { @@ -23,6 +28,8 @@ namespace Bit.iOS [Register("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { + private App.App _app; + // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window @@ -32,6 +39,8 @@ namespace Bit.iOS // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { + CrossFingerprint.AllowReuse = false; + global::Xamarin.Forms.Forms.Init(); if(!Resolver.IsSet) @@ -39,11 +48,69 @@ namespace Bit.iOS SetIoc(); } - LoadApplication(new App.App(Resolver.Resolve(), Resolver.Resolve())); + _app = new App.App( + Resolver.Resolve(), + Resolver.Resolve(), + Resolver.Resolve(), + Resolver.Resolve()); + + LoadApplication(_app); return base.FinishedLaunching(app, options); } + public override void DidEnterBackground(UIApplication uiApplication) + { + var colourView = new UIView(UIApplication.SharedApplication.KeyWindow.Frame) + { + BackgroundColor = UIColor.Black, + Tag = 4321 + }; + UIApplication.SharedApplication.KeyWindow.AddSubview(colourView); + UIApplication.SharedApplication.KeyWindow.BringSubviewToFront(colourView); + + base.DidEnterBackground(uiApplication); + Debug.WriteLine("DidEnterBackground"); + } + + + public override void OnResignActivation(UIApplication uiApplication) + { + base.OnResignActivation(uiApplication); + Debug.WriteLine("OnResignActivation"); + } + + public override void WillTerminate(UIApplication uiApplication) + { + base.WillTerminate(uiApplication); + Debug.WriteLine("WillTerminate"); + } + + public override void OnActivated(UIApplication uiApplication) + { + base.OnActivated(uiApplication); + Debug.WriteLine("OnActivated"); + + var view = UIApplication.SharedApplication.KeyWindow.ViewWithTag(4321); + if(view != null) + { + view.RemoveFromSuperview(); + } + } + + public override void WillEnterForeground(UIApplication uiApplication) + { + SendLockMessage(); + base.WillEnterForeground(uiApplication); + Debug.WriteLine("WillEnterForeground"); + } + + private void SendLockMessage() + { + MessagingCenter.Send(_app, "Lock"); + + } + private void SetIoc() { var container = new UnityContainer(); @@ -68,7 +135,8 @@ namespace Bit.iOS // Other .RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager()) .RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager()) - .RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager()); + .RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager()) + .RegisterInstance(CrossFingerprint.Current, new ContainerControlledLifetimeManager()); Resolver.SetResolver(new UnityResolver(container)); } diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index bf7f45cf9..38abfe039 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -36,6 +36,11 @@ True False + iPhone Developer + + + + none @@ -60,7 +65,8 @@ iPhone Developer true Entitlements.plist - 2ae5608a-6142-4e1d-9344-326d1982b392 + + @@ -174,6 +180,14 @@ ..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\Xamarin.iOS10\Plugin.Connectivity.Abstractions.dll True + + ..\..\packages\Plugin.Fingerprint.1.1.1-beta\lib\Xamarin.iOS10\Plugin.Fingerprint.dll + True + + + ..\..\packages\Plugin.Fingerprint.1.1.1-beta\lib\Xamarin.iOS10\Plugin.Fingerprint.Abstractions.dll + True + ..\..\packages\Xam.Plugins.Settings.2.1.0\lib\Xamarin.iOS10\Plugin.Settings.dll True diff --git a/src/iOS/packages.config b/src/iOS/packages.config index ff17114d1..5c8152267 100644 --- a/src/iOS/packages.config +++ b/src/iOS/packages.config @@ -4,6 +4,7 @@ +