mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-09 12:32:30 +01:00
Fix pending intent for Android 12
This commit is contained in:
parent
d4c64b800f
commit
22972373e5
@ -59,6 +59,10 @@ import kotlin.math.abs
|
||||
*/
|
||||
private val _40_DP = 40.dpToPx
|
||||
|
||||
private val pendingIntentFlagUpdateCurrent: Int
|
||||
get() = PendingIntent.FLAG_UPDATE_CURRENT or
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) PendingIntent.FLAG_IMMUTABLE else 0
|
||||
|
||||
/**
|
||||
* Enum to handle notification creations
|
||||
*/
|
||||
@ -227,7 +231,7 @@ enum class NotificationType(
|
||||
putContentExtra(intent, content)
|
||||
val group = "${groupPrefix}_${data.id}"
|
||||
val pendingIntent =
|
||||
PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.getActivity(context, 0, intent, pendingIntentFlagUpdateCurrent)
|
||||
val notifBuilder = context.frostNotification(channelId)
|
||||
.setContentTitle(title ?: context.string(R.string.frost_name))
|
||||
.setContentText(text)
|
||||
@ -266,7 +270,7 @@ enum class NotificationType(
|
||||
intent.data = Uri.parse(fbItem.url)
|
||||
val group = "${groupPrefix}_$userId"
|
||||
val pendingIntent =
|
||||
PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.getActivity(context, 0, intent, pendingIntentFlagUpdateCurrent)
|
||||
val notifBuilder = context.frostNotification(channelId)
|
||||
.setContentTitle(context.string(R.string.frost_name))
|
||||
.setContentText("$count ${context.string(fbItem.titleId)}")
|
||||
|
@ -86,7 +86,7 @@ class NotificationWidget : AppWidgetProvider() {
|
||||
context,
|
||||
0,
|
||||
type.createCommonIntent(context, userId),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
pendingIntentFlagUpdateCurrent
|
||||
)
|
||||
|
||||
views.setPendingIntentTemplate(R.id.widget_notification_list, pendingIntentTemplate)
|
||||
@ -96,6 +96,10 @@ class NotificationWidget : AppWidgetProvider() {
|
||||
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_notification_list)
|
||||
}
|
||||
|
||||
private val pendingIntentFlagUpdateCurrent: Int
|
||||
get() = PendingIntent.FLAG_UPDATE_CURRENT or
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) PendingIntent.FLAG_IMMUTABLE else 0
|
||||
|
||||
companion object {
|
||||
fun forceUpdate(context: Context) {
|
||||
val manager = AppWidgetManager.getInstance(context)
|
||||
|
@ -2,4 +2,5 @@ v3.1.0
|
||||
|
||||
* Fix multi account sign in
|
||||
* Only clear out cookies on explicit logout; Facebook logout redirects no longer erase cookies
|
||||
* Update themes
|
||||
* Update themes
|
||||
* Big infra changes (please file bugs for new crashes)
|
@ -10,6 +10,7 @@
|
||||
<item text="Fix multi account sign in" />
|
||||
<item text="Only clear out cookies on explicit logout; Facebook logout redirects no longer erase cookies" />
|
||||
<item text="Update themes" />
|
||||
<item text="Big infra changes (please file bugs for new crashes)" />
|
||||
|
||||
<version title="v3.0.0" />
|
||||
<item text="Removed email support. Please use GitHub for all inquiries as I no longer have time to look through all emails" />
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Fix multi account sign in
|
||||
* Only clear out cookies on explicit logout; Facebook logout redirects no longer erase cookies
|
||||
* Update themes
|
||||
* Big infra changes (please file bugs for new crashes)
|
||||
|
||||
## v3.0.0
|
||||
* Removed email support. Please use GitHub for all inquiries as I no longer have time to look through all emails
|
||||
|
Loading…
Reference in New Issue
Block a user