mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Use the room heroes when computing a DM avatar. (#2900)
* Use room heroes for DM avatar content ID. * Use RoomAvatar.heroes for the DM Details stack.
This commit is contained in:
@@ -8056,6 +8056,11 @@ class RoomProxyMock: RoomProxyProtocol {
|
||||
var underlyingOwnUserID: String!
|
||||
var name: String?
|
||||
var topic: String?
|
||||
var avatar: RoomAvatar {
|
||||
get { return underlyingAvatar }
|
||||
set(value) { underlyingAvatar = value }
|
||||
}
|
||||
var underlyingAvatar: RoomAvatar!
|
||||
var avatarURL: URL?
|
||||
var membersPublisher: CurrentValuePublisher<[RoomMemberProxyProtocol], Never> {
|
||||
get { return underlyingMembersPublisher }
|
||||
|
||||
@@ -10733,6 +10733,71 @@ open class RoomSDKMock: MatrixRustSDK.Room {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - heroes
|
||||
|
||||
var heroesUnderlyingCallsCount = 0
|
||||
open var heroesCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return heroesUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = heroesUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
heroesUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
heroesUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var heroesCalled: Bool {
|
||||
return heroesCallsCount > 0
|
||||
}
|
||||
|
||||
var heroesUnderlyingReturnValue: [RoomHero]!
|
||||
open var heroesReturnValue: [RoomHero]! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return heroesUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: [RoomHero]? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = heroesUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
heroesUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
heroesUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var heroesClosure: (() -> [RoomHero])?
|
||||
|
||||
open override func heroes() -> [RoomHero] {
|
||||
heroesCallsCount += 1
|
||||
if let heroesClosure = heroesClosure {
|
||||
return heroesClosure()
|
||||
} else {
|
||||
return heroesReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - id
|
||||
|
||||
var idUnderlyingCallsCount = 0
|
||||
|
||||
Reference in New Issue
Block a user