-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1075 from OneSignal/user-model/fix-notification-p…
…ermission-change-event-type [User Model] [Fix] Notification permission change event type to boolean
- Loading branch information
Showing
10 changed files
with
113 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { PermissionUtils } from "../../../src/shared/utils/PermissionUtils"; | ||
import RealPermissionManager from "../../../src/shared/managers/PermissionManager" | ||
|
||
export class PermissionManager { | ||
public static async mockNotificationPermissionChange( | ||
test: jest.It, | ||
nativePermission: NotificationPermission, | ||
): Promise<void> { | ||
test.stub(RealPermissionManager.prototype, 'getPermissionStatus', nativePermission); | ||
// mimick native permission change | ||
await PermissionUtils.triggerNotificationPermissionChanged(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
enum NotificationEventName { | ||
Click = "click", | ||
ForegroundWillDisplay = "foregroundWillDisplay", | ||
Dismiss = "dismiss", | ||
PermissionChange = "permissionChange", | ||
PermissionPromptDisplay = "permissionPromptDisplay" | ||
} | ||
|
||
export default NotificationEventName; | ||
export type NotificationEventName = | ||
"click" | | ||
"foregroundWillDisplay" | | ||
"dismiss" | | ||
"permissionChange" | | ||
"permissionPromptDisplay" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters