未关注状态 | 关注状态 | 主播信息面板 |
| | |
TUILiveKit/iOS/TUILiveKit/Source/Common/View
目录下的源代码,来实现您满意的 UI 效果。为了您更方便的定制 UI,这里对关注功能相关的文件做了介绍。// 文件位置:TUILiveKit/iOS/TUILiveKit/Source/Common/View/
View // 直播间信息UI组件的实现目录├── RoomInfoPanelView.swift // 直播间信息详情面板视图的具体实现└── RoomInfoView.swift // 直播间信息视图的具体实现,点击该视图,会展示详情面板视图
// 文件位置:TUILiveKit/iOS/TUILiveKit/Source/Service/UserService.swift
func followUser(userId: String) -> AnyPublisher<Bool, InternalError> {return Future<Bool, InternalError> { [weak self] promise inguard let self = self else { return }self.imManager?.followUser([userId]) { result inpromise(.success(true))} fail: { err, message inlet error = InternalError(error: TIMError.invalidUserId, message: TIMError.invalidUserId.description)promise(.failure(error))}}.eraseToAnyPublisher()}
// 文件位置:TUILiveKit/iOS/TUILiveKit/Source/Service/UserService.swift
func unfollowUser(userId: String) -> AnyPublisher<Bool, InternalError> {return Future<Bool, InternalError> { [weak self] promise inguard let self = self, let imManager = self.imManager else { return }imManager.unfollowUser([userId]) { result inpromise(.success(true))} fail: { err, message inlet error = InternalError(error: TIMError.invalidUserId, message: TIMError.invalidUserId.description)promise(.failure(error))}}.eraseToAnyPublisher()}
// 文件位置:TUILiveKit/iOS/TUILiveKit/Source/Service/UserService.swift
func checkFollowType(userId: String) -> AnyPublisher<V2TIMFollowType, InternalError> {return Future<V2TIMFollowType, InternalError> { [weak self] promise inguard let self = self, let imManager = self.imManager else { return }imManager.checkFollowType([userId], succ: { result inguard let followType = result?.first?.followType else { return }promise(.success(followType))}, fail: { err, message inlet error = InternalError(error: TIMError.invalidUserId, message: TIMError.invalidUserId.description)promise(.failure(error))})}.eraseToAnyPublisher()}
// 文件位置:TUILiveKit/iOS/TUILiveKit/Source/Service/UserService.swift
func fetchFollowersCount(userId: String) -> AnyPublisher<Int, InternalError> {return Future<Int, InternalError> { [weak self] promise inguard let self = self, let imManager = self.imManager else { return }imManager.getUserFollowInfo([userId], succ: { followInfo inlet followersCount = Int(followInfo?.first?.followersCount ?? 0)promise(.success(followersCount))}, fail: { err, message inlet error = InternalError(error: TIMError.invalidUserId, message: TIMError.invalidUserId.description)promise(.failure(error))})}.eraseToAnyPublisher()}
本页内容是否解决了您的问题?