Allow to add entry with no info in Magikeyboard

This commit is contained in:
J-Jamet
2022-04-19 16:06:16 +02:00
parent 6e4626bc02
commit 1ed1d4233f

View File

@@ -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)