mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
#53 - Refactored various components:
- updated the authentication coordinator to use async await - replaced the UserSession with a ClientProxy (similar to the RoomProxy) - renamed `completion` to `callback` on the coordinators and view models - renamed `viewModelResult` to `viewModelAction` - introduced back UserSession as a user specific service container
This commit is contained in:
committed by
Stefan Ceriu
parent
edf765b7cd
commit
1b4d3a650e
@@ -17,12 +17,12 @@ class MemberDetailProvider: MemberDetailProviderProtocol {
|
||||
self.roomProxy = roomProxy
|
||||
}
|
||||
|
||||
func avatarURLForUserId(_ userId: String) -> String? {
|
||||
func avatarURLStringForUserId(_ userId: String) -> String? {
|
||||
memberAvatars[userId]
|
||||
}
|
||||
|
||||
func loadAvatarURLForUserId(_ userId: String) async -> Result<String?, MemberDetailProviderError> {
|
||||
if let avatarURL = avatarURLForUserId(userId) {
|
||||
func loadAvatarURLStringForUserId(_ userId: String) async -> Result<String?, MemberDetailProviderError> {
|
||||
if let avatarURL = avatarURLStringForUserId(userId) {
|
||||
return .success(avatarURL)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ enum MemberDetailProviderError: Error {
|
||||
|
||||
@MainActor
|
||||
protocol MemberDetailProviderProtocol {
|
||||
func avatarURLForUserId(_ userId: String) -> String?
|
||||
func loadAvatarURLForUserId(_ userId: String) async -> Result<String?, MemberDetailProviderError>
|
||||
func avatarURLStringForUserId(_ userId: String) -> String?
|
||||
func loadAvatarURLStringForUserId(_ userId: String) async -> Result<String?, MemberDetailProviderError>
|
||||
|
||||
func displayNameForUserId(_ userId: String) -> String?
|
||||
func loadDisplayNameForUserId(_ userId: String) async -> Result<String?, MemberDetailProviderError>
|
||||
|
||||
@@ -14,6 +14,8 @@ struct MockRoomSummary: RoomSummaryProtocol {
|
||||
|
||||
var name: String?
|
||||
|
||||
var displayName: String?
|
||||
|
||||
var topic: String?
|
||||
|
||||
var isDirect: Bool = false
|
||||
@@ -24,8 +26,6 @@ struct MockRoomSummary: RoomSummaryProtocol {
|
||||
|
||||
var isTombstoned: Bool = false
|
||||
|
||||
var displayName: String?
|
||||
|
||||
var lastMessage: EventBrief?
|
||||
|
||||
var avatar: UIImage?
|
||||
|
||||
@@ -124,11 +124,11 @@ class RoomSummary: RoomSummaryProtocol {
|
||||
}
|
||||
|
||||
private func loadAvatar() async {
|
||||
guard let avatarURL = roomProxy.avatarURL else {
|
||||
guard let avatarURLString = roomProxy.avatarURL else {
|
||||
return
|
||||
}
|
||||
|
||||
switch await mediaProvider.loadImageFromURL(avatarURL) {
|
||||
switch await mediaProvider.loadImageFromURLString(avatarURLString) {
|
||||
case .success(let avatar):
|
||||
self.avatar = avatar
|
||||
case .failure(let error):
|
||||
|
||||
Reference in New Issue
Block a user