Skip to content

Commit

Permalink
Merge pull request #37 from Nirma/update/newiPodTouch
Browse files Browse the repository at this point in the history
Adding new iPod Touch support
  • Loading branch information
Nirma authored Jun 5, 2019
2 parents cad7fda + bd84e10 commit 29631f5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/DeviceModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public enum DeviceModel {
case iPadPro9_7Inch, iPadPro10_5Inch, iPadPro11Inch, iPadPro12_9Inch, iPadPro12_9Inch_SecondGen, iPadPro12_9Inch_ThirdGen

case iPodTouchFirstGen, iPodTouchSecondGen, iPodTouchThirdGen,
iPodTouchFourthGen, iPodTouchFifthGen, iPodTouchSixthGen
iPodTouchFourthGen, iPodTouchFifthGen, iPodTouchSixthGen, iPodTouchSeventhGen

case unknown
}
Expand Down Expand Up @@ -154,6 +154,7 @@ extension DeviceModel {
case (4, 1): return .iPodTouchFourthGen
case (5, 1): return .iPodTouchFifthGen
case (7, 1): return .iPodTouchSixthGen
case (9, 1): return .iPodTouchSeventhGen
default: return .unknown
}
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/Identifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ extension Identifier: CustomStringConvertible {
return "5th Gen iPod"
case (7, 1):
return "6th Gen iPod"
case (9, 1):
return "7th Gen iPod"
default:
return "unknown"
}
Expand Down
4 changes: 4 additions & 0 deletions Tests/DeviceModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ class DeviceModelTests: XCTestCase {
let deviceModel = DeviceModel(identifier: Identifier("iPod7,1"))
XCTAssert(deviceModel == .iPodTouchSixthGen , "DeviceModel - .iPodSixthGen is failing")
}
func testDeviceModelIPodTouchSeventhGen() {
let deviceModel = DeviceModel(identifier: Identifier("iPod9,1"))
XCTAssert(deviceModel == .iPodTouchSeventhGen , "DeviceModel - .iPodSeventhGen is failing")
}

// MARK: Simulator Test

Expand Down
4 changes: 4 additions & 0 deletions Tests/IdentifierTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ class IdentifierTests: XCTestCase {


// MARK: - iPod

func testDisplayStringiPod9v1() {
XCTAssert(Identifier("iPod9,1").description == "7th Gen iPod", "iPod9,1 is failing to produce a common device model string")
}

func testDisplayStringiPod7v1() {
XCTAssert(Identifier("iPod7,1").description == "6th Gen iPod", "iPod7,1 is failing to produce a common device model string")
Expand Down

0 comments on commit 29631f5

Please sign in to comment.