mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Allow to add entry with no info in Magikeyboard
This commit is contained in:
@@ -149,30 +149,21 @@ class KeyboardEntryNotificationService : LockNotificationService() {
|
|||||||
|
|
||||||
fun launchNotificationIfAllowed(context: Context, entry: EntryInfo, toast: Boolean) {
|
fun launchNotificationIfAllowed(context: Context, entry: EntryInfo, toast: Boolean) {
|
||||||
|
|
||||||
val containsURLToCopy = entry.url.isNotEmpty()
|
|
||||||
val containsUsernameToCopy = entry.username.isNotEmpty()
|
|
||||||
val containsPasswordToCopy = entry.password.isNotEmpty()
|
|
||||||
val containsExtraFieldToCopy = entry.customFields.isNotEmpty()
|
|
||||||
|
|
||||||
var startService = false
|
var startService = false
|
||||||
val intent = Intent(context, KeyboardEntryNotificationService::class.java)
|
val intent = Intent(context, KeyboardEntryNotificationService::class.java)
|
||||||
|
|
||||||
if (containsURLToCopy || containsUsernameToCopy || containsPasswordToCopy || containsExtraFieldToCopy) {
|
if (toast) {
|
||||||
if (toast) {
|
Toast.makeText(context,
|
||||||
Toast.makeText(context,
|
context.getString(R.string.keyboard_notification_entry_content_title, entry.title),
|
||||||
context.getString(R.string.keyboard_notification_entry_content_title, entry.title),
|
Toast.LENGTH_SHORT).show()
|
||||||
Toast.LENGTH_SHORT).show()
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Show the notification if allowed in Preferences
|
// Show the notification if allowed in Preferences
|
||||||
if (PreferencesUtil.isKeyboardNotificationEntryEnable(context)) {
|
if (PreferencesUtil.isKeyboardNotificationEntryEnable(context)) {
|
||||||
startService = true
|
startService = true
|
||||||
context.startService(intent.apply {
|
context.startService(intent.apply {
|
||||||
putExtra(ENTRY_INFO_KEY, entry)
|
putExtra(ENTRY_INFO_KEY, entry)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
} else {
|
|
||||||
MagikeyboardService.removeEntry(context)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startService)
|
if (!startService)
|
||||||
|
|||||||
Reference in New Issue
Block a user