mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
added the strings for the pin banner, the room list and the notification content builder
This commit is contained in:
@@ -207,6 +207,13 @@ nonisolated struct NotificationContentBuilder {
|
||||
using: mediaProvider,
|
||||
mediaSource: .init(source: content.source,
|
||||
mimeType: content.info?.mimetype))
|
||||
case .gallery(content: let content):
|
||||
// A notification can only show one attachment, so the gallery is represented by its first.
|
||||
if let mediaSource = content.itemtypes.firstPreviewableMediaSource {
|
||||
await addMediaAttachment(notificationContent: ¬ificationContent,
|
||||
using: mediaProvider,
|
||||
mediaSource: mediaSource)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
@@ -362,3 +369,24 @@ private nonisolated struct NotificationIcon {
|
||||
groupInfo != nil
|
||||
}
|
||||
}
|
||||
|
||||
private nonisolated extension [GalleryItemType] {
|
||||
/// The media source of the first attachment that a notification is able to show, skipping the
|
||||
/// types that it can't such as documents.
|
||||
var firstPreviewableMediaSource: MediaSourceProxy? {
|
||||
for itemType in self {
|
||||
switch itemType {
|
||||
case .image(let content):
|
||||
return .init(source: content.source, mimeType: content.info?.mimetype)
|
||||
case .video(let content):
|
||||
return .init(source: content.source, mimeType: content.info?.mimetype)
|
||||
case .audio(let content):
|
||||
return .init(source: content.source, mimeType: content.info?.mimetype)
|
||||
case .file, .other:
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user