     scalings[KeyboardScaleMap.hashKey(for: Device.iPadPro9Inch)] = Scaling(portrait: KeyboardSize(w: 768, h: 265, b: 55), landscape: KeyboardSize(w: 1024, h: 353, b: 55)) // Banner always shows; merges copy ctrls with pred-banner.
     scalings[KeyboardScaleMap.hashKey(for: Device.iPadPro11Inch)] = Scaling(portrait: KeyboardSize(w: 834, h: 265, b: 55), landscape: KeyboardSize(w: 1194, h: 353, b: 55)) // Banner always shows; has a safe-area inset {p: 20, l: 20}
     scalings[KeyboardScaleMap.hashKey(for: Device.iPadPro12Inch3)] = Scaling(portrait: KeyboardSize(w: 1024, h: 328, b: 55), landscape: KeyboardSize(w: 1366, h: 423, b: 55)) // Banner always shows; has a safe-area inset {p: 20, l: 20}
+
+    // The following definitions are in sorted order of increasing device resolution.
+    // Currrently, this also tends to correlates with the underlying devices' release dates.
+    phoneScalingThresholds =  [ Device.iPhoneSE, // smallest phone for 13.0
+                                Device.iPhone8,  // is 'pre-notch'
+                                Device.iPhoneX,  // smallest with 'notch'
+                                Device.iPhoneXR, // largest current model
+                              ]
+
+    tabletScalingThresholds = [ Device.iPad5, // smallest supported tablet
+                                Device.iPad7, // smallest 13.0 tablet
+                                Device.iPadAir3,
+                                Device.iPadPro11Inch,
+                                Device.iPadPro12Inch3, // taller than others of width, but is most recent at the same scale.
+                              ]
+
+    pointSizes = [:]
+
+    // `UIScreen.mains.bounds` values for threshold devices.  Taken in "portrait" orientation.
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPhoneSE)] = CGSize(width: 320, height: 568)
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPhone8)] = CGSize(width: 375, height: 667)
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPhoneX)] = CGSize(width: 375, height: 812)
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPhoneXR)] = CGSize(width: 414, height: 896)
+
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPad5)] = CGSize(width: 768, height: 1024)
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPad7)] = CGSize(width: 810, height: 1080)
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPadAir3)] = CGSize(width: 834, height: 1112)
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPadPro11Inch)] = CGSize(width: 834, height: 1194)
+    pointSizes[KeyboardScaleMap.hashKey(for: Device.iPadPro12Inch3)] = CGSize(width: 1024, height: 1366)
   }
 
   public static var shared: KeyboardScaleMap {


class KeyboardScaleMap {
  private var scalings: [String: Scaling]
  static var _shared: KeyboardScaleMap?

  private init() {

      return forPortrait ? scaling.portrait : scaling.landscape
    }

    var isUnknown = false
    switch device {
      case .unknown(_):
        isUnknown = true
        fallthrough
      default:
        if !isUnknown {
          // We can still perform a mapping, but it's not ideal.
          log.warning("Keyboard scaling definition missing for device \(device.description)")
        }

        // The expected case:  isUnknown = true.
        // Applies to future models of iPhone and iPad.  DeviceKit is of no help here, so we
        // compute the closest-resolution known device.
        let mappedDevice = getUnknownDeviceMapping()

        // As noted in the scalings data-map, devices of the same dimensions tend to have the same
        // keyboard dimensions.  It's not a perfect rule, but should suffice for a stop-gap solution.
        let scaling = shared.scalings[KeyboardScaleMap.hashKey(for: mappedDevice)]!

        return forPortrait ? scaling.portrait : scaling.landscape
    }
  }
}
