Skip to content

Commit

Permalink
Merge pull request #1130 from OneSignal/fix/hide_bell_if_user_is_subs…
Browse files Browse the repository at this point in the history
…cribed

[Fix] hide bell if user is subscribed, dashboard setting
  • Loading branch information
jkasten2 authored Nov 14, 2023
2 parents e93f2bb + c50a923 commit 36d42a9
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 36d42a9

Please sign in to comment.