diff --git a/src/views/notification-center/NotificationCenterMessageHandler.tsx b/src/views/notification-center/NotificationCenterMessageHandler.tsx index ab162d9d..de974b13 100644 --- a/src/views/notification-center/NotificationCenterMessageHandler.tsx +++ b/src/views/notification-center/NotificationCenterMessageHandler.tsx @@ -1,4 +1,4 @@ -import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, ClubGiftNotificationEvent, HabboBroadcastMessageEvent, HotelClosesAndWillOpenAtEvent, HotelWillShutdownEvent, ModeratorMessageEvent, MOTDNotificationEvent, NotificationDialogMessageEvent, PetAddedToInventoryEvent, RespectReceivedEvent, Vector3d } from '@nitrots/nitro-renderer'; +import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, ClubGiftNotificationEvent, HabboBroadcastMessageEvent, HotelClosesAndWillOpenAtEvent, HotelWillShutdownEvent, ModeratorMessageEvent, MOTDNotificationEvent, NotificationDialogMessageEvent, PetAddedToInventoryEvent, RespectReceivedEvent, RoomEnterEvent, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; import { GetRoomEngine, GetSessionDataManager, LocalizeBadgeName, LocalizeText } from '../../api'; import { NotificationCenterAlertEvent } from '../../events'; @@ -106,6 +106,15 @@ export const NotificationCenterMessageHandler: FC + { + const parser = event.getParser(); + + NotificationUtilities.showModerationDisclaimer(); + }, []); + + CreateMessageHook(RoomEnterEvent, onRoomEnterEvent); + const onMOTDNotificationEvent = useCallback((event: MOTDNotificationEvent) => { const parser = event.getParser(); @@ -113,6 +122,8 @@ export const NotificationCenterMessageHandler: FC { const parser = event.getParser(); @@ -125,6 +136,8 @@ export const NotificationCenterMessageHandler: FC { const parser = event.getParser(); @@ -132,8 +145,6 @@ export const NotificationCenterMessageHandler: FC = null; + private static cleanText(text: string): string { return text.replace(/\\r/g, '\r') @@ -133,4 +137,25 @@ export class NotificationUtilities CreateLinkEvent(url); } } + + public static showModerationDisclaimer(): void + { + if(RoomEnterEffect.isRunning()) + { + if(this.MODERATION_DISCLAIMER_TIMEOUT) return; + + this.MODERATION_DISCLAIMER_TIMEOUT = setTimeout(() => + { + this.showModerationDisclaimer(); + }, (RoomEnterEffect.totalRunningTime + this.MODERATION_DISCLAIMER_DELAY_MS)); + } + else + { + if(this.MODERATION_DISCLAIMER_SHOWN) return; + + this.showSingleBubble(LocalizeText('mod.chatdisclaimer'), NotificationType.INFO); + + this.MODERATION_DISCLAIMER_SHOWN = true; + } + } }