Security and privacy part 1 (#3617)

* added the security and settings button in details

* added content to the view

* added enable encryption alert

* updated preview tests and the UI

* removed wrong plists committed by mistake

* pr suggestions
This commit is contained in:
Mauro
2024-12-13 18:29:17 +01:00
committed by GitHub
parent e5da7ebd2d
commit b11fbc6cce
20 changed files with 398 additions and 16 deletions
@@ -405,6 +405,11 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
return .mediaEventsTimeline(previousState: fromState)
case (.mediaEventsTimeline(let previousState), .dismissMediaEventsTimeline):
return previousState
case (.roomDetails, .presentSecurityAndPrivacyScreen):
return .securityAndPrivacy(previousState: fromState)
case (.securityAndPrivacy(let previousState), .dismissSecurityAndPrivacyScreen):
return previousState
default:
return nil
@@ -571,6 +576,11 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
Task { await self.startMediaEventsTimelineFlow() }
case (.mediaEventsTimeline, .dismissMediaEventsTimeline, .roomDetails):
break
case (.roomDetails, .presentSecurityAndPrivacyScreen, .securityAndPrivacy):
presentSecurityAndPrivacyScreen()
case (.securityAndPrivacy, .dismissSecurityAndPrivacyScreen, .roomDetails):
break
// Child flow
case (_, .startChildFlow(let roomID, let via, let entryPoint), .presentingChild):
@@ -849,6 +859,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
stateMachine.tryEvent(.presentKnockRequestsListScreen)
case .presentMediaEventsTimeline:
stateMachine.tryEvent(.presentMediaEventsTimeline)
case .presentSecurityAndPrivacyScreen:
stateMachine.tryEvent(.presentSecurityAndPrivacyScreen)
}
}
.store(in: &cancellables)
@@ -1453,6 +1465,24 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
}
private func presentSecurityAndPrivacyScreen() {
let coordinator = SecurityAndPrivacyScreenCoordinator(parameters: .init(roomProxy: roomProxy))
coordinator.actionsPublisher.sink { [weak self] action in
guard let self else { return }
switch action {
case .done:
break
}
}
.store(in: &cancellables)
navigationStackCoordinator.push(coordinator) { [weak self] in
self?.stateMachine.tryEvent(.dismissSecurityAndPrivacyScreen)
}
}
// MARK: - Other flows
private func startChildFlow(for roomID: String, via: [String], entryPoint: RoomFlowCoordinatorEntryPoint) async {
@@ -1604,6 +1634,7 @@ private extension RoomFlowCoordinator {
case resolveSendFailure
case knockRequestsList(previousState: State)
case mediaEventsTimeline(previousState: State)
case securityAndPrivacy(previousState: State)
/// A child flow is in progress.
case presentingChild(childRoomID: String, previousState: State)
@@ -1687,6 +1718,9 @@ private extension RoomFlowCoordinator {
case presentMediaEventsTimeline
case dismissMediaEventsTimeline
case presentSecurityAndPrivacyScreen
case dismissSecurityAndPrivacyScreen
}
}