增加换肤功能
This commit is contained in:
58
TUIKit/TUIRoomKit/Source/Store/View/ViewActions.swift
Normal file
58
TUIKit/TUIRoomKit/Source/Store/View/ViewActions.swift
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ViewActions.swift
|
||||
// TUIRoomKit
|
||||
//
|
||||
// Created by CY zhao on 2024/7/9.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum ViewActions {
|
||||
static let key = "action.view"
|
||||
static let toastActionKey = key + ".showToast"
|
||||
|
||||
static let showToast = ActionTemplate(id: toastActionKey, payloadType: ToastInfo.self)
|
||||
}
|
||||
|
||||
enum ScheduleViewActions {
|
||||
static let key = ViewActions.key + ".scheduleView"
|
||||
|
||||
static let refreshConferenceList = ActionTemplate(id: key.appending(".refreshConferenceList"))
|
||||
static let stopRefreshList = ActionTemplate(id: key.appending(".stopRefreshList"))
|
||||
|
||||
static let popDetailView = ActionTemplate(id: key.appending(".popDetailView"))
|
||||
static let resetPopDetailFlag = ActionTemplate(id: key.appending(".resetPopDetailFlag"))
|
||||
}
|
||||
|
||||
enum InvitationViewActions {
|
||||
static let key = ViewActions.key + ".invitationView"
|
||||
|
||||
static let dismissInvitationView = ActionTemplate(id: key.appending(".dismissInvitationView"))
|
||||
static let resetInvitationFlag = ActionTemplate(id: key.appending(".resetInvitationFlag"))
|
||||
static let showInvitationPopupView = ActionTemplate(id: key.appending(".showInvitationPopupView"))
|
||||
static let resetPopupViewFlag = ActionTemplate(id: key.appending(".resetPopupViewFlag"))
|
||||
}
|
||||
|
||||
struct ToastInfo: Identifiable {
|
||||
enum Position {
|
||||
case center
|
||||
case bottom
|
||||
}
|
||||
let id: UUID
|
||||
let duration: TimeInterval
|
||||
let position: Position
|
||||
let message: String
|
||||
|
||||
init(message: String, position: Position = .center, duration: TimeInterval = 1.5) {
|
||||
id = UUID()
|
||||
self.message = message
|
||||
self.position = position
|
||||
self.duration = duration
|
||||
}
|
||||
}
|
||||
|
||||
extension ToastInfo: Equatable {
|
||||
static func ==(lhs: ToastInfo, rhs: ToastInfo) -> Bool{
|
||||
return lhs.id == rhs.id || lhs.message == rhs.message
|
||||
}
|
||||
}
|
||||
38
TUIKit/TUIRoomKit/Source/Store/View/ViewReducers.swift
Normal file
38
TUIKit/TUIRoomKit/Source/Store/View/ViewReducers.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// ViewReducers.swift
|
||||
// TUIRoomKit
|
||||
//
|
||||
// Created by CY zhao on 2024/7/15.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
let scheduleViewReducer = Reducer<ScheduleViewState>(
|
||||
ReduceOn(ScheduleViewActions.refreshConferenceList, reduce: { state, action in
|
||||
state.shouldRefreshList = true
|
||||
}),
|
||||
ReduceOn(ScheduleViewActions.stopRefreshList, reduce: { state, action in
|
||||
state.shouldRefreshList = false
|
||||
}),
|
||||
ReduceOn(ScheduleViewActions.popDetailView, reduce: { state, action in
|
||||
state.detailViewPopFlag = true
|
||||
}),
|
||||
ReduceOn(ScheduleViewActions.resetPopDetailFlag, reduce: { state, action in
|
||||
state.detailViewPopFlag = false
|
||||
})
|
||||
)
|
||||
|
||||
let invitationViewReducer = Reducer<InvitationViewState> (
|
||||
ReduceOn(InvitationViewActions.dismissInvitationView, reduce: { state, action in
|
||||
state.invitationViewDismissFlag = true
|
||||
}),
|
||||
ReduceOn(InvitationViewActions.resetInvitationFlag, reduce: { state, action in
|
||||
state.invitationViewDismissFlag = false
|
||||
}),
|
||||
ReduceOn(InvitationViewActions.showInvitationPopupView, reduce: { state, action in
|
||||
state.showInvitationPopupView = true
|
||||
}),
|
||||
ReduceOn(InvitationViewActions.resetPopupViewFlag, reduce: { state, action in
|
||||
state.showInvitationPopupView = false
|
||||
})
|
||||
)
|
||||
18
TUIKit/TUIRoomKit/Source/Store/View/ViewSelectors.swift
Normal file
18
TUIKit/TUIRoomKit/Source/Store/View/ViewSelectors.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// ViewSelectors.swift
|
||||
// TUIRoomKit
|
||||
//
|
||||
// Created by CY zhao on 2024/7/15.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum ViewSelectors {
|
||||
private static let getScheduleStatus = Selector(keyPath: \ViewState.scheduleViewState)
|
||||
static let getRefreshListFlag = Selector.with(getScheduleStatus, projector: \ScheduleViewState.shouldRefreshList)
|
||||
static let getPopDetailFlag = Selector.with(getScheduleStatus, projector: \ScheduleViewState.detailViewPopFlag)
|
||||
|
||||
private static let getInvitationStatus = Selector(keyPath: \ViewState.invitationViewState)
|
||||
static let getDismissInvitationFlag = Selector.with(getInvitationStatus, projector: \InvitationViewState.invitationViewDismissFlag)
|
||||
static let getShowinvitationPopupView = Selector.with(getInvitationStatus, projector: \InvitationViewState.showInvitationPopupView)
|
||||
}
|
||||
Reference in New Issue
Block a user