Files
Morgan Pretty 1a5b00a95b Updated the home screen to be based on the new ObservationManager
• Rebuild the observation system so UI updates can be triggered arbitrarily rather than just from database changes (requires manual evert firing)
• Refactored the TypingIndicators to be an actor
• Fixed an issue where sharing something from within the app via Session wouldn't update the conversation list content
2025-07-08 16:21:25 +10:00

42 lines
1.3 KiB
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import Foundation
import GRDB
import SessionUtilitiesKit
extension MessageReceiver {
internal static func handleTypingIndicator(
_ db: ObservingDatabase,
threadId: String,
threadVariant: SessionThread.Variant,
message: TypingIndicator,
using dependencies: Dependencies
) throws {
guard try SessionThread.exists(db, id: threadId) else { return }
switch message.kind {
case .started:
Task {
await dependencies[singleton: .typingIndicators].startIfNeeded(
threadId: threadId,
threadVariant: threadVariant,
direction: .incoming,
timestampMs: message.sentTimestampMs.map { Int64($0) }
)
}
case .stopped:
Task {
await dependencies[singleton: .typingIndicators].didStopTyping(
threadId: threadId,
direction: .incoming
)
}
default:
Log.warn(.messageReceiver, "Unknown TypingIndicator Kind ignored")
return
}
}
}