mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Coordinator stops (#207)
* Add `stop` method to `Coordinator` * Use new stop method to cleanup room screen * Call stop implicitly when removing a child coordinator * Revert placeholder avatar font change * Fix PR remarks
This commit is contained in:
@@ -58,4 +58,8 @@ final class RoomScreenCoordinator: Coordinator, Presentable {
|
||||
func toPresentable() -> UIViewController {
|
||||
roomScreenHostingController
|
||||
}
|
||||
|
||||
func stop() {
|
||||
roomScreenViewModel.stop()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ enum RoomScreenViewAction {
|
||||
case sendMessage
|
||||
case sendReaction(key: String, eventID: String)
|
||||
case cancelReply
|
||||
case viewDisappeared
|
||||
}
|
||||
|
||||
struct RoomScreenViewState: BindableState {
|
||||
|
||||
@@ -90,12 +90,14 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
MXLog.warning("React with \(key) failed. Not implemented.")
|
||||
case .cancelReply:
|
||||
state.composerMode = .default
|
||||
case .viewDisappeared:
|
||||
cancellables.forEach { $0.cancel() }
|
||||
cancellables.removeAll()
|
||||
state.contextMenuBuilder = nil
|
||||
}
|
||||
}
|
||||
|
||||
func stop() {
|
||||
cancellables.forEach { $0.cancel() }
|
||||
cancellables.removeAll()
|
||||
state.contextMenuBuilder = nil
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
|
||||
@@ -19,4 +19,6 @@ import Foundation
|
||||
@MainActor
|
||||
protocol RoomScreenViewModelProtocol {
|
||||
var context: RoomScreenViewModelType.Context { get }
|
||||
|
||||
func stop()
|
||||
}
|
||||
|
||||
@@ -41,9 +41,6 @@ struct RoomScreen: View {
|
||||
}
|
||||
}
|
||||
.alert(item: $context.alertInfo) { $0.alert }
|
||||
.onDisappear {
|
||||
context.send(viewAction: .viewDisappeared)
|
||||
}
|
||||
}
|
||||
|
||||
private func sendMessage() {
|
||||
|
||||
@@ -26,7 +26,8 @@ struct PlaceholderAvatarImage: View {
|
||||
Text(textForImage)
|
||||
.padding(4)
|
||||
.foregroundColor(.white)
|
||||
.font(.title2.bold())
|
||||
.font(.system(size: 200).weight(.semibold))
|
||||
.minimumScaleFactor(0.001)
|
||||
}
|
||||
.aspectRatio(1, contentMode: .fill)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user