supported versions (#1848)
This commit is contained in:
@@ -12,7 +12,7 @@ let package = Package(
|
||||
.library(name: "DesignKit", targets: ["DesignKit"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/vector-im/compound-ios", revision: "4d6300e7d9f5fd7e5c448605bd6bf89537add4b8"),
|
||||
.package(url: "https://github.com/vector-im/compound-ios", revision: "0966ff92b2670e3a96259c87016edd92d7ea7797"),
|
||||
.package(url: "https://github.com/vector-im/element-design-tokens", exact: "0.0.3"),
|
||||
.package(url: "https://github.com/siteline/SwiftUI-Introspect", from: "0.9.0")
|
||||
],
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// 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 UIKit
|
||||
|
||||
import SwiftUIIntrospect
|
||||
|
||||
// This can be removed once DesignKit has been migrated in the main app
|
||||
extension PlatformViewVersionPredicate<TextFieldType, UITextField> {
|
||||
static var supportedVersions: Self {
|
||||
.iOS(.v16, .v17)
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public struct ElementTextFieldStyle: TextFieldStyle {
|
||||
}
|
||||
.onTapGesture { isFocused = true } // Set focus with taps outside of the text field
|
||||
}
|
||||
.introspect(.textField, on: .iOS(.v16, .v17)) { textField in
|
||||
.introspect(.textField, on: .supportedVersions) { textField in
|
||||
textField.clearButtonMode = .whileEditing
|
||||
textField.attributedPlaceholder = NSAttributedString(string: textField.placeholder ?? "",
|
||||
attributes: [NSAttributedString.Key.foregroundColor: placeholderColor])
|
||||
|
||||
@@ -780,6 +780,7 @@
|
||||
EC280623A42904341363EAAF /* Collections in Frameworks */ = {isa = PBXBuildFile; productRef = A20EA00CCB9DBE0FFB17DD09 /* Collections */; };
|
||||
EC658A57E715699C52DFBC77 /* CreatePollScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB1D0C69FEDD93404DF927E /* CreatePollScreenViewModelTests.swift */; };
|
||||
ECA636DAF071C611FDC2BB57 /* Strings+Untranslated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A18F6CE4D694D21E4EA9B25 /* Strings+Untranslated.swift */; };
|
||||
ED564C8C7C43CF5F67000368 /* PlatformViewVersionPredicate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D26813CCE39221FE30BF22CD /* PlatformViewVersionPredicate.swift */; };
|
||||
EDF8919F15DE0FF00EF99E70 /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F5567A7EF6F2AB9473236F6 /* DocumentPicker.swift */; };
|
||||
EE4E2C1922BBF5169E213555 /* PillAttachmentViewProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B53D6C5C0D14B04D3AB3F6E /* PillAttachmentViewProvider.swift */; };
|
||||
EE4F5601356228FF72FC56B6 /* MockClientProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F40F48279322E504153AB0D /* MockClientProxy.swift */; };
|
||||
@@ -1526,6 +1527,7 @@
|
||||
D1897720266C036471AD9D1B /* FormRowLabelStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormRowLabelStyle.swift; sourceTree = "<group>"; };
|
||||
D1BC84BA0AF11C2128D58ABD /* Common.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Common.swift; sourceTree = "<group>"; };
|
||||
D263254AFE5B7993FFBBF324 /* NSE.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NSE.entitlements; sourceTree = "<group>"; };
|
||||
D26813CCE39221FE30BF22CD /* PlatformViewVersionPredicate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlatformViewVersionPredicate.swift; sourceTree = "<group>"; };
|
||||
D316BB02636AF2174F2580E6 /* SoftLogoutScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoftLogoutScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||
D33116993D54FADC0C721C1F /* Application.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = "<group>"; };
|
||||
D38391154120264910D19528 /* PollMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollMock.swift; sourceTree = "<group>"; };
|
||||
@@ -2320,6 +2322,7 @@
|
||||
4151163F666ED94FD959475A /* NotificationName.swift */,
|
||||
F72EFC8C634469F9262659C7 /* NSItemProvider.swift */,
|
||||
95BAC0F6C9644336E9567EE6 /* NSRegularExpresion.swift */,
|
||||
D26813CCE39221FE30BF22CD /* PlatformViewVersionPredicate.swift */,
|
||||
7310D8DFE01AF45F0689C3AA /* Publisher.swift */,
|
||||
584A61D9C459FAFEF038A7C0 /* Section.swift */,
|
||||
40B21E611DADDEF00307E7AC /* String.swift */,
|
||||
@@ -4878,6 +4881,7 @@
|
||||
9D79B94493FB32249F7E472F /* PlaceholderAvatarImage.swift in Sources */,
|
||||
1BA04D05EBC6646958B1BE60 /* PlaceholderScreenCoordinator.swift in Sources */,
|
||||
EF0D0155DD104C7A41A2EB0E /* PlainMentionBuilder.swift in Sources */,
|
||||
ED564C8C7C43CF5F67000368 /* PlatformViewVersionPredicate.swift in Sources */,
|
||||
16CBD087038DE3815CDA512C /* PollMock.swift in Sources */,
|
||||
6B4BF4A6450F55939B49FAEF /* PollOptionView.swift in Sources */,
|
||||
864C0D3A4077BF433DBC691F /* PollRoomTimelineItem.swift in Sources */,
|
||||
@@ -5829,7 +5833,7 @@
|
||||
repositoryURL = "https://github.com/vector-im/compound-ios";
|
||||
requirement = {
|
||||
kind = revision;
|
||||
revision = 4d6300e7d9f5fd7e5c448605bd6bf89537add4b8;
|
||||
revision = 0966ff92b2670e3a96259c87016edd92d7ea7797;
|
||||
};
|
||||
};
|
||||
9A472EE0218FE7DCF5283429 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/vector-im/compound-ios",
|
||||
"state" : {
|
||||
"revision" : "4d6300e7d9f5fd7e5c448605bd6bf89537add4b8"
|
||||
"revision" : "0966ff92b2670e3a96259c87016edd92d7ea7797"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -66,8 +66,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/nicklockwood/GZIP",
|
||||
"state" : {
|
||||
"revision" : "c45c8526dad61240a79aaff5b1cf6e082d2b90b2",
|
||||
"version" : "1.3.0"
|
||||
"revision" : "bd55f1d89e71ae3f481da74cd4adeadbb849620c",
|
||||
"version" : "1.3.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ struct Application: App {
|
||||
openURL($0)
|
||||
}
|
||||
}
|
||||
.introspect(.window, on: .iOS(.v16, .v17)) { window in
|
||||
.introspect(.window, on: .supportedVersions) { window in
|
||||
// Workaround for SwiftUI not consistently applying the tint colour to Alerts/Confirmation Dialogs.
|
||||
window.tintColor = .compound.textActionPrimary
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// 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 UIKit
|
||||
|
||||
import SwiftUIIntrospect
|
||||
|
||||
extension PlatformViewVersionPredicate<WindowType, UIWindow> {
|
||||
static var supportedVersions: Self {
|
||||
.iOS(.v16, .v17)
|
||||
}
|
||||
}
|
||||
|
||||
extension PlatformViewVersionPredicate<TextFieldType, UITextField> {
|
||||
static var supportedVersions: Self {
|
||||
.iOS(.v16, .v17)
|
||||
}
|
||||
}
|
||||
|
||||
extension PlatformViewVersionPredicate<ScrollViewType, UIScrollView> {
|
||||
static var supportedVersions: Self {
|
||||
.iOS(.v16, .v17)
|
||||
}
|
||||
}
|
||||
|
||||
extension PlatformViewVersionPredicate<ViewControllerType, UIViewController> {
|
||||
static var supportedVersions: Self {
|
||||
.iOS(.v16, .v17)
|
||||
}
|
||||
}
|
||||
|
||||
extension PlatformViewVersionPredicate<NavigationStackType, UINavigationController> {
|
||||
static var supportedVersions: Self {
|
||||
.iOS(.v16, .v17)
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ extension View {
|
||||
/// This modifier may be moved into Compound once styles for the various configuration options have been defined.
|
||||
func searchableConfiguration(hidesNavigationBar: Bool = true,
|
||||
showsCancelButton: Bool = true) -> some View {
|
||||
introspect(.navigationStack, on: .iOS(.v16), scope: .ancestor) { navigationController in
|
||||
introspect(.navigationStack, on: .supportedVersions, scope: .ancestor) { navigationController in
|
||||
guard let searchController = navigationController.navigationBar.topItem?.searchController else { return }
|
||||
searchController.hidesNavigationBarDuringPresentation = hidesNavigationBar
|
||||
searchController.automaticallyShowsCancelButton = showsCancelButton
|
||||
|
||||
@@ -27,7 +27,7 @@ struct ServerConfirmationScreen: View {
|
||||
}
|
||||
.background()
|
||||
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
|
||||
.introspect(.window, on: .iOS(.v16, .v17)) { window in
|
||||
.introspect(.window, on: .supportedVersions) { window in
|
||||
context.send(viewAction: .updateWindow(window))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ struct SoftLogoutScreen: View {
|
||||
}
|
||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||
.alert(item: $context.alertInfo)
|
||||
.introspect(.window, on: .iOS(.v16, .v17)) { window in
|
||||
.introspect(.window, on: .supportedVersions) { window in
|
||||
context.send(viewAction: .updateWindow(window))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ struct CreatePollScreen: View {
|
||||
Text(L10n.screenCreatePollQuestionHint)
|
||||
.compoundFormTextFieldPlaceholder()
|
||||
}
|
||||
.introspect(.textField, on: .iOS(.v16, .v17)) { textField in
|
||||
.introspect(.textField, on: .supportedVersions) { textField in
|
||||
textField.clearButtonMode = .whileEditing
|
||||
}
|
||||
.textFieldStyle(.compoundForm)
|
||||
@@ -151,7 +151,7 @@ private struct CreatePollOptionView: View {
|
||||
Text(placeholder)
|
||||
.compoundFormTextFieldPlaceholder()
|
||||
}
|
||||
.introspect(.textField, on: .iOS(.v16, .v17)) { textField in
|
||||
.introspect(.textField, on: .supportedVersions) { textField in
|
||||
textField.clearButtonMode = .whileEditing
|
||||
}
|
||||
.textFieldStyle(.compoundForm)
|
||||
|
||||
@@ -62,7 +62,7 @@ struct HomeScreen: View {
|
||||
.disableAutocorrection(true)
|
||||
}
|
||||
}
|
||||
.introspect(.scrollView, on: .iOS(.v16, .v17)) { scrollView in
|
||||
.introspect(.scrollView, on: .supportedVersions) { scrollView in
|
||||
guard scrollView != scrollViewAdapter.scrollView else { return }
|
||||
scrollViewAdapter.scrollView = scrollView
|
||||
}
|
||||
@@ -92,7 +92,7 @@ struct HomeScreen: View {
|
||||
.toolbar { toolbar }
|
||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||
.track(screen: .home)
|
||||
.introspect(.viewController, on: .iOS(.v16, .v17)) { controller in
|
||||
.introspect(.viewController, on: .supportedVersions) { controller in
|
||||
Task {
|
||||
if bloomView == nil {
|
||||
makeBloomView(controller: controller)
|
||||
|
||||
@@ -36,7 +36,7 @@ struct TimelineView: View {
|
||||
var body: some View {
|
||||
ScrollViewReader { scrollView in
|
||||
timelineScrollView
|
||||
.introspect(.scrollView, on: .iOS(.v16, .v17)) { uiScrollView in
|
||||
.introspect(.scrollView, on: .supportedVersions) { uiScrollView in
|
||||
guard uiScrollView != scrollViewAdapter.scrollView else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ struct SettingsScreen: View {
|
||||
.navigationTitle(L10n.commonSettings)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar { toolbar }
|
||||
.introspect(.window, on: .iOS(.v16, .v17)) { window in
|
||||
.introspect(.window, on: .supportedVersions) { window in
|
||||
context.send(viewAction: .updateWindow(window))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ packages:
|
||||
path: DesignKit
|
||||
Compound:
|
||||
url: https://github.com/vector-im/compound-ios
|
||||
revision: 4d6300e7d9f5fd7e5c448605bd6bf89537add4b8
|
||||
revision: 0966ff92b2670e3a96259c87016edd92d7ea7797
|
||||
# path: ../compound-ios
|
||||
AnalyticsEvents:
|
||||
url: https://github.com/matrix-org/matrix-analytics-events
|
||||
|
||||
Reference in New Issue
Block a user