mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Periphery cleanup (#5893)
This commit is contained in:
@@ -14,13 +14,9 @@ nonisolated protocol NSEUserSessionProtocol {
|
||||
var inviteAvatarsVisibility: InviteAvatars { get async }
|
||||
var mediaPreviewVisibility: MediaPreviews { get async }
|
||||
var threadsEnabled: Bool { get }
|
||||
|
||||
func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol?
|
||||
func roomForIdentifier(_ roomID: String) -> Room?
|
||||
}
|
||||
|
||||
final nonisolated class NSEUserSession: NSEUserSessionProtocol {
|
||||
private let sessionDirectories: SessionDirectories
|
||||
private let appSettings: CommonSettingsProtocol
|
||||
private let baseClient: Client
|
||||
private let notificationClient: NotificationClient
|
||||
@@ -61,7 +57,6 @@ final nonisolated class NSEUserSession: NSEUserSessionProtocol {
|
||||
clientSessionDelegate: ClientSessionDelegate,
|
||||
appHooks: AppHooks,
|
||||
appSettings: CommonSettingsProtocol) async throws {
|
||||
sessionDirectories = credentials.restorationToken.sessionDirectories
|
||||
userID = credentials.userID
|
||||
self.appSettings = appSettings
|
||||
|
||||
@@ -99,7 +94,6 @@ final nonisolated class NSEUserSession: NSEUserSessionProtocol {
|
||||
switch notificationStatus {
|
||||
case .event(let notification):
|
||||
return NotificationItemProxy(notificationItem: notification,
|
||||
eventID: eventID,
|
||||
receiverID: userID,
|
||||
roomID: roomID)
|
||||
case .eventNotFound:
|
||||
@@ -114,7 +108,7 @@ final nonisolated class NSEUserSession: NSEUserSessionProtocol {
|
||||
}
|
||||
} catch {
|
||||
MXLog.error("Could not get notification's content creating an empty notification instead, error: \(error)")
|
||||
return EmptyNotificationItemProxy(eventID: eventID, roomID: roomID, receiverID: userID)
|
||||
return EmptyNotificationItemProxy(roomID: roomID, receiverID: userID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +133,7 @@ private final nonisolated class ClientDelegateWrapper: ClientDelegate {
|
||||
MXLog.error("Received authentication error, the NSE can't handle this.")
|
||||
}
|
||||
|
||||
// periphery:ignore - required by the SDK's delegate protocol
|
||||
func didRefreshTokens() {
|
||||
MXLog.info("Delegating session updates to the ClientSessionDelegate.")
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import UserNotifications
|
||||
|
||||
nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol {
|
||||
let notificationItem: NotificationItem
|
||||
let eventID: String
|
||||
let receiverID: String
|
||||
let roomID: String
|
||||
|
||||
@@ -41,10 +40,6 @@ nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol {
|
||||
notificationItem.roomInfo.isSpace
|
||||
}
|
||||
|
||||
var isRoomDirect: Bool {
|
||||
notificationItem.roomInfo.isDirect
|
||||
}
|
||||
|
||||
var isDM: Bool {
|
||||
notificationItem.roomInfo.isDm
|
||||
}
|
||||
@@ -58,10 +53,6 @@ nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
var roomJoinedMembers: Int {
|
||||
Int(notificationItem.roomInfo.joinedMembersCount)
|
||||
}
|
||||
|
||||
var isNoisy: Bool {
|
||||
notificationItem.isNoisy ?? false
|
||||
}
|
||||
@@ -92,8 +83,6 @@ nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol {
|
||||
}
|
||||
|
||||
nonisolated struct EmptyNotificationItemProxy: NotificationItemProxyProtocol {
|
||||
let eventID: String
|
||||
|
||||
var event: NotificationEvent? {
|
||||
nil
|
||||
}
|
||||
@@ -122,10 +111,6 @@ nonisolated struct EmptyNotificationItemProxy: NotificationItemProxyProtocol {
|
||||
false
|
||||
}
|
||||
|
||||
var isRoomDirect: Bool {
|
||||
false
|
||||
}
|
||||
|
||||
var isDM: Bool {
|
||||
false
|
||||
}
|
||||
@@ -142,10 +127,6 @@ nonisolated struct EmptyNotificationItemProxy: NotificationItemProxyProtocol {
|
||||
nil
|
||||
}
|
||||
|
||||
var roomJoinedMembers: Int {
|
||||
0
|
||||
}
|
||||
|
||||
var hasMention: Bool {
|
||||
false
|
||||
}
|
||||
|
||||
@@ -28,12 +28,8 @@ nonisolated protocol NotificationItemProxyProtocol: Sendable {
|
||||
|
||||
var roomAvatarMediaSource: MediaSourceProxy? { get }
|
||||
|
||||
var roomJoinedMembers: Int { get }
|
||||
|
||||
var isRoomSpace: Bool { get }
|
||||
|
||||
var isRoomDirect: Bool { get }
|
||||
|
||||
var isRoomPrivate: Bool { get }
|
||||
|
||||
var isDM: Bool { get }
|
||||
|
||||
Reference in New Issue
Block a user