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
55
66public interface SwiftBackendConnector {
77 public suspend fun fetchCredentials (): PowerSyncResult
8+
89 public suspend fun uploadData (): PowerSyncResult
910}
1011
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 ?
1616
1717 override suspend fun uploadData (database : PowerSyncDatabase ) {
1818 handleLockResult(connector.uploadData())
1919 }
2020 }
21- }
Original file line number Diff line number Diff line change @@ -93,14 +93,15 @@ public fun createSyncOptions(
9393 clientConfiguration = createExtendedSyncClientConfiguration(loggingConfig),
9494 )
9595
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+ }
104107 }
105- }
106- }
You can’t perform that action at this time.
0 commit comments