Skip to content

Conversation

@serhii-londar
Copy link
Collaborator

@serhii-londar serhii-londar commented Jan 11, 2026

Note

Adds versioned request headers

  • Introduces CrowdinAPI.versioned and applies it to ContentDeliveryAPI (files/manifest), ProjectsAPI.downloadFileData, LoginAPI (token/refresh), and SocketAPI (WebSocket), using CrowdinSDK.currentVersion.

Thread-safety and stability

  • Refactors CrowdinLocalizationDownloader with a locked DownloadContext, cancels overlapping operations, validates manifest presence, and centralizes completion.
  • Cancels pending operations in RUFilesDownloader and CrowdinMappingDownloader to prevent overlaps.
  • Hardens CrowdinSupportedLanguages queueing and callbacks to avoid races; adds comprehensive concurrency unit tests and adjusts timeouts/iterations for reliability.

CI/CD improvements

  • Replaces hardcoded simulator names with dynamic selection across SPM build, example build, and tests; disables Xcode parallel testing; simplifies Pods install.

Dev tooling

  • Adds CrowdinSDK+Version.swift and git hooks (install_hooks.sh, pre-commit, sync_pod_version.sh) to auto-sync Podspec version; updates CONTRIBUTING and .gitignore.

Written by Cursor Bugbot for commit 2096890. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings January 11, 2026 13:42
@crowdin-bot
Copy link
Collaborator

crowdin-bot commented Jan 11, 2026

Warnings
⚠️ Big PR, try to keep changes smaller if you can

Generated by 🚫 Danger Swift against 2096890

@codecov
Copy link

codecov bot commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 69.29825% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.04%. Comparing base (12c9f2d) to head (0004de7).

Files with missing lines Patch % Lines
...tionDownloader/CrowdinLocalizationDownloader.swift 68.12% 22 Missing ⚠️
...SupportedLanguages/CrowdinSupportedLanguages.swift 16.67% 5 Missing ⚠️
...ContentDeliveryAPI/CrowdinContentDeliveryAPI.swift 60.00% 2 Missing ⚠️
...rowdinSDK/CrowdinAPI/ProjectsAPI/ProjectsAPI.swift 0.00% 2 Missing ⚠️
Sources/Tests/CrowdinAPI/CrowdinAPITests.swift 77.78% 2 Missing ⚠️
...s/CrowdinSupportedLanguagesThreadSafetyTests.swift 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #363      +/-   ##
==========================================
- Coverage   71.27%   71.04%   -0.22%     
==========================================
  Files         133      133              
  Lines        6239     6263      +24     
==========================================
+ Hits         4446     4449       +3     
- Misses       1793     1814      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds user agent headers to all network requests made by the Crowdin SDK and introduces automation for version management.

Changes:

  • Added User-Agent header to all HTTP/WebSocket requests with SDK version and platform information (iOS, tvOS, watchOS, macOS)
  • Created version synchronization automation that keeps Swift code version in sync with podspec version
  • Improved CI/CD simulator selection logic to use dynamically available simulators instead of hardcoded device names

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Sources/CrowdinSDK/CrowdinSDK/CrowdinSDK+Version.swift New file containing SDK version constant sourced from podspec
Sources/CrowdinSDK/CrowdinAPI/CrowdinAPI.swift Made versioned() method static and added platform-specific user agent generation for all platforms
Sources/CrowdinSDK/CrowdinAPI/LoginAPI/LoginAPI.swift Added user agent headers to OAuth token requests
Sources/CrowdinSDK/CrowdinAPI/ProjectsAPI/ProjectsAPI.swift Added user agent header to file download requests
Sources/CrowdinSDK/CrowdinAPI/ContentDeliveryAPI/CrowdinContentDeliveryAPI.swift Added user agent headers to manifest and content delivery requests
Sources/CrowdinSDK/Features/RealtimeUpdateFeature/SocketAPI/SocketAPI.swift Added user agent header to WebSocket connection requests
Sources/Tests/CrowdinAPI/CrowdinAPITests.swift Added test coverage for user agent header generation
sync_pod_version.sh New script to sync version from podspec to Swift code
install_hooks.sh New script to install git hooks and make scripts executable
pre-commit Updated to run version sync before SwiftLint
.github/workflows/build.yml Improved simulator selection with dynamic detection
CONTRIBUTING.md Added documentation for development setup
.gitignore Added buildServer.json to ignored files

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

serhii-londar and others added 2 commits January 11, 2026 14:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@andrii-bodnar andrii-bodnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@serhii-londar let's remove this part with git hook and syncing the version. It's overcomplicated. There is a risk that the CrowdinSDK+Version.swift file content will change without changing the hardcoded content in the sync script.

We can just manually increase the version number when creating a release. It's not a big deal. We could also use release automation tools that are already able to update the version number in the file content.

} else if supportedLanguages == nil {
let error = NSError(domain: "Unknown error while downloading supported languages", code: defaultCrowdinErrorCode, userInfo: nil)
callbacks.errors.forEach({ $0(error) })
callbacks.completions.forEach({ $0() })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completion callbacks now always fire on download errors

Medium Severity

The downloadSupportedLanguages callback behavior changed: previously, when an error occurred, only error callbacks were called (returning ([], self._errors)). Now both completion AND error callbacks are called (returning (self._completions, self._errors)). Additionally, when supportedLanguages is nil, the old code returned ([], []) calling nothing, while the new code now calls both callbacks. This API contract change could break callers expecting either completion OR error, but not both.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants