Skip to content

Commit 149216c

Browse files
authored
Support enacting manual loop if loop error (#1252)
1 parent 9da678d commit 149216c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Loop/View Controllers/StatusTableViewController.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,13 +1259,23 @@ final class StatusTableViewController: ChartsTableViewController {
12591259
}
12601260

12611261
@objc private func showLastError(_: Any) {
1262+
var error: Error? = nil
12621263
// First, check whether we have a device error after the most recent completion date
12631264
if let deviceError = deviceManager.lastError,
12641265
deviceError.date > (hudView?.loopCompletionHUD.lastLoopCompleted ?? .distantPast)
12651266
{
1266-
self.present(UIAlertController(with: deviceError.error), animated: true)
1267+
error = deviceError.error
12671268
} else if let lastLoopError = lastLoopError {
1268-
self.present(UIAlertController(with: lastLoopError), animated: true)
1269+
error = lastLoopError
1270+
}
1271+
1272+
if error != nil {
1273+
let alertController = UIAlertController(with: error!)
1274+
let manualLoopAction = UIAlertAction(title: NSLocalizedString("Retry", comment: "The button text for attempting a manual loop"), style: .default, handler: { _ in
1275+
self.deviceManager.loopManager.loop()
1276+
})
1277+
alertController.addAction(manualLoopAction)
1278+
present(alertController, animated: true)
12691279
}
12701280
}
12711281

0 commit comments

Comments
 (0)