Skip to content

Commit b43db06

Browse files
Merge branch 'main' into fts-demo
2 parents 5b5867d + 174282d commit b43db06

29 files changed

+228
-151
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Changelog
22

3-
## 1.5.1 (unreleased)
3+
## 1.5.1
44

55
* Update core extension to 0.4.5 ([changelog](https://github.com/powersync-ja/powersync-sqlite-core/releases/tag/v0.4.5))
6+
* Additional Swift 6 Strict Concurrency Checking declarations added for remaining protocols.
7+
* Fix issue in legacy sync client where local writes made offline could have their upload delayed until a keepalive event was received. This could also cause downloaded updates to be delayed even further until all uploads were completed.
68

79
## 1.5.0
810

Demo/PowerSyncExample.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@
661661
SDKROOT = iphoneos;
662662
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
663663
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
664+
SWIFT_STRICT_CONCURRENCY = complete;
664665
};
665666
name = Debug;
666667
};
@@ -717,6 +718,7 @@
717718
OTHER_LDFLAGS = "-lsqlite3";
718719
SDKROOT = iphoneos;
719720
SWIFT_COMPILATION_MODE = wholemodule;
721+
SWIFT_STRICT_CONCURRENCY = complete;
720722
VALIDATE_PRODUCT = YES;
721723
};
722724
name = Release;
@@ -758,7 +760,7 @@
758760
SWIFT_OBJC_BRIDGING_HEADER = "PowerSyncExample/PowerSyncExample-Bridging-Header.h";
759761
"SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "";
760762
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
761-
SWIFT_VERSION = 5.0;
763+
SWIFT_VERSION = 6.0;
762764
TARGETED_DEVICE_FAMILY = "1,2";
763765
};
764766
name = Debug;
@@ -797,7 +799,7 @@
797799
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
798800
SWIFT_EMIT_LOC_STRINGS = YES;
799801
SWIFT_OBJC_BRIDGING_HEADER = "PowerSyncExample/PowerSyncExample-Bridging-Header.h";
800-
SWIFT_VERSION = 5.0;
802+
SWIFT_VERSION = 6.0;
801803
TARGETED_DEVICE_FAMILY = "1,2";
802804
};
803805
name = Release;

Demo/PowerSyncExample/Components/AddListView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ struct AddListView: View {
1313
Task {
1414
do {
1515
try await system.insertList(newList)
16-
await completion(.success(true))
16+
completion(.success(true))
1717
} catch {
18-
await completion(.failure(error))
18+
completion(.failure(error))
1919
throw error
2020
}
2121
}

Demo/PowerSyncExample/Components/AddTodoListView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ struct AddTodoListView: View {
1515
Task{
1616
do {
1717
try await system.insertTodo(newTodo, listId)
18-
await completion(.success(true))
18+
completion(.success(true))
1919
} catch {
20-
await completion(.failure(error))
20+
completion(.failure(error))
2121
throw error
2222
}
2323
}

Demo/PowerSyncExample/PowerSync/SupabaseConnector.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ private enum PostgresFatalCodes {
3838
}
3939

4040
@Observable
41+
@MainActor // _session is mutable, limiting to the MainActor satisfies Sendable constraints
4142
final class SupabaseConnector: PowerSyncBackendConnectorProtocol {
4243
let powerSyncEndpoint: String = Secrets.powerSyncEndpoint
4344
let client: SupabaseClient = .init(
4445
supabaseURL: Secrets.supabaseURL,
4546
supabaseKey: Secrets.supabaseAnonKey,
4647
)
47-
var session: Session?
48+
private(set) var session: Session?
4849
private var errorCode: String?
4950

5051
@ObservationIgnored

Demo/PowerSyncExample/PowerSync/SupabaseRemoteStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22
import PowerSync
33
import Supabase
44

5-
class SupabaseRemoteStorage: RemoteStorageAdapter {
5+
final class SupabaseRemoteStorage: RemoteStorageAdapter {
66
let storage: Supabase.StorageFileApi
77

88
init(storage: Supabase.StorageFileApi) {

Demo/PowerSyncExample/PowerSync/SystemManager.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ func getAttachmentsDirectoryPath() throws -> String {
1313

1414
let logTag = "SystemManager"
1515

16+
/// We use the MainActor SupabaseConnector synchronously here, this requires specifying that SystemManager runs on the MainActor
17+
/// We don't actually block the MainActor with anything
1618
@Observable
17-
class SystemManager {
19+
@MainActor
20+
final class SystemManager {
1821
let connector = SupabaseConnector()
1922
let schema = AppSchema
2023
let db: PowerSyncDatabaseProtocol
2124

22-
var attachments: AttachmentQueue?
25+
let attachments: AttachmentQueue?
2326

2427
init() {
2528
db = PowerSyncDatabase(
@@ -227,21 +230,21 @@ class SystemManager {
227230
try await attachments.deleteFile(
228231
attachmentId: photoId
229232
) { transaction, _ in
230-
try self.deleteTodoInTX(
231-
id: todo.id,
232-
tx: transaction
233+
try transaction.execute(
234+
sql: "DELETE FROM \(TODOS_TABLE) WHERE id = ?",
235+
parameters: [todo.id]
233236
)
234237
}
235238
} else {
236-
try await db.writeTransaction { transaction in
237-
try self.deleteTodoInTX(
238-
id: todo.id,
239-
tx: transaction
239+
_ = try await db.writeTransaction { transaction in
240+
try transaction.execute(
241+
sql: "DELETE FROM \(TODOS_TABLE) WHERE id = ?",
242+
parameters: [todo.id]
240243
)
241244
}
242245
}
243246
}
244-
247+
245248
/// Searches across lists and todos using FTS.
246249
///
247250
/// - Parameter searchTerm: The text to search for.
@@ -338,6 +341,4 @@ class SystemManager {
338341
}
339342
return "\(trimmedSearchTerm)*"
340343
}
341-
342-
343344
}

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ if let kotlinSdkPath = localKotlinSdkOverride {
3232
// Not using a local build, so download from releases
3333
conditionalTargets.append(.binaryTarget(
3434
name: "PowerSyncKotlin",
35-
url: "https://github.com/powersync-ja/powersync-kotlin/releases/download/v1.5.0/PowersyncKotlinRelease.zip",
36-
checksum: "cb1d717d28411aff0bfdeeaa837ae01514ebf5d64203dc565a9520a2912bae9d"
35+
url: "https://github.com/powersync-ja/powersync-kotlin/releases/download/v1.5.1/PowersyncKotlinRelease.zip",
36+
checksum: "3a2de1863d2844d49cebf4428d0ab49956ba384dcab9f3cc2ddbc7836013c434"
3737
))
3838
}
3939

Sources/PowerSync/Kotlin/KotlinTypes.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ extension KotlinPowerSyncBackendConnector: @retroactive @unchecked Sendable {}
88
extension KotlinPowerSyncCredentials: @retroactive @unchecked Sendable {}
99
extension PowerSyncKotlin.KermitLogger: @retroactive @unchecked Sendable {}
1010
extension PowerSyncKotlin.SyncStatus: @retroactive @unchecked Sendable {}
11+
12+
extension PowerSyncKotlin.CrudEntry: @retroactive @unchecked Sendable {}
13+
extension PowerSyncKotlin.CrudBatch: @retroactive @unchecked Sendable {}
14+
extension PowerSyncKotlin.CrudTransaction: @retroactive @unchecked Sendable {}

Sources/PowerSync/Kotlin/sync/KotlinSyncStatusData.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,17 @@ extension KotlinProgressWithOperationsProtocol {
103103
}
104104
}
105105

106-
struct KotlinProgressWithOperations: KotlinProgressWithOperationsProtocol {
106+
struct KotlinProgressWithOperations: KotlinProgressWithOperationsProtocol,
107+
// We can't mark PowerSyncKotlin.ProgressWithOperations as Sendable
108+
@unchecked Sendable
109+
{
107110
let base: PowerSyncKotlin.ProgressWithOperations
108111
}
109112

110-
struct KotlinSyncDownloadProgress: KotlinProgressWithOperationsProtocol, SyncDownloadProgress {
113+
struct KotlinSyncDownloadProgress: KotlinProgressWithOperationsProtocol, SyncDownloadProgress,
114+
// We can't mark PowerSyncKotlin.SyncDownloadProgress as Sendable
115+
@unchecked Sendable
116+
{
111117
let progress: PowerSyncKotlin.SyncDownloadProgress
112118

113119
var base: any PowerSyncKotlin.ProgressWithOperations {

0 commit comments

Comments
 (0)