Clean up code

parent 5c545872
Pipeline #698 canceled with stages
......@@ -87,6 +87,8 @@ class ViewController: UIViewController, UITextViewDelegate {
let layoutGuides = [layoutGuideBase, layoutGuideTopMargin, layoutGuideStatusBadgeLeftMargin, layoutGuideStatusBadgeRightMargin, layoutGuideBottomMargin]
let layoutElements = [layoutElementStatusBadge, layoutElementStatusText]
for layoutGuide in layoutGuides { layoutGuide!.isHidden = true }
// TODO: Should we use transparent for this to make the rotations look nicer?
for layoutElement in layoutElements { layoutElement!.backgroundColor = UIColor.white }
}
......@@ -118,12 +120,13 @@ class ViewController: UIViewController, UITextViewDelegate {
}
var fontSize:BetterFontSize = .smallest
switch relevantDimensionValue {
case 0...374: fontSize = .smallest
case 375...413: fontSize = .small
case 414...824: fontSize = .medium
case 835...1023: fontSize = .medium
default: fontSize = .large
case 0...374: fontSize = .smallest
case 375...413: fontSize = .small
case 414...824: fontSize = .medium
case 835...1023: fontSize = .medium
default: fontSize = .large
}
print("Font size: \(fontSize)")
......@@ -232,21 +235,9 @@ class ViewController: UIViewController, UITextViewDelegate {
/// the text area is scrolled to the top if it overflows the visible area.
///
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
// Scroll the status text to the top in the next stack frame in case the text overflows the visible
// area so that the top of the message is always visible. (This can happen when the text size is set
// to a large setting via Dynamic Type (Accessibility).
print("Will transition to size: \(size).")
self.updateStatus()
coordinator.animate(alongsideTransition: nil) {
/* when complete, handle */ (coordinatorContext) in
// Scroll the status text view to the top (in case the person’s Dynamic Type
// settings have made the text overflow the visible region). (Accessibility)
self.statusTextView.setContentOffset(.zero, animated: false)
}
}
......@@ -255,8 +246,6 @@ class ViewController: UIViewController, UITextViewDelegate {
/// aligned correctly.
///
override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {
// TODO: LEFT OFF: Set the image horizontal alignment based on the vertical size class.
// (Left for compressed, centre for all others.)
print("Will transition to new trait collection.")
updateStatus()
......@@ -270,19 +259,20 @@ class ViewController: UIViewController, UITextViewDelegate {
guard
let launchSettingsURL = Foundation.URL(string: "better://launch-settings"),
let checkForUpdatesURL = Foundation.URL(string: "better://check-for-updates")
else
{
else {
fatalError("Could not create URL constants.")
}
switch URL {
case launchSettingsURL:
// TODO: Launch settings.
print("TODO: launch settings.")
case checkForUpdatesURL:
// TODO: Check for updates.
print("TODO: check for updates.")
default:
print("Warning: unhandled URL detected: \(URL). Ignoring.")
case launchSettingsURL:
// TODO: Launch settings.
print("TODO: launch settings.")
case checkForUpdatesURL:
// TODO: Check for updates.
print("TODO: check for updates.")
default:
print("Warning: unhandled URL detected: \(URL). Ignoring.")
}
return false
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment