Compare commits

..

5 Commits

13 changed files with 119 additions and 124 deletions

View File

@@ -56,8 +56,6 @@ using Android.Util;
using AndroidX.Core.Content; using AndroidX.Core.Content;
using Google.Android.Material.Dialog; using Google.Android.Material.Dialog;
using keepass2android; using keepass2android;
using AndroidX.Core.App;
using Google.Android.Material.Snackbar;
namespace keepass2android namespace keepass2android
{ {
@@ -573,41 +571,13 @@ namespace keepass2android
if (permissions.Length == 1 && permissions.First() == Android.Manifest.Permission.PostNotifications && if (permissions.Length == 1 && permissions.First() == Android.Manifest.Permission.PostNotifications &&
grantResults.First() == Permission.Granted) grantResults.First() == Permission.Granted)
{ {
if (!CopyToClipboardService.HasEntryNotificationPermissions(this, false))
{
Intent intent = new Intent();
if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
{
intent.SetAction(Android.Provider.Settings.ActionAppNotificationSettings);
intent.PutExtra(Android.Provider.Settings.ExtraAppPackage, PackageName);
}
else if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
intent.SetAction(Android.Provider.Settings.ActionAppNotificationSettings);
intent.PutExtra("app_package", PackageName);
intent.PutExtra("app_uid", ApplicationInfo.Uid);
}
else
{
intent.SetAction(Android.Provider.Settings.ActionApplicationDetailsSettings);
intent.AddCategory(Intent.CategoryDefault);
intent.SetData(Uri.Parse("package:" + PackageName));
}
StartActivity(intent);
}
else
{
Kp2aLog.Log($"StartNotificationsServiceAfterPermissionsCheck(activateKeyboard: requestCode == {requestCode}");
StartNotificationsServiceAfterPermissionsCheck(requestCode == 1 /*requestCode is used to transfer this flag*/); StartNotificationsServiceAfterPermissionsCheck(requestCode == 1 /*requestCode is used to transfer this flag*/);
} }
}
base.OnRequestPermissionsResult(requestCode, permissions, grantResults); base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
} }
internal void StartNotificationsService(bool activateKeyboard) internal void StartNotificationsService(bool activateKeyboard)
{ {
Kp2aLog.Log($"StartNotificationsService. ActivateKeyboard={activateKeyboard}");
if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean( if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
GetString(Resource.String.CopyToClipboardNotification_key), GetString(Resource.String.CopyToClipboardNotification_key),
Resources.GetBoolean(Resource.Boolean.CopyToClipboardNotification_default)) == false Resources.GetBoolean(Resource.Boolean.CopyToClipboardNotification_default)) == false
@@ -616,16 +586,12 @@ namespace keepass2android
Resources.GetBoolean(Resource.Boolean.UseKp2aKeyboard_default)) == false) Resources.GetBoolean(Resource.Boolean.UseKp2aKeyboard_default)) == false)
{ {
//notifications are disabled //notifications are disabled
Kp2aLog.Log($"StartNotificationsService. Notifications disabled. Returning.");
return; return;
} }
if ((int)Build.VERSION.SdkInt < 33 || CheckSelfPermission(Android.Manifest.Permission.PostNotifications) ==
Permission.Granted)
if ((int)Build.VERSION.SdkInt < 33 || CopyToClipboardService.HasEntryNotificationPermissions(this, activateKeyboard))
{ {
Kp2aLog.Log($"StartNotificationsService. Permissions ok. activateKeyboard={activateKeyboard}");
StartNotificationsServiceAfterPermissionsCheck(activateKeyboard); StartNotificationsServiceAfterPermissionsCheck(activateKeyboard);
return; return;
} }
@@ -636,34 +602,10 @@ namespace keepass2android
if (!ShouldShowRequestPermissionRationale(Android.Manifest.Permission.PostNotifications) //this menthod returns false if we haven't asked yet or if the user has denied permission too often if (!ShouldShowRequestPermissionRationale(Android.Manifest.Permission.PostNotifications) //this menthod returns false if we haven't asked yet or if the user has denied permission too often
&& PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean("RequestedPostNotificationsPermission", false))//use a preference to tell the difference between "haven't asked yet" and "have asked too often" && PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean("RequestedPostNotificationsPermission", false))//use a preference to tell the difference between "haven't asked yet" and "have asked too often"
{ {
Kp2aLog.Log($"StartNotificationsService. Permissions not granted. Showing snackbar.");
//user has denied permission before. Do not show the dialog. User must give permission in the Android App settings. //user has denied permission before. Do not show the dialog. User must give permission in the Android App settings.
var snackbar = Snackbar
.Make(SnackbarAnchorView, Resource.String.post_notifications_snackbar,
Snackbar.LengthIndefinite);
snackbar.SetTextMaxLines(10);
if ((int)Build.VERSION.SdkInt >= 23)
{
snackbar.SetBackgroundTint(App.Context.GetColor(Resource.Color.md_theme_inverseSurface));
snackbar.SetTextColor(App.Context.GetColor(Resource.Color.md_theme_inverseOnSurface));
}
snackbar.SetAction(Resource.String.post_notifications_snackbar_config, view => { ShowNotificationPermissionsDialog(activateKeyboard); });
snackbar.Show();
return; return;
} }
ShowNotificationPermissionsDialog(activateKeyboard);
}
private void ShowNotificationPermissionsDialog(bool activateKeyboard)
{
Kp2aLog.Log($"ShowNotificationPermissionsDialog");
new MaterialAlertDialogBuilder(this) new MaterialAlertDialogBuilder(this)
.SetTitle(Resource.String.post_notifications_dialog_title) .SetTitle(Resource.String.post_notifications_dialog_title)
.SetMessage(Resource.String.post_notifications_dialog_message) .SetMessage(Resource.String.post_notifications_dialog_message)
@@ -690,6 +632,8 @@ namespace keepass2android
}) })
.SetNeutralButton(Resource.String.post_notifications_dialog_notnow, (sender, args) => { }) .SetNeutralButton(Resource.String.post_notifications_dialog_notnow, (sender, args) => { })
.Show(); .Show();
} }
private void StartNotificationsServiceAfterPermissionsCheck(bool activateKeyboard) private void StartNotificationsServiceAfterPermissionsCheck(bool activateKeyboard)

View File

@@ -331,13 +331,17 @@ namespace keepass2android
} }
private bool hasRequestedKeyboardActivation = false;
protected override void OnStart() protected override void OnStart()
{ {
base.OnStart(); base.OnStart();
if (PreferenceManager.GetDefaultSharedPreferences(this) if (PreferenceManager.GetDefaultSharedPreferences(this)
.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false)) .GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false)
&& (!hasRequestedKeyboardActivation))
{ {
Kp2aLog.Log("Activating keyboard in EntryEditActivity due to UseKp2aKeyboardInKp2a"); //only try this once. if the user clicks cancel, we don't want to ask again
// (it may happen that the activity is restarted because of the NewTask flag immediately after the dialog)
hasRequestedKeyboardActivation = true;
CopyToClipboardService.ActivateKeyboard(this); CopyToClipboardService.ActivateKeyboard(this);
} }
} }

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="207" android:versionCode="206"
android:versionName="1.12-r5-test2848" android:versionName="1.12-r5"
package="keepass2android.keepass2android" package="keepass2android.keepass2android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"> android:installLocation="auto">

View File

@@ -1570,15 +1570,18 @@ namespace keepass2android
base.OnPause(); base.OnPause();
} }
private bool hasRequestedKeyboardActivation = false;
protected override void OnStart() protected override void OnStart()
{ {
base.OnStart(); base.OnStart();
_starting = true; _starting = true;
if (PreferenceManager.GetDefaultSharedPreferences(this) if (PreferenceManager.GetDefaultSharedPreferences(this)
.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false)) .GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false)
&& !hasRequestedKeyboardActivation)
{ {
Kp2aLog.Log("Activating keyboard in PasswordActivity due to UseKp2aKeyboardInKp2a"); hasRequestedKeyboardActivation = true;
CopyToClipboardService.ActivateKeyboard(this); CopyToClipboardService.ActivateKeyboard(this);
} }

View File

@@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
@@ -14,6 +19,7 @@
android:text="@string/switch_ime_text" /> android:text="@string/switch_ime_text" />
<Button <Button
android:id="@+id/btn_reopen" android:id="@+id/btn_reopen"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -25,4 +31,51 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/cancel" /> android:text="@string/cancel" />
<LinearLayout android:orientation="vertical"
android:paddingTop="64dp"
android:id="@+id/settings_notes_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:paddingTop="12dp"
android:id="@+id/note_kp2a_switch_rooted"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/autoswitch_enabled_but_not_setup"
/>
<TextView
android:paddingTop="12dp"
android:id="@+id/note_AutoFillTotp_prefs_ActivateKeyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/switch_keyboard_for_totp_enabled"
/>
<TextView
android:paddingTop="12dp"
android:id="@+id/note_UseKp2aKeyboardInKp2a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/switch_keyboard_inside_kp2a_enabled"
/>
<TextView
android:id="@+id/note_OpenKp2aKeyboardAutomatically"
android:paddingTop="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/switch_keyboard_on_search_enabled"
/>
<Button
style="?attr/materialButtonOutlinedStyle"
android:id="@+id/btn_open_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/IconVisibilityInfo_Android8_btnSettings" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -200,7 +200,7 @@
<item>System</item> <item>System</item>
</string-array> </string-array>
<string name="AcceptAllServerCertificates_default">WARN</string> <string name="AcceptAllServerCertificates_default">ERROR</string>
<string-array name="AcceptAllServerCertificates_values"> <string-array name="AcceptAllServerCertificates_values">
<item>IGNORE</item> <item>IGNORE</item>
<item>WARN</item> <item>WARN</item>

View File

@@ -1224,9 +1224,6 @@
<string name="enable_fingerprint_hint">Keepass2Android has detected biometric hardware. Do you want to enable Biometric Unlock for this database?</string> <string name="enable_fingerprint_hint">Keepass2Android has detected biometric hardware. Do you want to enable Biometric Unlock for this database?</string>
<string name="post_notifications_dialog_title">Allow notifications</string> <string name="post_notifications_dialog_title">Allow notifications</string>
<string name="post_notifications_dialog_message">Keepass2Android can show notifications with buttons to copy values like passwords and TOTPs to clipboard, or to bring up the built-in keyboard. This is useful to transfer values into other apps without switching to Keepass2Android repeatedly. Do you want to enable such notifications?</string> <string name="post_notifications_dialog_message">Keepass2Android can show notifications with buttons to copy values like passwords and TOTPs to clipboard, or to bring up the built-in keyboard. This is useful to transfer values into other apps without switching to Keepass2Android repeatedly. Do you want to enable such notifications?</string>
<string name="post_notifications_snackbar">Cannot make entry available through notification. No permission granted.</string>
<string name="post_notifications_snackbar_config">Configure</string>
<string name="post_notifications_dialog_allow">Allow notifications</string> <string name="post_notifications_dialog_allow">Allow notifications</string>
<string name="post_notifications_dialog_disable">Disable this feature</string> <string name="post_notifications_dialog_disable">Disable this feature</string>
<string name="post_notifications_dialog_notnow">Not now</string> <string name="post_notifications_dialog_notnow">Not now</string>
@@ -1252,5 +1249,9 @@
<string name="kp2a_switch_on_sendgodone_summary">Switch back when pressing send/go/done</string> <string name="kp2a_switch_on_sendgodone_summary">Switch back when pressing send/go/done</string>
<string name="qr_scanning_error_no_google_play_services">QR code scanning requires Google Play Services. Please install or update Google Play Services on your device.</string> <string name="qr_scanning_error_no_google_play_services">QR code scanning requires Google Play Services. Please install or update Google Play Services on your device.</string>
<string name="english_ime_settings">Android keyboard settings</string> <string name="english_ime_settings">Android keyboard settings</string>
<string name="autoswitch_enabled_but_not_setup">Note: You have enabled App - Settings - Password access - Keyboard switching - Auto-switch keyboard, but it doesn\'t seem to be configured correctly.</string>
<string name="switch_keyboard_for_totp_enabled">Note: You have enabled App - Password access - Autofill-Service - Autofill for TOTP entries. This can cause this window to show when you open an entry with a TOTP.</string>
<string name="switch_keyboard_inside_kp2a_enabled">Note: You have enabled App - Security - Use built-in keyboard inside Keepass2Android. This can cause this window to show when you open the app or edit an entry.</string>
<string name="switch_keyboard_on_search_enabled">Note: You have enabled App - Security - Password access - Keyboard switching - Switch keyboard. This can cause this window to show when you search for an entry from the browser.</string>
</resources> </resources>

View File

@@ -328,7 +328,6 @@ namespace keepass2android
if (prefs.GetBoolean("kp2a_switch_rooted", false)) if (prefs.GetBoolean("kp2a_switch_rooted", false))
{ {
activationCondition = ActivationCondition.Always; activationCondition = ActivationCondition.Always;
Kp2aLog.Log("Will activate keyboard because SearchUrlTask opened with ActionSend and kp2a_switch_rooted");
} }
else else
{ {
@@ -337,7 +336,6 @@ namespace keepass2android
if (prefs.GetBoolean(this.GetString(Resource.String.OpenKp2aKeyboardAutomatically_key), this.Resources.GetBoolean(Resource.Boolean.OpenKp2aKeyboardAutomatically_default))) if (prefs.GetBoolean(this.GetString(Resource.String.OpenKp2aKeyboardAutomatically_key), this.Resources.GetBoolean(Resource.Boolean.OpenKp2aKeyboardAutomatically_default)))
{ {
activationCondition = ActivationCondition.Always; activationCondition = ActivationCondition.Always;
Kp2aLog.Log("Will activate keyboard because SearchUrlTask opened with ActionSend and OpenKp2aKeyboardAutomatically");
} }
} }

View File

@@ -6,6 +6,7 @@ using System.Threading;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
using Android.OS; using Android.OS;
using Android.Preferences;
using Android.Runtime; using Android.Runtime;
using Android.Util; using Android.Util;
using Android.Views; using Android.Views;
@@ -15,8 +16,8 @@ using keepass2android;
namespace keepass2android namespace keepass2android
{ {
[Activity(Label = AppNames.AppName, TaskAffinity = "", NoHistory = true)] [Activity(Label = AppNames.AppName, Theme = "@style/Kp2aTheme_BlueActionBar")]
public class SwitchImeActivity : Activity public class SwitchImeActivity : AndroidX.AppCompat.App.AppCompatActivity
{ {
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
@@ -24,7 +25,26 @@ namespace keepass2android
SetContentView(Resource.Layout.switch_ime_activity_layout); SetContentView(Resource.Layout.switch_ime_activity_layout);
FindViewById<Button>(Resource.Id.btn_reopen).Click += (sender, args) => TrySwitchKeyboard(); FindViewById<Button>(Resource.Id.btn_reopen).Click += (sender, args) => TrySwitchKeyboard();
FindViewById<Button>(Resource.Id.btn_cancel).Click += (sender, args) => Finish(); FindViewById<Button>(Resource.Id.btn_cancel).Click += (sender, args) => Finish();
FindViewById<Button>(Resource.Id.btn_open_settings).Click += (sender, args) => AppSettingsActivity.Launch(this);
var prefs = PreferenceManager.GetDefaultSharedPreferences(LocaleManager.LocalizedAppContext);
bool useKp2aKeyboardInKp2a = prefs.GetBoolean(GetString(Resource.String.UseKp2aKeyboardInKp2a_key), false);
bool kp2a_switch_rooted = prefs.GetBoolean("kp2a_switch_rooted", false);
bool AutoFillTotp_prefs_ActivateKeyboard = prefs.GetBoolean("AutoFillTotp_prefs_ActivateKeyboard_key", false);
bool OpenKp2aKeyboardAutomatically = prefs.GetBoolean(GetString(Resource.String.OpenKp2aKeyboardAutomatically_key), Resources.GetBoolean(Resource.Boolean.OpenKp2aKeyboardAutomatically_default));
FindViewById(Resource.Id.note_UseKp2aKeyboardInKp2a).Visibility = useKp2aKeyboardInKp2a ? ViewStates.Visible : ViewStates.Gone;
FindViewById(Resource.Id.note_kp2a_switch_rooted).Visibility = kp2a_switch_rooted ? ViewStates.Visible : ViewStates.Gone;
FindViewById(Resource.Id.note_AutoFillTotp_prefs_ActivateKeyboard).Visibility = AutoFillTotp_prefs_ActivateKeyboard ? ViewStates.Visible : ViewStates.Gone;
FindViewById(Resource.Id.note_OpenKp2aKeyboardAutomatically).Visibility = OpenKp2aKeyboardAutomatically ? ViewStates.Visible : ViewStates.Gone;
bool hasNote = useKp2aKeyboardInKp2a || kp2a_switch_rooted || AutoFillTotp_prefs_ActivateKeyboard || OpenKp2aKeyboardAutomatically;
((LinearLayout)FindViewById(Resource.Id.settings_notes_container)).Visibility = hasNote ? ViewStates.Visible : ViewStates.Gone;
} }
private string Kp2aInputMethodName private string Kp2aInputMethodName
{ {
get { return PackageName + "/keepass2android.softkeyboard.KP2AKeyboard"; } get { return PackageName + "/keepass2android.softkeyboard.KP2AKeyboard"; }

View File

@@ -918,13 +918,15 @@ namespace keepass2android
{ {
var prefs = PreferenceManager.GetDefaultSharedPreferences(LocaleManager.LocalizedAppContext); var prefs = PreferenceManager.GetDefaultSharedPreferences(LocaleManager.LocalizedAppContext);
ValidationMode validationMode = ValidationMode.Warn; ValidationMode validationMode = ValidationMode.Error;
string strValMode = prefs.GetString(LocaleManager.LocalizedAppContext.Resources.GetString(Resource.String.AcceptAllServerCertificates_key), string strValMode = prefs.GetString(LocaleManager.LocalizedAppContext.Resources.GetString(Resource.String.AcceptAllServerCertificates_key),
LocaleManager.LocalizedAppContext.Resources.GetString(Resource.String.AcceptAllServerCertificates_default)); LocaleManager.LocalizedAppContext.Resources.GetString(Resource.String.AcceptAllServerCertificates_default));
if (strValMode == "IGNORE") if (strValMode == "IGNORE")
validationMode = ValidationMode.Ignore; validationMode = ValidationMode.Ignore;
else if (strValMode == "WARN")
validationMode = ValidationMode.Warn;
else if (strValMode == "ERROR") else if (strValMode == "ERROR")
validationMode = ValidationMode.Error; validationMode = ValidationMode.Error;
return validationMode; return validationMode;

View File

@@ -355,10 +355,6 @@ namespace keepass2android
activity.GetString(Resource.String activity.GetString(Resource.String
.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key), false); .OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key), false);
Kp2aLog.Log($"AppTask.CompleteOnCreateEntryActivity. ActivateKeyboard={activateKeyboard}, kp2a_switch_rooted={prefs.GetBoolean("kp2a_switch_rooted", false)}, OpenKp2aKeyboardAutomaticallyOnlyAfterSearch={prefs.GetBoolean(
activity.GetString(Resource.String
.OpenKp2aKeyboardAutomaticallyOnlyAfterSearch_key), false)}");
activity.StartNotificationsService(activateKeyboard); activity.StartNotificationsService(activateKeyboard);
} }
@@ -626,7 +622,6 @@ namespace keepass2android
bool isTotpEntry = totpPluginAdapter != null; bool isTotpEntry = totpPluginAdapter != null;
bool activateKeyboard = ActivateKeyboard == ActivationCondition.Always || (ActivateKeyboard == ActivationCondition.WhenTotp && isTotpEntry); bool activateKeyboard = ActivateKeyboard == ActivationCondition.Always || (ActivateKeyboard == ActivationCondition.WhenTotp && isTotpEntry);
Kp2aLog.Log($"activateKeyboard == {activateKeyboard}. Task.Activate=={ActivateKeyboard}, isTotpEntry={isTotpEntry}");
if ((ShowUserNotifications == ActivationCondition.Always) if ((ShowUserNotifications == ActivationCondition.Always)
|| ((ShowUserNotifications == ActivationCondition.WhenTotp) && isTotpEntry) || ((ShowUserNotifications == ActivationCondition.WhenTotp) && isTotpEntry)

View File

@@ -732,11 +732,17 @@
<ItemGroup> <ItemGroup>
<AndroidNativeLibrary Include="..\java\argon2\libs\armeabi-v7a\libargon2.so" Link="armeabi-v7a\libargon2.so" /> <AndroidNativeLibrary Include="..\java\argon2\libs\armeabi-v7a\libargon2.so" Link="armeabi-v7a\libargon2.so" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidNativeLibrary Include="..\java\argon2\libs\x86\libargon2.so" Link="x86\libargon2.so" />
</ItemGroup>
<ItemGroup>
<AndroidNativeLibrary Include="..\java\argon2\libs\x86_64\libargon2.so" Link="x86_64\libargon2.so" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.7.0.5" /> <PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.7.0.5" />
<PackageReference Include="Xamarin.AndroidX.AppCompat.AppCompatResources" Version="1.7.0.5" /> <PackageReference Include="Xamarin.AndroidX.AppCompat.AppCompatResources" Version="1.7.0.5" />
<PackageReference Include="Xamarin.AndroidX.AutoFill" Version="1.1.0.30" /> <PackageReference Include="Xamarin.AndroidX.AutoFill" Version="1.1.0.30" />
<PackageReference Include="Xamarin.AndroidX.Biometric" Version="1.1.0.27" /> <PackageReference Include="Xamarin.AndroidX.Biometric" Version="1.1.0.6" />
<PackageReference Include="Xamarin.AndroidX.CoordinatorLayout" Version="1.3.0" /> <PackageReference Include="Xamarin.AndroidX.CoordinatorLayout" Version="1.3.0" />
<PackageReference Include="Xamarin.AndroidX.CursorAdapter" Version="1.0.0.31" /> <PackageReference Include="Xamarin.AndroidX.CursorAdapter" Version="1.0.0.31" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.8.7.2" /> <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.8.7.2" />

View File

@@ -878,37 +878,6 @@ namespace keepass2android
{ {
get { return PackageName + "/keepass2android.softkeyboard.KP2AKeyboard"; } get { return PackageName + "/keepass2android.softkeyboard.KP2AKeyboard"; }
} }
private static bool IsChannelPermissionGranted(Context context, string channelId)
{
if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
{
if (!string.IsNullOrEmpty(channelId))
{
NotificationManager? manager =
(NotificationManager?)context.GetSystemService(Context.NotificationService)!;
NotificationChannel? channel = manager?.GetNotificationChannel(channelId);
return channel?.Importance != Android.App.NotificationImportance.None;
}
return false;
}
return true;
}
public static bool HasEntryNotificationPermissions(Context context, bool activateKeyboard)
{
if (!NotificationManagerCompat.From(context).AreNotificationsEnabled())
{
return false;
}
return IsChannelPermissionGranted(context, App.NotificationChannelIdEntry);
}
} }
[BroadcastReceiver(Permission = "keepass2android." + AppNames.PackagePart + ".permission.CopyToClipboard")] [BroadcastReceiver(Permission = "keepass2android." + AppNames.PackagePart + ".permission.CopyToClipboard")]