diff --git a/src/app/core/notifications/notifications_manager.nim b/src/app/core/notifications/notifications_manager.nim index 06a5e1b8cb..881e8823fb 100644 --- a/src/app/core/notifications/notifications_manager.nim +++ b/src/app/core/notifications/notifications_manager.nim @@ -19,15 +19,9 @@ const SIGNAL_DISPLAY_APP_NOTIFICATION* = "displayAppNotification" const SIGNAL_DISPLAY_WINDOWS_OS_NOTIFICATION* = "displayWindowsOsNotification" const SIGNAL_OS_NOTIFICATION_CLICKED* = "osNotificationClicked" -# Notification preferences -const NOTIFY_ABOUT_ALL_MESSAGES = 0 -const NOTIFY_JUST_ABOUT_MENTIONS = 1 -const NOTIFY_NOTHING_ABOUT = 2 - # Anonymous preferences const PREVIEW_ANONYMOUS = 0 const PREVIEW_NAME_ONLY = 1 -const PREVIEW_NAME_AND_MESSAGE = 2 type NotificationArgs* = ref object of Args @@ -64,7 +58,7 @@ QtObject: new(result, delete) result.setup(events, settingsService) - proc init*(self: NotificationsManager) = + proc onAppReady(self: NotificationsManager) = self.osNotification = newStatusOSNotification() self.soundManager = newStatusSoundManager() @@ -96,6 +90,10 @@ QtObject: self.notificationSetUp = true + proc init*(self: NotificationsManager) = + self.events.once(FAKE_LOADING_SCREEN_FINISHED) do(e:Args): + self.onAppReady() + proc showOSNotification(self: NotificationsManager, title: string, message: string, identifier: string) = if defined(windows): let data = NotificationArgs(title: title, message: message) @@ -208,10 +206,10 @@ QtObject: self.osNotification.showIconBadgeNotification(allMentions) proc notificationCheck(self: NotificationsManager, title: string, message: string, details: NotificationDetails, - notificationWay: string) = + notificationWay: string) = var data = NotificationArgs(title: title, message: message, details: details) # All but the NewMessage notifications go to Activity Center - if(details.notificationType != NotificationType.NewMessage): + if details.notificationType != NotificationType.NewMessage: debug "Add AC notification", title=title, message=message self.events.emit(SIGNAL_ADD_NOTIFICATION_TO_ACTIVITY_CENTER, data) @@ -220,28 +218,28 @@ QtObject: let appIsActive = app_isActive(singletonInstance.engine) - if(details.notificationType == NotificationType.NewMessage or - details.notificationType == NotificationType.NewMessageWithPersonalMention or - details.notificationType == NotificationType.NewMessageWithGlobalMention or - details.notificationType == NotificationType.NewContactRequest or - details.notificationType == NotificationType.ContactRemoved or - details.notificationType == NotificationType.IdentityVerificationRequest): - - if(notificationWay == VALUE_NOTIF_DELIVER_QUIETLY): - return - - if((details.notificationType == NotificationType.NewMessage or + if details.notificationType == NotificationType.NewMessage or details.notificationType == NotificationType.NewMessageWithPersonalMention or - details.notificationType == NotificationType.NewMessageWithGlobalMention) and - details.sectionActive and - details.chatActive and appIsActive): + details.notificationType == NotificationType.NewMessageWithGlobalMention or + details.notificationType == NotificationType.NewContactRequest or + details.notificationType == NotificationType.ContactRemoved or + details.notificationType == NotificationType.IdentityVerificationRequest: + + if notificationWay == VALUE_NOTIF_DELIVER_QUIETLY: return - if(appIsActive): + if (details.notificationType == NotificationType.NewMessage or + details.notificationType == NotificationType.NewMessageWithPersonalMention or + details.notificationType == NotificationType.NewMessageWithGlobalMention) and + details.sectionActive and + details.chatActive and appIsActive: + return + + if appIsActive: debug "Add APP notification", title=title, message=message self.events.emit(SIGNAL_DISPLAY_APP_NOTIFICATION, data) - if(not appIsActive or details.notificationType == NotificationType.TestNotification): + if not appIsActive or details.notificationType == NotificationType.TestNotification: # Check anonymity level if(self.settingsService.getNotificationMessagePreview() == PREVIEW_ANONYMOUS): data.title = "Status" @@ -253,7 +251,7 @@ QtObject: debug "Add OS notification", title=data.title, message=data.message, identifier=identifier self.showOSNotification(data.title, data.message, identifier) - if(self.settingsService.getNotificationSoundsEnabled()): + if self.settingsService.getNotificationSoundsEnabled(): self.soundManager.setPlayerVolume(self.settingsService.getNotificationVolume()) self.soundManager.playSound(NOTIFICATION_SOUND) diff --git a/src/app/global/app_signals.nim b/src/app/global/app_signals.nim index fa27d1318d..32fbb83032 100644 --- a/src/app/global/app_signals.nim +++ b/src/app/global/app_signals.nim @@ -39,4 +39,5 @@ type url*: string userId*: string # can be public key or ens name -const SIGNAL_STATUS_URL_ACTIVATED* = "statusUrlActivated" \ No newline at end of file +const SIGNAL_STATUS_URL_ACTIVATED* = "statusUrlActivated" +const FAKE_LOADING_SCREEN_FINISHED* = "fakeLoadingScreenFinished" \ No newline at end of file diff --git a/src/app/modules/main/io_interface.nim b/src/app/modules/main/io_interface.nim index 62fa8fd4b4..0bb4e2f211 100644 --- a/src/app/modules/main/io_interface.nim +++ b/src/app/modules/main/io_interface.nim @@ -392,6 +392,9 @@ method insertMockedKeycardAction*(self: AccessInterface, cardIndex: int) {.base. method removeMockedKeycardAction*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") +method fakeLoadingScreenFinished*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + method onCommunityTokensDetailsLoaded*(self: AccessInterface, communityId: string, communityTokens: seq[CommunityTokenDto], communityTokenJsonItems: JsonNode) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index 414a622dac..3090f62c5b 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -1570,4 +1570,7 @@ method insertMockedKeycardAction*[T](self: Module[T], cardIndex: int) = method removeMockedKeycardAction*[T](self: Module[T]) = self.keycardService.removeMockedKeycardAction() +method fakeLoadingScreenFinished*[T](self: Module[T]) = + self.events.emit(FAKE_LOADING_SCREEN_FINISHED, Args()) + {.pop.} diff --git a/src/app/modules/main/view.nim b/src/app/modules/main/view.nim index 258f8d94d8..31b7082fae 100644 --- a/src/app/modules/main/view.nim +++ b/src/app/modules/main/view.nim @@ -323,3 +323,6 @@ QtObject: proc removeMockedKeycardAction*(self: View) {.slot.} = self.delegate.removeMockedKeycardAction() + + proc fakeLoadingScreenFinished*(self: View) {.slot.} = + self.delegate.fakeLoadingScreenFinished() diff --git a/ui/main.qml b/ui/main.qml index 9dfdf87e05..9b57291385 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -196,6 +196,9 @@ StatusWindow { // We set main module to the Global singleton once user is logged in and we move to the main app. appLoadingAnimation.active = localAppSettings && localAppSettings.fakeLoadingScreenEnabled appLoadingAnimation.runningProgressAnimation = localAppSettings && localAppSettings.fakeLoadingScreenEnabled + if (!appLoadingAnimation.runningProgressAnimation) { + mainModule.fakeLoadingScreenFinished() + } Global.userProfile = userProfile Global.appIsReady = true @@ -382,6 +385,7 @@ StatusWindow { onProgressChanged: { if (progress === 1) { appLoadingAnimation.active = false + mainModule.fakeLoadingScreenFinished() } } }