NewPipe icon indicating copy to clipboard operation
NewPipe copied to clipboard

"allow NewPipe to send you notification" message appears again when changing from portait to landscape view

Open KaGaster opened this issue 8 months ago • 6 comments

Checklist

  • [x] I am able to reproduce the bug with the latest version given here: CLICK THIS LINK.
  • [x] I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • [x] I have read the FAQ and my problem isn't listed.
  • [x] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • [x] This issue contains only one bug.
  • [x] I have read and understood the contribution guidelines.

Affected version

0.27.6

Steps to reproduce the bug

  1. Uninstall the app if it is already on the phone.
  2. Re/install the app.
  3. Start with portait view.
  4. Click on "don't allow" when the message appears.
  5. Directly switch to landscape view.

Expected behavior

The notification message should not appear a second time.

Actual behavior

It does.

Screenshots/Screen recordings

No response

Logs

No response

Affected Android/Custom ROM version

Android 14

Affected device model

Samsung Galaxy A53 5G

Additional information

No response

KaGaster avatar Apr 19 '25 20:04 KaGaster

Hi! If no one’s currently working on this, I’d be happy to take it on. I’d love to get familiar with the notification codebase.

VougJo23 avatar Apr 22 '25 22:04 VougJo23

Okay, so some observations I made:

The issue only happens if you are in a newly-installed version of the app. So if you open -> click no -> rotate on a new install, it re-opens the dialog. But if you then go to the settings, enable them, disable again, and open -> click no -> rotate, now this does not happen.

It looks to me like it depends on whether the app activity is re-created, and for some reason it is re-created when opening for the first time. Then the state has not propagated from the system to the acitvity??

But it also means this is a three-state boolean, “not asked yet, no, yes”, and if you go to the settings and enable/disable, the popup gets opened again by the system. this might be different between android versions!

I feel like this is actually an Android bug, not something that we can really fix without doing workarounds. Especially since the behaviour might change between Android versions (and has already changed before, in the past there were issues with the notification popup opening multiple times on top of each other).

Since it’s such a minor issue, I’d opt for closing as WONTFIX.

Profpatsch avatar May 09 '25 14:05 Profpatsch

For the record, I think it would be a bad idea to cache this information locally in our view. We should always ask the system, otherwise we’ll run into issues later (e.g. if the user changes it in the settings, this would lead to state invalidation we can’t detect).

Profpatsch avatar May 09 '25 14:05 Profpatsch

@Profpatsch citing from here:

At the same time, your app should respect the user's decision to deny a permission. Starting in Android 11 (API level 30), if the user taps Deny for a specific permission more than once during your app's lifetime of installation on a device, the user doesn't see the system permissions dialog if your app requests that permission again. The user's action implies "don't ask again." On previous versions, users saw the system permissions dialog each time your app requested a permission, unless they had previously selected a "don't ask again" checkbox or option.

If a user denies a permission request more than once, this is considered a permanant denial. It's very important to only prompt users for permissions when they need access to a specific feature, otherwise you might inadvertently lose the ability to re-request permissions.

In certain situations, the permission might be denied automatically, without the user taking any action. (A permission might be granted automatically as well.) It's important to not assume anything about automatic behavior. Each time your app needs to access functionality that requires a permission, check that your app is still granted that permission.

I read those docs and other stack overflow threads and there seems to be no way to detect whether the user has already denied the setting reliably. The only "solutions" were to store a boolean in preferences saying whether the user has previously denied the setting, but this becomes inconsistent if the user manually changes the setting, as you said.

What we could do is to store a boolean notifPermAlreadyRequested in the App and use it to decide whether to ask the permission again in the current execution of the app. Since it seems like this problem only happens on the first execution, and not on subsequent ones, this shouldn't be a problem.

Stypox avatar May 10 '25 09:05 Stypox

What we could do is to store a boolean notifPermAlreadyRequested in the App and use it to decide whether to ask the permission again in the current execution of the app. Since it seems like this problem only happens on the first execution, and not on subsequent ones, this shouldn't be a problem.

yeah, but it’s such a tiny bug that 99.9% of people are never gonna hit, and worst case they have to click “no” twice.

I think in general we should probably think about how to re-design the notification allowance, e.g. by not asking directly but by showing a small nagbar that prompts the user to make a choice and then never appears again. I’d also change the “Notifications” menu icon to say “notifications disabled” directly if they are not enabled.

Profpatsch avatar May 10 '25 10:05 Profpatsch

Okay, I implemented a solution with a boolean setting in #12201 which fixes the rotation issue for me.

Profpatsch avatar May 10 '25 12:05 Profpatsch

I'm a student and would like to fix this for an assignment. I've reviewed #12201 and read the comments. I can resolve the bug by adding a field in app as requested. Could this issue be assigned to me?

Isaac-75 avatar Oct 16 '25 09:10 Isaac-75

Sure @Isaac-75, thanks! Let me close #12201 in the meantime.

Just add a boolean field in App so we keep it simple

Stypox avatar Oct 16 '25 09:10 Stypox

I've created a PR: #12716. Everything seems fine, but please let me know if I need to change anything. Thank you!

Isaac-75 avatar Oct 18 '25 16:10 Isaac-75