Skip to content

[Fix] Continuation called with OneSignal.getNotifications().requestPermission does not fire when permission is already granted#2093

Merged
jinliu9508 merged 1 commit intomainfrom
fix-notification-permission-prompt-continuation
May 23, 2024
Merged

[Fix] Continuation called with OneSignal.getNotifications().requestPermission does not fire when permission is already granted#2093
jinliu9508 merged 1 commit intomainfrom
fix-notification-permission-prompt-continuation

Conversation

@jinliu9508
Copy link
Copy Markdown
Contributor

@jinliu9508 jinliu9508 commented May 21, 2024

Description

One Line Summary

Fix a bug causing OneSignal.getNotifications().requestPermission with continuation not firing when permission is granted.

Details

Motivation

This will fix some wrappers that utilize a Java bridge (like Unity and Flutter) and await forever and never resolve.

Testing

Manual testing

Scenarios that I manually tested:
a. Notification permission is off:
1. prompt for permission and allow
2. request again and observe that no prompt shows up and the continuation is fired with permissionResult = true
b. Notification permission is off:
1. prompt for permission and dismiss both dialogs
2. observe that the continuation is fired with permissionResult = false
c. Notification permission is on:
1. request permission and observe that no prompt shows up and the continuation is fired with permissionResult = true

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

@jinliu9508 jinliu9508 force-pushed the fix-notification-permission-prompt-continuation branch 2 times, most recently from caea4da to 506f0b1 Compare May 23, 2024 21:56
@jinliu9508 jinliu9508 changed the title fix returning true in suspend fun not firing continuation [Fix] Continuation called with OneSignal.getNotifications().requestPermission does not fire when permission is already granted May 23, 2024
@jinliu9508 jinliu9508 requested a review from jkasten2 May 23, 2024 22:00
@jinliu9508 jinliu9508 force-pushed the fix-notification-permission-prompt-continuation branch from 114b533 to 5326adb Compare May 23, 2024 22:48
@nan-li
Copy link
Copy Markdown
Contributor

nan-li commented May 23, 2024

Can clean up the commit history?

@jinliu9508 jinliu9508 force-pushed the fix-notification-permission-prompt-continuation branch from 5326adb to 4f7cc32 Compare May 23, 2024 23:46
@jinliu9508 jinliu9508 merged commit 4727d9b into main May 23, 2024
@jinliu9508 jinliu9508 deleted the fix-notification-permission-prompt-continuation branch May 23, 2024 23:47
@jinliu9508 jinliu9508 mentioned this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants