Skip to content

Commit 4e9c2a8

Browse files
deprecate userId
1 parent 1383c4b commit 4e9c2a8

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- Improved the stability of watched queries. Watched queries were previously susceptible to runtime crashes if an exception was thrown in the update stream. Errors are now gracefully handled.
66

7+
- Deprecated `PowerSyncCredentials` `userId` field. This value is not used by the PowerSync service.
8+
79
- Added `readLock` and `writeLock` APIs. These methods allow obtaining a SQLite connection context without starting a transaction.
810

911
- Removed references to the PowerSync Kotlin SDK from all public API protocols. Dedicated Swift protocols are now defined. These protocols align better with Swift primitives. See the `BRAKING CHANGES` section for more details. Updated protocols include:

Sources/PowerSync/PowerSyncCredentials.swift

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,35 @@ public struct PowerSyncCredentials: Codable {
1212
public let token: String
1313

1414
/// User ID.
15-
public let userId: String?
15+
@available(*, deprecated, message: "This value is not used anymore.")
16+
public let userId: String? = nil
17+
18+
enum CodingKeys: String, CodingKey {
19+
case endpoint
20+
case token
21+
}
22+
23+
@available(*, deprecated, message: "Use init(endpoint:token:) instead. `userId` is no longer used.")
24+
public init(
25+
endpoint: String,
26+
token: String,
27+
userId: String? = nil) {
28+
self.endpoint = endpoint
29+
self.token = token
30+
}
1631

17-
public init(endpoint: String, token: String, userId: String? = nil) {
32+
public init(endpoint: String, token: String) {
1833
self.endpoint = endpoint
1934
self.token = token
20-
self.userId = userId
2135
}
2236

2337
internal init(kotlin: KotlinPowerSyncCredentials) {
2438
self.endpoint = kotlin.endpoint
2539
self.token = kotlin.token
26-
self.userId = kotlin.userId
2740
}
2841

2942
internal var kotlinCredentials: KotlinPowerSyncCredentials {
30-
return KotlinPowerSyncCredentials(endpoint: endpoint, token: token, userId: userId)
43+
return KotlinPowerSyncCredentials(endpoint: endpoint, token: token, userId: nil)
3144
}
3245

3346
public func endpointUri(path: String) -> String {
@@ -37,6 +50,6 @@ public struct PowerSyncCredentials: Codable {
3750

3851
extension PowerSyncCredentials: CustomStringConvertible {
3952
public var description: String {
40-
return "PowerSyncCredentials<endpoint: \(endpoint) userId: \(userId ?? "nil")>"
53+
return "PowerSyncCredentials<endpoint: \(endpoint))>"
4154
}
4255
}

Sources/PowerSync/attachments/AttachmentContext.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ open class AttachmentContext {
206206
updatedRecord.id,
207207
updatedRecord.timestamp,
208208
updatedRecord.filename,
209-
updatedRecord.localUri ?? NSNull(),
210-
updatedRecord.mediaType ?? NSNull(),
211-
updatedRecord.size ?? NSNull(),
209+
updatedRecord.localUri,
210+
updatedRecord.mediaType,
211+
updatedRecord.size,
212212
updatedRecord.state.rawValue,
213213
updatedRecord.hasSynced ?? 0,
214-
updatedRecord.metaData ?? NSNull()
214+
updatedRecord.metaData
215215
]
216216
)
217217

0 commit comments

Comments
 (0)