mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Removing Delivered Notifications (#1305)
* completed * changelog * tests * more tests * better naming * fix * a bit more waiting time * generated mocks * xcodegen
This commit is contained in:
@@ -48,4 +48,5 @@ struct InvitesScreenRoomDetails: Identifiable {
|
||||
enum InvitesScreenViewAction {
|
||||
case accept(InvitesScreenRoomDetails)
|
||||
case decline(InvitesScreenRoomDetails)
|
||||
case appeared
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ class InvitesScreenViewModel: InvitesScreenViewModelType, InvitesScreenViewModel
|
||||
private let appSettings: AppSettings
|
||||
private let analytics: AnalyticsService
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let notificationCenterProtocol: NotificationCenterProtocol
|
||||
|
||||
private let previouslySeenInvites: Set<String>
|
||||
private let actionsSubject: PassthroughSubject<InvitesScreenViewModelAction, Never> = .init()
|
||||
@@ -36,11 +37,13 @@ class InvitesScreenViewModel: InvitesScreenViewModelType, InvitesScreenViewModel
|
||||
init(userSession: UserSessionProtocol,
|
||||
appSettings: AppSettings,
|
||||
analytics: AnalyticsService,
|
||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
notificationCenterProtocol: NotificationCenterProtocol = NotificationCenter.default) {
|
||||
self.userSession = userSession
|
||||
self.appSettings = appSettings
|
||||
self.analytics = analytics
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.notificationCenterProtocol = notificationCenterProtocol
|
||||
|
||||
previouslySeenInvites = appSettings.seenInvites
|
||||
super.init(initialViewState: InvitesScreenViewState(), imageProvider: userSession.mediaProvider)
|
||||
@@ -55,6 +58,8 @@ class InvitesScreenViewModel: InvitesScreenViewModelType, InvitesScreenViewModel
|
||||
accept(invite: invite)
|
||||
case .decline(let invite):
|
||||
startDeclineFlow(invite: invite)
|
||||
case .appeared:
|
||||
notificationCenterProtocol.post(name: .invitesScreenAppeared, object: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,11 @@ struct InvitesScreen: View {
|
||||
noInvitesContent
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
context.send(viewAction: .appeared)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var noInvitesContent: some View {
|
||||
Text(L10n.screenInvitesEmptyList)
|
||||
.font(.compound.bodyLG)
|
||||
|
||||
@@ -33,18 +33,21 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let analytics: AnalyticsService
|
||||
private unowned let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let notificationCenterProtocol: NotificationCenterProtocol
|
||||
|
||||
init(timelineController: RoomTimelineControllerProtocol,
|
||||
mediaProvider: MediaProviderProtocol,
|
||||
roomProxy: RoomProxyProtocol,
|
||||
appSettings: AppSettings,
|
||||
analytics: AnalyticsService,
|
||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
notificationCenterProtocol: NotificationCenterProtocol = NotificationCenter.default) {
|
||||
self.roomProxy = roomProxy
|
||||
self.timelineController = timelineController
|
||||
self.appSettings = appSettings
|
||||
self.analytics = analytics
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.notificationCenterProtocol = notificationCenterProtocol
|
||||
|
||||
super.init(initialViewState: RoomScreenViewState(roomId: timelineController.roomID,
|
||||
roomTitle: roomProxy.roomTitle,
|
||||
@@ -214,6 +217,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
}
|
||||
|
||||
private func markRoomAsRead() async {
|
||||
notificationCenterProtocol.post(name: .roomMarkedAsRead, object: roomProxy.id)
|
||||
_ = await timelineController.markRoomAsRead()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user