Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add descriptions for some App Preview delivery errors #212

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading