Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve bluetooth turned off error #174

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions SitumWayfinding/Classes/Positioning/PositioningPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,28 @@ class PositioningPresenter: NSObject, SITLocationDelegate, SITDirectionsDelegate

func locationManager(_ locationManager: SITLocationInterface, didFailWithError error: Error?) {
Logger.logErrorMessage("Location error problem: \(error.debugDescription)")
view?.cleanLocationUI()
view?.stopNavigation(status: .error(NavigationError.locationError(error)))

// TODO: Update SDK Error visibility to access
switch error {
case .some(let error as NSError) where error.code == 7 || error.code == 8:

view?.showAlertMessage(title: NSLocalizedString("wayfinding.permissionsErrorTitle", bundle: SitumMapsLibrary.bundle, comment: "Unable to provide location"), message: NSLocalizedString("wayfinding.permissionsErrorDescription", bundle: SitumMapsLibrary.bundle, comment: "Please go to settings and enable location and bluetooth permissions to provide locations") , alertType: .permissionsError)

case .some(let error as NSError) where error.code == 6: // Bluetooth turned off
// Positioning keeps working in case of useGps
if error.userInfo["kindof"] as! String == "warning" {
return
}
// If critical then stop reporting location
default:
print("detected error: \(error)")

}

view?.cleanLocationUI()
view?.stopNavigation(status: .error(NavigationError.locationError(error)))

// TODO: Update SDK Error visibility to access

}

func locationManager(_ locationManager: SITLocationInterface, didUpdate state: SITLocationState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ class PositioningViewController: UIViewController, GMSMapViewDelegate, UITableVi
self.dismiss(animated: true)
}
}

}

@IBAction
Expand Down