Removing dead code part 2 (#2235)

Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
Mauro
2023-12-15 20:16:16 +01:00
committed by GitHub
parent 2f88d39789
commit 123164f398
91 changed files with 64 additions and 694 deletions
@@ -95,6 +95,7 @@ extension AlertInfo {
message = L10n.errorUnknown
}
// periphery: ignore - might be useful in the future
/// Initialises the type with the title from an `Error`'s localised description along with the default Ok button.
///
/// Currently this initialiser creates an alert for every error, however in the future it may be updated to filter
@@ -1,22 +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
extension Image {
/// Empty image view
static let empty = Image(uiImage: .init(ciImage: .empty()))
}
@@ -18,23 +18,11 @@ import Foundation
/// NSRegularExpressions work internally on NSStrings, we need to be careful how we build the ranges for extended grapheme clusters https://stackoverflow.com/a/27880748/730924
extension NSRegularExpression {
func enumerateMatches(in string: String, options: NSRegularExpression.MatchingOptions = [], using block: (NSTextCheckingResult?, NSRegularExpression.MatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Void) {
enumerateMatches(in: string, options: options, range: .init(location: 0, length: (string as NSString).length), using: block)
}
func matches(in string: String, options: NSRegularExpression.MatchingOptions = []) -> [NSTextCheckingResult] {
matches(in: string, options: options, range: .init(location: 0, length: (string as NSString).length))
}
func numberOfMatches(in string: String, options: NSRegularExpression.MatchingOptions = []) -> Int {
numberOfMatches(in: string, options: options, range: .init(location: 0, length: (string as NSString).length))
}
func firstMatch(in string: String, options: NSRegularExpression.MatchingOptions = []) -> NSTextCheckingResult? {
firstMatch(in: string, options: options, range: .init(location: 0, length: (string as NSString).length))
}
func rangeOfFirstMatch(in string: String, options: NSRegularExpression.MatchingOptions = []) -> NSRange {
rangeOfFirstMatch(in: string, options: options, range: .init(location: 0, length: (string as NSString).length))
}
}
@@ -41,9 +41,3 @@ extension PlatformViewVersionPredicate<ViewControllerType, UIViewController> {
.iOS(.v16, .v17)
}
}
extension PlatformViewVersionPredicate<NavigationStackType, UINavigationController> {
static var supportedVersions: Self {
.iOS(.v16, .v17)
}
}
@@ -160,6 +160,7 @@ enum MXLog {
// MARK: - Private
// periphery:ignore:parameters function,column
private static func createSpan(_ name: String,
level: LogLevel,
file: String = #file,
@@ -177,6 +178,7 @@ enum MXLog {
return Span(file: file, line: UInt32(line), level: level, target: target, name: name)
}
// periphery:ignore:parameters function,column,context
private static func log(_ message: Any,
level: LogLevel,
file: String = #file,
@@ -230,15 +230,6 @@ extension MapLibreMapView {
// MARK: - MGLMapView convenient methods
private extension MGLMapView {
func removeAllAnnotations() {
guard let annotations else {
return
}
removeAnnotations(annotations)
}
}
private extension MapTilerStyle {
init(_ colorScheme: ColorScheme) {
switch colorScheme {
@@ -1,27 +0,0 @@
//
// Copyright 2023 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 CoreLocation
import Foundation
enum MapTilerGeocodingError: Error {
case wrongGeocodingURL
case geocodingFailed
}
protocol MapTilerGeoCodingServiceProtocol {
func reverseGeoCoding(for coordinate: CLLocationCoordinate2D) async -> Result<String, MapTilerGeocodingError>
}
@@ -27,14 +27,6 @@ class NetworkMonitor: NetworkMonitorProtocol {
reachabilitySubject.asCurrentValuePublisher()
}
var isCurrentConnectionExpensive: Bool {
pathMonitor.currentPath.isExpensive
}
var isCurrentConnectionConstrained: Bool {
pathMonitor.currentPath.isConstrained
}
init() {
queue = DispatchQueue(label: "io.element.elementx.networkmonitor", qos: .background)
pathMonitor = NWPathMonitor()
@@ -23,8 +23,6 @@ enum NetworkMonitorReachability {
protocol NetworkMonitorProtocol {
var reachabilityPublisher: CurrentValuePublisher<NetworkMonitorReachability, Never> { get }
var isCurrentConnectionExpensive: Bool { get }
var isCurrentConnectionConstrained: Bool { get }
}
// sourcery: AutoMockable
@@ -80,10 +80,13 @@ final class PillAttachmentViewProvider: NSTextAttachmentViewProvider {
// Fixes crashes when inserting mention pills in the composer on Mac
// https://github.com/element-hq/element-x-ios/issues/2070
// periphery:ignore - read comment above
static var supportsSecureCoding = false
// periphery:ignore - read comment above
func encode(with coder: NSCoder) { }
// periphery:ignore - read comment above
init?(coder: NSCoder) {
fatalError("Not implemented")
}
@@ -77,8 +77,6 @@ struct LoadableImage<TransformerView: View, PlaceholderView: View>: View {
private struct LoadableImageContent<TransformerView: View, PlaceholderView: View>: View, ImageDataProvider {
private let mediaSource: MediaSourceProxy
private let blurhash: String?
private let size: CGSize?
private let imageProvider: ImageProviderProtocol?
private let transformer: (AnyView) -> TransformerView
private let placeholder: () -> PlaceholderView
@@ -92,8 +90,6 @@ private struct LoadableImageContent<TransformerView: View, PlaceholderView: View
placeholder: @escaping () -> PlaceholderView) {
self.mediaSource = mediaSource
self.blurhash = blurhash
self.size = size
self.imageProvider = imageProvider
self.transformer = transformer
self.placeholder = placeholder
_contentLoader = StateObject(wrappedValue: ContentLoader(mediaSource: mediaSource, size: size, imageProvider: imageProvider))
@@ -18,8 +18,6 @@ import Compound
import SwiftUI
struct LocationMarkerView: View {
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
var mode: Mode = .map
enum Mode { case map, button }