File tree Expand file tree Collapse file tree
Sources/PowerSync/Kotlin/sync Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33## 1.11.0 (unreleased)
44
55* Add support for [ sync streams] ( https://docs.powersync.com/sync/streams/overview ) .
6+ * Fixed MainActor isolation warning for UserAgent function.
67
78## 1.10.0
89
Original file line number Diff line number Diff line change 1- import Foundation
21
2+ import Foundation
33#if os(iOS) || os(tvOS)
44import UIKit
55#endif
66
7- func userAgent( ) -> String {
8- #if os(macOS)
7+ func userAgent( ) async -> String {
8+ #if os(macOS)
99 let osName = " macOS "
10- let version = ProcessInfo . processInfo. operatingSystemVersion
11- let osVersion = " \( version. majorVersion) . \( version. minorVersion) "
12- #elseif os(watchOS)
10+ #elseif os(watchOS)
1311 let osName = " watchOS "
14- let version = ProcessInfo . processInfo. operatingSystemVersion
15- let osVersion = " \( version. majorVersion) . \( version. minorVersion) "
16- #elseif os(iOS)
12+ #elseif os(iOS)
1713 let osName = " iOS "
18- let osVersion = UIDevice . current. systemVersion
19- #elseif os(tvOS)
14+ #elseif os(tvOS)
2015 let osName = " tvOS "
21- let osVersion = UIDevice . current. systemVersion
22- #else
16+ #else
2317 let osName = " unknown "
24- let version = ProcessInfo . processInfo. operatingSystemVersion
25- let osVersion = " \( version. majorVersion) . \( version. minorVersion) "
26- #endif
27-
18+ #endif
19+ let osVersion = await getOSVersion ( )
2820 return " powersync-swift/ \( libraryVersion) \( osName) / \( osVersion) "
2921}
22+
23+ // Returns the OS version string for the current platform
24+ @MainActor func getOSVersion( ) async -> String {
25+ #if os(iOS) || os(tvOS)
26+ // UIDevice must be accessed on the main actor
27+ return UIDevice . current. systemVersion
28+ #else
29+ let version = ProcessInfo . processInfo. operatingSystemVersion
30+ return " \( version. majorVersion) . \( version. minorVersion) "
31+ #endif
32+ }
You can’t perform that action at this time.
0 commit comments