Skip to content

Conversation

@stevensJourney
Copy link
Contributor

@stevensJourney stevensJourney commented Jan 29, 2026

closes: #109

UIDevice.current.systemVersion is MainActor isolated, which means we should safely use this in other async contexts. This PR cleans up the UserAgent method to cater for potentially asynchronously accessing this property.

Here are some samples for PowerSync service useragent logs

powersync-swift/1.10.0 iOS/26.2
{"client_id":"a8cf0c70-4b84-4e7e-b4d4-445549396f11","duration_ms":26200,"level":"info","message":"STREAM /sync/stream","rid":"s/019c0a5f-adb7-7077-8d49-2bfe2e347cc4","timestamp":"2026-01-29T15:29:54.711Z","user_agent":"powersync-swift/1.10.0 iOS/26.2","user_id":"50ada944-f6af-48dc-9ec5-549bb88aa396"}

powersync-swift/1.10.0 macOS/26.2
{"app_metadata":{},"client_id":"7ed923f6-968e-46a2-8be4-590d5aa5c904","client_params":{},"level":"info","message":"Sync stream started","rid":"s/019c0a61-6495-717f-aab7-37ea557cbb49","timestamp":"2026-01-29T15:31:20.857Z","user_agent":"powersync-swift/1.10.0 macOS/26.2","user_id":"50ada944-f6af-48dc-9ec5-549bb88aa396"}

powersync-swift/1.10.0 watchOS/11.5
{"app_metadata":{},"client_id":"ae638d96-e625-41c1-a5f3-f5697b193f40","close_reason":"client closing stream","data_sent_bytes":674,"data_synced_bytes":1454,"encoding":"permessage-deflate","large_buckets":{},"level":"info","message":"Sync stream complete","operation_counts":{"clear":0,"move":0,"put":2,"remove":0},"operations_synced":2,"rid":"s/019c0a65-ed3d-72dc-bbd2-ef06aee4b07f","stream_ms":10212,"timestamp":"2026-01-29T15:36:28.204Z","user_agent":"powersync-swift/1.10.0 watchOS/11.5","user_id":"50ada944-f6af-48dc-9ec5-549bb88aa396"}

powersync-swift/1.10.0 tvOS/26.2
{"app_metadata":{},"client_id":"36c5460f-ac82-46ca-a0d1-c95be73d97b3","close_reason":"client closing stream","data_sent_bytes":682,"data_synced_bytes":1456,"encoding":"permessage-deflate","large_buckets":{},"level":"info","message":"Sync stream complete","operation_counts":{"clear":0,"move":0,"put":2,"remove":0},"operations_synced":2,"rid":"s/019c4683-0e7c-741b-b18a-441092ee07cc","stream_ms":10339,"timestamp":"2026-02-10T07:45:30.338Z","user_agent":"powersync-swift/1.10.0 tvOS/26.2","user_id":"50ada944-f6af-48dc-9ec5-549bb88aa396"}

@stevensJourney stevensJourney marked this pull request as ready for review January 29, 2026 16:02
simolus3
simolus3 previously approved these changes Jan 29, 2026
Copy link
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

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

We previously had logic for tvOS, but we don't actually list tvOS as a supported platform in our Package.Swift file. Trying to run the tests for tvOS also results in an error

Huh, we're not even compiling the Kotlin framework for tvOS despite the fact that we have it as a supported platform on our KMP SDK? I'll take a look at that.

Anyway, happy with this fix 👍

Chriztiaan
Chriztiaan previously approved these changes Feb 2, 2026
@stevensJourney stevensJourney dismissed stale reviews from Chriztiaan and simolus3 via 87c31c4 February 10, 2026 07:46
@stevensJourney stevensJourney merged commit 75257c1 into main Feb 10, 2026
3 checks passed
@stevensJourney stevensJourney deleted the user-agent branch February 10, 2026 10:03
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.

Main-actor isolation in UserAgent.swift on iOS/tvOS

3 participants