Skip to content

Commit

Permalink
fix "Hide bell if user is subscribed" option
Browse files Browse the repository at this point in the history
Option that can be set in dashboard when configuring the bell. Updated
to the new v16 function. Also corrected type that was incorrect for
displayPredicate
  • Loading branch information
jkasten2 committed Nov 14, 2023
1 parent a99d2f7 commit c50a923
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/shared/helpers/ConfigHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,7 @@ export class ConfigHelper {
enable: serverConfig.config.staticPrompts.bell.enabled,
displayPredicate: serverConfig.config.staticPrompts.bell
.hideWhenSubscribed
? () => {
return OneSignal.isPushNotificationsEnabled().then(
(isPushEnabled: boolean) => {
/* The user is subscribed, so we want to return "false" to hide the notify button */
return !isPushEnabled;
},
);
}
? () => !OneSignal.User.PushSubscription.optedIn
: null,
size: serverConfig.config.staticPrompts.bell.size,
position: serverConfig.config.staticPrompts.bell.location,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/models/Prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export interface BellText {
export interface AppUserConfigNotifyButton {
options?: AppUserConfigNotifyButton;
enable: boolean;
displayPredicate?: () => void | null | undefined;
displayPredicate?: null | (() => void | null | undefined | boolean);
size?: BellSize;
position?: BellPosition;
offset?: { bottom: string; left: string; right: string };
Expand Down

0 comments on commit c50a923

Please sign in to comment.