diff --git a/Sources/CrowdinSDK/CrowdinAPI/ScreenshotsAPI/ScreenshotsAPI.swift b/Sources/CrowdinSDK/CrowdinAPI/ScreenshotsAPI/ScreenshotsAPI.swift index e2e636a8..1150b7fe 100644 --- a/Sources/CrowdinSDK/CrowdinAPI/ScreenshotsAPI/ScreenshotsAPI.swift +++ b/Sources/CrowdinSDK/CrowdinAPI/ScreenshotsAPI/ScreenshotsAPI.swift @@ -60,7 +60,7 @@ class ScreenshotsAPI: CrowdinAPI { ListScreenshotsParameters.search.rawValue: query, ListScreenshotsParameters.orderBy.rawValue: "createdAt desc,updatedAt desc", ListScreenshotsParameters.offset.rawValue: "0", - ListScreenshotsParameters.limit.rawValue: "1" + ListScreenshotsParameters.limit.rawValue: "2" ] let url = baseUrl(with: projectId) self.cw_get(url: url, parameters: parameters, completion: completion) diff --git a/Sources/CrowdinSDK/Features/ScreenshotFeature/ScreenshotUploader.swift b/Sources/CrowdinSDK/Features/ScreenshotFeature/ScreenshotUploader.swift index b5c47935..10dc064f 100644 --- a/Sources/CrowdinSDK/Features/ScreenshotFeature/ScreenshotUploader.swift +++ b/Sources/CrowdinSDK/Features/ScreenshotFeature/ScreenshotUploader.swift @@ -135,8 +135,11 @@ class CrowdinScreenshotUploader: ScreenshotUploader { errorHandler?(error ?? NSError(domain: Errors.unknownError.rawValue, code: defaultCrowdinErrorCode, userInfo: nil)) return } - if let screenshotData = response.data.first { - let screnshotId = screenshotData.data.id + if response.data.count > 0 { + if response.data.count > 1 { + CrowdinLogsCollector.shared.add(log: CrowdinLog(type: .warning, message: "Encountered multiple screenshots with the same name - \(name); only one will be updated.")) + } + let screnshotId = response.data[0].data.id let storageAPI = StorageAPI(organizationName: self.organizationName, auth: LoginFeature.shared) guard let data = screenshot.pngData() else { return }