generated from element-hq/.github
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
455 additions
and
275 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...esolveVerifiedUserSendFailureScreen/ResolveVerifiedUserSendFailureScreenCoordinator.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// Copyright 2022 New Vector Ltd | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Combine | ||
import SwiftUI | ||
|
||
struct ResolveVerifiedUserSendFailureScreenCoordinatorParameters { | ||
let failure: TimelineItemSendFailure.VerifiedUser | ||
let itemID: TimelineItemIdentifier | ||
let roomProxy: JoinedRoomProxyProtocol | ||
} | ||
|
||
enum ResolveVerifiedUserSendFailureScreenCoordinatorAction { | ||
case dismiss | ||
} | ||
|
||
final class ResolveVerifiedUserSendFailureScreenCoordinator: CoordinatorProtocol { | ||
private let parameters: ResolveVerifiedUserSendFailureScreenCoordinatorParameters | ||
private let viewModel: ResolveVerifiedUserSendFailureScreenViewModelProtocol | ||
|
||
private var cancellables = Set<AnyCancellable>() | ||
|
||
private let actionsSubject: PassthroughSubject<ResolveVerifiedUserSendFailureScreenCoordinatorAction, Never> = .init() | ||
var actionsPublisher: AnyPublisher<ResolveVerifiedUserSendFailureScreenCoordinatorAction, Never> { | ||
actionsSubject.eraseToAnyPublisher() | ||
} | ||
|
||
init(parameters: ResolveVerifiedUserSendFailureScreenCoordinatorParameters) { | ||
self.parameters = parameters | ||
|
||
viewModel = ResolveVerifiedUserSendFailureScreenViewModel(failure: parameters.failure, | ||
itemID: parameters.itemID, | ||
roomProxy: parameters.roomProxy) | ||
} | ||
|
||
func start() { | ||
viewModel.actionsPublisher.sink { [weak self] action in | ||
MXLog.info("Coordinator: received view model action: \(action)") | ||
|
||
guard let self else { return } | ||
switch action { | ||
case .dismiss: | ||
actionsSubject.send(.dismiss) | ||
} | ||
} | ||
.store(in: &cancellables) | ||
} | ||
|
||
func toPresentable() -> AnyView { | ||
AnyView(ResolveVerifiedUserSendFailureScreen(context: viewModel.context)) | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ens/ResolveVerifiedUserSendFailureScreen/ResolveVerifiedUserSendFailureScreenModels.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Copyright 2022 New Vector Ltd | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
|
||
enum ResolveVerifiedUserSendFailureScreenViewModelAction { | ||
case dismiss | ||
} | ||
|
||
struct ResolveVerifiedUserSendFailureScreenViewState: BindableState { | ||
var currentFailure: TimelineItemSendFailure.VerifiedUser | ||
var currentMemberDisplayName: String | ||
|
||
var title: String { | ||
switch currentFailure { | ||
case .hasUnsignedDevice: UntranslatedL10n.screenRoomSendFailureUnsignedDeviceResolveTitle(currentMemberDisplayName) | ||
case .changedIdentity: UntranslatedL10n.screenRoomSendFailureIdentityChangedResolveTitle(currentMemberDisplayName) | ||
} | ||
} | ||
|
||
var subtitle: String { | ||
switch currentFailure { | ||
case .hasUnsignedDevice: UntranslatedL10n.screenRoomSendFailureUnsignedDeviceResolveSubtitle(currentMemberDisplayName, | ||
currentMemberDisplayName) | ||
case .changedIdentity: UntranslatedL10n.screenRoomSendFailureIdentityChangedResolveSubtitle(currentMemberDisplayName) | ||
} | ||
} | ||
|
||
var primaryButtonTitle: String { | ||
switch currentFailure { | ||
case .hasUnsignedDevice: UntranslatedL10n.screenRoomSendFailureUnsignedDeviceResolvePrimaryButtonTitle | ||
case .changedIdentity: UntranslatedL10n.screenRoomSendFailureIdentityChangedResolvePrimaryButtonTitle | ||
} | ||
} | ||
} | ||
|
||
enum ResolveVerifiedUserSendFailureScreenViewAction { | ||
case resolveAndResend | ||
case resend | ||
case cancel | ||
} |
Oops, something went wrong.