def _onServerSettingsChange(self, *args, **kwargs): if not self._lobbyContext.getServerSettings().isOffersEnabled(): if not AccountSettings.getNotifications(OFFERS_DISABLED_MSG_SEEN) and _getEventsOffersData(): AccountSettings.setNotifications(OFFERS_DISABLED_MSG_SEEN, True) msg = makeI18nError('offers/switch_off/body') SystemMessages.pushMessage(msg.userMsg, msg.sysMsgType) elif AccountSettings.getNotifications(OFFERS_DISABLED_MSG_SEEN): AccountSettings.setNotifications(OFFERS_DISABLED_MSG_SEEN, False)
def __processClanNewsNotification(self): account = self.__clansCtrl.getAccountProfile() notificationStartTime = self.__lobbyContext.getServerSettings( ).getClansConfig().get(ClansConfig.NOTIFICATION_START_TIME, 0) if not account.isInClan( ) or account.getJoinedAt() > notificationStartTime: return if not AccountSettings.getNotifications(CLAN_NEWS_SEEN): AccountSettings.setNotifications(CLAN_NEWS_SEEN, True) self.setCounters(self.CLAN_NEWS_ALIAS, 1, isIncrement=True)
def __widgetWasShown(self, _): model = self._model() if model is None: return else: model.removeNotification(NOTIFICATION_TYPE.PROGRESSIVE_REWARD, ProgressiveRewardDecorator.ENTITY_ID) if self.__seniorityAwardsIsActive(): AccountSettings.setCounters(SENIORITY_AWARDS_COUNTER, 1) else: AccountSettings.setNotifications(PROGRESSIVE_REWARD_VISITED, True) return
def __updateActionState(self): actions = self._eventsCache.getActions().keys() for name in actions: if _ACTION_POSTFIX in name: self._isStarted = True if not AccountSettings.getNotifications(BLUEPRINTS_CONVERT_SALE_STARTED_SEEN) and self._isEnabled: AccountSettings.setNotifications(BLUEPRINTS_CONVERT_SALE_STARTED_SEEN, True) self.__showNotification(BCSActionState.STARTED) return if self._isStarted: self._isStarted = False self.__showNotification(BCSActionState.END)
def __checkStartedFinishedEvents(self, isTabVisited): eventsSettings = self.__eventBoardsSettings events = eventsSettings.getEventsSettings().getEvents() if events: notifications = AccountSettings.getNotifications( ELEN_NOTIFICATIONS) started = notifications.get( MISSIONS_CONSTANTS.ELEN_EVENT_STARTED_NOTIFICATION) finished = notifications.get( MISSIONS_CONSTANTS.ELEN_EVENT_FINISHED_NOTIFICATION) visited = notifications.get( MISSIONS_CONSTANTS.ELEN_EVENT_TAB_VISITED) allEventID = [event.getEventID() for event in events] started = started.intersection(allEventID) finished = finished.intersection(allEventID) visited = visited.intersection(allEventID) notifications[ MISSIONS_CONSTANTS.ELEN_EVENT_STARTED_NOTIFICATION] = started notifications[ MISSIONS_CONSTANTS.ELEN_EVENT_FINISHED_NOTIFICATION] = finished notifications[MISSIONS_CONSTANTS.ELEN_EVENT_TAB_VISITED] = visited for event in events: eventID = event.getEventID() if isTabVisited and event.isStarted( ) and not event.isFinished(): visited.add(eventID) if event.isAtBeginning(): if eventID not in started: SystemMessages.pushMessage( _ms(EVENT_BOARDS.NOTIFICATION_EVENTSTARTED_BODY, eventName=event.getName()), messageData={ 'header': _ms(EVENT_BOARDS. NOTIFICATION_EVENTSTARTED_HEADER) }, type=SM_TYPE.OpenEventBoards) started.add(eventID) if event.isAfterEnd() and eventID in visited: if eventID not in finished: self.__complexWarningNotification( _ms(EVENT_BOARDS.NOTIFICATION_EVENTFINISHED_HEADER ), _ms(EVENT_BOARDS.NOTIFICATION_EVENTFINISHED_BODY, eventName=event.getName())) finished.add(eventID) AccountSettings.setNotifications(ELEN_NOTIFICATIONS, notifications)