From bd84e1033ab58f9a71acb1b790fc5ba468d9a41a Mon Sep 17 00:00:00 2001 From: Vincent Neo <23420208+vincentneo@users.noreply.github.com> Date: Wed, 5 Jun 2019 11:30:42 +0800 Subject: [PATCH] iPod Touch 7th Gen added! --- Sources/DeviceModel.swift | 3 ++- Sources/Identifier.swift | 2 ++ Tests/DeviceModelTests.swift | 4 ++++ Tests/IdentifierTests.swift | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Sources/DeviceModel.swift b/Sources/DeviceModel.swift index 37e229d..5c3c3b0 100644 --- a/Sources/DeviceModel.swift +++ b/Sources/DeviceModel.swift @@ -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 } @@ -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 } } diff --git a/Sources/Identifier.swift b/Sources/Identifier.swift index 81f4097..b9a0a12 100644 --- a/Sources/Identifier.swift +++ b/Sources/Identifier.swift @@ -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" } diff --git a/Tests/DeviceModelTests.swift b/Tests/DeviceModelTests.swift index 0553be2..d1994ef 100644 --- a/Tests/DeviceModelTests.swift +++ b/Tests/DeviceModelTests.swift @@ -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 diff --git a/Tests/IdentifierTests.swift b/Tests/IdentifierTests.swift index 121242b..25ac80c 100644 --- a/Tests/IdentifierTests.swift +++ b/Tests/IdentifierTests.swift @@ -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")