Periphery to detect dead code (#2227)

This commit is contained in:
Mauro
2023-12-12 11:17:15 +01:00
committed by GitHub
parent deb109f157
commit b9a6ebe03a
15 changed files with 121 additions and 112 deletions
@@ -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)
}
}