From 28833f06f23ca0d5f179aaba0cfa8d00843fb255 Mon Sep 17 00:00:00 2001 From: Go Takagi <15936908+shimastripe@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:04:50 +0900 Subject: [PATCH] Sort transactions by purchase date --- Sources/IAPClient/AppStoreServerClient.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/IAPClient/AppStoreServerClient.swift b/Sources/IAPClient/AppStoreServerClient.swift index e53db38..ed4b84f 100644 --- a/Sources/IAPClient/AppStoreServerClient.swift +++ b/Sources/IAPClient/AppStoreServerClient.swift @@ -127,6 +127,8 @@ extension AppStoreServerClient: DependencyKey { signedTransaction)) } + items = items.sorted(by: { ($0.purchaseDate ?? .distantPast) < ($1.purchaseDate ?? .distantPast) }) + return .init( revision: response.revision, hasMore: response.hasMore, bundleId: response.bundleId, appAppleId: response.appAppleId,