Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security and privacy part 2 #3637

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
26 changes: 23 additions & 3 deletions ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1468,14 +1468,16 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}

private func presentSecurityAndPrivacyScreen() {
let coordinator = SecurityAndPrivacyScreenCoordinator(parameters: .init(roomProxy: roomProxy))
let coordinator = SecurityAndPrivacyScreenCoordinator(parameters: .init(roomProxy: roomProxy,
clientProxy: userSession.clientProxy,
userIndicatorController: userIndicatorController))

coordinator.actionsPublisher.sink { [weak self] action in
guard let self else { return }

switch action {
case .done:
break
case .displayEditAddressScreen:
presentEditAddressScreen()
}
}
.store(in: &cancellables)
Expand All @@ -1485,6 +1487,24 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
}

private func presentEditAddressScreen() {
let stackCoordinator = NavigationStackCoordinator()
let coordinator = EditRoomAddressScreenCoordinator(parameters: .init(roomProxy: roomProxy,
clientProxy: userSession.clientProxy,
userIndicatorController: userIndicatorController))

coordinator.actionsPublisher.sink { [weak self] action in
switch action {
case .dismiss:
self?.navigationStackCoordinator.setSheetCoordinator(nil)
}
}
.store(in: &cancellables)

stackCoordinator.setRootCoordinator(coordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator)
}

// MARK: - Other flows

private func startChildFlow(for roomID: String, via: [String], entryPoint: RoomFlowCoordinatorEntryPoint) async {
Expand Down
64 changes: 64 additions & 0 deletions ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7227,6 +7227,70 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
return withdrawVerificationAndResendUserIDsSendHandleReturnValue
}
}
//MARK: - isVisibleInRoomDirectory

var isVisibleInRoomDirectoryUnderlyingCallsCount = 0
var isVisibleInRoomDirectoryCallsCount: Int {
get {
if Thread.isMainThread {
return isVisibleInRoomDirectoryUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = isVisibleInRoomDirectoryUnderlyingCallsCount
}

return returnValue!
}
}
set {
if Thread.isMainThread {
isVisibleInRoomDirectoryUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
isVisibleInRoomDirectoryUnderlyingCallsCount = newValue
}
}
}
}
var isVisibleInRoomDirectoryCalled: Bool {
return isVisibleInRoomDirectoryCallsCount > 0
}

var isVisibleInRoomDirectoryUnderlyingReturnValue: Result<Bool, RoomProxyError>!
var isVisibleInRoomDirectoryReturnValue: Result<Bool, RoomProxyError>! {
get {
if Thread.isMainThread {
return isVisibleInRoomDirectoryUnderlyingReturnValue
} else {
var returnValue: Result<Bool, RoomProxyError>? = nil
DispatchQueue.main.sync {
returnValue = isVisibleInRoomDirectoryUnderlyingReturnValue
}

return returnValue!
}
}
set {
if Thread.isMainThread {
isVisibleInRoomDirectoryUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
isVisibleInRoomDirectoryUnderlyingReturnValue = newValue
}
}
}
}
var isVisibleInRoomDirectoryClosure: (() async -> Result<Bool, RoomProxyError>)?

func isVisibleInRoomDirectory() async -> Result<Bool, RoomProxyError> {
isVisibleInRoomDirectoryCallsCount += 1
if let isVisibleInRoomDirectoryClosure = isVisibleInRoomDirectoryClosure {
return await isVisibleInRoomDirectoryClosure()
} else {
return isVisibleInRoomDirectoryReturnValue
}
}
//MARK: - flagAsUnread

var flagAsUnreadUnderlyingCallsCount = 0
Expand Down
Loading
Loading