Skip to content

Commit

Permalink
Merge pull request #736 from OneBusAway/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
aaronbrethorst authored Aug 1, 2024
2 parents 51e3c60 + 8db4bb9 commit 31f141b
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/obakittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: macos-13
runs-on: macos-14

steps:
- uses: actions/checkout@v2
Expand All @@ -21,7 +21,7 @@ jobs:
${{ runner.os }}-spm-
- name: Switch Xcode 15
run: sudo xcode-select -switch /Applications/Xcode_15.0.1.app
run: sudo xcode-select -switch /Applications/Xcode_15.4.app

- name: Install xcodegen
run: brew install xcodegen
Expand Down
2 changes: 1 addition & 1 deletion Apps/Shared/analytics_fx_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
packages:
Firebase:
url: https://github.com/firebase/firebase-ios-sdk.git
majorVersion: 9.3.0
majorVersion: 10.29.0

targets:
App:
Expand Down
2 changes: 1 addition & 1 deletion Apps/Shared/app_shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ settings:
base:
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: true
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER: false
MARKETING_VERSION: 24.1.0
MARKETING_VERSION: 24.2.0

options:
minimumXcodeGenVersion: 2.17
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"originHash" : "d50ac90e89b7fcc5be736448d6951021804837a9d0f32e7eeb044c444b4346e4",
"pins" : [
{
"identity" : "abseil-cpp-swiftpm",
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/abseil-cpp-SwiftPM.git",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "583de9bd60f66b40e78d08599cc92036c2e7e4e1",
"version" : "0.20220203.2"
"revision" : "748c7837511d0e6a507737353af268484e1745e2",
"version" : "1.2024011601.1"
}
},
{
"identity" : "boringssl-swiftpm",
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/boringssl-SwiftPM.git",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "dd3eda2b05a3f459fc3073695ad1b28659066eab",
"version" : "0.9.1"
"revision" : "3b62f154d00019ae29a71e9738800bb6f18b236d",
"version" : "10.19.2"
}
},
{
Expand Down Expand Up @@ -68,8 +69,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "8467858fc4cee858511380ac0f9ea5a17d007b5d",
"version" : "9.3.0"
"revision" : "eca84fd638116dd6adb633b5a3f31cc7befcbb7d",
"version" : "10.29.0"
}
},
{
Expand All @@ -86,44 +87,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "f54f60d0164d887e1174fa51ab2efe48a8e9d178",
"version" : "9.3.0"
"revision" : "fe727587518729046fc1465625b9afd80b5ab361",
"version" : "10.28.0"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8",
"version" : "9.2.0"
"revision" : "a637d318ae7ae246b02d7305121275bc75ed5565",
"version" : "9.4.0"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "f4abe56ce62a779e64b525eb133c8fc2a84bbc1f",
"version" : "7.7.1"
"revision" : "57a1d307f42df690fdef2637f3e5b776da02aad6",
"version" : "7.13.3"
}
},
{
"identity" : "grpc-ios",
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/grpc/grpc-ios.git",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "8440b914756e0d26d4f4d054a1c1581daedfc5b6",
"version" : "1.44.3-grpc"
"revision" : "e9fad491d0673bdda7063a0341fb6b47a30c5359",
"version" : "1.62.2"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "19605024d59eaefdb1f6a2cb11ebe75df4421126",
"version" : "2.0.0"
"revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b",
"version" : "3.5.0"
}
},
{
Expand All @@ -135,6 +136,15 @@
"version" : "1.1.0"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
"version" : "100.0.0"
}
},
{
"identity" : "leveldb",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -185,8 +195,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/promises.git",
"state" : {
"revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb",
"version" : "2.1.1"
"revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
"version" : "2.4.0"
}
},
{
Expand Down Expand Up @@ -217,5 +227,5 @@
}
}
],
"version" : 2
"version" : 3
}
12 changes: 2 additions & 10 deletions OBAKit/Controls/AwesomeSpotlightView/AwesomeSpotlightView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@ class AwesomeSpotlightView: UIView {
let continueLabelWidth = skipButtonModel.isEnable ? 0.7 * bounds.size.width : bounds.size.width
let continueLabelHeight: CGFloat = 30.0

if #available(iOS 11.0, *) {
continueLabel = UILabel(frame: CGRect(x: 0, y: bounds.size.height - continueLabelHeight - safeAreaInsets.bottom, width: continueLabelWidth, height: continueLabelHeight))
} else {
continueLabel = UILabel(frame: CGRect(x: 0, y: bounds.size.height - continueLabelHeight, width: continueLabelWidth, height: continueLabelHeight))
}
continueLabel = UILabel(frame: CGRect(x: 0, y: bounds.size.height - continueLabelHeight - safeAreaInsets.bottom, width: continueLabelWidth, height: continueLabelHeight))

continueLabel.font = continueButtonModel.font
continueLabel.textAlignment = .center
Expand All @@ -156,11 +152,7 @@ class AwesomeSpotlightView: UIView {
let skipSpotlightButtonWidth = bounds.size.width - continueLabelWidth
let skipSpotlightButtonHeight: CGFloat = 30.0

if #available(iOS 11.0, *) {
skipSpotlightButton = UIButton(frame: CGRect(x: continueLabelWidth, y: bounds.size.height - skipSpotlightButtonHeight - safeAreaInsets.bottom, width: skipSpotlightButtonWidth, height: skipSpotlightButtonHeight))
} else {
skipSpotlightButton = UIButton(frame: CGRect(x: continueLabelWidth, y: bounds.size.height - skipSpotlightButtonHeight, width: skipSpotlightButtonWidth, height: skipSpotlightButtonHeight))
}
skipSpotlightButton = UIButton(frame: CGRect(x: continueLabelWidth, y: bounds.size.height - skipSpotlightButtonHeight - safeAreaInsets.bottom, width: skipSpotlightButtonWidth, height: skipSpotlightButtonHeight))

skipSpotlightButton.addTarget(self, action: #selector(AwesomeSpotlightView.skipSpotlight), for: .touchUpInside)
skipSpotlightButton.setTitle(skipButtonModel.title, for: [])
Expand Down
36 changes: 11 additions & 25 deletions OBAKit/Controls/Navigation/RenamableNavigationTitle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ fileprivate struct RenamableNavigationTitle<MenuItems: View>: ViewModifier {
.frame(maxWidth: geometry.size.width, alignment: .center)
.position(x: geometry.frame(in: .local).midX, y: geometry.frame(in: .local).midY)
}

}
}

Expand All @@ -110,34 +109,26 @@ extension View {
/// - precondition: `title` cannot be an empty string.
/// - postcondition: The title will not be set to an empty string. If the user inputs an empty title, it is defaulted back to the pre-editing title.
/// - parameter title: The string to display in the navigation title. When the user renames the text, it is updating the binding.
/// - parameter forceCustomImplementation: Forces the use of the custom implementation (polyfill). This is primarily used for previews.
/// - parameter menuItems: Additional actions to display in the menu. A `Rename` action is already included by default.
@ViewBuilder
func renamableNavigationTitle<C>(
_ title: Binding<String>,
forceCustomImplementation: Bool = false,
@ViewBuilder menuItems: () -> C = { EmptyView() }
) -> some View where C: View {
if #available(iOS 16.0, *), !forceCustomImplementation {
self
.navigationBarTitleDisplayMode(.inline)
.navigationTitle(title)
.toolbarTitleMenu {
RenameButton()
menuItems()
}
} else {
// Apply our custom implementation of the navigation title, since iOS 16 APIs are unavailable.
modifier(RenamableNavigationTitle(title: title, menuItems: menuItems))
}
self
.navigationBarTitleDisplayMode(.inline)
.navigationTitle(title)
.toolbarTitleMenu {
RenameButton()
menuItems()
}
}
}

// MARK: - Previews

fileprivate struct RenamableNavigationTitlePreview: View {
@State var title = "Hello, world!LONGLONGLONGLONGLONGLONGLONGLONG"
var forceCustomImplementation: Bool = false

@State var isShowingAlert = false

Expand All @@ -152,7 +143,7 @@ fileprivate struct RenamableNavigationTitlePreview: View {
title += "+"
}
}
.renamableNavigationTitle($title, forceCustomImplementation: forceCustomImplementation)
.renamableNavigationTitle($title)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button("Leading", action: {})
Expand All @@ -167,21 +158,16 @@ fileprivate struct RenamableNavigationTitlePreview: View {

struct RenamableNavigationTitle_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
RenamableNavigationTitlePreview(forceCustomImplementation: true)
}
.previewDisplayName("Custom implementation (iOS 15)")

// Test the truncation of the navigation title, and title respecting
// other toolbar items.
NavigationView {
RenamableNavigationTitlePreview(title: "asdfLongLongLongLongLongLongLongLongLong", forceCustomImplementation: true)
RenamableNavigationTitlePreview(title: "asdfLongLongLongLongLongLongLongLongLong")
}
.previewDisplayName("Custom implementation, long title (iOS 15)")
.previewDisplayName("long title")

NavigationView {
RenamableNavigationTitlePreview()
}
.previewDisplayName("iOS stock implementation (iOS 16+)")
.previewDisplayName("No title")
}
}
10 changes: 4 additions & 6 deletions OBAKit/Mapping/MapStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,10 @@ class MapStatusView: UIView {

// MARK: - State changes
func state(for service: LocationService) -> State {
if #available(iOS 14, *) {
return .init(service.authorizationStatus,
isImprecise: service.accuracyAuthorization == .reducedAccuracy)
} else {
return .init(service.authorizationStatus)
}
return .init(
service.authorizationStatus,
isImprecise: service.accuracyAuthorization == .reducedAccuracy
)
}

func configure(with service: LocationService) {
Expand Down
6 changes: 2 additions & 4 deletions OBAKit/Mapping/MapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,8 @@ class MapViewController: UIViewController,
alert.addAction(keepLocationOffButton)
case .impreciseLocation:
alert.addAction(goToSettingsButton)
if #available(iOS 14, *) {
alert.addAction(title: OBALoc("locationservices_alert_request_precise_location_once.button", value: "Allow Once", comment: "")) { _ in
self.application.locationService.requestTemporaryFullAccuracyAuthorization(withPurposeKey: "MapStatusView")
}
alert.addAction(title: OBALoc("locationservices_alert_request_precise_location_once.button", value: "Allow Once", comment: "")) { _ in
self.application.locationService.requestTemporaryFullAccuracyAuthorization(withPurposeKey: "MapStatusView")
}
alert.addAction(title: OBALoc("locationservices_alert_keep_precise_location_off.button", value: "Keep Precise Location Off", comment: ""), handler: nil)
case .locationServicesUnavailable, .locationServicesOn:
Expand Down
19 changes: 3 additions & 16 deletions OBAKit/Stops/StopViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,10 @@ public class StopViewController: UIViewController,
// On iOS 13+ (SFSymbols 1.0), the symbol name is `line.horizontal.3.decrease.circle`.
if stopPreferences.hasHiddenRoutes && isListFiltered {
filterButtonTitle = "FILTER (ON)"
if #available(iOS 15, *) {
filterButtonImage = UIImage(systemName: "line.3.horizontal.decrease.circle.fill")
} else {
filterButtonImage = UIImage(systemName: "line.horizontal.3.decrease.circle.fill")
}
filterButtonImage = UIImage(systemName: "line.3.horizontal.decrease.circle.fill")
} else {
filterButtonTitle = "FILTER (OFF)"
if #available(iOS 15, *) {
filterButtonImage = UIImage(systemName: "line.3.horizontal.decrease.circle")
} else {
filterButtonImage = UIImage(systemName: "line.horizontal.3.decrease.circle")
}
filterButtonImage = UIImage(systemName: "line.3.horizontal.decrease.circle")
}

let filterMenuButton = UIBarButtonItem(title: filterButtonTitle, image: filterButtonImage, menu: filterMenu())
Expand Down Expand Up @@ -406,12 +398,7 @@ public class StopViewController: UIViewController,
var sortMenu: UIMenu
let sortMenuTitle = OBALoc("stop_preferences_controller.sorting_section.header_title", value: "Sort By", comment: "Title of the Sorting section")
let sortMenuImage = UIImage(systemName: "arrow.up.arrow.down")
if #available(iOS 15, *) {
// Submenus in iOS 15 looks better.
sortMenu = UIMenu(title: sortMenuTitle, image: sortMenuImage, children: [sortByTime, sortByRoute])
} else {
sortMenu = UIMenu(title: sortMenuTitle, image: sortMenuImage, options: .displayInline, children: [sortByTime, sortByRoute])
}
sortMenu = UIMenu(title: sortMenuTitle, image: sortMenuImage, children: [sortByTime, sortByRoute])

return sortMenu
}
Expand Down
7 changes: 2 additions & 5 deletions OBAKit/Trip/TripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,8 @@ class TripViewController: UIViewController,
super.viewDidLoad()

// Don't show user location if accuracy is reduced to avoid user confusion.
if #available(iOS 14, *) {
mapView.showsUserLocation = application.locationService.isLocationUseAuthorized && application.locationService.accuracyAuthorization == .fullAccuracy
} else {
mapView.showsUserLocation = application.locationService.isLocationUseAuthorized
}
mapView.showsUserLocation = application.locationService.isLocationUseAuthorized && application.locationService.accuracyAuthorization == .fullAccuracy

mapView.showsTraffic = application.mapRegionManager.mapViewShowsTraffic
mapView.showsScale = application.mapRegionManager.mapViewShowsScale
application.mapRegionManager.registerAnnotationViews(mapView: mapView)
Expand Down
8 changes: 3 additions & 5 deletions OBAKitUITests/OBAKitUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ import XCTest

class AppUITests: XCTestCase {
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}

0 comments on commit 31f141b

Please sign in to comment.