diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index e22e527de..2c227c5b2 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -119,6 +119,7 @@ + @@ -553,5 +554,11 @@ + + + MSBuild:UpdateGeneratedFiles + Designer + + \ No newline at end of file diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index 74cd3ffdd..846991252 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -151,6 +151,7 @@ namespace Bit.Droid } catch { } } + var setRestrictions = AndroidHelpers.SetPreconfiguredRestrictionSettingsAsync(this); } protected override void OnNewIntent(Intent intent) diff --git a/src/Android/Properties/AndroidManifest.xml b/src/Android/Properties/AndroidManifest.xml index 751bb4568..7ccfaf68d 100644 --- a/src/Android/Properties/AndroidManifest.xml +++ b/src/Android/Properties/AndroidManifest.xml @@ -54,5 +54,6 @@ + diff --git a/src/Android/Receivers/RestrictionsChangedReceiver.cs b/src/Android/Receivers/RestrictionsChangedReceiver.cs new file mode 100644 index 000000000..156dc7c1f --- /dev/null +++ b/src/Android/Receivers/RestrictionsChangedReceiver.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Android.App; +using Android.Content; +using Bit.App.Utilities; +using Bit.Core.Abstractions; +using Bit.Core.Utilities; +using Bit.Droid.Utilities; + +namespace Bit.Droid.Receivers +{ + [BroadcastReceiver(Name = "com.x8bit.bitwarden.RestrictionsChangedReceiver", Exported = false)] + [IntentFilter(new[] { Intent.ActionApplicationRestrictionsChanged })] + public class RestrictionsChangedReceiver : BroadcastReceiver + { + public async override void OnReceive(Context context, Intent intent) + { + if(intent.Action == Intent.ActionApplicationRestrictionsChanged) + { + await AndroidHelpers.SetPreconfiguredRestrictionSettingsAsync(context); + } + } + } +} diff --git a/src/Android/Resources/Resource.designer.cs b/src/Android/Resources/Resource.designer.cs index c2802365a..519d02459 100644 --- a/src/Android/Resources/Resource.designer.cs +++ b/src/Android/Resources/Resource.designer.cs @@ -10433,125 +10433,125 @@ namespace Bit.Droid public partial class String { - // aapt resource value: 0x7F0D0006 - public const int abc_action_bar_home_description = 2131558406; - - // aapt resource value: 0x7F0D0007 - public const int abc_action_bar_up_description = 2131558407; - // aapt resource value: 0x7F0D0008 - public const int abc_action_menu_overflow_description = 2131558408; + public const int abc_action_bar_home_description = 2131558408; // aapt resource value: 0x7F0D0009 - public const int abc_action_mode_done = 2131558409; - - // aapt resource value: 0x7F0D000B - public const int abc_activitychooserview_choose_application = 2131558411; + public const int abc_action_bar_up_description = 2131558409; // aapt resource value: 0x7F0D000A - public const int abc_activity_chooser_view_see_all = 2131558410; + public const int abc_action_menu_overflow_description = 2131558410; - // aapt resource value: 0x7F0D000C - public const int abc_capital_off = 2131558412; + // aapt resource value: 0x7F0D000B + public const int abc_action_mode_done = 2131558411; // aapt resource value: 0x7F0D000D - public const int abc_capital_on = 2131558413; + public const int abc_activitychooserview_choose_application = 2131558413; + + // aapt resource value: 0x7F0D000C + public const int abc_activity_chooser_view_see_all = 2131558412; // aapt resource value: 0x7F0D000E - public const int abc_font_family_body_1_material = 2131558414; + public const int abc_capital_off = 2131558414; // aapt resource value: 0x7F0D000F - public const int abc_font_family_body_2_material = 2131558415; + public const int abc_capital_on = 2131558415; // aapt resource value: 0x7F0D0010 - public const int abc_font_family_button_material = 2131558416; + public const int abc_font_family_body_1_material = 2131558416; // aapt resource value: 0x7F0D0011 - public const int abc_font_family_caption_material = 2131558417; + public const int abc_font_family_body_2_material = 2131558417; // aapt resource value: 0x7F0D0012 - public const int abc_font_family_display_1_material = 2131558418; + public const int abc_font_family_button_material = 2131558418; // aapt resource value: 0x7F0D0013 - public const int abc_font_family_display_2_material = 2131558419; + public const int abc_font_family_caption_material = 2131558419; // aapt resource value: 0x7F0D0014 - public const int abc_font_family_display_3_material = 2131558420; + public const int abc_font_family_display_1_material = 2131558420; // aapt resource value: 0x7F0D0015 - public const int abc_font_family_display_4_material = 2131558421; + public const int abc_font_family_display_2_material = 2131558421; // aapt resource value: 0x7F0D0016 - public const int abc_font_family_headline_material = 2131558422; + public const int abc_font_family_display_3_material = 2131558422; // aapt resource value: 0x7F0D0017 - public const int abc_font_family_menu_material = 2131558423; + public const int abc_font_family_display_4_material = 2131558423; // aapt resource value: 0x7F0D0018 - public const int abc_font_family_subhead_material = 2131558424; + public const int abc_font_family_headline_material = 2131558424; // aapt resource value: 0x7F0D0019 - public const int abc_font_family_title_material = 2131558425; + public const int abc_font_family_menu_material = 2131558425; // aapt resource value: 0x7F0D001A - public const int abc_menu_alt_shortcut_label = 2131558426; + public const int abc_font_family_subhead_material = 2131558426; // aapt resource value: 0x7F0D001B - public const int abc_menu_ctrl_shortcut_label = 2131558427; + public const int abc_font_family_title_material = 2131558427; // aapt resource value: 0x7F0D001C - public const int abc_menu_delete_shortcut_label = 2131558428; + public const int abc_menu_alt_shortcut_label = 2131558428; // aapt resource value: 0x7F0D001D - public const int abc_menu_enter_shortcut_label = 2131558429; + public const int abc_menu_ctrl_shortcut_label = 2131558429; // aapt resource value: 0x7F0D001E - public const int abc_menu_function_shortcut_label = 2131558430; + public const int abc_menu_delete_shortcut_label = 2131558430; // aapt resource value: 0x7F0D001F - public const int abc_menu_meta_shortcut_label = 2131558431; + public const int abc_menu_enter_shortcut_label = 2131558431; // aapt resource value: 0x7F0D0020 - public const int abc_menu_shift_shortcut_label = 2131558432; + public const int abc_menu_function_shortcut_label = 2131558432; // aapt resource value: 0x7F0D0021 - public const int abc_menu_space_shortcut_label = 2131558433; + public const int abc_menu_meta_shortcut_label = 2131558433; // aapt resource value: 0x7F0D0022 - public const int abc_menu_sym_shortcut_label = 2131558434; + public const int abc_menu_shift_shortcut_label = 2131558434; // aapt resource value: 0x7F0D0023 - public const int abc_prepend_shortcut_label = 2131558435; - - // aapt resource value: 0x7F0D0025 - public const int abc_searchview_description_clear = 2131558437; - - // aapt resource value: 0x7F0D0026 - public const int abc_searchview_description_query = 2131558438; - - // aapt resource value: 0x7F0D0027 - public const int abc_searchview_description_search = 2131558439; - - // aapt resource value: 0x7F0D0028 - public const int abc_searchview_description_submit = 2131558440; - - // aapt resource value: 0x7F0D0029 - public const int abc_searchview_description_voice = 2131558441; + public const int abc_menu_space_shortcut_label = 2131558435; // aapt resource value: 0x7F0D0024 - public const int abc_search_hint = 2131558436; + public const int abc_menu_sym_shortcut_label = 2131558436; + + // aapt resource value: 0x7F0D0025 + public const int abc_prepend_shortcut_label = 2131558437; + + // aapt resource value: 0x7F0D0027 + public const int abc_searchview_description_clear = 2131558439; + + // aapt resource value: 0x7F0D0028 + public const int abc_searchview_description_query = 2131558440; + + // aapt resource value: 0x7F0D0029 + public const int abc_searchview_description_search = 2131558441; // aapt resource value: 0x7F0D002A - public const int abc_shareactionprovider_share_with = 2131558442; + public const int abc_searchview_description_submit = 2131558442; // aapt resource value: 0x7F0D002B - public const int abc_shareactionprovider_share_with_application = 2131558443; + public const int abc_searchview_description_voice = 2131558443; + + // aapt resource value: 0x7F0D0026 + public const int abc_search_hint = 2131558438; // aapt resource value: 0x7F0D002C - public const int abc_toolbar_collapse_description = 2131558444; + public const int abc_shareactionprovider_share_with = 2131558444; // aapt resource value: 0x7F0D002D - public const int appbar_scrolling_view_behavior = 2131558445; + public const int abc_shareactionprovider_share_with_application = 2131558445; + + // aapt resource value: 0x7F0D002E + public const int abc_toolbar_collapse_description = 2131558446; + + // aapt resource value: 0x7F0D002F + public const int appbar_scrolling_view_behavior = 2131558447; // aapt resource value: 0x7F0D0000 public const int ApplicationName = 2131558400; @@ -10562,437 +10562,437 @@ namespace Bit.Droid // aapt resource value: 0x7F0D0002 public const int AutoFillServiceSummary = 2131558402; - // aapt resource value: 0x7F0D002E - public const int bottom_sheet_behavior = 2131558446; - - // aapt resource value: 0x7F0D002F - public const int character_counter_content_description = 2131558447; - // aapt resource value: 0x7F0D0030 - public const int character_counter_pattern = 2131558448; + public const int bottom_sheet_behavior = 2131558448; // aapt resource value: 0x7F0D0031 - public const int common_google_play_services_enable_button = 2131558449; + public const int character_counter_content_description = 2131558449; // aapt resource value: 0x7F0D0032 - public const int common_google_play_services_enable_text = 2131558450; + public const int character_counter_pattern = 2131558450; // aapt resource value: 0x7F0D0033 - public const int common_google_play_services_enable_title = 2131558451; + public const int common_google_play_services_enable_button = 2131558451; // aapt resource value: 0x7F0D0034 - public const int common_google_play_services_install_button = 2131558452; + public const int common_google_play_services_enable_text = 2131558452; // aapt resource value: 0x7F0D0035 - public const int common_google_play_services_install_text = 2131558453; + public const int common_google_play_services_enable_title = 2131558453; // aapt resource value: 0x7F0D0036 - public const int common_google_play_services_install_title = 2131558454; + public const int common_google_play_services_install_button = 2131558454; // aapt resource value: 0x7F0D0037 - public const int common_google_play_services_notification_ticker = 2131558455; + public const int common_google_play_services_install_text = 2131558455; // aapt resource value: 0x7F0D0038 - public const int common_google_play_services_unknown_issue = 2131558456; + public const int common_google_play_services_install_title = 2131558456; // aapt resource value: 0x7F0D0039 - public const int common_google_play_services_unsupported_text = 2131558457; + public const int common_google_play_services_notification_ticker = 2131558457; // aapt resource value: 0x7F0D003A - public const int common_google_play_services_update_button = 2131558458; + public const int common_google_play_services_unknown_issue = 2131558458; // aapt resource value: 0x7F0D003B - public const int common_google_play_services_update_text = 2131558459; + public const int common_google_play_services_unsupported_text = 2131558459; // aapt resource value: 0x7F0D003C - public const int common_google_play_services_update_title = 2131558460; + public const int common_google_play_services_update_button = 2131558460; // aapt resource value: 0x7F0D003D - public const int common_google_play_services_updating_text = 2131558461; + public const int common_google_play_services_update_text = 2131558461; // aapt resource value: 0x7F0D003E - public const int common_google_play_services_wear_update_text = 2131558462; + public const int common_google_play_services_update_title = 2131558462; // aapt resource value: 0x7F0D003F - public const int common_open_on_phone = 2131558463; + public const int common_google_play_services_updating_text = 2131558463; // aapt resource value: 0x7F0D0040 - public const int common_signin_button_text = 2131558464; + public const int common_google_play_services_wear_update_text = 2131558464; // aapt resource value: 0x7F0D0041 - public const int common_signin_button_text_long = 2131558465; + public const int common_open_on_phone = 2131558465; // aapt resource value: 0x7F0D0042 - public const int default_web_client_id = 2131558466; + public const int common_signin_button_text = 2131558466; // aapt resource value: 0x7F0D0043 - public const int fab_transformation_scrim_behavior = 2131558467; + public const int common_signin_button_text_long = 2131558467; // aapt resource value: 0x7F0D0044 - public const int fab_transformation_sheet_behavior = 2131558468; + public const int default_web_client_id = 2131558468; // aapt resource value: 0x7F0D0045 - public const int fcm_fallback_notification_channel_label = 2131558469; + public const int fab_transformation_scrim_behavior = 2131558469; // aapt resource value: 0x7F0D0046 - public const int firebase_database_url = 2131558470; + public const int fab_transformation_sheet_behavior = 2131558470; // aapt resource value: 0x7F0D0047 - public const int gcm_defaultSenderId = 2131558471; + public const int fcm_fallback_notification_channel_label = 2131558471; // aapt resource value: 0x7F0D0048 - public const int google_api_key = 2131558472; + public const int firebase_database_url = 2131558472; // aapt resource value: 0x7F0D0049 - public const int google_app_id = 2131558473; + public const int gcm_defaultSenderId = 2131558473; // aapt resource value: 0x7F0D004A - public const int google_crash_reporting_api_key = 2131558474; + public const int google_api_key = 2131558474; // aapt resource value: 0x7F0D004B - public const int google_storage_bucket = 2131558475; + public const int google_app_id = 2131558475; + + // aapt resource value: 0x7F0D004C + public const int google_crash_reporting_api_key = 2131558476; + + // aapt resource value: 0x7F0D004D + public const int google_storage_bucket = 2131558477; // aapt resource value: 0x7F0D0003 public const int Hello = 2131558403; - // aapt resource value: 0x7F0D004C - public const int hide_bottom_view_on_scroll_behavior = 2131558476; - - // aapt resource value: 0x7F0D004D - public const int hockeyapp_crash_dialog_app_name_fallback = 2131558477; - // aapt resource value: 0x7F0D004E - public const int hockeyapp_crash_dialog_message = 2131558478; + public const int hide_bottom_view_on_scroll_behavior = 2131558478; // aapt resource value: 0x7F0D004F - public const int hockeyapp_crash_dialog_negative_button = 2131558479; + public const int hockeyapp_crash_dialog_app_name_fallback = 2131558479; // aapt resource value: 0x7F0D0050 - public const int hockeyapp_crash_dialog_neutral_button = 2131558480; + public const int hockeyapp_crash_dialog_message = 2131558480; // aapt resource value: 0x7F0D0051 - public const int hockeyapp_crash_dialog_positive_button = 2131558481; + public const int hockeyapp_crash_dialog_negative_button = 2131558481; // aapt resource value: 0x7F0D0052 - public const int hockeyapp_crash_dialog_title = 2131558482; + public const int hockeyapp_crash_dialog_neutral_button = 2131558482; // aapt resource value: 0x7F0D0053 - public const int hockeyapp_dialog_error_message = 2131558483; + public const int hockeyapp_crash_dialog_positive_button = 2131558483; // aapt resource value: 0x7F0D0054 - public const int hockeyapp_dialog_error_title = 2131558484; + public const int hockeyapp_crash_dialog_title = 2131558484; // aapt resource value: 0x7F0D0055 - public const int hockeyapp_dialog_positive_button = 2131558485; + public const int hockeyapp_dialog_error_message = 2131558485; // aapt resource value: 0x7F0D0056 - public const int hockeyapp_download_failed_dialog_message = 2131558486; + public const int hockeyapp_dialog_error_title = 2131558486; // aapt resource value: 0x7F0D0057 - public const int hockeyapp_download_failed_dialog_negative_button = 2131558487; + public const int hockeyapp_dialog_positive_button = 2131558487; // aapt resource value: 0x7F0D0058 - public const int hockeyapp_download_failed_dialog_positive_button = 2131558488; + public const int hockeyapp_download_failed_dialog_message = 2131558488; // aapt resource value: 0x7F0D0059 - public const int hockeyapp_download_failed_dialog_title = 2131558489; + public const int hockeyapp_download_failed_dialog_negative_button = 2131558489; // aapt resource value: 0x7F0D005A - public const int hockeyapp_error_install_form_unknown_sources_disabled = 2131558490; + public const int hockeyapp_download_failed_dialog_positive_button = 2131558490; // aapt resource value: 0x7F0D005B - public const int hockeyapp_error_no_external_storage_permission = 2131558491; + public const int hockeyapp_download_failed_dialog_title = 2131558491; // aapt resource value: 0x7F0D005C - public const int hockeyapp_error_no_network_message = 2131558492; + public const int hockeyapp_error_install_form_unknown_sources_disabled = 2131558492; // aapt resource value: 0x7F0D005D - public const int hockeyapp_expiry_info_text = 2131558493; + public const int hockeyapp_error_no_external_storage_permission = 2131558493; // aapt resource value: 0x7F0D005E - public const int hockeyapp_expiry_info_title = 2131558494; - - // aapt resource value: 0x7F0D0061 - public const int hockeyapp_feedback_attachment_added = 2131558497; - - // aapt resource value: 0x7F0D0062 - public const int hockeyapp_feedback_attachment_button_text = 2131558498; - - // aapt resource value: 0x7F0D0063 - public const int hockeyapp_feedback_attachment_error = 2131558499; - - // aapt resource value: 0x7F0D0064 - public const int hockeyapp_feedback_attachment_loading = 2131558500; - - // aapt resource value: 0x7F0D0066 - public const int hockeyapp_feedback_attachment_removed = 2131558502; - - // aapt resource value: 0x7F0D0065 - public const int hockeyapp_feedback_attachment_remove_description = 2131558501; + public const int hockeyapp_error_no_network_message = 2131558494; // aapt resource value: 0x7F0D005F - public const int hockeyapp_feedback_attach_file = 2131558495; + public const int hockeyapp_expiry_info_text = 2131558495; // aapt resource value: 0x7F0D0060 - public const int hockeyapp_feedback_attach_picture = 2131558496; + public const int hockeyapp_expiry_info_title = 2131558496; - // aapt resource value: 0x7F0D0067 - public const int hockeyapp_feedback_email_hint = 2131558503; + // aapt resource value: 0x7F0D0063 + public const int hockeyapp_feedback_attachment_added = 2131558499; + + // aapt resource value: 0x7F0D0064 + public const int hockeyapp_feedback_attachment_button_text = 2131558500; + + // aapt resource value: 0x7F0D0065 + public const int hockeyapp_feedback_attachment_error = 2131558501; + + // aapt resource value: 0x7F0D0066 + public const int hockeyapp_feedback_attachment_loading = 2131558502; // aapt resource value: 0x7F0D0068 - public const int hockeyapp_feedback_email_hint_required = 2131558504; + public const int hockeyapp_feedback_attachment_removed = 2131558504; + + // aapt resource value: 0x7F0D0067 + public const int hockeyapp_feedback_attachment_remove_description = 2131558503; + + // aapt resource value: 0x7F0D0061 + public const int hockeyapp_feedback_attach_file = 2131558497; + + // aapt resource value: 0x7F0D0062 + public const int hockeyapp_feedback_attach_picture = 2131558498; // aapt resource value: 0x7F0D0069 - public const int hockeyapp_feedback_fetching_feedback_text = 2131558505; + public const int hockeyapp_feedback_email_hint = 2131558505; // aapt resource value: 0x7F0D006A - public const int hockeyapp_feedback_last_updated_text = 2131558506; + public const int hockeyapp_feedback_email_hint_required = 2131558506; // aapt resource value: 0x7F0D006B - public const int hockeyapp_feedback_max_attachments_allowed = 2131558507; + public const int hockeyapp_feedback_fetching_feedback_text = 2131558507; // aapt resource value: 0x7F0D006C - public const int hockeyapp_feedback_message_hint = 2131558508; + public const int hockeyapp_feedback_last_updated_text = 2131558508; // aapt resource value: 0x7F0D006D - public const int hockeyapp_feedback_message_hint_required = 2131558509; + public const int hockeyapp_feedback_max_attachments_allowed = 2131558509; // aapt resource value: 0x7F0D006E - public const int hockeyapp_feedback_name_hint = 2131558510; + public const int hockeyapp_feedback_message_hint = 2131558510; // aapt resource value: 0x7F0D006F - public const int hockeyapp_feedback_name_hint_required = 2131558511; + public const int hockeyapp_feedback_message_hint_required = 2131558511; // aapt resource value: 0x7F0D0070 - public const int hockeyapp_feedback_new_answer_notification_message = 2131558512; + public const int hockeyapp_feedback_name_hint = 2131558512; // aapt resource value: 0x7F0D0071 - public const int hockeyapp_feedback_notification_channel = 2131558513; + public const int hockeyapp_feedback_name_hint_required = 2131558513; // aapt resource value: 0x7F0D0072 - public const int hockeyapp_feedback_notification_title = 2131558514; + public const int hockeyapp_feedback_new_answer_notification_message = 2131558514; // aapt resource value: 0x7F0D0073 - public const int hockeyapp_feedback_refresh_button_text = 2131558515; + public const int hockeyapp_feedback_notification_channel = 2131558515; // aapt resource value: 0x7F0D0074 - public const int hockeyapp_feedback_response_button_text = 2131558516; + public const int hockeyapp_feedback_notification_title = 2131558516; // aapt resource value: 0x7F0D0075 - public const int hockeyapp_feedback_screenshot_fail = 2131558517; + public const int hockeyapp_feedback_refresh_button_text = 2131558517; // aapt resource value: 0x7F0D0076 - public const int hockeyapp_feedback_screenshot_notification_message = 2131558518; + public const int hockeyapp_feedback_response_button_text = 2131558518; // aapt resource value: 0x7F0D0077 - public const int hockeyapp_feedback_select_file = 2131558519; + public const int hockeyapp_feedback_screenshot_fail = 2131558519; // aapt resource value: 0x7F0D0078 - public const int hockeyapp_feedback_select_picture = 2131558520; - - // aapt resource value: 0x7F0D007C - public const int hockeyapp_feedback_sending_feedback_text = 2131558524; + public const int hockeyapp_feedback_screenshot_notification_message = 2131558520; // aapt resource value: 0x7F0D0079 - public const int hockeyapp_feedback_send_button_text = 2131558521; + public const int hockeyapp_feedback_select_file = 2131558521; // aapt resource value: 0x7F0D007A - public const int hockeyapp_feedback_send_generic_error = 2131558522; - - // aapt resource value: 0x7F0D007B - public const int hockeyapp_feedback_send_network_error = 2131558523; - - // aapt resource value: 0x7F0D007D - public const int hockeyapp_feedback_sent_toast = 2131558525; + public const int hockeyapp_feedback_select_picture = 2131558522; // aapt resource value: 0x7F0D007E - public const int hockeyapp_feedback_subject_hint = 2131558526; + public const int hockeyapp_feedback_sending_feedback_text = 2131558526; + + // aapt resource value: 0x7F0D007B + public const int hockeyapp_feedback_send_button_text = 2131558523; + + // aapt resource value: 0x7F0D007C + public const int hockeyapp_feedback_send_generic_error = 2131558524; + + // aapt resource value: 0x7F0D007D + public const int hockeyapp_feedback_send_network_error = 2131558525; // aapt resource value: 0x7F0D007F - public const int hockeyapp_feedback_subject_hint_required = 2131558527; + public const int hockeyapp_feedback_sent_toast = 2131558527; // aapt resource value: 0x7F0D0080 - public const int hockeyapp_feedback_title = 2131558528; + public const int hockeyapp_feedback_subject_hint = 2131558528; // aapt resource value: 0x7F0D0081 - public const int hockeyapp_feedback_validate_email_empty = 2131558529; + public const int hockeyapp_feedback_subject_hint_required = 2131558529; // aapt resource value: 0x7F0D0082 - public const int hockeyapp_feedback_validate_email_error = 2131558530; + public const int hockeyapp_feedback_title = 2131558530; // aapt resource value: 0x7F0D0083 - public const int hockeyapp_feedback_validate_name_error = 2131558531; + public const int hockeyapp_feedback_validate_email_empty = 2131558531; // aapt resource value: 0x7F0D0084 - public const int hockeyapp_feedback_validate_subject_error = 2131558532; + public const int hockeyapp_feedback_validate_email_error = 2131558532; // aapt resource value: 0x7F0D0085 - public const int hockeyapp_feedback_validate_text_error = 2131558533; + public const int hockeyapp_feedback_validate_name_error = 2131558533; // aapt resource value: 0x7F0D0086 - public const int hockeyapp_login_email_hint_required = 2131558534; + public const int hockeyapp_feedback_validate_subject_error = 2131558534; // aapt resource value: 0x7F0D0087 - public const int hockeyapp_login_headline_text = 2131558535; + public const int hockeyapp_feedback_validate_text_error = 2131558535; // aapt resource value: 0x7F0D0088 - public const int hockeyapp_login_headline_text_email_only = 2131558536; + public const int hockeyapp_login_email_hint_required = 2131558536; // aapt resource value: 0x7F0D0089 - public const int hockeyapp_login_login_button_text = 2131558537; + public const int hockeyapp_login_headline_text = 2131558537; // aapt resource value: 0x7F0D008A - public const int hockeyapp_login_missing_credentials_toast = 2131558538; + public const int hockeyapp_login_headline_text_email_only = 2131558538; // aapt resource value: 0x7F0D008B - public const int hockeyapp_login_password_hint_required = 2131558539; + public const int hockeyapp_login_login_button_text = 2131558539; // aapt resource value: 0x7F0D008C - public const int hockeyapp_paint_dialog_message = 2131558540; + public const int hockeyapp_login_missing_credentials_toast = 2131558540; // aapt resource value: 0x7F0D008D - public const int hockeyapp_paint_dialog_negative_button = 2131558541; + public const int hockeyapp_login_password_hint_required = 2131558541; // aapt resource value: 0x7F0D008E - public const int hockeyapp_paint_dialog_neutral_button = 2131558542; + public const int hockeyapp_paint_dialog_message = 2131558542; // aapt resource value: 0x7F0D008F - public const int hockeyapp_paint_dialog_positive_button = 2131558543; + public const int hockeyapp_paint_dialog_negative_button = 2131558543; // aapt resource value: 0x7F0D0090 - public const int hockeyapp_paint_indicator_toast = 2131558544; + public const int hockeyapp_paint_dialog_neutral_button = 2131558544; // aapt resource value: 0x7F0D0091 - public const int hockeyapp_paint_menu_clear = 2131558545; + public const int hockeyapp_paint_dialog_positive_button = 2131558545; // aapt resource value: 0x7F0D0092 - public const int hockeyapp_paint_menu_save = 2131558546; + public const int hockeyapp_paint_indicator_toast = 2131558546; // aapt resource value: 0x7F0D0093 - public const int hockeyapp_paint_menu_undo = 2131558547; + public const int hockeyapp_paint_menu_clear = 2131558547; // aapt resource value: 0x7F0D0094 - public const int hockeyapp_update_already_installed = 2131558548; + public const int hockeyapp_paint_menu_save = 2131558548; // aapt resource value: 0x7F0D0095 - public const int hockeyapp_update_button = 2131558549; + public const int hockeyapp_paint_menu_undo = 2131558549; // aapt resource value: 0x7F0D0096 - public const int hockeyapp_update_dialog_message = 2131558550; + public const int hockeyapp_update_already_installed = 2131558550; // aapt resource value: 0x7F0D0097 - public const int hockeyapp_update_dialog_negative_button = 2131558551; + public const int hockeyapp_update_button = 2131558551; // aapt resource value: 0x7F0D0098 - public const int hockeyapp_update_dialog_positive_button = 2131558552; + public const int hockeyapp_update_dialog_message = 2131558552; // aapt resource value: 0x7F0D0099 - public const int hockeyapp_update_dialog_title = 2131558553; + public const int hockeyapp_update_dialog_negative_button = 2131558553; // aapt resource value: 0x7F0D009A - public const int hockeyapp_update_loading = 2131558554; + public const int hockeyapp_update_dialog_positive_button = 2131558554; // aapt resource value: 0x7F0D009B - public const int hockeyapp_update_mandatory_toast = 2131558555; + public const int hockeyapp_update_dialog_title = 2131558555; // aapt resource value: 0x7F0D009C - public const int hockeyapp_update_newest_version = 2131558556; + public const int hockeyapp_update_loading = 2131558556; // aapt resource value: 0x7F0D009D - public const int hockeyapp_update_no_info = 2131558557; + public const int hockeyapp_update_mandatory_toast = 2131558557; // aapt resource value: 0x7F0D009E - public const int hockeyapp_update_restore = 2131558558; + public const int hockeyapp_update_newest_version = 2131558558; // aapt resource value: 0x7F0D009F - public const int hockeyapp_update_title = 2131558559; + public const int hockeyapp_update_no_info = 2131558559; // aapt resource value: 0x7F0D00A0 - public const int hockeyapp_update_unknown_size = 2131558560; + public const int hockeyapp_update_restore = 2131558560; // aapt resource value: 0x7F0D00A1 - public const int hockeyapp_update_version = 2131558561; + public const int hockeyapp_update_title = 2131558561; // aapt resource value: 0x7F0D00A2 - public const int hockeyapp_update_version_details_label = 2131558562; + public const int hockeyapp_update_unknown_size = 2131558562; // aapt resource value: 0x7F0D00A3 - public const int library_name = 2131558563; + public const int hockeyapp_update_version = 2131558563; // aapt resource value: 0x7F0D00A4 - public const int mr_button_content_description = 2131558564; + public const int hockeyapp_update_version_details_label = 2131558564; // aapt resource value: 0x7F0D00A5 - public const int mr_cast_button_connected = 2131558565; + public const int library_name = 2131558565; // aapt resource value: 0x7F0D00A6 - public const int mr_cast_button_connecting = 2131558566; + public const int mr_button_content_description = 2131558566; // aapt resource value: 0x7F0D00A7 - public const int mr_cast_button_disconnected = 2131558567; + public const int mr_cast_button_connected = 2131558567; // aapt resource value: 0x7F0D00A8 - public const int mr_cast_dialog_title_view_placeholder = 2131558568; + public const int mr_cast_button_connecting = 2131558568; // aapt resource value: 0x7F0D00A9 - public const int mr_chooser_searching = 2131558569; + public const int mr_cast_button_disconnected = 2131558569; // aapt resource value: 0x7F0D00AA - public const int mr_chooser_title = 2131558570; + public const int mr_cast_dialog_title_view_placeholder = 2131558570; // aapt resource value: 0x7F0D00AB - public const int mr_controller_album_art = 2131558571; + public const int mr_chooser_searching = 2131558571; // aapt resource value: 0x7F0D00AC - public const int mr_controller_casting_screen = 2131558572; + public const int mr_chooser_title = 2131558572; // aapt resource value: 0x7F0D00AD - public const int mr_controller_close_description = 2131558573; + public const int mr_controller_album_art = 2131558573; // aapt resource value: 0x7F0D00AE - public const int mr_controller_collapse_group = 2131558574; + public const int mr_controller_casting_screen = 2131558574; // aapt resource value: 0x7F0D00AF - public const int mr_controller_disconnect = 2131558575; + public const int mr_controller_close_description = 2131558575; // aapt resource value: 0x7F0D00B0 - public const int mr_controller_expand_group = 2131558576; + public const int mr_controller_collapse_group = 2131558576; // aapt resource value: 0x7F0D00B1 - public const int mr_controller_no_info_available = 2131558577; + public const int mr_controller_disconnect = 2131558577; // aapt resource value: 0x7F0D00B2 - public const int mr_controller_no_media_selected = 2131558578; + public const int mr_controller_expand_group = 2131558578; // aapt resource value: 0x7F0D00B3 - public const int mr_controller_pause = 2131558579; + public const int mr_controller_no_info_available = 2131558579; // aapt resource value: 0x7F0D00B4 - public const int mr_controller_play = 2131558580; + public const int mr_controller_no_media_selected = 2131558580; // aapt resource value: 0x7F0D00B5 - public const int mr_controller_stop = 2131558581; + public const int mr_controller_pause = 2131558581; // aapt resource value: 0x7F0D00B6 - public const int mr_controller_stop_casting = 2131558582; + public const int mr_controller_play = 2131558582; // aapt resource value: 0x7F0D00B7 - public const int mr_controller_volume_slider = 2131558583; + public const int mr_controller_stop = 2131558583; // aapt resource value: 0x7F0D00B8 - public const int mr_dialog_device_header = 2131558584; + public const int mr_controller_stop_casting = 2131558584; // aapt resource value: 0x7F0D00B9 - public const int mr_dialog_route_header = 2131558585; + public const int mr_controller_volume_slider = 2131558585; // aapt resource value: 0x7F0D00BA - public const int mr_system_route_name = 2131558586; + public const int mr_dialog_device_header = 2131558586; // aapt resource value: 0x7F0D00BB - public const int mr_user_route_category_name = 2131558587; + public const int mr_dialog_route_header = 2131558587; // aapt resource value: 0x7F0D00BC - public const int mtrl_chip_close_icon_content_description = 2131558588; + public const int mr_system_route_name = 2131558588; + + // aapt resource value: 0x7F0D00BD + public const int mr_user_route_category_name = 2131558589; + + // aapt resource value: 0x7F0D00BE + public const int mtrl_chip_close_icon_content_description = 2131558590; // aapt resource value: 0x7F0D0004 public const int MyVault = 2131558404; @@ -11000,26 +11000,32 @@ namespace Bit.Droid // aapt resource value: 0x7F0D0005 public const int PasswordGenerator = 2131558405; - // aapt resource value: 0x7F0D00BD - public const int password_toggle_content_description = 2131558589; - - // aapt resource value: 0x7F0D00BE - public const int path_password_eye = 2131558590; - // aapt resource value: 0x7F0D00BF - public const int path_password_eye_mask_strike_through = 2131558591; + public const int password_toggle_content_description = 2131558591; // aapt resource value: 0x7F0D00C0 - public const int path_password_eye_mask_visible = 2131558592; + public const int path_password_eye = 2131558592; // aapt resource value: 0x7F0D00C1 - public const int path_password_strike_through = 2131558593; + public const int path_password_eye_mask_strike_through = 2131558593; // aapt resource value: 0x7F0D00C2 - public const int search_menu_title = 2131558594; + public const int path_password_eye_mask_visible = 2131558594; // aapt resource value: 0x7F0D00C3 - public const int status_bar_notification_info_overflow = 2131558595; + public const int path_password_strike_through = 2131558595; + + // aapt resource value: 0x7F0D00C4 + public const int search_menu_title = 2131558596; + + // aapt resource value: 0x7F0D0006 + public const int SelfHostedServerUrl = 2131558406; + + // aapt resource value: 0x7F0D0007 + public const int ServerUrl = 2131558407; + + // aapt resource value: 0x7F0D00C5 + public const int status_bar_notification_info_overflow = 2131558597; static String() { @@ -15659,16 +15665,19 @@ namespace Bit.Droid public const int accessibilityservice = 2131755008; // aapt resource value: 0x7F100001 - public const int autofillservice = 2131755009; + public const int app_restrictions = 2131755009; // aapt resource value: 0x7F100002 - public const int filepaths = 2131755010; + public const int autofillservice = 2131755010; // aapt resource value: 0x7F100003 - public const int network_security_config = 2131755011; + public const int filepaths = 2131755011; // aapt resource value: 0x7F100004 - public const int xamarin_essentials_fileprovider_file_paths = 2131755012; + public const int network_security_config = 2131755012; + + // aapt resource value: 0x7F100005 + public const int xamarin_essentials_fileprovider_file_paths = 2131755013; static Xml() { diff --git a/src/Android/Resources/values/strings.xml b/src/Android/Resources/values/strings.xml index 6fb45f3c3..ec96d918f 100644 --- a/src/Android/Resources/values/strings.xml +++ b/src/Android/Resources/values/strings.xml @@ -16,4 +16,10 @@ Password Generator + + Self-hosted server URL + + + Server URL + diff --git a/src/Android/Resources/xml/app_restrictions.xml b/src/Android/Resources/xml/app_restrictions.xml new file mode 100644 index 000000000..e6f7a37c3 --- /dev/null +++ b/src/Android/Resources/xml/app_restrictions.xml @@ -0,0 +1,9 @@ + + + + diff --git a/src/Android/Utilities/AndroidHelpers.cs b/src/Android/Utilities/AndroidHelpers.cs index 5973ca5e8..a36869998 100644 --- a/src/Android/Utilities/AndroidHelpers.cs +++ b/src/Android/Utilities/AndroidHelpers.cs @@ -1,10 +1,15 @@ -using Android.Content; +using System.Collections.Generic; +using System.Threading.Tasks; +using Android.Content; using Android.Provider; +using Bit.App.Utilities; namespace Bit.Droid.Utilities { public static class AndroidHelpers { + private static string BaseEnvironmentUrlRestrictionKey = "baseEnvironmentUrl"; + public static string GetFileName(Context context, Android.Net.Uri uri) { string name = null; @@ -26,5 +31,21 @@ namespace Bit.Droid.Utilities } return name; } + + public static async Task SetPreconfiguredRestrictionSettingsAsync(Context context) + { + var restrictionsManager = (RestrictionsManager)context.GetSystemService(Context.RestrictionsService); + var restrictions = restrictionsManager.ApplicationRestrictions; + var dict = new Dictionary(); + if(restrictions.ContainsKey(BaseEnvironmentUrlRestrictionKey)) + { + dict.Add(BaseEnvironmentUrlRestrictionKey, restrictions.GetString(BaseEnvironmentUrlRestrictionKey)); + } + + if(dict.Count > 0) + { + await AppHelpers.SetPreconfiguredSettingsAsync(dict); + } + } } } diff --git a/src/App/Utilities/AppHelpers.cs b/src/App/Utilities/AppHelpers.cs index a08f63d91..82d75f96f 100644 --- a/src/App/Utilities/AppHelpers.cs +++ b/src/App/Utilities/AppHelpers.cs @@ -6,6 +6,7 @@ using Bit.Core.Abstractions; using Bit.Core.Models.View; using Bit.Core.Utilities; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Xamarin.Forms; @@ -145,5 +146,35 @@ namespace Bit.App.Utilities } return false; } + + public static async Task SetPreconfiguredSettingsAsync(IDictionary configSettings) + { + if(configSettings?.Any() ?? true) + { + return; + } + foreach(var setting in configSettings) + { + switch(setting.Key) + { + case "baseEnvironmentUrl": + var environmentService = ServiceContainer.Resolve("environmentService"); + if(environmentService.BaseUrl != setting.Value) + { + await environmentService.SetUrlsAsync(new Core.Models.Data.EnvironmentUrlData + { + Base = setting.Value, + Api = environmentService.ApiUrl, + Identity = environmentService.IdentityUrl, + WebVault = environmentService.WebVaultUrl, + Icons = environmentService.IconsUrl + }); + } + break; + default: + break; + } + } + } } } diff --git a/src/iOS.Core/Utilities/iOSCoreHelpers.cs b/src/iOS.Core/Utilities/iOSCoreHelpers.cs index db2320634..2a273c921 100644 --- a/src/iOS.Core/Utilities/iOSCoreHelpers.cs +++ b/src/iOS.Core/Utilities/iOSCoreHelpers.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using System.Threading.Tasks; using Bit.App.Abstractions; using Bit.App.Services; @@ -64,12 +65,12 @@ namespace Bit.iOS.Core.Utilities ServiceContainer.Register("platformUtilsService", platformUtilsService); } - public static void Bootstrap() + public static void Bootstrap(Func postBootstrapFunc = null) { (ServiceContainer.Resolve("i18nService") as MobileI18nService).Init(); ServiceContainer.Resolve("authService").Init(); // Note: This is not awaited - var bootstrapTask = BootstrapAsync(); + var bootstrapTask = BootstrapAsync(postBootstrapFunc); } public static void AppearanceAdjustments(IDeviceActionService deviceActionService) @@ -79,13 +80,17 @@ namespace Bit.iOS.Core.Utilities UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; } - private static async Task BootstrapAsync() + private static async Task BootstrapAsync(Func postBootstrapFunc = null) { var disableFavicon = await ServiceContainer.Resolve("storageService").GetAsync( Bit.Core.Constants.DisableFaviconKey); await ServiceContainer.Resolve("stateService").SaveAsync( Bit.Core.Constants.DisableFaviconKey, disableFavicon); await ServiceContainer.Resolve("environmentService").SetUrlsFromStorageAsync(); + if(postBootstrapFunc != null) + { + await postBootstrapFunc.Invoke(); + } } } -} \ No newline at end of file +} diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 3b2a7da88..f808a46d4 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -282,7 +282,7 @@ namespace Bit.iOS _nfcDelegate = new NFCReaderDelegate((success, message) => _messagingService.Send("gotYubiKeyOTP", message)); - iOSCoreHelpers.Bootstrap(); + iOSCoreHelpers.Bootstrap(async () => await ApplyManagedSettingsAsync()); } private void RegisterPush() @@ -475,5 +475,20 @@ namespace Bit.iOS UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId); _eventBackgroundTaskId = 0; } + + private async Task ApplyManagedSettingsAsync() + { + var userDefaults = NSUserDefaults.StandardUserDefaults; + var managedSettings = userDefaults.DictionaryForKey("com.apple.configuration.managed"); + if(managedSettings != null && managedSettings.Count > 0) + { + var dict = new Dictionary(); + foreach(var setting in managedSettings) + { + dict.Add(setting.Key.ToString(), setting.Value?.ToString()); + } + await AppHelpers.SetPreconfiguredSettingsAsync(dict); + } + } } }