Skip to content
Merged
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
24 changes: 22 additions & 2 deletions Loop/View Controllers/BolusViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class BolusViewController: UITableViewController, IdentifiableClass, UITex
bolusAmountTextField.accessibilityHint = String(format: NSLocalizedString("Recommended Bolus: %@ Units", comment: "Accessibility hint describing recommended bolus units"), spellOutFormatter.string(from: NSNumber(value: recommendedBolus)) ?? "0")

bolusAmountTextField.becomeFirstResponder()

AnalyticsManager.sharedManager.didDisplayBolusScreen()
}

Expand All @@ -42,10 +42,30 @@ final class BolusViewController: UITableViewController, IdentifiableClass, UITex
}
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (indexPath.row == 0) {
acceptRecommendedBolus();
}
}

override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if (indexPath.row == 0) {
cell.accessibilityCustomActions = [
UIAccessibilityCustomAction(name: NSLocalizedString("AcceptRecommendedBolus", comment: "Action to copy the recommended Bolus value to the actual Bolus Field"), target: self, selector: #selector(BolusViewController.acceptRecommendedBolus))
]
}
}

@objc
func acceptRecommendedBolus() {
bolusAmountTextField?.text = recommendedBolusAmountLabel?.text
}


@IBOutlet weak var bolusAmountTextField: UITextField!

// MARK: - Actions

@IBAction func authenticateBolus(_ sender: Any) {
bolusAmountTextField.resignFirstResponder()

Expand Down