Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(HW-773): Show notifications invitation modal by period #2124

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
ButtonVariant,
LottieWrap,
Text,
TextPosition,
TextVariant,
} from '@app/components/ui';
import {createTheme} from '@app/helpers';
import {useThemeSelector} from '@app/hooks';
Expand Down Expand Up @@ -46,10 +48,15 @@ export const NotificationPopup = ({
loop={true}
/>
</View>
<Text t7 center style={styles.title} i18n={I18N.popupNotificationTitle} />
<Text
t14
center
variant={TextVariant.t7}
position={TextPosition.center}
style={styles.title}
i18n={I18N.popupNotificationTitle}
/>
<Text
variant={TextVariant.t14}
position={TextPosition.center}
color={Color.textBase2}
style={styles.t14}
i18n={I18N.popupNotificationDescription}
Expand Down
2 changes: 1 addition & 1 deletion src/event-actions/on-banner-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function onBannerAction(
await onBannerNotificationsEnable(id);
break;
case BannerButtonEvent.notificationsSnooze:
await onBannerNotificationsSnooze(id);
await onBannerNotificationsSnooze();
break;
case BannerButtonEvent.notificationsTopicSubscribe:
await onBannerNotificationsTopicSubscribe(id, params.topic ?? '');
Expand Down
11 changes: 1 addition & 10 deletions src/event-actions/on-banner-notifications-snooze.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import {addMinutes} from 'date-fns';

import {Banner} from '@app/models/banner';
import {VariablesDate} from '@app/models/variables-date';

export async function onBannerNotificationsSnooze(id: string) {
const banner = Banner.getById(id);

if (!banner) {
throw new Error('Banner not found');
}

export async function onBannerNotificationsSnooze() {
VariablesDate.set('snoozeNotifications', addMinutes(new Date(), 5 * 1440));

Banner.remove(id);
}
4 changes: 1 addition & 3 deletions src/screens/popup-notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export const PopupNotificationScreen = memo(({onCloseProp}: Props) => {
await sleep(ANIMATION_DURATION);
onCloseProp?.();
goBack();
await onBannerNotificationsSnooze(
PopupNotificationBannerTypes.notification,
);
await onBannerNotificationsSnooze();
},
[goBack],
);
Expand Down