feat: add AI retouch task center

This commit is contained in:
2026-08-14 15:06:57 +08:00
parent 0f3b26991e
commit 30bfe0313f
26 changed files with 3679 additions and 50 deletions
@@ -63,6 +63,34 @@ final class PushNotificationTests: XCTestCase {
XCTAssertEqual(nested.destination, .paymentDetails)
}
func testAIRetouchPushRoutesToDetailAndFallsBackToList() {
XCTAssertEqual(
PushPayload(userInfo: [
"type": 14,
"data": ["ai_retouch_batch_id": 91, "status": "succeeded"],
]).destination,
.aiRetouchTaskDetail(batchId: 91)
)
XCTAssertEqual(
PushPayload(userInfo: ["type": 14, "data": [:]]).destination,
.aiRetouchTaskList
)
XCTAssertEqual(
PushPayload(userInfo: ["type": 14, "data": ["ai_retouch_batch_id": "0"]]).destination,
.aiRetouchTaskList
)
XCTAssertEqual(PushPayload(userInfo: ["type": 10]).destination, .messageCenter)
}
func testAIRetouchPushReadsEncodedDataAndVendorWrapper() {
let payload = PushPayload(userInfo: [
"n_extras": #"{"type":14,"data":"{\"ai_retouch_batch_id\":92}"}"#,
])
XCTAssertEqual(payload.destination, .aiRetouchTaskDetail(batchId: 92))
XCTAssertEqual(payload.normalizedValues["ai_retouch_batch_id"], "92")
}
func testPushAPIUsesAndroidCompatibleEndpointAndQuery() async throws {
let session = MockURLSession(responses: [try TestJSON.envelope(data: EmptyPayload())])
let api = PushAPI(client: APIClient(environment: .testing, session: session))