mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Switch to Xcode 14 and handle the UICollectionView-backed List. (#229)
* Fix Timeline on Xcode 14/iOS 16
Raise requirement to iOS 16+
Reduce pagination jumping.
Sonarcloud fixes.
Fix verification test.
Adopt if let optional { syntax.
* Remove unused ScrollViewReader
The ScrollViewReader didn't appear to change the behaviour.
* Fix warnings on Run Scripts.
Run script build phase 'SwiftLint' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.
This commit is contained in:
@@ -29,7 +29,7 @@ struct Benchmark {
|
||||
let startTime = CFAbsoluteTimeGetCurrent()
|
||||
trackingIdentifiers[identifier] = startTime
|
||||
|
||||
if let message = message {
|
||||
if let message {
|
||||
MXLog.verbose("⏰ \(message).")
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ struct Benchmark {
|
||||
}
|
||||
|
||||
let elapsedTime = CFAbsoluteTimeGetCurrent() - start
|
||||
if let message = message {
|
||||
if let message {
|
||||
MXLog.verbose("⏰ \(message). Elapsed time: \(elapsedTime.round(to: 4)) seconds.")
|
||||
} else {
|
||||
MXLog.verbose("⏰ Elapsed time: \(elapsedTime.round(to: 4)) seconds.")
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// 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 Introspect
|
||||
import SwiftUI
|
||||
|
||||
extension View {
|
||||
/// Finds a `UICollectionView` from a `SwiftUI.List`, or `SwiftUI.List` child.
|
||||
/// Stop gap until https://github.com/siteline/SwiftUI-Introspect/pull/169
|
||||
func introspectCollectionView(customize: @escaping (UICollectionView) -> Void) -> some View {
|
||||
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
}
|
||||
|
||||
func fromPlain(_ string: String?) -> AttributedString? {
|
||||
guard let string = string else {
|
||||
guard let string else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
// that could happen with the default HTML renderer of NSAttributedString which is a
|
||||
// webview.
|
||||
func fromHTML(_ htmlString: String?) -> AttributedString? {
|
||||
guard let htmlString = htmlString,
|
||||
guard let htmlString,
|
||||
let data = htmlString.data(using: .utf8) else {
|
||||
return nil
|
||||
}
|
||||
@@ -93,7 +93,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
}
|
||||
|
||||
func blockquoteCoalescedComponentsFrom(_ attributedString: AttributedString?) -> [AttributedStringBuilderComponent]? {
|
||||
guard let attributedString = attributedString else {
|
||||
guard let attributedString else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public extension DTHTMLElement {
|
||||
/// - Parameters:
|
||||
/// - font: The default font to use when resetting the content of any unsupported tags.
|
||||
@objc func sanitize(font: UIFont) {
|
||||
if let name = name, !Self.allowedHTMLTags.contains(name) {
|
||||
if let name, !Self.allowedHTMLTags.contains(name) {
|
||||
// This is an unsupported tag.
|
||||
// Remove any attachments to fix rendering.
|
||||
textAttachment = nil
|
||||
|
||||
@@ -95,7 +95,7 @@ final class NavigationRouter: NSObject, NavigationRouterType {
|
||||
self.willPopViewController($0)
|
||||
}
|
||||
|
||||
if let popCompletion = popCompletion {
|
||||
if let popCompletion {
|
||||
completions[controller] = popCompletion
|
||||
}
|
||||
|
||||
|
||||
@@ -60,14 +60,14 @@ extension AlertInfo {
|
||||
|
||||
extension AlertInfo {
|
||||
private var messageText: Text? {
|
||||
guard let message = message else { return nil }
|
||||
guard let message else { return nil }
|
||||
return Text(message)
|
||||
}
|
||||
|
||||
/// Returns a SwiftUI `Alert` created from this alert info, using default button
|
||||
/// styles for both primary and (if set) secondary buttons.
|
||||
var alert: Alert {
|
||||
if let secondaryButton = secondaryButton {
|
||||
if let secondaryButton {
|
||||
return Alert(title: Text(title),
|
||||
message: messageText,
|
||||
primaryButton: alertButton(for: primaryButton),
|
||||
|
||||
@@ -97,7 +97,7 @@ class StateStoreViewModel<State: BindableState, ViewAction> {
|
||||
init(initialViewState: State) {
|
||||
context = Context(initialViewState: initialViewState)
|
||||
context.viewActions.sink { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
guard let self else { return }
|
||||
|
||||
Task { await self.process(viewAction: action) }
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType {
|
||||
|
||||
func presentActivityIndicator(on view: UIView, animated: Bool, completion: (() -> Void)? = nil) {
|
||||
if presentingView != nil {
|
||||
if let completion = completion {
|
||||
if let completion {
|
||||
completion()
|
||||
}
|
||||
return
|
||||
@@ -88,7 +88,7 @@ final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType {
|
||||
}
|
||||
|
||||
func removeCurrentActivityIndicator(animated: Bool, completion: (() -> Void)? = nil) {
|
||||
guard let presentingView = presentingView,
|
||||
guard let presentingView,
|
||||
let backgroundOverlayView = backgroundOverlayView,
|
||||
let activityIndicatorView = activityIndicatorView else {
|
||||
return
|
||||
|
||||
@@ -35,7 +35,7 @@ class FullscreenLoadingViewPresenter: UserIndicatorViewPresentable {
|
||||
while presentingController?.navigationController != nil {
|
||||
presentingController = presentingController?.navigationController
|
||||
}
|
||||
guard let presentingController = presentingController else {
|
||||
guard let presentingController else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class FullscreenLoadingViewPresenter: UserIndicatorViewPresentable {
|
||||
}
|
||||
|
||||
func dismiss() {
|
||||
guard let view = view, view.superview != nil else {
|
||||
guard let view, view.superview != nil else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class RectangleToastView: UIView {
|
||||
image: UIImage? = nil) {
|
||||
super.init(frame: .zero)
|
||||
|
||||
if let image = image {
|
||||
if let image {
|
||||
imageView.image = image
|
||||
NSLayoutConstraint.activate([
|
||||
imageView.widthAnchor.constraint(equalToConstant: image.size.width),
|
||||
|
||||
@@ -66,7 +66,7 @@ class ToastViewPresenter: UserIndicatorViewPresentable {
|
||||
}
|
||||
|
||||
func dismiss() {
|
||||
guard let view = view, view.superview != nil else {
|
||||
guard let view, view.superview != nil else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user