Skip to content

Commit b5c6564

Browse files
authored
feat: add new UndoManager APIs (#25)
1 parent c071ec4 commit b5c6564

File tree

3 files changed

+67
-5
lines changed

3 files changed

+67
-5
lines changed

Sources/Loro/LoroFFI.swift

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9435,6 +9435,26 @@ public protocol UndoManagerProtocol : AnyObject {
94359435
*/
94369436
func canUndo() -> Bool
94379437

9438+
/**
9439+
* Ends the current group, calling UndoManager::undo() after this will
9440+
* undo all changes that occurred during the group.
9441+
*/
9442+
func groupEnd()
9443+
9444+
/**
9445+
* Will start a new group of changes, all subsequent changes will be merged
9446+
* into a new item on the undo stack. If we receive remote changes, we determine
9447+
* wether or not they are conflicting. If the remote changes are conflicting
9448+
* we split the undo item and close the group. If there are no conflict
9449+
* in changed container ids we continue the group merge.
9450+
*/
9451+
func groupStart() throws
9452+
9453+
/**
9454+
* Get the peer id of the undo manager
9455+
*/
9456+
func peer() -> UInt64
9457+
94389458
/**
94399459
* Record a new checkpoint.
94409460
*/
@@ -9574,6 +9594,39 @@ open func canUndo() -> Bool {
95749594
uniffi_loro_ffi_fn_method_undomanager_can_undo(self.uniffiClonePointer(),$0
95759595
)
95769596
})
9597+
}
9598+
9599+
/**
9600+
* Ends the current group, calling UndoManager::undo() after this will
9601+
* undo all changes that occurred during the group.
9602+
*/
9603+
open func groupEnd() {try! rustCall() {
9604+
uniffi_loro_ffi_fn_method_undomanager_group_end(self.uniffiClonePointer(),$0
9605+
)
9606+
}
9607+
}
9608+
9609+
/**
9610+
* Will start a new group of changes, all subsequent changes will be merged
9611+
* into a new item on the undo stack. If we receive remote changes, we determine
9612+
* wether or not they are conflicting. If the remote changes are conflicting
9613+
* we split the undo item and close the group. If there are no conflict
9614+
* in changed container ids we continue the group merge.
9615+
*/
9616+
open func groupStart()throws {try rustCallWithError(FfiConverterTypeLoroError.lift) {
9617+
uniffi_loro_ffi_fn_method_undomanager_group_start(self.uniffiClonePointer(),$0
9618+
)
9619+
}
9620+
}
9621+
9622+
/**
9623+
* Get the peer id of the undo manager
9624+
*/
9625+
open func peer() -> UInt64 {
9626+
return try! FfiConverterUInt64.lift(try! rustCall() {
9627+
uniffi_loro_ffi_fn_method_undomanager_peer(self.uniffiClonePointer(),$0
9628+
)
9629+
})
95779630
}
95789631

95799632
/**
@@ -16983,6 +17036,15 @@ private var initializationResult: InitializationResult = {
1698317036
if (uniffi_loro_ffi_checksum_method_undomanager_can_undo() != 42348) {
1698417037
return InitializationResult.apiChecksumMismatch
1698517038
}
17039+
if (uniffi_loro_ffi_checksum_method_undomanager_group_end() != 37541) {
17040+
return InitializationResult.apiChecksumMismatch
17041+
}
17042+
if (uniffi_loro_ffi_checksum_method_undomanager_group_start() != 64372) {
17043+
return InitializationResult.apiChecksumMismatch
17044+
}
17045+
if (uniffi_loro_ffi_checksum_method_undomanager_peer() != 45180) {
17046+
return InitializationResult.apiChecksumMismatch
17047+
}
1698617048
if (uniffi_loro_ffi_checksum_method_undomanager_record_new_checkpoint() != 12209) {
1698717049
return InitializationResult.apiChecksumMismatch
1698817050
}

loro-swift/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

loro-swift/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name = "uniffi-bindgen"
1111
path = "src/uniffi-bindgen.rs"
1212

1313
[dependencies]
14-
loro-ffi = { version = "1.5.9" }
14+
loro-ffi = { version = "1.5.10" }
1515
uniffi = { version = "0.28.3" }
1616

1717
[build-dependencies]

0 commit comments

Comments
 (0)