mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
SDK Changes Refactor (#1312)
* internal id * notification refactor * client proxy refactor * required self * better identifier system * using the event id when required * tests fixed * tested some stuff * fixed merge conflict * improved the test wait * animation disabled * Bump Rust SDK version to 1.0.98-alpha (#1310) * code improvement * pause sync * pr suggestions * result * Apply suggestions from code review Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> * enum based debug identifier --------- Co-authored-by: aringenbach <80891108+aringenbach@users.noreply.github.com> Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -18,7 +18,7 @@ import Combine
|
||||
import SwiftUI
|
||||
|
||||
struct ReportContentScreenCoordinatorParameters {
|
||||
let itemID: String
|
||||
let eventID: String
|
||||
let senderID: String
|
||||
let roomProxy: RoomProxyProtocol
|
||||
weak var userIndicatorController: UserIndicatorControllerProtocol?
|
||||
@@ -39,7 +39,7 @@ final class ReportContentScreenCoordinator: CoordinatorProtocol {
|
||||
init(parameters: ReportContentScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = ReportContentScreenViewModel(itemID: parameters.itemID, senderID: parameters.senderID, roomProxy: parameters.roomProxy)
|
||||
viewModel = ReportContentScreenViewModel(eventID: parameters.eventID, senderID: parameters.senderID, roomProxy: parameters.roomProxy)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
@@ -20,7 +20,7 @@ import SwiftUI
|
||||
typealias ReportContentScreenViewModelType = StateStoreViewModel<ReportContentScreenViewState, ReportContentScreenViewAction>
|
||||
|
||||
class ReportContentScreenViewModel: ReportContentScreenViewModelType, ReportContentScreenViewModelProtocol {
|
||||
private let itemID: String
|
||||
private let eventID: String
|
||||
private let senderID: String
|
||||
private let roomProxy: RoomProxyProtocol
|
||||
private let actionsSubject: PassthroughSubject<ReportContentScreenViewModelAction, Never> = .init()
|
||||
@@ -29,8 +29,8 @@ class ReportContentScreenViewModel: ReportContentScreenViewModelType, ReportCont
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(itemID: String, senderID: String, roomProxy: RoomProxyProtocol) {
|
||||
self.itemID = itemID
|
||||
init(eventID: String, senderID: String, roomProxy: RoomProxyProtocol) {
|
||||
self.eventID = eventID
|
||||
self.senderID = senderID
|
||||
self.roomProxy = roomProxy
|
||||
|
||||
@@ -53,7 +53,7 @@ class ReportContentScreenViewModel: ReportContentScreenViewModelType, ReportCont
|
||||
private func submitReport() async {
|
||||
actionsSubject.send(.submitStarted)
|
||||
|
||||
if case let .failure(error) = await roomProxy.reportContent(itemID, reason: state.bindings.reasonText) {
|
||||
if case let .failure(error) = await roomProxy.reportContent(eventID, reason: state.bindings.reasonText) {
|
||||
MXLog.error("Submit Report Content failed: \(error)")
|
||||
actionsSubject.send(.submitFailed(error: error))
|
||||
return
|
||||
|
||||
@@ -84,7 +84,7 @@ struct ReportContentScreen: View {
|
||||
// MARK: - Previews
|
||||
|
||||
struct ReportContentScreen_Previews: PreviewProvider {
|
||||
static let viewModel = ReportContentScreenViewModel(itemID: "",
|
||||
static let viewModel = ReportContentScreenViewModel(eventID: "",
|
||||
senderID: "",
|
||||
roomProxy: RoomProxyMock(with: .init(displayName: nil)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user