Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix card title can't open Trello app #45

Merged
merged 1 commit into from
May 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.github.oryanmat.trellowidget.widget

import android.annotation.SuppressLint
import android.app.PendingIntent
import android.app.PendingIntent.FLAG_IMMUTABLE
import android.app.PendingIntent.FLAG_MUTABLE
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context
Expand Down Expand Up @@ -105,9 +107,10 @@ class TrelloWidgetProvider : AppWidgetProvider() {
return PendingIntent.getActivity(context, appWidgetId, reconfigIntent, FLAG_IMMUTABLE)
}

@SuppressLint("MutableImplicitPendingIntent")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for? I don't get a warning without it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the warning I get:

Mutable implicit PendingIntent will throw an exception once this app starts targeting Android 14 or above, follow either of these recommendations: for an existing PendingIntent use FLAG_NO_CREATE and for a new PendingIntent either make it immutable or make the Intent within explicit
Inspection info: Apps targeting Android 14 and above are not allowed to create PendingIntents with FLAG_MUTABLE and an implicit intent within for security reasons. To retrieve an existing PendingIntent, use FLAG_NO_CREATE. To create a new PendingIntent, either make the intent explicit, or make it immutable with FLAG_IMMUTABLE.
Issue id: MutableImplicitPendingIntent

More in the reference.

I guess this PR is not the definitive solution, but a workaround to make things work as before. for new updates to SDK version we may need to make some changes to the app design.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's fine for now then.

private fun getCardPendingIntent(context: Context): PendingIntent {
// individual card URIs are set in a RemoteViewsFactory.setOnClickFillInIntent
return PendingIntent.getActivity(context, 0, Intent(Intent.ACTION_VIEW), FLAG_IMMUTABLE)
return PendingIntent.getActivity(context, 0, Intent(Intent.ACTION_VIEW), FLAG_MUTABLE)
}

private fun getTitleIntent(context: Context, board: Board): PendingIntent {
Expand Down