mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-01 18:23:03 +00:00
22d14ff8e4
* create DependenciesProtocol and replace ServiceLocator registration with it replace mocking calls for ServiceLocator to Dependencies replace ServiceLocator with instance level calls replace ServiceLocator configs with TestDependencies config in Tests replace servicelocator usage in analytics service replace remaining ServiceLocator calls in unit tests that depended on the UnitTestAppCoordinator configuration with per suite dependencies instances fix swiftlint warning remove remaining references to ServiceLocator make dependencies properties consistent in tests delete Dependencies and DependenciesProtocol fix whitespace modifications updates from PR feedback a pass over converting AppSettings and AnalyticsService test instance properties to per test instantiation fix a missed PR feedback Sync up after rebase create DependenciesProtocol and replace ServiceLocator registration with it replace mocking calls for ServiceLocator to Dependencies replace ServiceLocator with instance level calls replace ServiceLocator configs with TestDependencies config in Tests replace servicelocator usage in analytics service replace remaining ServiceLocator calls in unit tests that depended on the UnitTestAppCoordinator configuration with per suite dependencies instances fix swiftlint warning remove remaining references to ServiceLocator make dependencies properties consistent in tests delete Dependencies and DependenciesProtocol * AppSettings is instance level mockable now * replace mocked and preview usages of reset + AppSettings global init with AppSettings(store: UserDefaultsMock()) * AppSettings.UserDefaultsKeys is now a RawRep struct, making it extensible * update tests with new AppSettings so it builds * update remaining AppSettings test/mock inits * AppSettings.UserDefaultsKey conformed to ExpressibleByStringLiteral * addressed issues found in first pass ai review * update AppSettings instantiations after rebase * fix accessibility tests coordinator after rebase * Rename to VolatileUserDefaults * AppSettings init uses mandatory parameter * Revert UserDefaultsKey to enum * Add TrackedUserDefaults to be able to reset the defaults object * Added volatile static func to AppSettings * Use .volatile() static func instead of full init * review fixups * Resolve build issues after rebase * updated enterprise module * remove the static reset settings call from the preview tests --------- Co-authored-by: Mauro Romito <mauro.romito@element.io>
75 lines
3.3 KiB
Swift
75 lines
3.3 KiB
Swift
//
|
|
// Copyright 2026 Element Creations Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import Compound
|
|
import SwiftUI
|
|
|
|
struct InviteUsersConfirmationSheetView: View {
|
|
@ObservedObject var context: InviteUsersScreenViewModel.Context
|
|
|
|
/// The users whose identities we wish the user to confirm.
|
|
var users: [UserProfileProxy]
|
|
|
|
var body: some View {
|
|
FullscreenDialog(topPadding: 24, horizontalPadding: 24) {
|
|
VStack(spacing: 32) {
|
|
TitleAndIcon(title: users.count == 1 ? L10n.screenInviteUsersConfirmDialogTitleOneUser : L10n.screenInviteUsersConfirmDialogTitleMutipleUsers,
|
|
subtitle: users.count == 1 ? L10n.screenInviteUsersConfirmDialogSubtitleOneUser : L10n.screenInviteUsersConfirmDialogSubtitleMultipleUsers,
|
|
icon: \.userAddSolid,
|
|
iconStyle: .defaultSolid)
|
|
VStack(spacing: 0) {
|
|
ForEach(users, id: \.userID) { user in
|
|
UserProfileListRow(user: user,
|
|
membership: nil,
|
|
mediaProvider: context.mediaProvider,
|
|
kind: .label)
|
|
.rowDivider(alignment: .top)
|
|
.accessibilityIdentifier(A11yIdentifiers.inviteUsersScreen.userProfile)
|
|
}
|
|
}
|
|
}
|
|
} bottomContent: {
|
|
HStack(spacing: 32) {
|
|
Button(L10n.actionRemove, role: .cancel) {
|
|
context.send(viewAction: .removeUnknownUsers)
|
|
}
|
|
.buttonStyle(.compound(.secondary))
|
|
|
|
Button(L10n.actionInvite) {
|
|
context.send(viewAction: .confirmUnknownUsers)
|
|
}
|
|
.buttonStyle(.compound(.primary))
|
|
}
|
|
}
|
|
.background()
|
|
.backgroundStyle(.compound.bgCanvasDefault)
|
|
.interactiveDismissDisabled()
|
|
}
|
|
}
|
|
|
|
struct InviteUsersConfirmationSheetView_Previews: PreviewProvider, TestablePreview {
|
|
static var viewModel = makeViewModel()
|
|
|
|
static var previews: some View {
|
|
InviteUsersConfirmationSheetView(context: viewModel.context, users: [.mockAlice, .mockCharlie, .mockBob, .mockDan])
|
|
.previewDisplayName("Default")
|
|
}
|
|
|
|
static func makeViewModel() -> InviteUsersScreenViewModel {
|
|
let viewModel = InviteUsersScreenViewModel(userSession: UserSessionMock(.init(clientProxy: ClientProxyMock(.init()))),
|
|
roomType: .existingRoom(roomProxy: JoinedRoomProxyMock(.init(members: []))),
|
|
isSkippable: true,
|
|
userDiscoveryService: UserDiscoveryServiceMock(),
|
|
userIndicatorController: UserIndicatorControllerMock(),
|
|
appSettings: .volatile())
|
|
|
|
viewModel.state.usersToConfirm = [.mockAlice, .mockCharlie, .mockBob, .mockDan]
|
|
|
|
return viewModel
|
|
}
|
|
}
|