mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Autoplay the next voice message if it is the next timeline item. (#6089)
This commit is contained in:
@@ -64,4 +64,18 @@ nonisolated extension Array where Element == RoomTimelineItemProtocol {
|
||||
func firstUsingStableID(_ id: TimelineItemIdentifier) -> Element? {
|
||||
first { $0.id.uniqueID == id.uniqueID }
|
||||
}
|
||||
|
||||
/// The voice message that directly follows the item with the given ID, if there is one.
|
||||
///
|
||||
/// Decorations such as date separators and the read marker are ignored, but any other
|
||||
/// kind of item in between means that no voice message directly follows.
|
||||
func voiceMessageDirectlyFollowing(_ id: TimelineItemIdentifier) -> VoiceMessageRoomTimelineItem? {
|
||||
guard let index = firstIndex(where: { $0.id.uniqueID == id.uniqueID }) else { return nil }
|
||||
|
||||
for item in self[index...].dropFirst() where !(item is DecorationTimelineItemProtocol) {
|
||||
return item as? VoiceMessageRoomTimelineItem
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,16 @@ nonisolated extension URL {
|
||||
return url
|
||||
}
|
||||
|
||||
/// The directory holding the sounds that iOS uses for its own interface.
|
||||
static let systemSoundsDirectory: URL = {
|
||||
let systemRoot = if let simulatorRoot = ProcessInfo.processInfo.environment["SIMULATOR_ROOT"] {
|
||||
URL(filePath: simulatorRoot)
|
||||
} else {
|
||||
URL(filePath: "/")
|
||||
}
|
||||
return systemRoot.appending(components: "System", "Library", "Audio", "UISounds", directoryHint: .isDirectory)
|
||||
}()
|
||||
|
||||
var globalProxy: String? {
|
||||
guard let proxySettings = CFNetworkCopySystemProxySettings()?.takeRetainedValue() else {
|
||||
MXLog.error("Failed retrieving proxy settings")
|
||||
|
||||
Reference in New Issue
Block a user