diff --git a/Sources/XuqmSDK/Update/UpdateSDK.swift b/Sources/XuqmSDK/Update/UpdateSDK.swift index b61de65..aabc66d 100644 --- a/Sources/XuqmSDK/Update/UpdateSDK.swift +++ b/Sources/XuqmSDK/Update/UpdateSDK.swift @@ -20,13 +20,18 @@ public final class UpdateSDK { public func checkAppUpdate(currentVersionCode: Int) async throws -> AppUpdateInfo { let config = XuqmSDK.shared.requireConfig() + let userId = XuqmSDK.shared.currentUserId + var queryItems = [ + URLQueryItem(name: "appKey", value: config.appKey), + URLQueryItem(name: "platform", value: "IOS"), + URLQueryItem(name: "currentVersionCode", value: "\(currentVersionCode)"), + ] + if let userId, !userId.isEmpty { + queryItems.append(URLQueryItem(name: "userId", value: userId)) + } return try await ApiClient.shared.request( path: "/api/v1/updates/app/check", - queryItems: [ - URLQueryItem(name: "appKey", value: config.appKey), - URLQueryItem(name: "platform", value: "IOS"), - URLQueryItem(name: "currentVersionCode", value: "\(currentVersionCode)"), - ] + queryItems: queryItems ) }