mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 03:48:27 +00:00
Periphery to detect dead code (#2227)
This commit is contained in:
@@ -34,18 +34,6 @@ extension AggregatedReaction {
|
||||
private static var alice: String {
|
||||
RoomMemberProxyMock.mockAlice.userID
|
||||
}
|
||||
|
||||
static var mockThumbsUpHighlighted: AggregatedReaction {
|
||||
mockReaction(key: "👍", senderIDs: [alice] + mockIds(4))
|
||||
}
|
||||
|
||||
static var mockClap: AggregatedReaction {
|
||||
mockReaction(key: "👏", senderIDs: mockIds(1))
|
||||
}
|
||||
|
||||
static var mockParty: AggregatedReaction {
|
||||
mockReaction(key: "🎉", senderIDs: mockIds(20))
|
||||
}
|
||||
|
||||
static var mockReactions: [AggregatedReaction] {
|
||||
[
|
||||
|
||||
@@ -67,7 +67,6 @@ enum A11yIdentifiers {
|
||||
struct AppLockSetupSettingsScreen {
|
||||
let changePIN = "app_lock_setup_settings-change_pin"
|
||||
let removePIN = "app_lock_setup_settings-remove_pin"
|
||||
let removePINAlertYes = "app_lock_setup_settings-remove_pin_alert_yes"
|
||||
}
|
||||
|
||||
struct AnalyticsPromptScreen {
|
||||
@@ -94,7 +93,6 @@ enum A11yIdentifiers {
|
||||
struct HomeScreen {
|
||||
let userAvatar = "home_screen-user_avatar"
|
||||
let settings = "home_screen-settings"
|
||||
let signOut = "home_screen-sign_out"
|
||||
let verificationBannerContinue = "home_screen-verification_continue"
|
||||
let recoveryKeyConfirmationBannerContinue = "home_screen-recovery_key_confirmation_continue"
|
||||
let invites = "home_screen-invites"
|
||||
@@ -218,7 +216,6 @@ enum A11yIdentifiers {
|
||||
let password = "soft_logout-password"
|
||||
let forgotPassword = "soft_logout-forgot_password"
|
||||
let next = "soft_logout-next"
|
||||
let unsupportedServer = "soft_logout-unsupported_server"
|
||||
let clearDataTitle = "soft_logout-clear_data_title"
|
||||
let clearDataMessage = "soft_logout-clear_data_message"
|
||||
let clearData = "soft_logout-clear_data"
|
||||
|
||||
@@ -31,17 +31,6 @@ extension View {
|
||||
})
|
||||
return alert(item.wrappedValue?.title ?? "", isPresented: binding, presenting: item.wrappedValue, actions: actions, message: message)
|
||||
}
|
||||
|
||||
func alert<Item, Actions>(item: Binding<Item?>, @ViewBuilder actions: (Item) -> Actions) -> some View where Item: AlertProtocol, Actions: View {
|
||||
let binding = Binding<Bool>(get: {
|
||||
item.wrappedValue != nil
|
||||
}, set: { newValue in
|
||||
if !newValue {
|
||||
item.wrappedValue = nil
|
||||
}
|
||||
})
|
||||
return alert(item.wrappedValue?.title ?? "", isPresented: binding, presenting: item.wrappedValue, actions: actions)
|
||||
}
|
||||
}
|
||||
|
||||
/// A type that describes an alert to be shown to the user.
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// 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 SwiftUI
|
||||
|
||||
/// A horizontal `ScrollView` that will pad the start of it's content
|
||||
/// when the alignment is set to `.trailing`.
|
||||
struct AlignedScrollView<Content: View>: View {
|
||||
let alignment: HorizontalAlignment
|
||||
var showsIndicators = true
|
||||
|
||||
@ViewBuilder let content: () -> Content
|
||||
|
||||
@State private var scrollViewFrame: CGRect = .zero
|
||||
|
||||
var body: some View {
|
||||
ScrollView(.horizontal, showsIndicators: showsIndicators) {
|
||||
content()
|
||||
.frame(minWidth: scrollViewFrame.width,
|
||||
alignment: Alignment(horizontal: alignment, vertical: .center))
|
||||
}
|
||||
.readFrame($scrollViewFrame)
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public struct AuthenticationTextFieldStyle: TextFieldStyle {
|
||||
}
|
||||
|
||||
struct ElementTextFieldStyle_Previews: PreviewProvider {
|
||||
public static var previews: some View {
|
||||
static var previews: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 20) {
|
||||
// Plain text field.
|
||||
|
||||
@@ -51,9 +51,6 @@ struct PollFormScreen: View {
|
||||
Section {
|
||||
ListRow(label: .plain(title: L10n.screenCreatePollQuestionHint),
|
||||
kind: .textField(text: $context.question, axis: .vertical))
|
||||
.introspect(.textField, on: .supportedVersions) { textField in
|
||||
textField.clearButtonMode = .whileEditing
|
||||
}
|
||||
.focused($focus, equals: .question)
|
||||
.accessibilityIdentifier(A11yIdentifiers.pollFormScreen.question)
|
||||
.onSubmit {
|
||||
|
||||
-11
@@ -17,20 +17,9 @@
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
enum AdvancedSettingsScreenCoordinatorAction {
|
||||
case clearCache
|
||||
}
|
||||
|
||||
final class AdvancedSettingsScreenCoordinator: CoordinatorProtocol {
|
||||
private var viewModel: AdvancedSettingsScreenViewModelProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<AdvancedSettingsScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
var actions: AnyPublisher<AdvancedSettingsScreenCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init() {
|
||||
viewModel = AdvancedSettingsScreenViewModel(advancedSettings: ServiceLocator.shared.settings)
|
||||
}
|
||||
|
||||
-2
@@ -16,8 +16,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
enum AdvancedSettingsScreenViewModelAction { }
|
||||
|
||||
struct AdvancedSettingsScreenViewState: BindableState {
|
||||
var bindings: AdvancedSettingsScreenViewStateBindings
|
||||
}
|
||||
|
||||
-6
@@ -20,12 +20,6 @@ import SwiftUI
|
||||
typealias AdvancedSettingsScreenViewModelType = StateStoreViewModel<AdvancedSettingsScreenViewState, AdvancedSettingsScreenViewAction>
|
||||
|
||||
class AdvancedSettingsScreenViewModel: AdvancedSettingsScreenViewModelType, AdvancedSettingsScreenViewModelProtocol {
|
||||
private var actionsSubject: PassthroughSubject<AdvancedSettingsScreenViewModelAction, Never> = .init()
|
||||
|
||||
var actions: AnyPublisher<AdvancedSettingsScreenViewModelAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(advancedSettings: AdvancedSettingsProtocol) {
|
||||
let bindings = AdvancedSettingsScreenViewStateBindings(advancedSettings: advancedSettings)
|
||||
let state = AdvancedSettingsScreenViewState(bindings: bindings)
|
||||
|
||||
-1
@@ -18,6 +18,5 @@ import Combine
|
||||
|
||||
@MainActor
|
||||
protocol AdvancedSettingsScreenViewModelProtocol {
|
||||
var actions: AnyPublisher<AdvancedSettingsScreenViewModelAction, Never> { get }
|
||||
var context: AdvancedSettingsScreenViewModelType.Context { get }
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ targets:
|
||||
|
||||
dependencies:
|
||||
- target: NSE
|
||||
- target: NCE
|
||||
- package: MatrixRustSDK
|
||||
- package: Compound
|
||||
- package: Algorithms
|
||||
|
||||
Reference in New Issue
Block a user