mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
pr suggestions
This commit is contained in:
@@ -105,14 +105,14 @@ extension UNMutableNotificationContent {
|
||||
forcePlaceholder: Bool = false) async throws -> UNMutableNotificationContent {
|
||||
var fetchedImage: INImage?
|
||||
let image: INImage
|
||||
if !forcePlaceholder, let mediaSource = icon.mediaSource {
|
||||
switch await mediaProvider?.loadThumbnailForSource(source: mediaSource, size: .init(width: 100, height: 100)) {
|
||||
if !forcePlaceholder,
|
||||
let mediaProvider,
|
||||
let mediaSource = icon.mediaSource {
|
||||
switch await mediaProvider.loadThumbnailForSource(source: mediaSource, size: .init(width: 100, height: 100)) {
|
||||
case .success(let data):
|
||||
fetchedImage = INImage(imageData: data)
|
||||
case .failure(let error):
|
||||
MXLog.error("Couldn't add sender icon: \(error)")
|
||||
case .none:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,15 @@ enum RoomAvatar: Equatable {
|
||||
case room(id: String, name: String?, avatarURL: URL?)
|
||||
/// An avatar generated from the room's heroes.
|
||||
case heroes([UserProfileProxy])
|
||||
|
||||
var removingAvatar: RoomAvatar {
|
||||
switch self {
|
||||
case let .room(id, name, _):
|
||||
return .room(id: id, name: name, avatarURL: nil)
|
||||
case let .heroes(users):
|
||||
return .heroes(users.map { .init(userID: $0.userID, displayName: $0.displayName, avatarURL: nil) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A view that shows the avatar for a room, or a cluster of heroes if provided.
|
||||
|
||||
@@ -30,7 +30,7 @@ final class UserPreference<T: Codable> {
|
||||
/// - key: The key used to store and retrieve the value.
|
||||
/// - defaultValue: The default value to use if no stored value exists or if `forceDefault` is `true`.
|
||||
/// - keyedStorage: The storage instance where the value is saved.
|
||||
/// - forceDefault: A publisher that determines whether the default value should always be used. Defaults to publish`false`. Useful in the context of MDM settings.
|
||||
/// - forceDefault: A publisher that determines whether the default value should always be used. Defaults to publish `false`. Useful in the context of remote settings.
|
||||
init(key: String,
|
||||
defaultValue: @autoclosure @escaping () -> T,
|
||||
keyedStorage: any KeyedStorage<T>,
|
||||
|
||||
Reference in New Issue
Block a user