mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• 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
42 lines
1.3 KiB
Swift
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
|
|
}
|
|
}
|
|
}
|