Skip to content

Commit

Permalink
Add warning message to logs when there are multiple screenshots with …
Browse files Browse the repository at this point in the history
…same name.
  • Loading branch information
serhii-londar committed Nov 15, 2024
1 parent 8a6ef28 commit 56ba1bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 56ba1bb

Please sign in to comment.