Skip to content

Commit 717d4e7

Browse files
TangjianingAbySwifter
authored andcommitted
【iOS】Modify the issue of inaccurate participants in conference details.
1 parent 421866a commit 717d4e7

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

iOS/TUIRoomKit/Source/View/ConferenceOptions/ScheduleConference/Store/ScheduleConferenceStore.swift

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import Combine
99

1010
protocol ScheduleConferenceStore {
11-
func fetchAttendees(cursor: String)
1211
func update(conference info: ConferenceInfo)
13-
func fetchRoomInfo(roomId: String)
12+
func fetchAttendees(cursor: String)
13+
func fetchRoomPassword(roomId: String)
1414
func select<Value:Equatable>(_ selector: Selector<ConferenceInfo, Value>) -> AnyPublisher<Value, Never>
1515
var conferenceInfo: ConferenceInfo { get }
1616
}
@@ -19,7 +19,8 @@ class ScheduleConferenceStoreProvider {
1919
static let updateConferenceInfo = ActionTemplate(id: "updateConferenceInfo", payloadType: ConferenceInfo.self)
2020
static let fetchAttendeeList = ActionTemplate(id: "fetchAttendeeList", payloadType: (String, String, Int).self)
2121
static let updateAttendeeList = ActionTemplate(id: "updateAttendeeList", payloadType: ([UserInfo], String, UInt).self)
22-
static let fetchRoomInfo = ActionTemplate(id: ".fetchRoomInfo", payloadType: String.self)
22+
static let fetchRoomPassword = ActionTemplate(id: ".fetchRoomPassword", payloadType: String.self)
23+
static let updateRoomPassword = ActionTemplate(id: "updateRoomPassword", payloadType: String.self)
2324
static let attendeesPerFetch = 20
2425

2526
// MARK: - private property.
@@ -37,6 +38,10 @@ class ScheduleConferenceStoreProvider {
3738
state.attendeeListResult.attendeeList.append(contentsOf: action.payload.0)
3839
state.attendeeListResult.fetchCursor = action.payload.1
3940
state.attendeeListResult.totalCount = action.payload.2
41+
}),
42+
ReduceOn(updateRoomPassword, reduce: { state, action in
43+
state.basicInfo.password = action.payload
44+
state.basicInfo.isPasswordEnabled = !action.payload.isEmpty
4045
})
4146
)
4247

@@ -47,17 +52,17 @@ class ScheduleConferenceStoreProvider {
4752
}
4853

4954
extension ScheduleConferenceStoreProvider: ScheduleConferenceStore {
55+
func update(conference info: ConferenceInfo) {
56+
store.dispatch(action: ScheduleConferenceStoreProvider.updateConferenceInfo(payload: info))
57+
}
58+
5059
func fetchAttendees(cursor: String) {
5160
let conferenceId = conferenceInfo.basicInfo.roomId
5261
store.dispatch(action: ScheduleConferenceStoreProvider.fetchAttendeeList(payload: (conferenceId, cursor, ScheduleConferenceStoreProvider.attendeesPerFetch)))
5362
}
5463

55-
func update(conference info: ConferenceInfo) {
56-
store.dispatch(action: ScheduleConferenceStoreProvider.updateConferenceInfo(payload: info))
57-
}
58-
59-
func fetchRoomInfo(roomId: String) {
60-
store.dispatch(action: ScheduleConferenceStoreProvider.fetchRoomInfo(payload: roomId))
64+
func fetchRoomPassword(roomId: String) {
65+
store.dispatch(action: ScheduleConferenceStoreProvider.fetchRoomPassword(payload: roomId))
6166
}
6267

6368
func select<Value>(_ selector: Selector<ConferenceInfo, Value>) -> AnyPublisher<Value, Never> where Value : Equatable {
@@ -88,12 +93,12 @@ class scheduleConferenceEffects: Effects {
8893
.eraseToAnyPublisher()
8994
}
9095

91-
let fetchRoomInfo = Effect<Environment>.dispatchingOne { actions, environment in
92-
actions.wasCreated(from: ScheduleConferenceStoreProvider.fetchRoomInfo)
96+
let fetchRoomPassword = Effect<Environment>.dispatchingOne { actions, environment in
97+
actions.wasCreated(from: ScheduleConferenceStoreProvider.fetchRoomPassword)
9398
.flatMap { action in
9499
environment.conferenceListService.fetchConferenceInfo(roomId: action.payload)
95100
.map { conferenceInfo in
96-
ScheduleConferenceStoreProvider.updateConferenceInfo(payload: conferenceInfo)
101+
ScheduleConferenceStoreProvider.updateRoomPassword(payload: conferenceInfo.basicInfo.password)
97102
}
98103
.catch { error -> Just<Action> in
99104
Just(ErrorActions.throwError(payload: error))

iOS/TUIRoomKit/Source/View/ConferenceOptions/ScheduleConference/View/ScheduleDetails/ScheduleDetailsDataHelper.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class ScheduleDetailsDataHelper: ScheduleConferenceDataHelper {
117117
item?.bindStateClosure = { cell, cancellableSet in
118118
let selector = Selector(keyPath: \ConferenceInfo.attendeeListResult.attendeeList)
119119
store.select(selector)
120+
.removeDuplicates()
120121
.receive(on: RunLoop.main)
121122
.sink { [weak cell] list in
122123
if let cell = cell as? ScheduleTabCell {

iOS/TUIRoomKit/Source/View/ConferenceOptions/ScheduleConference/View/ScheduleDetails/ScheduleDetailsViewController .swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class ScheduleDetailsViewController: UIViewController {
114114
self.rootView.tableView.reloadData()
115115
}
116116
.store(in: &cancellableSet)
117-
store.fetchRoomInfo(roomId: conferenceInfo.basicInfo.roomId)
117+
store.fetchRoomPassword(roomId: conferenceInfo.basicInfo.roomId)
118118
}
119119

120120
private func initState() {

0 commit comments

Comments
 (0)