This commit is contained in:
Kyle Spearrin 2016-05-03 02:08:50 -04:00
parent c6222c8ed3
commit 92e74274e0
24 changed files with 574 additions and 214 deletions

View file

@ -72,6 +72,22 @@
<DebugSymbols>False</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="Acr.Support.Android, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.Support.2.0.2\lib\MonoAndroid10\Acr.Support.Android.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Acr.UserDialogs, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\MonoAndroid10\Acr.UserDialogs.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Acr.UserDialogs.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\MonoAndroid10\Acr.UserDialogs.Interface.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="AndHUD, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\MonoAndroid10\AndHUD.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FormsViewGroup, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.2.0.31\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
<Private>True</Private>
@ -94,6 +110,14 @@
<HintPath>..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Connectivity, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\MonoAndroid10\Plugin.Connectivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Connectivity.Abstractions, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\MonoAndroid10\Plugin.Connectivity.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Settings, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\MonoAndroid10\Plugin.Settings.dll</HintPath>
<Private>True</Private>
@ -102,6 +126,10 @@
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\MonoAndroid10\Plugin.Settings.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Splat.1.6.2\lib\monoandroid\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLite-net, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\sqlite-net-pcl.1.1.1\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
<Private>True</Private>

View file

@ -13,6 +13,8 @@ using XLabs.Ioc.Unity;
using XLabs.Ioc;
using Bit.Android.Services;
using Plugin.Settings;
using Plugin.Connectivity;
using Acr.UserDialogs;
namespace Bit.Android
{
@ -46,9 +48,13 @@ namespace Bit.Android
.RegisterType<ICryptoService, CryptoService>(new ContainerControlledLifetimeManager())
.RegisterType<IAuthService, AuthService>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderService, FolderService>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteService, SiteService>(new ContainerControlledLifetimeManager());
.RegisterType<ISiteService, SiteService>(new ContainerControlledLifetimeManager())
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
.RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager());
Resolver.SetResolver(new UnityResolver(container));
UserDialogs.Init(this);
}
}
}

View file

@ -26,7 +26,45 @@ namespace Bit.Android
public static void UpdateIdValues()
{
global::AndroidHUD.Resource.Attribute.ahBarColor = global::Bit.Android.Resource.Attribute.ahBarColor;
global::AndroidHUD.Resource.Attribute.ahBarLength = global::Bit.Android.Resource.Attribute.ahBarLength;
global::AndroidHUD.Resource.Attribute.ahBarWidth = global::Bit.Android.Resource.Attribute.ahBarWidth;
global::AndroidHUD.Resource.Attribute.ahCircleColor = global::Bit.Android.Resource.Attribute.ahCircleColor;
global::AndroidHUD.Resource.Attribute.ahDelayMillis = global::Bit.Android.Resource.Attribute.ahDelayMillis;
global::AndroidHUD.Resource.Attribute.ahRadius = global::Bit.Android.Resource.Attribute.ahRadius;
global::AndroidHUD.Resource.Attribute.ahRimColor = global::Bit.Android.Resource.Attribute.ahRimColor;
global::AndroidHUD.Resource.Attribute.ahRimWidth = global::Bit.Android.Resource.Attribute.ahRimWidth;
global::AndroidHUD.Resource.Attribute.ahSpinSpeed = global::Bit.Android.Resource.Attribute.ahSpinSpeed;
global::AndroidHUD.Resource.Attribute.ahText = global::Bit.Android.Resource.Attribute.ahText;
global::AndroidHUD.Resource.Attribute.ahTextColor = global::Bit.Android.Resource.Attribute.ahTextColor;
global::AndroidHUD.Resource.Attribute.ahTextSize = global::Bit.Android.Resource.Attribute.ahTextSize;
global::AndroidHUD.Resource.Drawable.ic_errorstatus = global::Bit.Android.Resource.Drawable.ic_errorstatus;
global::AndroidHUD.Resource.Drawable.ic_successstatus = global::Bit.Android.Resource.Drawable.ic_successstatus;
global::AndroidHUD.Resource.Drawable.roundedbg = global::Bit.Android.Resource.Drawable.roundedbg;
global::AndroidHUD.Resource.Drawable.roundedbgdark = global::Bit.Android.Resource.Drawable.roundedbgdark;
global::AndroidHUD.Resource.Id.loadingImage = global::Bit.Android.Resource.Id.loadingImage;
global::AndroidHUD.Resource.Id.loadingProgressBar = global::Bit.Android.Resource.Id.loadingProgressBar;
global::AndroidHUD.Resource.Id.loadingProgressWheel = global::Bit.Android.Resource.Id.loadingProgressWheel;
global::AndroidHUD.Resource.Id.textViewStatus = global::Bit.Android.Resource.Id.textViewStatus;
global::AndroidHUD.Resource.Layout.loading = global::Bit.Android.Resource.Layout.loading;
global::AndroidHUD.Resource.Layout.loadingimage = global::Bit.Android.Resource.Layout.loadingimage;
global::AndroidHUD.Resource.Layout.loadingprogress = global::Bit.Android.Resource.Layout.loadingprogress;
global::AndroidHUD.Resource.String.library_name = global::Bit.Android.Resource.String.library_name;
global::AndroidHUD.Resource.Styleable.ProgressWheel = global::Bit.Android.Resource.Styleable.ProgressWheel;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahBarColor = global::Bit.Android.Resource.Styleable.ProgressWheel_ahBarColor;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahBarLength = global::Bit.Android.Resource.Styleable.ProgressWheel_ahBarLength;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahBarWidth = global::Bit.Android.Resource.Styleable.ProgressWheel_ahBarWidth;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahCircleColor = global::Bit.Android.Resource.Styleable.ProgressWheel_ahCircleColor;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahDelayMillis = global::Bit.Android.Resource.Styleable.ProgressWheel_ahDelayMillis;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahRadius = global::Bit.Android.Resource.Styleable.ProgressWheel_ahRadius;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahRimColor = global::Bit.Android.Resource.Styleable.ProgressWheel_ahRimColor;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahRimWidth = global::Bit.Android.Resource.Styleable.ProgressWheel_ahRimWidth;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahSpinSpeed = global::Bit.Android.Resource.Styleable.ProgressWheel_ahSpinSpeed;
global::AndroidHUD.Resource.Styleable.ProgressWheel_ahText = global::Bit.Android.Resource.Styleable.ProgressWheel_ahText;
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::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;
}
@ -199,6 +237,42 @@ namespace Bit.Android
// aapt resource value: 0x7f010083
public const int activityChooserViewStyle = 2130772099;
// aapt resource value: 0x7f01013f
public const int ahBarColor = 2130772287;
// aapt resource value: 0x7f010147
public const int ahBarLength = 2130772295;
// aapt resource value: 0x7f010146
public const int ahBarWidth = 2130772294;
// aapt resource value: 0x7f010144
public const int ahCircleColor = 2130772292;
// aapt resource value: 0x7f010143
public const int ahDelayMillis = 2130772291;
// aapt resource value: 0x7f010145
public const int ahRadius = 2130772293;
// aapt resource value: 0x7f010140
public const int ahRimColor = 2130772288;
// aapt resource value: 0x7f010141
public const int ahRimWidth = 2130772289;
// aapt resource value: 0x7f010142
public const int ahSpinSpeed = 2130772290;
// aapt resource value: 0x7f01013c
public const int ahText = 2130772284;
// aapt resource value: 0x7f01013d
public const int ahTextColor = 2130772285;
// aapt resource value: 0x7f01013e
public const int ahTextSize = 2130772286;
// aapt resource value: 0x7f0100a6
public const int alertDialogButtonGroupStyle = 2130772134;
@ -2049,160 +2123,172 @@ namespace Bit.Android
public const int ic_collapse_00015 = 2130837613;
// aapt resource value: 0x7f02006e
public const int ic_expand = 2130837614;
public const int ic_errorstatus = 2130837614;
// aapt resource value: 0x7f02006f
public const int ic_expand_00000 = 2130837615;
public const int ic_expand = 2130837615;
// aapt resource value: 0x7f020070
public const int ic_expand_00001 = 2130837616;
public const int ic_expand_00000 = 2130837616;
// aapt resource value: 0x7f020071
public const int ic_expand_00002 = 2130837617;
public const int ic_expand_00001 = 2130837617;
// aapt resource value: 0x7f020072
public const int ic_expand_00003 = 2130837618;
public const int ic_expand_00002 = 2130837618;
// aapt resource value: 0x7f020073
public const int ic_expand_00004 = 2130837619;
public const int ic_expand_00003 = 2130837619;
// aapt resource value: 0x7f020074
public const int ic_expand_00005 = 2130837620;
public const int ic_expand_00004 = 2130837620;
// aapt resource value: 0x7f020075
public const int ic_expand_00006 = 2130837621;
public const int ic_expand_00005 = 2130837621;
// aapt resource value: 0x7f020076
public const int ic_expand_00007 = 2130837622;
public const int ic_expand_00006 = 2130837622;
// aapt resource value: 0x7f020077
public const int ic_expand_00008 = 2130837623;
public const int ic_expand_00007 = 2130837623;
// aapt resource value: 0x7f020078
public const int ic_expand_00009 = 2130837624;
public const int ic_expand_00008 = 2130837624;
// aapt resource value: 0x7f020079
public const int ic_expand_00010 = 2130837625;
public const int ic_expand_00009 = 2130837625;
// aapt resource value: 0x7f02007a
public const int ic_expand_00011 = 2130837626;
public const int ic_expand_00010 = 2130837626;
// aapt resource value: 0x7f02007b
public const int ic_expand_00012 = 2130837627;
public const int ic_expand_00011 = 2130837627;
// aapt resource value: 0x7f02007c
public const int ic_expand_00013 = 2130837628;
public const int ic_expand_00012 = 2130837628;
// aapt resource value: 0x7f02007d
public const int ic_expand_00014 = 2130837629;
public const int ic_expand_00013 = 2130837629;
// aapt resource value: 0x7f02007e
public const int ic_expand_00015 = 2130837630;
public const int ic_expand_00014 = 2130837630;
// aapt resource value: 0x7f02007f
public const int ic_media_pause = 2130837631;
public const int ic_expand_00015 = 2130837631;
// aapt resource value: 0x7f020080
public const int ic_media_play = 2130837632;
public const int ic_media_pause = 2130837632;
// aapt resource value: 0x7f020081
public const int ic_media_route_disabled_mono_dark = 2130837633;
public const int ic_media_play = 2130837633;
// aapt resource value: 0x7f020082
public const int ic_media_route_off_mono_dark = 2130837634;
public const int ic_media_route_disabled_mono_dark = 2130837634;
// aapt resource value: 0x7f020083
public const int ic_media_route_on_0_mono_dark = 2130837635;
public const int ic_media_route_off_mono_dark = 2130837635;
// aapt resource value: 0x7f020084
public const int ic_media_route_on_1_mono_dark = 2130837636;
public const int ic_media_route_on_0_mono_dark = 2130837636;
// aapt resource value: 0x7f020085
public const int ic_media_route_on_2_mono_dark = 2130837637;
public const int ic_media_route_on_1_mono_dark = 2130837637;
// aapt resource value: 0x7f020086
public const int ic_media_route_on_mono_dark = 2130837638;
public const int ic_media_route_on_2_mono_dark = 2130837638;
// aapt resource value: 0x7f020087
public const int ic_pause_dark = 2130837639;
public const int ic_media_route_on_mono_dark = 2130837639;
// aapt resource value: 0x7f020088
public const int ic_pause_light = 2130837640;
public const int ic_pause_dark = 2130837640;
// aapt resource value: 0x7f020089
public const int ic_play_dark = 2130837641;
public const int ic_pause_light = 2130837641;
// aapt resource value: 0x7f02008a
public const int ic_play_light = 2130837642;
public const int ic_play_dark = 2130837642;
// aapt resource value: 0x7f02008b
public const int ic_speaker_dark = 2130837643;
public const int ic_play_light = 2130837643;
// aapt resource value: 0x7f02008c
public const int ic_speaker_group_dark = 2130837644;
public const int ic_speaker_dark = 2130837644;
// aapt resource value: 0x7f02008d
public const int ic_speaker_group_light = 2130837645;
public const int ic_speaker_group_dark = 2130837645;
// aapt resource value: 0x7f02008e
public const int ic_speaker_light = 2130837646;
public const int ic_speaker_group_light = 2130837646;
// aapt resource value: 0x7f02008f
public const int ic_tv_dark = 2130837647;
public const int ic_speaker_light = 2130837647;
// aapt resource value: 0x7f020090
public const int ic_tv_light = 2130837648;
public const int ic_successstatus = 2130837648;
// aapt resource value: 0x7f020091
public const int icon = 2130837649;
public const int ic_tv_dark = 2130837649;
// aapt resource value: 0x7f020092
public const int mr_dialog_material_background_dark = 2130837650;
public const int ic_tv_light = 2130837650;
// aapt resource value: 0x7f020093
public const int mr_dialog_material_background_light = 2130837651;
public const int icon = 2130837651;
// aapt resource value: 0x7f020094
public const int mr_ic_audiotrack_light = 2130837652;
public const int mr_dialog_material_background_dark = 2130837652;
// aapt resource value: 0x7f020095
public const int mr_ic_cast_dark = 2130837653;
public const int mr_dialog_material_background_light = 2130837653;
// aapt resource value: 0x7f020096
public const int mr_ic_cast_light = 2130837654;
public const int mr_ic_audiotrack_light = 2130837654;
// aapt resource value: 0x7f020097
public const int mr_ic_close_dark = 2130837655;
public const int mr_ic_cast_dark = 2130837655;
// aapt resource value: 0x7f020098
public const int mr_ic_close_light = 2130837656;
public const int mr_ic_cast_light = 2130837656;
// aapt resource value: 0x7f020099
public const int mr_ic_media_route_connecting_mono_dark = 2130837657;
public const int mr_ic_close_dark = 2130837657;
// aapt resource value: 0x7f02009a
public const int mr_ic_media_route_connecting_mono_light = 2130837658;
public const int mr_ic_close_light = 2130837658;
// aapt resource value: 0x7f02009b
public const int mr_ic_media_route_mono_dark = 2130837659;
public const int mr_ic_media_route_connecting_mono_dark = 2130837659;
// aapt resource value: 0x7f02009c
public const int mr_ic_media_route_mono_light = 2130837660;
public const int mr_ic_media_route_connecting_mono_light = 2130837660;
// aapt resource value: 0x7f02009d
public const int mr_ic_pause_dark = 2130837661;
public const int mr_ic_media_route_mono_dark = 2130837661;
// aapt resource value: 0x7f02009e
public const int mr_ic_pause_light = 2130837662;
public const int mr_ic_media_route_mono_light = 2130837662;
// aapt resource value: 0x7f02009f
public const int mr_ic_play_dark = 2130837663;
public const int mr_ic_pause_dark = 2130837663;
// aapt resource value: 0x7f0200a0
public const int mr_ic_play_light = 2130837664;
public const int mr_ic_pause_light = 2130837664;
// aapt resource value: 0x7f0200a1
public const int notification_template_icon_bg = 2130837665;
public const int mr_ic_play_dark = 2130837665;
// aapt resource value: 0x7f0200a2
public const int mr_ic_play_light = 2130837666;
// aapt resource value: 0x7f0200a5
public const int notification_template_icon_bg = 2130837669;
// aapt resource value: 0x7f0200a3
public const int roundedbg = 2130837667;
// aapt resource value: 0x7f0200a4
public const int roundedbgdark = 2130837668;
static Drawable()
{
@ -2217,8 +2303,8 @@ namespace Bit.Android
public partial class Id
{
// aapt resource value: 0x7f07008b
public const int action0 = 2131165323;
// aapt resource value: 0x7f07008f
public const int action0 = 2131165327;
// aapt resource value: 0x7f07005a
public const int action_bar = 2131165274;
@ -2244,8 +2330,8 @@ namespace Bit.Android
// aapt resource value: 0x7f07005b
public const int action_context_bar = 2131165275;
// aapt resource value: 0x7f07008f
public const int action_divider = 2131165327;
// aapt resource value: 0x7f070093
public const int action_divider = 2131165331;
// aapt resource value: 0x7f070003
public const int action_menu_divider = 2131165187;
@ -2280,8 +2366,8 @@ namespace Bit.Android
// aapt resource value: 0x7f070044
public const int buttonPanel = 2131165252;
// aapt resource value: 0x7f07008c
public const int cancel_action = 2131165324;
// aapt resource value: 0x7f070090
public const int cancel_action = 2131165328;
// aapt resource value: 0x7f07002b
public const int center = 2131165227;
@ -2295,8 +2381,8 @@ namespace Bit.Android
// aapt resource value: 0x7f070052
public const int checkbox = 2131165266;
// aapt resource value: 0x7f070092
public const int chronometer = 2131165330;
// aapt resource value: 0x7f070096
public const int chronometer = 2131165334;
// aapt resource value: 0x7f070033
public const int clip_horizontal = 2131165235;
@ -2346,8 +2432,8 @@ namespace Bit.Android
// aapt resource value: 0x7f07001c
public const int end = 2131165212;
// aapt resource value: 0x7f070097
public const int end_padder = 2131165335;
// aapt resource value: 0x7f07009b
public const int end_padder = 2131165339;
// aapt resource value: 0x7f070023
public const int enterAlways = 2131165219;
@ -2391,8 +2477,8 @@ namespace Bit.Android
// aapt resource value: 0x7f07003f
public const int image = 2131165247;
// aapt resource value: 0x7f070096
public const int info = 2131165334;
// aapt resource value: 0x7f07009a
public const int info = 2131165338;
// aapt resource value: 0x7f070000
public const int item_touch_helper_previous_elevation = 2131165184;
@ -2400,11 +2486,11 @@ namespace Bit.Android
// aapt resource value: 0x7f07002f
public const int left = 2131165231;
// aapt resource value: 0x7f070090
public const int line1 = 2131165328;
// aapt resource value: 0x7f070094
public const int line3 = 2131165332;
public const int line1 = 2131165332;
// aapt resource value: 0x7f070098
public const int line3 = 2131165336;
// aapt resource value: 0x7f07000b
public const int listMode = 2131165195;
@ -2412,8 +2498,17 @@ namespace Bit.Android
// aapt resource value: 0x7f070041
public const int list_item = 2131165249;
// aapt resource value: 0x7f07008e
public const int media_actions = 2131165326;
// aapt resource value: 0x7f070074
public const int loadingImage = 2131165300;
// aapt resource value: 0x7f070072
public const int loadingProgressBar = 2131165298;
// aapt resource value: 0x7f070075
public const int loadingProgressWheel = 2131165301;
// aapt resource value: 0x7f070092
public const int media_actions = 2131165330;
// aapt resource value: 0x7f07001d
public const int middle = 2131165213;
@ -2421,77 +2516,77 @@ namespace Bit.Android
// aapt resource value: 0x7f070037
public const int mini = 2131165239;
// aapt resource value: 0x7f07007d
public const int mr_art = 2131165309;
// aapt resource value: 0x7f070072
public const int mr_chooser_list = 2131165298;
// aapt resource value: 0x7f070075
public const int mr_chooser_route_desc = 2131165301;
// aapt resource value: 0x7f070073
public const int mr_chooser_route_icon = 2131165299;
// aapt resource value: 0x7f070074
public const int mr_chooser_route_name = 2131165300;
// aapt resource value: 0x7f07007a
public const int mr_close = 2131165306;
// aapt resource value: 0x7f070080
public const int mr_control_divider = 2131165312;
// aapt resource value: 0x7f070086
public const int mr_control_play_pause = 2131165318;
// aapt resource value: 0x7f070089
public const int mr_control_subtitle = 2131165321;
// aapt resource value: 0x7f070088
public const int mr_control_title = 2131165320;
// aapt resource value: 0x7f070087
public const int mr_control_title_container = 2131165319;
// aapt resource value: 0x7f07007b
public const int mr_custom_control = 2131165307;
// aapt resource value: 0x7f07007c
public const int mr_default_control = 2131165308;
// aapt resource value: 0x7f070077
public const int mr_dialog_area = 2131165303;
// aapt resource value: 0x7f070081
public const int mr_art = 2131165313;
// aapt resource value: 0x7f070076
public const int mr_expandable_area = 2131165302;
// aapt resource value: 0x7f07008a
public const int mr_group_expand_collapse = 2131165322;
// aapt resource value: 0x7f07007e
public const int mr_media_main_control = 2131165310;
public const int mr_chooser_list = 2131165302;
// aapt resource value: 0x7f070079
public const int mr_name = 2131165305;
public const int mr_chooser_route_desc = 2131165305;
// aapt resource value: 0x7f07007f
public const int mr_playback_control = 2131165311;
// aapt resource value: 0x7f070077
public const int mr_chooser_route_icon = 2131165303;
// aapt resource value: 0x7f070078
public const int mr_title_bar = 2131165304;
public const int mr_chooser_route_name = 2131165304;
// aapt resource value: 0x7f070081
public const int mr_volume_control = 2131165313;
// aapt resource value: 0x7f070082
public const int mr_volume_group_list = 2131165314;
// aapt resource value: 0x7f07007e
public const int mr_close = 2131165310;
// aapt resource value: 0x7f070084
public const int mr_volume_item_icon = 2131165316;
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;
// aapt resource value: 0x7f07007b
public const int mr_dialog_area = 2131165307;
// aapt resource value: 0x7f07007a
public const int mr_expandable_area = 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_slider = 2131165317;
public const int mr_volume_control = 2131165317;
// aapt resource value: 0x7f070086
public const int mr_volume_group_list = 2131165318;
// aapt resource value: 0x7f070088
public const int mr_volume_item_icon = 2131165320;
// aapt resource value: 0x7f070089
public const int mr_volume_slider = 2131165321;
// aapt resource value: 0x7f070016
public const int multiply = 2131165206;
@ -2619,8 +2714,8 @@ namespace Bit.Android
// aapt resource value: 0x7f070031
public const int start = 2131165233;
// aapt resource value: 0x7f07008d
public const int status_bar_latest_event_content = 2131165325;
// aapt resource value: 0x7f070091
public const int status_bar_latest_event_content = 2131165329;
// aapt resource value: 0x7f070065
public const int submit_area = 2131165285;
@ -2628,17 +2723,20 @@ namespace Bit.Android
// aapt resource value: 0x7f07000d
public const int tabMode = 2131165197;
// aapt resource value: 0x7f070095
public const int text = 2131165333;
// aapt resource value: 0x7f070099
public const int text = 2131165337;
// aapt resource value: 0x7f070093
public const int text2 = 2131165331;
// aapt resource value: 0x7f070097
public const int text2 = 2131165335;
// aapt resource value: 0x7f07004d
public const int textSpacerNoButtons = 2131165261;
// aapt resource value: 0x7f070091
public const int time = 2131165329;
// aapt resource value: 0x7f070073
public const int textViewStatus = 2131165299;
// aapt resource value: 0x7f070095
public const int time = 2131165333;
// aapt resource value: 0x7f070043
public const int title = 2131165251;
@ -2664,8 +2762,8 @@ namespace Bit.Android
// aapt resource value: 0x7f07000a
public const int view_offset_helper = 2131165194;
// aapt resource value: 0x7f070083
public const int volume_item_container = 2131165315;
// aapt resource value: 0x7f070087
public const int volume_item_container = 2131165319;
// aapt resource value: 0x7f070022
public const int withText = 2131165218;
@ -2860,58 +2958,67 @@ namespace Bit.Android
public const int design_navigation_menu_item = 2130903076;
// aapt resource value: 0x7f030025
public const int mr_chooser_dialog = 2130903077;
public const int loading = 2130903077;
// aapt resource value: 0x7f030026
public const int mr_chooser_list_item = 2130903078;
public const int loadingimage = 2130903078;
// aapt resource value: 0x7f030027
public const int mr_controller_material_dialog_b = 2130903079;
public const int loadingprogress = 2130903079;
// aapt resource value: 0x7f030028
public const int mr_controller_volume_item = 2130903080;
public const int mr_chooser_dialog = 2130903080;
// aapt resource value: 0x7f030029
public const int mr_playback_control = 2130903081;
public const int mr_chooser_list_item = 2130903081;
// aapt resource value: 0x7f03002a
public const int mr_volume_control = 2130903082;
public const int mr_controller_material_dialog_b = 2130903082;
// aapt resource value: 0x7f03002b
public const int notification_media_action = 2130903083;
public const int mr_controller_volume_item = 2130903083;
// aapt resource value: 0x7f03002c
public const int notification_media_cancel_action = 2130903084;
public const int mr_playback_control = 2130903084;
// aapt resource value: 0x7f03002d
public const int notification_template_big_media = 2130903085;
public const int mr_volume_control = 2130903085;
// aapt resource value: 0x7f03002e
public const int notification_template_big_media_narrow = 2130903086;
public const int notification_media_action = 2130903086;
// aapt resource value: 0x7f03002f
public const int notification_template_lines = 2130903087;
public const int notification_media_cancel_action = 2130903087;
// aapt resource value: 0x7f030030
public const int notification_template_media = 2130903088;
public const int notification_template_big_media = 2130903088;
// aapt resource value: 0x7f030031
public const int notification_template_part_chronometer = 2130903089;
public const int notification_template_big_media_narrow = 2130903089;
// aapt resource value: 0x7f030032
public const int notification_template_part_time = 2130903090;
public const int notification_template_lines = 2130903090;
// aapt resource value: 0x7f030033
public const int select_dialog_item_material = 2130903091;
public const int notification_template_media = 2130903091;
// aapt resource value: 0x7f030034
public const int select_dialog_multichoice_material = 2130903092;
public const int notification_template_part_chronometer = 2130903092;
// aapt resource value: 0x7f030035
public const int select_dialog_singlechoice_material = 2130903093;
public const int notification_template_part_time = 2130903093;
// aapt resource value: 0x7f030036
public const int support_simple_spinner_dropdown_item = 2130903094;
public const int select_dialog_item_material = 2130903094;
// aapt resource value: 0x7f030037
public const int select_dialog_multichoice_material = 2130903095;
// aapt resource value: 0x7f030038
public const int select_dialog_singlechoice_material = 2130903096;
// aapt resource value: 0x7f030039
public const int support_simple_spinner_dropdown_item = 2130903097;
static Layout()
{
@ -5407,6 +5514,56 @@ namespace Bit.Android
// aapt resource value: 0
public const int PopupWindowBackgroundState_state_above_anchor = 0;
public static int[] ProgressWheel = new int[] {
2130772284,
2130772285,
2130772286,
2130772287,
2130772288,
2130772289,
2130772290,
2130772291,
2130772292,
2130772293,
2130772294,
2130772295};
// aapt resource value: 3
public const int ProgressWheel_ahBarColor = 3;
// aapt resource value: 11
public const int ProgressWheel_ahBarLength = 11;
// aapt resource value: 10
public const int ProgressWheel_ahBarWidth = 10;
// aapt resource value: 8
public const int ProgressWheel_ahCircleColor = 8;
// aapt resource value: 7
public const int ProgressWheel_ahDelayMillis = 7;
// aapt resource value: 9
public const int ProgressWheel_ahRadius = 9;
// aapt resource value: 4
public const int ProgressWheel_ahRimColor = 4;
// aapt resource value: 5
public const int ProgressWheel_ahRimWidth = 5;
// aapt resource value: 6
public const int ProgressWheel_ahSpinSpeed = 6;
// aapt resource value: 0
public const int ProgressWheel_ahText = 0;
// aapt resource value: 1
public const int ProgressWheel_ahTextColor = 1;
// aapt resource value: 2
public const int ProgressWheel_ahTextSize = 2;
public static int[] RecyclerView = new int[] {
16842948,
2130771968,

View file

@ -1,10 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Acr.Support" version="2.0.2" targetFramework="monoandroid60" />
<package id="Acr.UserDialogs" version="5.0.1" targetFramework="monoandroid60" />
<package id="CommonServiceLocator" version="1.3" targetFramework="monoandroid60" />
<package id="modernhttpclient" version="2.4.2" targetFramework="monoandroid50" />
<package id="Splat" version="1.6.2" targetFramework="monoandroid60" />
<package id="sqlite-net-pcl" version="1.1.1" targetFramework="monoandroid60" />
<package id="SQLitePCL.raw" version="0.8.6" targetFramework="monoandroid60" />
<package id="Unity" version="3.5.1405-prerelease" targetFramework="monoandroid60" />
<package id="Xam.Plugin.Connectivity" version="2.1.2" targetFramework="monoandroid60" />
<package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />

View file

@ -1,13 +1,14 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Bit.App.Models;
using Bit.App.Models.Api;
namespace Bit.App.Abstractions
{
public interface IFolderService
{
Task<Folder> GetByIdAsync(int id);
Task<Folder> GetByIdAsync(string id);
Task<IEnumerable<Folder>> GetAllAsync();
Task SaveAsync(Folder folder);
Task<ApiResult<FolderResponse>> SaveAsync(Folder folder);
}
}

View file

@ -1,12 +1,13 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Bit.App.Models;
using Bit.App.Models.Api;
namespace Bit.App.Abstractions
{
public interface ISiteService
{
Task<IEnumerable<Site>> GetAllAsync();
Task SaveAsync(Site site);
Task<ApiResult<SiteResponse>> SaveAsync(Site site);
}
}

View file

@ -89,6 +89,14 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="Acr.UserDialogs, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\portable-win+net45+wp8+win8+wpa81\Acr.UserDialogs.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Acr.UserDialogs.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\portable-win+net45+wp8+win8+wpa81\Acr.UserDialogs.Interface.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\..\packages\Portable.BouncyCastle.1.8.1\lib\portable-net45+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.dll</HintPath>
<Private>True</Private>
@ -109,6 +117,14 @@
<HintPath>..\..\packages\Newtonsoft.Json.8.0.3\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Connectivity, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\portable-net45+wp80+wp81+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+Xamarin.Mac20+UAP10\Plugin.Connectivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Connectivity.Abstractions, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\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</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Settings, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.dll</HintPath>
<Private>True</Private>
@ -117,6 +133,10 @@
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Settings.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Splat.1.6.2\lib\Portable-net45+win+wpa81+wp80\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLite-net, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\sqlite-net-pcl.1.1.1\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
<Private>True</Private>

View file

@ -2,6 +2,11 @@
{
public class FolderRequest
{
public FolderRequest(Folder folder)
{
Name = folder.Name?.EncryptedString;
}
public string Name { get; set; }
}
}

View file

@ -2,6 +2,16 @@
{
public class SiteRequest
{
public SiteRequest(Site site)
{
FolderId = site.FolderId;
Name = site.Name?.EncryptedString;
Uri = site.Uri?.EncryptedString;
Username = site.Username?.EncryptedString;
Password = site.Password?.EncryptedString;
Notes = site.Notes?.EncryptedString;
}
public string FolderId { get; set; }
public string Name { get; set; }
public string Uri { get; set; }

View file

@ -4,8 +4,7 @@ namespace Bit.App.Models
{
public abstract class Cipher
{
public int Id { get; set; }
public string ServerId { get; set; }
public string Id { get; set; }
public CipherString Name { get; set; }
}
}

View file

@ -1,11 +1,12 @@
using System;
using SQLite;
using Bit.App.Abstractions;
using Bit.App.Models.Api;
namespace Bit.App.Models.Data
{
[Table("Folder")]
public class FolderData : IDataObject<int>
public class FolderData : IDataObject<string>
{
public FolderData()
{ }
@ -13,15 +14,19 @@ namespace Bit.App.Models.Data
public FolderData(Folder folder, string userId)
{
Id = folder.Id;
ServerId = folder.ServerId;
UserId = userId;
Name = folder.Name?.EncryptedString;
}
public FolderData(FolderResponse folder, string userId)
{
Id = folder.Id;
UserId = userId;
Name = folder.Name;
}
[PrimaryKey]
[AutoIncrement]
public int Id { get; set; }
public string ServerId { get; set; }
public string Id { get; set; }
public string UserId { get; set; }
public string Name { get; set; }
public DateTime RevisionDateTime { get; set; } = DateTime.UtcNow;

View file

@ -1,11 +1,12 @@
using System;
using SQLite;
using Bit.App.Abstractions;
using Bit.App.Models.Api;
namespace Bit.App.Models.Data
{
[Table("Site")]
public class SiteData : IDataObject<int>
public class SiteData : IDataObject<string>
{
public SiteData()
{ }
@ -13,9 +14,7 @@ namespace Bit.App.Models.Data
public SiteData(Site site, string userId)
{
Id = site.Id;
ServerId = site.ServerId;
FolderId = site.FolderId;
ServerFolderId = site.ServerFolderId;
UserId = userId;
Name = site.Name?.EncryptedString;
Uri = site.Uri?.EncryptedString;
@ -24,12 +23,21 @@ namespace Bit.App.Models.Data
Notes = site.Notes?.EncryptedString;
}
public SiteData(SiteResponse site, string userId)
{
Id = site.Id;
FolderId = site.FolderId;
UserId = userId;
Name = site.Name;
Uri = site.Uri;
Username = site.Username;
Password = site.Password;
Notes = site.Notes;
}
[PrimaryKey]
[AutoIncrement]
public int Id { get; set; }
public string ServerId { get; set; }
public int? FolderId { get; set; }
public string ServerFolderId { get; set; }
public string Id { get; set; }
public string FolderId { get; set; }
public string UserId { get; set; }
public string Name { get; set; }
public string Uri { get; set; }

View file

@ -11,16 +11,20 @@ namespace Bit.App.Models
public Folder(FolderData data)
{
Id = data.Id;
ServerId = data.ServerId;
Name = data.Name != null ? new CipherString(data.Name) : null;
}
public Folder(FolderResponse response)
{
ServerId = response.Id;
Id = response.Id;
Name = response.Name != null ? new CipherString(response.Name) : null;
}
public FolderRequest ToFolderRequest()
{
return new FolderRequest(this);
}
public FolderData ToFolderData(string userId)
{
return new FolderData(this, userId);

View file

@ -11,9 +11,7 @@ namespace Bit.App.Models
public Site(SiteData data)
{
Id = data.Id;
ServerId = data.ServerId;
FolderId = data.FolderId;
ServerFolderId = data.ServerFolderId;
Name = data.Name != null ? new CipherString(data.Name) : null;
Uri = data.Uri != null ? new CipherString(data.Uri) : null;
Username = data.Username != null ? new CipherString(data.Username) : null;
@ -23,8 +21,8 @@ namespace Bit.App.Models
public Site(SiteResponse response)
{
ServerId = response.Id;
ServerFolderId = response.FolderId;
Id = response.Id;
FolderId = response.FolderId;
Name = response.Name != null ? new CipherString(response.Name) : null;
Uri = response.Uri != null ? new CipherString(response.Uri) : null;
Username = response.Username != null ? new CipherString(response.Username) : null;
@ -32,13 +30,17 @@ namespace Bit.App.Models
Notes = response.Notes != null ? new CipherString(response.Notes) : null;
}
public int? FolderId { get; set; }
public string ServerFolderId { get; set; }
public string FolderId { get; set; }
public CipherString Uri { get; set; }
public CipherString Username { get; set; }
public CipherString Password { get; set; }
public CipherString Notes { get; set; }
public SiteRequest ToSiteRequest()
{
return new SiteRequest(this);
}
public SiteData ToSiteData(string userId)
{
return new SiteData(this, userId);

View file

@ -15,7 +15,7 @@ namespace Bit.App.Models.View
Username = site.Username?.Decrypt();
}
public int Id { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string Username { get; set; }
}
@ -40,7 +40,7 @@ namespace Bit.App.Models.View
Name = folder.Name?.Decrypt();
}
public int? Id { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string FirstLetter { get { return Name.Substring(0, 1); } }
}

View file

@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using Acr.UserDialogs;
using Bit.App.Abstractions;
using Bit.App.Models;
using Plugin.Connectivity.Abstractions;
using Xamarin.Forms;
using XLabs.Ioc;
@ -16,6 +19,8 @@ namespace Bit.App.Pages
{
var cryptoService = Resolver.Resolve<ICryptoService>();
var folderService = Resolver.Resolve<IFolderService>();
var userDialogs = Resolver.Resolve<IUserDialogs>();
var connectivity = Resolver.Resolve<IConnectivity>();
var nameEntry = new Entry();
@ -31,6 +36,12 @@ namespace Bit.App.Pages
var saveToolBarItem = new ToolbarItem("Save", null, async () =>
{
if(!connectivity.IsConnected)
{
AlertNoConnection();
return;
}
if(string.IsNullOrWhiteSpace(nameEntry.Text))
{
await DisplayAlert("An error has occurred", "The Name field is required.", "Ok");
@ -42,13 +53,28 @@ namespace Bit.App.Pages
Name = nameEntry.Text.Encrypt()
};
await folderService.SaveAsync(folder);
var saveTask = folderService.SaveAsync(folder);
userDialogs.ShowLoading("Saving...", MaskType.Black);
await saveTask;
userDialogs.HideLoading();
await Navigation.PopAsync();
userDialogs.SuccessToast(nameEntry.Text, "New folder created.");
}, ToolbarItemOrder.Default, 0);
Title = "Add Folder";
Content = scrollView;
ToolbarItems.Add(saveToolBarItem);
if(!connectivity.IsConnected)
{
AlertNoConnection();
}
}
public void AlertNoConnection()
{
DisplayAlert("No internet connection", "Adding a new folder required an internet connection. Please connect to the internet before continuing.", "Ok");
}
}
}

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Acr.UserDialogs;
using Bit.App.Abstractions;
using Bit.App.Models;
using Xamarin.Forms;
@ -17,6 +18,7 @@ namespace Bit.App.Pages
var cryptoService = Resolver.Resolve<ICryptoService>();
var siteService = Resolver.Resolve<ISiteService>();
var folderService = Resolver.Resolve<IFolderService>();
var userDialogs = Resolver.Resolve<IUserDialogs>();
var folders = folderService.GetAllAsync().GetAwaiter().GetResult().OrderBy(f => f.Name);
@ -81,8 +83,13 @@ namespace Bit.App.Pages
site.FolderId = folders.ElementAt(folderPicker.SelectedIndex - 1).Id;
}
await siteService.SaveAsync(site);
var saveTask = siteService.SaveAsync(site);
userDialogs.ShowLoading("Saving...", MaskType.Black);
await saveTask;
userDialogs.HideLoading();
await Navigation.PopAsync();
userDialogs.SuccessToast(nameEntry.Text, "New site created.");
}, ToolbarItemOrder.Default, 0);
Title = "Add Site";

View file

@ -62,7 +62,7 @@ namespace Bit.App.Pages
var folderItems = folders.Select(f => new VaultView.Folder(f, sites.Where(s => s.FolderId == f.Id))).ToList();
// add the sites with no folder
folderItems.Add(new VaultView.Folder(sites.Where(s => !s.FolderId.HasValue)));
folderItems.Add(new VaultView.Folder(sites.Where(s => s.FolderId != null)));
_listView.ItemsSource = folderItems;
}

View file

@ -5,22 +5,29 @@ using System.Threading.Tasks;
using Bit.App.Abstractions;
using Bit.App.Models;
using Bit.App.Models.Data;
using Bit.App.Models.Api;
using Newtonsoft.Json;
using System.Net.Http;
using System.Text;
namespace Bit.App.Services
{
public class FolderService : Repository<FolderData, int>, IFolderService
public class FolderService : Repository<FolderData, string>, IFolderService
{
private readonly IAuthService _authService;
private readonly IApiService _apiService;
public FolderService(
ISqlService sqlService,
IAuthService authService)
IAuthService authService,
IApiService apiService)
: base(sqlService)
{
_authService = authService;
_apiService = apiService;
}
public new Task<Folder> GetByIdAsync(int id)
public new Task<Folder> GetByIdAsync(string id)
{
var data = Connection.Table<FolderData>().Where(f => f.UserId == _authService.UserId && f.Id == id).FirstOrDefault();
return Task.FromResult(new Folder(data));
@ -32,21 +39,39 @@ namespace Bit.App.Services
return Task.FromResult(data.Select(f => new Folder(f)));
}
public async Task SaveAsync(Folder folder)
public async Task<ApiResult<FolderResponse>> SaveAsync(Folder folder)
{
var data = new FolderData(folder, _authService.UserId);
data.RevisionDateTime = DateTime.UtcNow;
var request = new FolderRequest(folder);
var requestContent = JsonConvert.SerializeObject(request);
var requestMessage = new HttpRequestMessage
{
Method = folder.Id == null ? HttpMethod.Post : HttpMethod.Put,
RequestUri = new Uri(_apiService.Client.BaseAddress, folder.Id == null ? "/folders" : string.Concat("/folders/", folder.Id)),
Content = new StringContent(requestContent, Encoding.UTF8, "application/json")
};
requestMessage.Headers.Add("Authorization", string.Concat("Bearer ", _authService.Token));
if(folder.Id == 0)
var response = await _apiService.Client.SendAsync(requestMessage);
if(!response.IsSuccessStatusCode)
{
return await _apiService.HandleErrorAsync<FolderResponse>(response);
}
var responseContent = await response.Content.ReadAsStringAsync();
var responseObj = JsonConvert.DeserializeObject<FolderResponse>(responseContent);
var data = new FolderData(responseObj, _authService.UserId);
if(folder.Id == null)
{
await CreateAsync(data);
folder.Id = responseObj.Id;
}
else
{
await ReplaceAsync(data);
}
folder.Id = data.Id;
return ApiResult<FolderResponse>.Success(responseObj, response.StatusCode);
}
}
}

View file

@ -1,26 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Bit.App.Abstractions;
using Bit.App.Models;
using Bit.App.Models.Api;
using Bit.App.Models.Data;
using Newtonsoft.Json;
namespace Bit.App.Services
{
public class SiteService : Repository<SiteData, int>, ISiteService
public class SiteService : Repository<SiteData, string>, ISiteService
{
private readonly IAuthService _authService;
private readonly IFolderService _folderService;
private readonly IApiService _apiService;
public SiteService(
ISqlService sqlService,
IAuthService authService,
IFolderService folderService)
IApiService apiService)
: base(sqlService)
{
_authService = authService;
_folderService = folderService;
_apiService = apiService;
}
public new Task<IEnumerable<Site>> GetAllAsync()
@ -29,30 +33,39 @@ namespace Bit.App.Services
return Task.FromResult(data.Select(s => new Site(s)));
}
public async Task SaveAsync(Site site)
public async Task<ApiResult<SiteResponse>> SaveAsync(Site site)
{
var data = new SiteData(site, _authService.UserId);
data.RevisionDateTime = DateTime.UtcNow;
if(site.FolderId.HasValue && site.ServerFolderId == null)
var request = new SiteRequest(site);
var requestContent = JsonConvert.SerializeObject(request);
var requestMessage = new HttpRequestMessage
{
var folder = await _folderService.GetByIdAsync(site.FolderId.Value);
if(folder != null)
{
site.ServerFolderId = folder.ServerId;
}
Method = site.Id == null ? HttpMethod.Post : HttpMethod.Put,
RequestUri = new Uri(_apiService.Client.BaseAddress, site.Id == null ? "/sites" : string.Concat("/folders/", site.Id)),
Content = new StringContent(requestContent, Encoding.UTF8, "application/json")
};
requestMessage.Headers.Add("Authorization", string.Concat("Bearer ", _authService.Token));
var response = await _apiService.Client.SendAsync(requestMessage);
if(!response.IsSuccessStatusCode)
{
return await _apiService.HandleErrorAsync<SiteResponse>(response);
}
if(site.Id == 0)
var responseContent = await response.Content.ReadAsStringAsync();
var responseObj = JsonConvert.DeserializeObject<SiteResponse>(responseContent);
var data = new SiteData(responseObj, _authService.UserId);
if(site.Id == null)
{
await CreateAsync(data);
site.Id = responseObj.Id;
}
else
{
await ReplaceAsync(data);
}
site.Id = data.Id;
return ApiResult<SiteResponse>.Success(responseObj, response.StatusCode);
}
}
}

View file

@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Acr.UserDialogs" version="5.0.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="CommonServiceLocator" version="1.3" targetFramework="portable45-net45+win8+wpa81" />
<package id="modernhttpclient" version="2.4.2" targetFramework="portable45-net45+win8+wpa81" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="portable45-net45+win8+wpa81" />
<package id="Portable.BouncyCastle" version="1.8.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Splat" version="1.6.2" targetFramework="portable45-net45+win8+wpa81" />
<package id="sqlite-net-pcl" version="1.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLitePCL.raw" version="0.8.6" targetFramework="portable45-net45+win8+wpa81" />
<package id="Unity" version="3.5.1405-prerelease" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xam.Plugin.Connectivity" version="2.1.2" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="portable45-net45+win8+wpa81" />
<package id="Xamarin.Forms" version="2.2.0.31" targetFramework="portable45-net45+win8+wpa81" />
<package id="XLabs.IoC" version="2.0.5782" targetFramework="portable45-net45+win8+wpa81" />

View file

@ -11,6 +11,8 @@ using Bit.App.Services;
using Microsoft.Practices.Unity;
using Bit.iOS.Services;
using Plugin.Settings;
using Plugin.Connectivity;
using Acr.UserDialogs;
namespace Bit.iOS
{
@ -54,7 +56,9 @@ namespace Bit.iOS
.RegisterType<ICryptoService, CryptoService>(new ContainerControlledLifetimeManager())
.RegisterType<IAuthService, AuthService>(new ContainerControlledLifetimeManager())
.RegisterType<IFolderService, FolderService>(new ContainerControlledLifetimeManager())
.RegisterType<ISiteService, SiteService>(new ContainerControlledLifetimeManager());
.RegisterType<ISiteService, SiteService>(new ContainerControlledLifetimeManager())
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
.RegisterInstance(UserDialogs.Instance, new ContainerControlledLifetimeManager());
Resolver.SetResolver(new UnityResolver(container));
}

View file

@ -118,6 +118,22 @@
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
</ItemGroup>
<ItemGroup>
<Reference Include="Acr.Support.iOS, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.Support.2.0.2\lib\Xamarin.iOS10\Acr.Support.iOS.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Acr.UserDialogs, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\Xamarin.iOS10\Acr.UserDialogs.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Acr.UserDialogs.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\Xamarin.iOS10\Acr.UserDialogs.Interface.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="BTProgressHUD, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Acr.UserDialogs.5.0.1\lib\Xamarin.iOS10\BTProgressHUD.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
<Private>True</Private>
@ -130,6 +146,14 @@
<HintPath>..\..\packages\modernhttpclient.2.4.2\lib\Xamarin.iOS10\ModernHttpClient.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Connectivity, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\Xamarin.iOS10\Plugin.Connectivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Connectivity.Abstractions, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugin.Connectivity.2.1.2\lib\Xamarin.iOS10\Plugin.Connectivity.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Plugin.Settings, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\Xamarin.iOS10\Plugin.Settings.dll</HintPath>
<Private>True</Private>
@ -138,6 +162,10 @@
<HintPath>..\..\packages\Xam.Plugins.Settings.2.1.0\lib\Xamarin.iOS10\Plugin.Settings.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Splat.1.6.2\lib\Xamarin.iOS10\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLite-net, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\sqlite-net-pcl.1.1.1\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
<Private>True</Private>

View file

@ -1,10 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Acr.Support" version="2.0.2" targetFramework="xamarinios10" />
<package id="Acr.UserDialogs" version="5.0.1" targetFramework="xamarinios10" />
<package id="CommonServiceLocator" version="1.3" targetFramework="xamarinios10" />
<package id="modernhttpclient" version="2.4.2" targetFramework="xamarinios10" />
<package id="Splat" version="1.6.2" targetFramework="xamarinios10" />
<package id="sqlite-net-pcl" version="1.1.1" targetFramework="xamarinios10" />
<package id="SQLitePCL.raw" version="0.8.6" targetFramework="xamarinios10" />
<package id="Unity" version="3.5.1405-prerelease" targetFramework="xamarinios10" />
<package id="Xam.Plugin.Connectivity" version="2.1.2" targetFramework="xamarinios10" />
<package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="xamarinios10" />
<package id="Xamarin.Forms" version="2.2.0.31" targetFramework="xamarinios10" />
<package id="XLabs.IoC" version="2.0.5782" targetFramework="xamarinios10" />