Skip to content

Commit

Permalink
Critical bug fix: turning on headset mode crashed the app on iPhone 1…
Browse files Browse the repository at this point in the history
…3 series. The app is now future-proof against devices that may be released before it can compensate for them.
  • Loading branch information
philipturner committed Sep 25, 2021
1 parent b7f6e39 commit 63268c6
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 51 deletions.
12 changes: 6 additions & 6 deletions AR MultiPendulum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_COMPILER_FLAGS = "-fpreserve-invariance";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -1507,7 +1507,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_COMPILER_FLAGS = "-fpreserve-invariance";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand All @@ -1530,12 +1530,12 @@
DEVELOPMENT_TEAM = 6T952M2592;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "AR MultiPendulum/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.philipturner.AR-MultiPendulum";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1557,12 +1557,12 @@
DEVELOPMENT_TEAM = 6T952M2592;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "AR MultiPendulum/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.philipturner.AR-MultiPendulum";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"repositoryURL": "https://github.com/devicekit/DeviceKit",
"state": {
"branch": "master",
"revision": "70f1564e4218f0b68b73a4a795cb31aee5696f08",
"revision": "769a8aefbe99c8e83650b94acf6343f06f6db20b",
"version": null
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ final class CameraMeasurements: DelegateUserSettings {
var device: FutureDevice

if screenBounds.width >= 2778 || screenBounds.height >= 1284 {
device = .iPhone13ProMax
device = .iPhone14ProMax
} else if screenBounds.width >= 2532 || screenBounds.height >= 1170 {
if ARWorldTrackingConfiguration.supportsSceneReconstruction(.mesh) {
device = .iPhone13Pro
device = .iPhone14Pro
} else {
device = .iPhone13
device = .iPhone14
}
} else if screenBounds.width >= 2340 || screenBounds.height >= 1080 {
device = .iPhone13Mini
} else {
device = .iPhoneSE3
}
Expand All @@ -106,10 +104,10 @@ final class CameraMeasurements: DelegateUserSettings {
device = .iPadPro11Inch3
} else if screenBounds.width >= 2360 || screenBounds.height >= 1640 {
device = .iPadAir4
} else if screenBounds.width >= 2160 || screenBounds.height >= 1620 {
device = .iPad8
} else if screenBounds.width >= 2266 || screenBounds.height < 1620 {
device = .iPadMini6
} else {
device = .iPadMini5
device = .iPad9
}

deviceSize = device.deviceSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ extension Device: DeviceMeasurementProvider {
case .iPhone12: return 0.001 * [146.71, 71.52, 7.39]
case .iPhone12Pro: return 0.001 * [146.71, 71.52, 7.39]
case .iPhone12ProMax: return 0.001 * [160.84, 78.07, 7.39]

case .iPhone13Mini: return 0.001 * [131.50, 64.21, 7.65]
case .iPhone13: return 0.001 * [146.71, 71.52, 7.65]
case .iPhone13Pro: return 0.001 * [146.71, 71.52, 7.65]
case .iPhone13ProMax: return 0.001 * [160.84, 78.07, 7.65]

case .iPadMini5: return 0.001 * [203.16, 134.75, 6.10]
case .iPadMini6: return 0.001 * [195.40, 134.80, 6.30]

case .iPad5, .iPad6: return 0.001 * [240.00, 169.47, 7.50]
case .iPad7, .iPad8: return 0.001 * [250.59, 174.08, 7.50]
case .iPad9: return 0.001 * [250.59, 174.08, 7.50]

case .iPadAir3: return 0.001 * [250.59, 174.08, 6.10]
case .iPadAir4: return 0.001 * [247.64, 178.51, 6.123]
Expand Down Expand Up @@ -94,11 +101,18 @@ extension Device: DeviceMeasurementProvider {
case .iPhone12: return 0.001 * [139.77, 64.58]
case .iPhone12Pro: return 0.001 * [139.77, 64.58]
case .iPhone12ProMax: return 0.001 * [153.90, 71.13]

case .iPhone13Mini: return 0.001 * [124.96, 57.67]
case .iPhone13: return 0.001 * [139.77, 64.58]
case .iPhone13Pro: return 0.001 * [139.77, 64.58]
case .iPhone13ProMax: return 0.001 * [153.90, 71.13]

case .iPadMini5: return 0.001 * [160.74, 120.81]
case .iPadMini6: return 0.001 * [160.74, 120.81]

case .iPad5, .iPad6: return 0.001 * [196.47, 147.39]
case .iPad7, .iPad8: return 0.001 * [207.36, 155.52]
case .iPad9: return 0.001 * [207.36, 155.52]

case .iPadAir3: return 0.001 * [213.50, 160.13]
case .iPadAir4: return 0.001 * [227.56, 158.44]
Expand Down Expand Up @@ -129,14 +143,17 @@ extension Device: DeviceMeasurementProvider {

case .iPhoneX, .iPhoneXR, .iPhoneXS, .iPhoneXSMax,
.iPhone11, .iPhone11Pro, .iPhone11ProMax,
.iPhone12Mini, .iPhone12, .iPhone12Pro, .iPhone12ProMax:
.iPhone12Mini, .iPhone12, .iPhone12Pro, .iPhone12ProMax,
.iPhone13Mini, .iPhone13, .iPhone13Pro, .iPhone13ProMax:
return true

case .iPadMini5, .iPad5, .iPad6, .iPad7, .iPad8, .iPadAir3,
case .iPadMini5, .iPadAir3,
.iPad5, .iPad6, .iPad7, .iPad8, .iPad9,
.iPadPro9Inch, .iPadPro10Inch, .iPadPro12Inch, .iPadPro12Inch2:
return false

case .iPadAir4, .iPadPro11Inch, .iPadPro11Inch2, .iPadPro11Inch3,
case .iPadMini6, .iPadAir4,
.iPadPro11Inch, .iPadPro11Inch2, .iPadPro11Inch3,
.iPadPro12Inch3, .iPadPro12Inch4, .iPadPro12Inch5:
return true

Expand Down Expand Up @@ -174,11 +191,18 @@ extension Device: DeviceMeasurementProvider {
case .iPhone12: return 0.001 * [27.01, 12.73, 5.01]
case .iPhone12Pro: return 0.001 * [12.16, 12.16, 5.51]
case .iPhone12ProMax: return 0.001 * [30.90, 13.43, 5.91]

case .iPhone13Mini: return 0.001 * [24.00, 24.00, 5.91]
case .iPhone13: return 0.001 * [24.00, 24.00, 5.91]
case .iPhone13Pro: return 0.001 * [30.90, 13.43, 5.91]
case .iPhone13ProMax: return 0.001 * [30.90, 13.43, 5.91]

case .iPadMini5: return 0.001 * [10.23, 10.23, 2.83]
case .iPadMini6: return 0.001 * [10.23, 10.23, 2.83]

case .iPad5, .iPad6: return 0.001 * [11.68, 14.37, 4.23]
case .iPad7, .iPad8: return 0.001 * [11.66, 14.37, 4.23]
case .iPad9: return 0.001 * [11.66, 14.37, 4.23]

case .iPadAir3: return 0.001 * [10.23, 10.23, 2.80]
case .iPadAir4: return 0.001 * [12.70, 12.69, 6.18]
Expand Down Expand Up @@ -208,21 +232,25 @@ extension Device: DeviceMeasurementProvider {
.iPhone11, .iPhone11Pro, .iPhone11ProMax, .iPhoneSE2,
.iPhone12Pro:
return .topLeft

case .iPhone12Mini, .iPhone12, .iPhone12ProMax:

case .iPhone12Mini, .iPhone12, .iPhone12ProMax,
.iPhone13Pro, .iPhone13ProMax:
return .bottomLeft
case .iPadMini5,
.iPad5, .iPad6, .iPad7, .iPad8,

case .iPadMini5, .iPadMini6,
.iPad5, .iPad6, .iPad7, .iPad8, .iPad9,
.iPadAir3, .iPadAir4,
.iPadPro9Inch, .iPadPro10Inch, .iPadPro11Inch,
.iPadPro12Inch, .iPadPro12Inch2, .iPadPro12Inch3:
return .topLeft

case .iPadPro11Inch2, .iPadPro11Inch3,
.iPadPro12Inch4, .iPadPro12Inch5:
return .bottomLeft

case .iPhone13Mini, .iPhone13:
return .bottomRight

default:
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,60 +12,55 @@ import simd
// released before the app updates to account for them

enum FutureDevice: DeviceMeasurementProvider {
case iPhone13Mini
case iPhone13
case iPhone13Pro
case iPhone13ProMax
case iPhone14
// case iPhone14Max - waiting to implement until rumors are more concrete
case iPhone14Pro
case iPhone14ProMax
case iPhoneSE3

var closestDevice: Device {
switch self {
case .iPhone13Mini: return .iPhone12Mini
case .iPhone13: return .iPhone12
case .iPhone13Pro: return .iPhone12Pro
case .iPhone13ProMax: return .iPhone12ProMax
case .iPhone14: return .iPhone13
case .iPhone14Pro: return .iPhone13Pro
case .iPhone14ProMax: return .iPhone13ProMax
case .iPhoneSE3: return .iPhoneSE2
}
}

var deviceSize: simd_double3! {
switch self {
case .iPhone13Mini: return [131.50, 64.21, 7.65]
case .iPhone13: return [146.71, 71.52, 7.65]
case .iPhone13Pro: return [146.71, 71.52, 7.65]
case .iPhone13ProMax: return [160.84, 78.07, 7.65]
case .iPhoneSE3: return [138.44, 67.27, 7.31]
case .iPhone14: return 0.001 * [146.71, 71.52, 7.65]
case .iPhone14Pro: return 0.001 * [146.71, 71.52, 7.65]
case .iPhone14ProMax: return 0.001 * [160.84, 78.07, 7.65]
case .iPhoneSE3: return 0.001 * [138.44, 67.27, 7.31]
}
}

var screenSize: simd_double2! {
switch self {
case .iPhone13Mini: return [124.96, 57.67]
case .iPhone13: return [139.77, 64.58]
case .iPhone13Pro: return [139.77, 64.58]
case .iPhone13ProMax: return [153.90, 71.13]
case .iPhoneSE3: return [104.05, 58.50]
case .iPhone14: return 0.001 * [139.77, 64.58]
case .iPhone14Pro: return 0.001 * [139.77, 64.58]
case .iPhone14ProMax: return 0.001 * [153.90, 71.13]
case .iPhoneSE3: return 0.001 * [104.05, 58.50]
}
}

var isFullScreen: Bool! { true }

var wideCameraOffset: simd_double3! {
switch self {
case .iPhone13Mini: return [24.00, 24.00, 5.91]
case .iPhone13: return [24.00, 24.00, 5.91]
case .iPhone13Pro: return [30.90, 13.43, 5.91]
case .iPhone13ProMax: return [30.90, 13.43, 5.91]
case .iPhoneSE3: return [10.24, 10.44, 5.31]
case .iPhone14: return 0.001 * [24.00, 24.00, 5.91]
case .iPhone14Pro: return 0.001 * [30.90, 13.43, 5.91]
case .iPhone14ProMax: return 0.001 * [30.90, 13.43, 5.91]
case .iPhoneSE3: return 0.001 * [10.24, 10.44, 5.31]
}
}

var wideCameraID: DeviceBackCameraPosition! {
switch self {
case .iPhone13Mini: return .bottomRight
case .iPhone13: return .bottomRight
case .iPhone13Pro: return .bottomLeft
case .iPhone13ProMax: return .bottomLeft
case .iPhone14: return .bottomRight
case .iPhone14Pro: return .bottomLeft
case .iPhone14ProMax: return .bottomLeft
case .iPhoneSE3: return .topLeft
}
}
Expand Down

0 comments on commit 63268c6

Please sign in to comment.