Skip to content

Commit

Permalink
Add support for new March 2022 devices. (#308)
Browse files Browse the repository at this point in the history
* Add iPhone SE (3rd generation) and iPad Air (5th generation) support.

* Fix tests.

* Add device identifier for iPhone SE (3rd generation)

* Version bump (4.6.0) and update changelog.

* Fix testIsPhoneIsPadIsPod test.

* Add device identifiers for iPad Air (5th generation)

* Use Python 3 for gyb.

* Adjust release date.

* Add support URL and images for iPhone SE (3rd generation).

* fix release date due to sick leave

* correct version in readme

Co-authored-by: Denise Nepraunig <[email protected]>
  • Loading branch information
Zandor300 and denisenepraunig authored Mar 18, 2022
1 parent 1d310c5 commit af953da
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 50 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## Version 4.6.0

Releasedate: 2022-03-18

```ruby
pod 'DeviceKit', '~> 4.6'
```

### New March 2022 devices

This version adds support for the devices announced at the March 2022 Apple Event: ([#286](https://github.com/devicekit/DeviceKit/pull/308))

| Device | Case value |
| --- | --- |
| iPhone SE (3rd generation) | `Device.iPhoneSE3` |
| iPad Air (5th generation) | `Device.iPadAir5` |

## Version 4.5.2

Releasedate: 2021-10-24
Expand Down
2 changes: 1 addition & 1 deletion DeviceKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'DeviceKit'
s.version = '4.5.2'
s.version = '4.6.0'
s.summary = 'DeviceKit is a µ-framework that provides a value-type replacement of UIDevice.'

s.description = <<-DESC
Expand Down
4 changes: 2 additions & 2 deletions DeviceKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 4.5.2;
MARKETING_VERSION = 4.6.0;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = me.dennisweissmann.DeviceKit;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -439,7 +439,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 4.5.2;
MARKETING_VERSION = 4.6.0;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = me.dennisweissmann.DeviceKit;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

`DeviceKit` is a value-type replacement of [`UIDevice`](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/).

## Current version 4.5.2
## Current version 4.6.0.
See our detailed [changelog](CHANGELOG.md) for the latest features, improvements and bug fixes.

## Features
Expand Down
41 changes: 32 additions & 9 deletions Source/Device.generated.swift

Large diffs are not rendered by default.

62 changes: 32 additions & 30 deletions Source/Device.swift.gyb

Large diffs are not rendered by default.

61 changes: 55 additions & 6 deletions Tests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,38 @@ class DeviceKitTests: XCTestCase {
XCTAssertTrue(device.isSimulator)
}

func testIsPhoneIsPad() {
func testIsPhoneIsPadIsPod() {
// Test for https://github.com/devicekit/DeviceKit/issues/165 to prevent it from happening in the future.

if UIDevice.current.userInterfaceIdiom == .pad {
XCTAssertTrue(device.isPad)
XCTAssertFalse(device.isPhone)
XCTAssertFalse(device.isPod)
} else if UIDevice.current.userInterfaceIdiom == .phone {
XCTAssertFalse(device.isPad)
XCTAssertTrue(device.isPhone) // TODO: failed for iPod touch (7th generation)
if device.description.contains("iPod") {
XCTAssertFalse(device.isPhone)
XCTAssertTrue(device.isPod)
} else {
XCTAssertTrue(device.isPhone)
XCTAssertFalse(device.isPod)
}
}

for pad in Device.allPads {
XCTAssertTrue(pad.isPad)
XCTAssertFalse(pad.isPhone)
XCTAssertFalse(pad.isPod)
}
for phone in Device.allPhones {
XCTAssertFalse(phone.isPad)
XCTAssertTrue(phone.isPhone)
XCTAssertFalse(phone.isPod)
}
for pod in Device.allPods {
XCTAssertFalse(pod.isPad)
XCTAssertFalse(pod.isPhone)
XCTAssertTrue(pod.isPod)
}
}

Expand Down Expand Up @@ -349,11 +363,37 @@ class DeviceKitTests: XCTestCase {
}

func testIsPlusSized() {
XCTAssertEqual(Device.allPlusSizedDevices, [.iPhone6Plus, .iPhone6sPlus, .iPhone7Plus, .iPhone8Plus, .iPhoneXSMax, .iPhone11ProMax, .iPhone12ProMax])
XCTAssertEqual(Device.allPlusSizedDevices, [
.iPhone6Plus,
.iPhone6sPlus,
.iPhone7Plus,
.iPhone8Plus,
.iPhoneXSMax,
.iPhone11ProMax,
.iPhone12ProMax,
.iPhone13ProMax
])
}

func testIsPro() {
XCTAssertEqual(Device.allProDevices, [.iPhone11Pro, .iPhone11ProMax, .iPhone12Pro, .iPhone12ProMax, .iPadPro9Inch, .iPadPro12Inch, .iPadPro12Inch2, .iPadPro10Inch, .iPadPro11Inch, .iPadPro12Inch3, .iPadPro11Inch2, .iPadPro12Inch4, .iPadPro11Inch3, .iPadPro12Inch5])
XCTAssertEqual(Device.allProDevices, [
.iPhone11Pro,
.iPhone11ProMax,
.iPhone12Pro,
.iPhone12ProMax,
.iPhone13Pro,
.iPhone13ProMax,
.iPadPro9Inch,
.iPadPro12Inch,
.iPadPro12Inch2,
.iPadPro10Inch,
.iPadPro11Inch,
.iPadPro12Inch3,
.iPadPro11Inch2,
.iPadPro12Inch4,
.iPadPro11Inch3,
.iPadPro12Inch5
])
}

func testGuidedAccessSession() {
Expand Down Expand Up @@ -433,9 +473,18 @@ class DeviceKitTests: XCTestCase {
}

func testLidarValues() {
let lidarDevices: [Device] = [.iPhone12Pro, .iPhone12ProMax, .iPadPro11Inch2, .iPadPro12Inch4, .iPadPro11Inch3, .iPadPro12Inch5]
let lidarDevices: [Device] = [
.iPhone12Pro,
.iPhone12ProMax,
.iPhone13Pro,
.iPhone13ProMax,
.iPadPro11Inch2,
.iPadPro12Inch4,
.iPadPro11Inch3,
.iPadPro12Inch5
]
for device in Device.allRealDevices {
XCTAssertTrue(device.hasLidarSensor == device.isOneOf(lidarDevices))
XCTAssertTrue(device.hasLidarSensor == device.isOneOf(lidarDevices), "testLidarValues failed for \(device.description)")
}
}

Expand Down
2 changes: 1 addition & 1 deletion Utils/gyb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
import gyb
gyb.main()

0 comments on commit af953da

Please sign in to comment.