mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 20:55:31 +00:00
Extract method to handle weak self only once
This commit is contained in:
@@ -57,12 +57,7 @@ class TrackingViewController : UIViewController {
|
||||
preferredStyle: .alert
|
||||
)
|
||||
let okAction = UIAlertAction(title: Translation.Common.OK.String, style: .default) { [weak self] action in
|
||||
LocationManager.sharedManager.stopTracking()
|
||||
SVProgressHUD.show()
|
||||
self?.sessionController.gpsFixController.sendAll(completion: { (withSuccess) in
|
||||
SVProgressHUD.popActivity()
|
||||
self?.dismiss(animated: true, completion: nil)
|
||||
})
|
||||
self?.stopTracking()
|
||||
}
|
||||
let cancelAction = UIAlertAction(title: Translation.Common.Cancel.String, style: .cancel, handler: nil)
|
||||
alertController.addAction(okAction)
|
||||
@@ -70,6 +65,15 @@ class TrackingViewController : UIViewController {
|
||||
present(alertController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
fileprivate func stopTracking() {
|
||||
LocationManager.sharedManager.stopTracking()
|
||||
SVProgressHUD.show()
|
||||
self.sessionController.gpsFixController.sendAll(completion: { (withSuccess) in
|
||||
SVProgressHUD.popActivity()
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - UITableViewDataSourceDelegate
|
||||
|
||||
Reference in New Issue
Block a user