mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix pending intent
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.kunzisoft.keepass.services
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.PendingIntent
|
||||
import android.content.*
|
||||
import android.net.Uri
|
||||
@@ -50,6 +51,9 @@ class AdvancedUnlockNotificationService : NotificationService() {
|
||||
mTempCipherDao = ArrayList()
|
||||
}
|
||||
|
||||
// It's simpler to use pendingIntent to perform REMOVE_ADVANCED_UNLOCK_KEY_ACTION
|
||||
// because can be directly broadcast to another module or app
|
||||
@SuppressLint("LaunchActivityFromNotification")
|
||||
override fun onBind(intent: Intent): IBinder {
|
||||
super.onBind(intent)
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.kunzisoft.keepass.services
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.kunzisoft.keepass.R
|
||||
import com.kunzisoft.keepass.model.EntryInfo
|
||||
@@ -112,7 +113,13 @@ class ClipboardEntryNotificationService : LockNotificationService() {
|
||||
putParcelableArrayListExtra(EXTRA_CLIPBOARD_FIELDS, fieldsToAdd)
|
||||
}
|
||||
return PendingIntent.getService(
|
||||
this, 0, copyIntent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
this, 0, copyIntent,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
} else {
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun newNotification(title: String?, fieldsToAdd: ArrayList<ClipboardEntryNotificationField>) {
|
||||
@@ -162,7 +169,13 @@ class ClipboardEntryNotificationService : LockNotificationService() {
|
||||
val cleanIntent = Intent(this, ClipboardEntryNotificationService::class.java)
|
||||
cleanIntent.action = ACTION_CLEAN_CLIPBOARD
|
||||
val cleanPendingIntent = PendingIntent.getService(
|
||||
this, 0, cleanIntent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
this, 0, cleanIntent,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
} else {
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
}
|
||||
)
|
||||
builder.setDeleteIntent(cleanPendingIntent)
|
||||
|
||||
//Get settings
|
||||
|
||||
@@ -408,7 +408,11 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
|
||||
this,
|
||||
0,
|
||||
Intent(this, GroupActivity::class.java),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
} else {
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
}
|
||||
)
|
||||
val pendingDeleteIntent = PendingIntent.getBroadcast(
|
||||
this,
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.kunzisoft.keepass.services
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.preference.PreferenceManager
|
||||
@@ -93,7 +94,13 @@ class KeyboardEntryNotificationService : LockNotificationService() {
|
||||
val deleteIntent = Intent(this, KeyboardEntryNotificationService::class.java).apply {
|
||||
action = ACTION_CLEAN_KEYBOARD_ENTRY
|
||||
}
|
||||
pendingDeleteIntent = PendingIntent.getService(this, 0, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
pendingDeleteIntent = PendingIntent.getService(this, 0, deleteIntent,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
} else {
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
}
|
||||
)
|
||||
|
||||
val builder = buildNewNotification()
|
||||
.setSmallIcon(R.drawable.notification_ic_keyboard_key_24dp)
|
||||
|
||||
Reference in New Issue
Block a user