RoomState.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // RoomState.swift
  3. // TUIRoomKit
  4. //
  5. // Created by janejntang on 2024/7/9.
  6. //
  7. import Foundation
  8. import RTCRoomEngine
  9. struct RoomInfo {
  10. var roomId = ""
  11. var name = ""
  12. var ownerId = ""
  13. var ownerName = ""
  14. var ownerAvatarUrl = ""
  15. var isSeatEnabled = false
  16. var password = ""
  17. var isMicrophoneDisableForAllUser = false
  18. var isCameraDisableForAllUser = false
  19. var isScreenShareDisableForAllUser = false
  20. var createTime: UInt = 0
  21. var isPasswordEnabled: Bool = false
  22. var isEnteredRoom = false
  23. var memberCount = 0
  24. init() {}
  25. init(with roomInfo: TUIRoomInfo) {
  26. self.roomId = roomInfo.roomId
  27. self.name = roomInfo.name
  28. self.ownerId = roomInfo.ownerId
  29. self.ownerName = roomInfo.ownerName
  30. self.ownerAvatarUrl = roomInfo.ownerAvatarUrl
  31. self.isSeatEnabled = roomInfo.isSeatEnabled
  32. self.password = roomInfo.password
  33. self.isMicrophoneDisableForAllUser = roomInfo.isMicrophoneDisableForAllUser
  34. self.isCameraDisableForAllUser = roomInfo.isCameraDisableForAllUser
  35. self.createTime = roomInfo.createTime
  36. self.isPasswordEnabled = roomInfo.password.count > 0
  37. self.memberCount = roomInfo.memberCount
  38. self.isScreenShareDisableForAllUser = roomInfo.isScreenShareDisableForAllUser
  39. }
  40. }
  41. extension TUIRoomInfo {
  42. convenience init(roomInfo: RoomInfo) {
  43. self.init()
  44. self.roomId = roomInfo.roomId
  45. self.name = roomInfo.name
  46. self.isSeatEnabled = roomInfo.isSeatEnabled
  47. self.password = roomInfo.password
  48. self.isMicrophoneDisableForAllUser = roomInfo.isMicrophoneDisableForAllUser
  49. self.isCameraDisableForAllUser = roomInfo.isCameraDisableForAllUser
  50. self.seatMode = .applyToTake
  51. self.isScreenShareDisableForAllUser = roomInfo.isScreenShareDisableForAllUser
  52. }
  53. }