File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed
PowerSyncKotlin/src/appleMain/kotlin/com/powersync Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,16 @@ import com.powersync.connectors.PowerSyncCredentials
5
5
6
6
public interface SwiftBackendConnector {
7
7
public suspend fun fetchCredentials (): PowerSyncResult
8
+
8
9
public suspend fun uploadData (): PowerSyncResult
9
10
}
10
11
11
- public fun swiftBackendConnectorToPowerSyncConnector (connector : SwiftBackendConnector ): PowerSyncBackendConnector {
12
- return object : PowerSyncBackendConnector () {
13
- override suspend fun fetchCredentials (): PowerSyncCredentials ? {
14
- return handleLockResult(connector.fetchCredentials()) as PowerSyncCredentials ?
15
- }
12
+ public fun swiftBackendConnectorToPowerSyncConnector (connector : SwiftBackendConnector ): PowerSyncBackendConnector =
13
+ object : PowerSyncBackendConnector () {
14
+ override suspend fun fetchCredentials (): PowerSyncCredentials ? =
15
+ handleLockResult(connector.fetchCredentials()) as PowerSyncCredentials ?
16
16
17
17
override suspend fun uploadData (database : PowerSyncDatabase ) {
18
18
handleLockResult(connector.uploadData())
19
19
}
20
20
}
21
- }
Original file line number Diff line number Diff line change @@ -93,14 +93,15 @@ public fun createSyncOptions(
93
93
clientConfiguration = createExtendedSyncClientConfiguration(loggingConfig),
94
94
)
95
95
96
- public fun errorHandledCrudTransactions (db : PowerSyncDatabase ): Flow <PowerSyncResult > {
97
- return db.getCrudTransactions().map<CrudTransaction , PowerSyncResult > {
98
- PowerSyncResult .Success (it)
99
- }.catch {
100
- if (it is PowerSyncException ) {
101
- emit(PowerSyncResult .Failure (it))
102
- } else {
103
- throw it
96
+ public fun errorHandledCrudTransactions (db : PowerSyncDatabase ): Flow <PowerSyncResult > =
97
+ db
98
+ .getCrudTransactions()
99
+ .map<CrudTransaction , PowerSyncResult > {
100
+ PowerSyncResult .Success (it)
101
+ }.catch {
102
+ if (it is PowerSyncException ) {
103
+ emit(PowerSyncResult .Failure (it))
104
+ } else {
105
+ throw it
106
+ }
104
107
}
105
- }
106
- }
You can’t perform that action at this time.
0 commit comments