Skip to content

Commit

Permalink
Add descriptions for some App Preview delivery errors (#212)
Browse files Browse the repository at this point in the history
* Add descriptions for some App Preview delivery errors

* Add tests
  • Loading branch information
MortenGregersen authored Dec 9, 2024
1 parent 9e96d5b commit 23b803e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ public extension AppMediaStateError {
*/
var betterDescription: String {
if description == "IMAGE_INCORRECT_DIMENSIONS" {
return "The dimensions of the screenshot is wrong"
"The dimensions of the screenshot is wrong"
} else if description == "MOV_RESAVE_STEREO" {
"The App Preview contains unsupported or corrupted audio"
} else if description == "MOV_RESAVE_LONGER" {
"The App Preview's duration is too short"
} else if description == "MOV_RESAVE_TRIM" {
"The App Preview is too large"
} else {
description!
}
return description!
}

/**
Expand All @@ -20,7 +27,9 @@ public extension AppMediaStateError {
*/
var learnMoreUrl: URL? {
if code == "IMAGE_INCORRECT_DIMENSIONS" {
return URL(string: "https://help.apple.com/app-store-connect/#/devd274dd925")
return URL(string: "https://developer.apple.com/help/app-store-connect/reference/screenshot-specifications")
} else if code == "MOV_RESAVE_STEREO" || code == "MOV_RESAVE_LONGER" || code == "MOV_RESAVE_TRIM" {
return URL(string: "https://developer.apple.com/help/app-store-connect/reference/app-preview-specifications")
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ final class AppMediaStateErrorMoreInfoTests: XCTestCase {
XCTAssertNotEqual(error.betterDescription, error.description)
}

func testBetterDescription_MovieResaveStereo() {
let error = AppMediaStateError(code: "MOV_RESAVE_STEREO", description: "MOV_RESAVE_STEREO")
XCTAssertNotEqual(error.betterDescription, error.description)
}

func testBetterDescription_MovieResaveLonger() {
let error = AppMediaStateError(code: "MOV_RESAVE_LONGER", description: "MOV_RESAVE_LONGER")
XCTAssertNotEqual(error.betterDescription, error.description)
}

func testBetterDescription_MovieResaveTrim() {
let error = AppMediaStateError(code: "MOV_RESAVE_TRIM", description: "MOV_RESAVE_TRIM")
XCTAssertNotEqual(error.betterDescription, error.description)
}

func testBetterDescription_Unknown() {
let error = AppMediaStateError(code: "SOME_ERROR", description: "SOME_ERROR")
XCTAssertEqual(error.betterDescription, error.description)
Expand All @@ -17,6 +32,21 @@ final class AppMediaStateErrorMoreInfoTests: XCTestCase {
XCTAssertNotNil(error.learnMoreUrl)
}

func testLearnMoreUrl_MovieResaveStereo() {
let error = AppMediaStateError(code: "MOV_RESAVE_STEREO", description: "MOV_RESAVE_STEREO")
XCTAssertNotNil(error.learnMoreUrl)
}

func testLearnMoreUrl_MovieResaveLonger() {
let error = AppMediaStateError(code: "MOV_RESAVE_LONGER", description: "MOV_RESAVE_LONGER")
XCTAssertNotNil(error.learnMoreUrl)
}

func testLearnMoreUrl_MovieResaveTrim() {
let error = AppMediaStateError(code: "MOV_RESAVE_TRIM", description: "MOV_RESAVE_TRIM")
XCTAssertNotNil(error.learnMoreUrl)
}

func testLearnMoreUrl_Unknown() {
let error = AppMediaStateError(code: "SOME_ERROR", description: "SOME_ERROR")
XCTAssertNil(error.learnMoreUrl)
Expand Down

0 comments on commit 23b803e

Please sign in to comment.