Skip to content

Commit

Permalink
Merge pull request #61 from OneBusAway/fix-testflight-crash
Browse files Browse the repository at this point in the history
Fix Testflight Crash
  • Loading branch information
aaronbrethorst authored Aug 22, 2024
2 parents 2c17b6a + 120515e commit 225ab0d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
12 changes: 6 additions & 6 deletions Examples/OTPKitDemo/OTPKitDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
0111FD712C6CFBE400B4472E /* OTPKit in Frameworks */ = {isa = PBXBuildFile; productRef = 0111FD702C6CFBE400B4472E /* OTPKit */; };
014316DF2C6B6F2C00B33240 /* OTPKit in Frameworks */ = {isa = PBXBuildFile; productRef = 014316DE2C6B6F2C00B33240 /* OTPKit */; };
01AA23162C758E62008F484E /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 01AA23152C758E62008F484E /* Launch Screen.storyboard */; };
01AA23162C758E62008F484E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 01AA23152C758E62008F484E /* LaunchScreen.storyboard */; };
01AA80542C6B6A7500D4038A /* OTPKitDemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01AA80532C6B6A7500D4038A /* OTPKitDemoApp.swift */; };
01AA80562C6B6A7500D4038A /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01AA80552C6B6A7500D4038A /* MapView.swift */; };
01AA80582C6B6A7600D4038A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 01AA80572C6B6A7600D4038A /* Assets.xcassets */; };
Expand All @@ -18,7 +18,7 @@

/* Begin PBXFileReference section */
014316E02C6B713D00B33240 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
01AA23152C758E62008F484E /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
01AA23152C758E62008F484E /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
01AA80502C6B6A7500D4038A /* OTPKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OTPKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
01AA80532C6B6A7500D4038A /* OTPKitDemoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OTPKitDemoApp.swift; sourceTree = "<group>"; };
01AA80552C6B6A7500D4038A /* MapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapView.swift; sourceTree = "<group>"; };
Expand All @@ -42,7 +42,6 @@
01AA80472C6B6A7500D4038A = {
isa = PBXGroup;
children = (
01AA23152C758E62008F484E /* Launch Screen.storyboard */,
01AA80522C6B6A7500D4038A /* OTPKitDemo */,
01AA80512C6B6A7500D4038A /* Products */,
);
Expand All @@ -59,6 +58,7 @@
01AA80522C6B6A7500D4038A /* OTPKitDemo */ = {
isa = PBXGroup;
children = (
01AA23152C758E62008F484E /* LaunchScreen.storyboard */,
014316E02C6B713D00B33240 /* Info.plist */,
01AA80532C6B6A7500D4038A /* OTPKitDemoApp.swift */,
01AA80552C6B6A7500D4038A /* MapView.swift */,
Expand Down Expand Up @@ -141,7 +141,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
01AA23162C758E62008F484E /* Launch Screen.storyboard in Resources */,
01AA23162C758E62008F484E /* LaunchScreen.storyboard in Resources */,
01AA805B2C6B6A7600D4038A /* Preview Assets.xcassets in Resources */,
01AA80582C6B6A7600D4038A /* Assets.xcassets in Resources */,
);
Expand Down Expand Up @@ -298,7 +298,7 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "Launch Screen.storyboard";
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -331,7 +331,7 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "Launch Screen.storyboard";
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
19 changes: 7 additions & 12 deletions Sources/OTPKit/Services/TripPlannerService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,9 @@ public final class TripPlannerService: NSObject {

// MARK: - User Location Methods

/// Checks if location services are enabled and requests authorization if necessary
public func checkIfLocationServicesIsEnabled() {
DispatchQueue.global().async {
if CLLocationManager.locationServicesEnabled() {
self.checkLocationAuthorization()
}
}
}

private func checkLocationAuthorization() {
switch locationManager.authorizationStatus {
public func checkLocationAuthorization() async {
let status = await locationManager.authorizationStatus
switch status {
case .notDetermined:
locationManager.requestWhenInUseAuthorization()
case .restricted, .denied:
Expand All @@ -322,6 +314,7 @@ public final class TripPlannerService: NSObject {
break
}
}

}

// MARK: - MKLocalSearchCompleterDelegate
Expand Down Expand Up @@ -382,7 +375,9 @@ extension TripPlannerService: CLLocationManagerDelegate {
}

public func locationManagerDidChangeAuthorization(_: CLLocationManager) {
checkLocationAuthorization()
Task {
await checkLocationAuthorization()
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/OTPKit/TripPlannerExtensionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public struct TripPlannerExtensionView<MapContent: View>: View {

overlayContent
}
.onAppear {
tripPlanner.checkIfLocationServicesIsEnabled()
.task {
await tripPlanner.checkLocationAuthorization()
}
}

Expand Down

0 comments on commit 225ab0d

Please sign in to comment.