diff --git a/Examples/CocoaPodsTest/Podfile.lock b/Examples/CocoaPodsTest/Podfile.lock index b9e899a02..33ff4afb4 100644 --- a/Examples/CocoaPodsTest/Podfile.lock +++ b/Examples/CocoaPodsTest/Podfile.lock @@ -1,6 +1,6 @@ PODS: - - GeoMonitor (0.1.1) - - Kingfisher (7.4.1) + - GeoMonitor (0.1.2) + - Kingfisher (7.6.1) - RxCocoa (6.5.0): - RxRelay (= 6.5.0) - RxSwift (= 6.5.0) @@ -8,16 +8,16 @@ PODS: - RxSwift (= 6.5.0) - RxSwift (6.5.0) - TGCardViewController (2.1.2) - - TripKit (4.3.0) - - TripKitInterApp (4.3.0): - - TripKit (~> 4.3.0) - - TripKitUI (4.3.0): - - GeoMonitor (~> 0.1) + - TripKit (4.4.2) + - TripKitInterApp (4.4.2): + - TripKit (~> 4.4.2) + - TripKitUI (4.4.2): + - GeoMonitor (~> 0.1.2) - Kingfisher (~> 7.0) - RxCocoa (~> 6.5) - RxSwift (~> 6.5) - TGCardViewController (>= 2.1) - - TripKit (~> 4.3.0) + - TripKit (~> 4.4.2) DEPENDENCIES: - TripKit (from `../../`) @@ -42,15 +42,15 @@ EXTERNAL SOURCES: :path: "../../" SPEC CHECKSUMS: - GeoMonitor: 4f71326249934ee41b16772546f79e93205cac45 - Kingfisher: cd762a593a61b2fbecf7645c00f9a801a3ebfc9c + GeoMonitor: 3af6b577d3f55007c3570c05ed20d0b97b18267e + Kingfisher: 93a3c6d0d551658a31e19f21747e1d15cb39d525 RxCocoa: 94f817b71c07517321eb4f9ad299112ca8af743b RxRelay: 1de1523e604c72b6c68feadedd1af3b1b4d0ecbd RxSwift: 5710a9e6b17f3c3d6e40d6e559b9fa1e813b2ef8 TGCardViewController: a19c5fad9f8352f75a7cd0663292d63c693b9947 - TripKit: fca5aab1f4a6b2a4e2e2bb9d236192a528cc6ea7 - TripKitInterApp: 4a61bcde573c741d107cd973dcbb15a3eba61026 - TripKitUI: 309c28ef02d05a3111da454d6e990322abf9f7a6 + TripKit: 529557ef943f1d2731c04b74ac92e326383d1637 + TripKitInterApp: c038c575f9a490dd993200be8950dbe8ae936f78 + TripKitUI: cdac5df250bede3dccbfe736bf06d44c3aaac7b9 PODFILE CHECKSUM: fd67bcba748ae215ff8d7ed6cf43555a3235bd4a diff --git a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/Contents.json b/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/Contents.json deleted file mode 100644 index 515ce1b7e..000000000 --- a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/Contents.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "icon-signal.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "icon-signal@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "icon-signal@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - }, - "properties" : { - "template-rendering-intent" : "template" - } -} \ No newline at end of file diff --git a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal.png b/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal.png deleted file mode 100644 index c6da8e986..000000000 Binary files a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal.png and /dev/null differ diff --git a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal@2x.png b/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal@2x.png deleted file mode 100644 index a607c3ac9..000000000 Binary files a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal@2x.png and /dev/null differ diff --git a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal@3x.png b/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal@3x.png deleted file mode 100644 index 8e89ccb31..000000000 Binary files a/Sources/TripKit/Resources/TripKit.xcassets/Transport/icon-signal.imageset/icon-signal@3x.png and /dev/null differ diff --git a/Sources/TripKit/server/TKWaypointRouter.swift b/Sources/TripKit/server/TKWaypointRouter.swift index acc3791bd..92876b29d 100644 --- a/Sources/TripKit/server/TKWaypointRouter.swift +++ b/Sources/TripKit/server/TKWaypointRouter.swift @@ -52,7 +52,9 @@ extension TKWaypointRouter { TKRegionManager.shared.requireRegions { error in guard let region = trip.request.startRegion else { - completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + DispatchQueue.main.async { + completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + } return } @@ -101,11 +103,15 @@ extension TKWaypointRouter { TKRegionManager.shared.requireRegions { result in if case .failure(let error) = result { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } return } guard let region = segment.trip.request.startRegion else { - completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + DispatchQueue.main.async { + completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + } return } @@ -118,7 +124,9 @@ extension TKWaypointRouter { self.fetchTrip(input: input, region: region, into: segment.trip.request, completion: completion) } catch { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } } } } @@ -127,11 +135,15 @@ extension TKWaypointRouter { TKRegionManager.shared.requireRegions { result in if case .failure(let error) = result { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } return } guard let region = segment.trip.request.startRegion else { - completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + DispatchQueue.main.async { + completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + } return } @@ -143,7 +155,9 @@ extension TKWaypointRouter { self.fetchTrip(input: input, region: region, into: segment.trip.tripGroup, completion: completion) } catch { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } } } @@ -158,12 +172,16 @@ extension TKWaypointRouter { public static func fetchTrip(byMoving segment: TKSegment, to location: TKModeCoordinate, usingPrivateVehicles vehicles: [TKVehicular] = [], completion: @escaping (Result) -> Void) { TKRegionManager.shared.requireRegions { result in if case .failure(let error) = result { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } return } guard let region = segment.trip.request.startRegion else { - completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + DispatchQueue.main.async { + completion(.failure(TKWaypointRouter.WaypointError.couldNotFindRegionForTrip)) + } return } @@ -192,7 +210,9 @@ extension TKWaypointRouter { let input = buildInput(segments: segments, vehicles: vehicles) self.fetchTrip(input: input, region: region, into: segment.trip.tripGroup, completion: completion) } catch { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } } } } @@ -219,12 +239,15 @@ extension TKWaypointRouter { let response = try await fetchAndParse(input: input, region: region, into: context) let routingResponse = try response.result.get() TKRoutingParser.add(routingResponse, to: tripGroup, merge: false) { parserResult in + dispatchPrecondition(condition: .onQueue(.main)) completion(Result { try parserResult.get().first.orThrow(WaypointError.fetchedResultsButGotNoTrip) }) } } catch { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } } } } @@ -245,12 +268,15 @@ extension TKWaypointRouter { let response = try await fetchAndParse(input: input, region: region, into: context) let routingResponse = try response.result.get() TKRoutingParser.add(routingResponse, to: request, merge: false) { parserResult in + dispatchPrecondition(condition: .onQueue(.main)) completion(Result { try parserResult.get().first.orThrow(WaypointError.fetchedResultsButGotNoTrip) }) } } catch { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } } } } @@ -262,12 +288,15 @@ extension TKWaypointRouter { let response = try await fetchAndParse(input: input, region: region, into: context) let routingResponse = try response.result.get() TKRoutingParser.add(routingResponse, into: context) { parserResult in + dispatchPrecondition(condition: .onQueue(.main)) completion(Result { try parserResult.get().trips.first.orThrow(WaypointError.fetchedResultsButGotNoTrip) }) } } catch { - completion(.failure(error)) + DispatchQueue.main.async { + completion(.failure(error)) + } } } } diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/Contents.json b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/Contents.json deleted file mode 100644 index 6765fbeb3..000000000 --- a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/Contents.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "images" : [ - { - "filename" : "icon-signal-mini-one-bar.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "icon-signal-mini-one-bar@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "icon-signal-mini-one-bar@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "template-rendering-intent" : "template" - } -} diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar.png deleted file mode 100644 index ece82a490..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar@2x.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar@2x.png deleted file mode 100644 index 656ecb02e..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar@2x.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar@3x.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar@3x.png deleted file mode 100644 index 70be8e544..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars1.imageset/icon-signal-mini-one-bar@3x.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/Contents.json b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/Contents.json deleted file mode 100644 index 02e84bf72..000000000 --- a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/Contents.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "images" : [ - { - "filename" : "icon-signal-mini-two-bars.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "icon-signal-mini-two-bars@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "icon-signal-mini-two-bars@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "template-rendering-intent" : "template" - } -} diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars.png deleted file mode 100644 index a60644de1..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars@2x.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars@2x.png deleted file mode 100644 index 82450d0b0..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars@2x.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars@3x.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars@3x.png deleted file mode 100644 index fb4b710b3..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars2.imageset/icon-signal-mini-two-bars@3x.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/Contents.json b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/Contents.json deleted file mode 100644 index f8a005a19..000000000 --- a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/Contents.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "images" : [ - { - "filename" : "icon-signal-mini-three-bars.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "icon-signal-mini-three-bars@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "icon-signal-mini-three-bars@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "template-rendering-intent" : "template" - } -} diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars.png deleted file mode 100644 index 3da8f5ffc..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars@2x.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars@2x.png deleted file mode 100644 index 97f2f8234..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars@2x.png and /dev/null differ diff --git a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars@3x.png b/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars@3x.png deleted file mode 100644 index ca9d68cec..000000000 Binary files a/Sources/TripKitUI/Resources/TripKitUI.xcassets/Code/icon-signal-bars3.imageset/icon-signal-mini-three-bars@3x.png and /dev/null differ diff --git a/Sources/TripKitUI/helper/Categories/UIImageView+AsAccessoryImage.swift b/Sources/TripKitUI/helper/Categories/UIImageView+AsAccessoryImage.swift index 9fd6bb3de..f8ffd2cc0 100644 --- a/Sources/TripKitUI/helper/Categories/UIImageView+AsAccessoryImage.swift +++ b/Sources/TripKitUI/helper/Categories/UIImageView+AsAccessoryImage.swift @@ -14,7 +14,7 @@ extension UIImageView { convenience init(asRealTimeAccessoryImageAnimated animated: Bool, tintColor: UIColor? = nil) { self.init() - let images = UIImageView.realTimeAccessoryImage(animated, tintColor: tintColor) + let images = UIImageView.realTimeAccessoryImage(animated) if animated { self.image = images.last self.animationImages = images @@ -26,49 +26,25 @@ extension UIImageView { self.image = images.first } self.accessibilityLabel = Loc.RealTime + if let tintColor { + self.tintColor = tintColor + } } - private static func realTimeAccessoryImage(_ animated: Bool, tintColor: UIColor? = nil) -> [UIImage] { - if animated { - var image1 = TripKitUIBundle.imageNamed("icon-signal-bars1") - var image2 = TripKitUIBundle.imageNamed("icon-signal-bars2") - var image3 = TripKitUIBundle.imageNamed("icon-signal-bars3") + private static func realTimeAccessoryImage(_ animated: Bool) -> [UIImage] { + if #available(iOS 16.0, *), animated { + let image1 = UIImage(systemName: "dot.radiowaves.forward", variableValue: 0.3) + let image2 = UIImage(systemName: "dot.radiowaves.forward", variableValue: 0.7) + let image3 = UIImage(systemName: "dot.radiowaves.forward", variableValue: 1.0) + return [image1, image2, image3, image3, image3, image3, image3, image3].compactMap { $0 } + + } else if #available(iOS 14.0, *) { + // Right-pointing, all bars + return [UIImage(systemName: "dot.radiowaves.forward")].compactMap { $0 } - if let tintColor = tintColor { - image1 = image1.applying(tintColor: tintColor) - image2 = image2.applying(tintColor: tintColor) - image3 = image3.applying(tintColor: tintColor) - } - return [image1, image2, image3, image3, image3, image3, image3, image3] } else { - return [TripKitUIBundle.imageNamed("icon-signal-bars3")] + // Up-pointing, like wifi, all bars + return [UIImage(systemName: "wifi")].compactMap { $0 } } } } - -extension UIImage { - func applying(tintColor: UIColor) -> UIImage { - let drawRect = CGRect(origin: .zero, size: size) - UIGraphicsBeginImageContextWithOptions(drawRect.size, false, 0) - guard - let context = UIGraphicsGetCurrentContext(), - let cgImage = self.cgImage - else { return self } - - context.translateBy(x: 0, y: size.height) - context.scaleBy(x: 1, y: -1) - - // draw original image - context.setBlendMode(.normal) - context.draw(cgImage, in: drawRect) - - // draw color atop - context.setFillColor(tintColor.cgColor) - context.setBlendMode(.sourceAtop) - context.fill(drawRect) - - let tinted = UIGraphicsGetImageFromCurrentImageContext() - UIGraphicsEndImageContext() - return tinted ?? self - } -} diff --git a/Sources/TripKitUI/views/results/TKUIResultsAccessoryView.swift b/Sources/TripKitUI/views/results/TKUIResultsAccessoryView.swift index a3675a284..9e51eac29 100644 --- a/Sources/TripKitUI/views/results/TKUIResultsAccessoryView.swift +++ b/Sources/TripKitUI/views/results/TKUIResultsAccessoryView.swift @@ -26,7 +26,13 @@ class TKUIResultsAccessoryView: UIView { override func awakeFromNib() { super.awakeFromNib() - backgroundColor = UIColor.tkAppTintColor.withAlphaComponent(0.12) + backgroundColor = UIColor { traits in + if traits.accessibilityContrast == .high { + return UIColor.tkAppTintColor.withAlphaComponent(0.04) + } else { + return UIColor.tkAppTintColor.withAlphaComponent(0.12) + } + } timeButton.setTitle(nil, for: .normal) timeButton.titleLabel?.font = TKStyleManager.customFont(forTextStyle: .subheadline) diff --git a/Sources/TripKitUI/views/results/TKUIResultsTitleView.swift b/Sources/TripKitUI/views/results/TKUIResultsTitleView.swift index 010045744..cea922bcb 100644 --- a/Sources/TripKitUI/views/results/TKUIResultsTitleView.swift +++ b/Sources/TripKitUI/views/results/TKUIResultsTitleView.swift @@ -109,8 +109,15 @@ class TKUIResultsTitleView: UIView, TGPreferrableView { .foregroundColor, value: UIColor.tkLabelSecondary, range: NSRange(location: 0, length: (originText as NSString).length) ) + let nameColor = UIColor { traits in + if traits.accessibilityContrast == .high { + return UIColor.tkLabelSecondary + } else { + return UIColor.tkAppTintColor + } + } attributedOrigin.addAttribute( - .foregroundColor, value: UIColor.tkAppTintColor, + .foregroundColor, value: nameColor, range: (originText as NSString).range(of: originName) )