Present iPhone Git actions (#51)

This commit is contained in:
2026-08-14 17:24:41 +02:00
parent fcf649e56d
commit 65eb1da71c
8 changed files with 1054 additions and 90 deletions

View File

@@ -1099,11 +1099,15 @@ public protocol MobileHomeOperationProtocol: AnyObject, Sendable {
func cancel()
func commit(message: String) throws -> MobileHomePage
func fetch() throws -> MobileHomePage
func progress() -> MobileHomeProgress
func pull() throws -> MobileHomePage
func refresh() throws -> MobileHomePage
func push() throws -> MobileHomePage
func refreshIfStale() throws -> MobileHomePage
@@ -1178,6 +1182,25 @@ open func cancel() {try! rustCall() {
}
}
open func commit(message: String)throws -> MobileHomePage {
return try FfiConverterTypeMobileHomePage_lift(try rustCallWithError(FfiConverterTypeMobileHomeFfiError_lift) {
uniffiCallStatus in
uniffi_ironstorage_apple_fn_method_mobilehomeoperation_commit(
self.uniffiCloneHandle(),
FfiConverterString.lower(message),uniffiCallStatus
)
})
}
open func fetch()throws -> MobileHomePage {
return try FfiConverterTypeMobileHomePage_lift(try rustCallWithError(FfiConverterTypeMobileHomeFfiError_lift) {
uniffiCallStatus in
uniffi_ironstorage_apple_fn_method_mobilehomeoperation_fetch(
self.uniffiCloneHandle(),uniffiCallStatus
)
})
}
open func progress() -> MobileHomeProgress {
return try! FfiConverterTypeMobileHomeProgress_lift(try! rustCall() {
uniffiCallStatus in
@@ -1196,10 +1219,10 @@ open func pull()throws -> MobileHomePage {
})
}
open func refresh()throws -> MobileHomePage {
open func push()throws -> MobileHomePage {
return try FfiConverterTypeMobileHomePage_lift(try rustCallWithError(FfiConverterTypeMobileHomeFfiError_lift) {
uniffiCallStatus in
uniffi_ironstorage_apple_fn_method_mobilehomeoperation_refresh(
uniffi_ironstorage_apple_fn_method_mobilehomeoperation_push(
self.uniffiCloneHandle(),uniffiCallStatus
)
})
@@ -2527,6 +2550,64 @@ public func FfiConverterTypeMobileGitIdentity_lower(_ value: MobileGitIdentity)
}
public struct MobileHomeAction: Equatable, Hashable {
public var kind: MobileHomeActionKind
public var title: String
public var systemImage: String
// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(kind: MobileHomeActionKind, title: String, systemImage: String) {
self.kind = kind
self.title = title
self.systemImage = systemImage
}
}
#if compiler(>=6)
extension MobileHomeAction: Sendable {}
#endif
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMobileHomeAction: FfiConverterRustBuffer {
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobileHomeAction {
return
try MobileHomeAction(
kind: FfiConverterTypeMobileHomeActionKind.read(from: &buf),
title: FfiConverterString.read(from: &buf),
systemImage: FfiConverterString.read(from: &buf)
)
}
public static func write(_ value: MobileHomeAction, into buf: inout [UInt8]) {
FfiConverterTypeMobileHomeActionKind.write(value.kind, into: &buf)
FfiConverterString.write(value.title, into: &buf)
FfiConverterString.write(value.systemImage, into: &buf)
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMobileHomeAction_lift(_ buf: RustBuffer) throws -> MobileHomeAction {
return try FfiConverterTypeMobileHomeAction.lift(buf)
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMobileHomeAction_lower(_ value: MobileHomeAction) -> RustBuffer {
return FfiConverterTypeMobileHomeAction.lower(value)
}
public struct MobileHomeChange: Equatable, Hashable {
public var id: String
public var title: String
@@ -2604,16 +2685,18 @@ public struct MobileHomeCommit: Equatable, Hashable {
public var systemImage: String
public var timestamp: Int64
public var changes: [MobileHomeChange]
public var actions: [MobileHomeAction]
// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(id: String, title: String, detail: String, systemImage: String, timestamp: Int64, changes: [MobileHomeChange]) {
public init(id: String, title: String, detail: String, systemImage: String, timestamp: Int64, changes: [MobileHomeChange], actions: [MobileHomeAction]) {
self.id = id
self.title = title
self.detail = detail
self.systemImage = systemImage
self.timestamp = timestamp
self.changes = changes
self.actions = actions
}
@@ -2637,7 +2720,8 @@ public struct FfiConverterTypeMobileHomeCommit: FfiConverterRustBuffer {
detail: FfiConverterString.read(from: &buf),
systemImage: FfiConverterString.read(from: &buf),
timestamp: FfiConverterInt64.read(from: &buf),
changes: FfiConverterSequenceTypeMobileHomeChange.read(from: &buf)
changes: FfiConverterSequenceTypeMobileHomeChange.read(from: &buf),
actions: FfiConverterSequenceTypeMobileHomeAction.read(from: &buf)
)
}
@@ -2648,6 +2732,7 @@ public struct FfiConverterTypeMobileHomeCommit: FfiConverterRustBuffer {
FfiConverterString.write(value.systemImage, into: &buf)
FfiConverterInt64.write(value.timestamp, into: &buf)
FfiConverterSequenceTypeMobileHomeChange.write(value.changes, into: &buf)
FfiConverterSequenceTypeMobileHomeAction.write(value.actions, into: &buf)
}
}
@@ -2804,13 +2889,15 @@ public func FfiConverterTypeMobileHomePage_lower(_ value: MobileHomePage) -> Rus
public struct MobileHomeProgress: Equatable, Hashable {
public var action: MobileHomeActionKind?
public var phase: MobileHomePhase
public var title: String
public var detail: String
// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(phase: MobileHomePhase, title: String, detail: String) {
public init(action: MobileHomeActionKind?, phase: MobileHomePhase, title: String, detail: String) {
self.action = action
self.phase = phase
self.title = title
self.detail = detail
@@ -2832,6 +2919,7 @@ public struct FfiConverterTypeMobileHomeProgress: FfiConverterRustBuffer {
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobileHomeProgress {
return
try MobileHomeProgress(
action: FfiConverterOptionTypeMobileHomeActionKind.read(from: &buf),
phase: FfiConverterTypeMobileHomePhase.read(from: &buf),
title: FfiConverterString.read(from: &buf),
detail: FfiConverterString.read(from: &buf)
@@ -2839,6 +2927,7 @@ public struct FfiConverterTypeMobileHomeProgress: FfiConverterRustBuffer {
}
public static func write(_ value: MobileHomeProgress, into buf: inout [UInt8]) {
FfiConverterOptionTypeMobileHomeActionKind.write(value.action, into: &buf)
FfiConverterTypeMobileHomePhase.write(value.phase, into: &buf)
FfiConverterString.write(value.title, into: &buf)
FfiConverterString.write(value.detail, into: &buf)
@@ -2866,14 +2955,16 @@ public struct MobileHomeSummaryRow: Equatable, Hashable {
public var title: String
public var detail: String
public var systemImage: String
public var actions: [MobileHomeAction]
// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(id: String, title: String, detail: String, systemImage: String) {
public init(id: String, title: String, detail: String, systemImage: String, actions: [MobileHomeAction]) {
self.id = id
self.title = title
self.detail = detail
self.systemImage = systemImage
self.actions = actions
}
@@ -2895,7 +2986,8 @@ public struct FfiConverterTypeMobileHomeSummaryRow: FfiConverterRustBuffer {
id: FfiConverterString.read(from: &buf),
title: FfiConverterString.read(from: &buf),
detail: FfiConverterString.read(from: &buf),
systemImage: FfiConverterString.read(from: &buf)
systemImage: FfiConverterString.read(from: &buf),
actions: FfiConverterSequenceTypeMobileHomeAction.read(from: &buf)
)
}
@@ -2904,6 +2996,7 @@ public struct FfiConverterTypeMobileHomeSummaryRow: FfiConverterRustBuffer {
FfiConverterString.write(value.title, into: &buf)
FfiConverterString.write(value.detail, into: &buf)
FfiConverterString.write(value.systemImage, into: &buf)
FfiConverterSequenceTypeMobileHomeAction.write(value.actions, into: &buf)
}
}
@@ -4619,6 +4712,86 @@ public func FfiConverterTypeMobileEntrySectionKind_lower(_ value: MobileEntrySec
public enum MobileHomeActionKind: Equatable, Hashable {
case commit
case fetch
case pull
case push
}
#if compiler(>=6)
extension MobileHomeActionKind: Sendable {}
#endif
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMobileHomeActionKind: FfiConverterRustBuffer {
typealias SwiftType = MobileHomeActionKind
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobileHomeActionKind {
let variant: Int32 = try readInt(&buf)
switch variant {
case 1: return .commit
case 2: return .fetch
case 3: return .pull
case 4: return .push
default: throw UniffiInternalError.unexpectedEnumCase
}
}
public static func write(_ value: MobileHomeActionKind, into buf: inout [UInt8]) {
switch value {
case .commit:
writeInt(&buf, Int32(1))
case .fetch:
writeInt(&buf, Int32(2))
case .pull:
writeInt(&buf, Int32(3))
case .push:
writeInt(&buf, Int32(4))
}
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMobileHomeActionKind_lift(_ buf: RustBuffer) throws -> MobileHomeActionKind {
return try FfiConverterTypeMobileHomeActionKind.lift(buf)
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMobileHomeActionKind_lower(_ value: MobileHomeActionKind) -> RustBuffer {
return FfiConverterTypeMobileHomeActionKind.lower(value)
}
public enum MobileHomeChangeKind: Equatable, Hashable {
case passwordEntry
@@ -4779,6 +4952,7 @@ public enum MobileHomeErrorKind: Equatable, Hashable {
case authentication
case conflict
case dirtyLocalChanges
case noChanges
case offline
case interrupted
case secureStorage
@@ -4815,15 +4989,17 @@ public struct FfiConverterTypeMobileHomeErrorKind: FfiConverterRustBuffer {
case 5: return .dirtyLocalChanges
case 6: return .offline
case 6: return .noChanges
case 7: return .interrupted
case 7: return .offline
case 8: return .secureStorage
case 8: return .interrupted
case 9: return .repository
case 9: return .secureStorage
case 10: return .partialProgress
case 10: return .repository
case 11: return .partialProgress
default: throw UniffiInternalError.unexpectedEnumCase
}
@@ -4853,25 +5029,29 @@ public struct FfiConverterTypeMobileHomeErrorKind: FfiConverterRustBuffer {
writeInt(&buf, Int32(5))
case .offline:
case .noChanges:
writeInt(&buf, Int32(6))
case .interrupted:
case .offline:
writeInt(&buf, Int32(7))
case .secureStorage:
case .interrupted:
writeInt(&buf, Int32(8))
case .repository:
case .secureStorage:
writeInt(&buf, Int32(9))
case .partialProgress:
case .repository:
writeInt(&buf, Int32(10))
case .partialProgress:
writeInt(&buf, Int32(11))
}
}
}
@@ -5052,6 +5232,7 @@ public enum MobileHomePhase: Equatable, Hashable {
case authenticating
case receiving
case integrating
case sending
case finishing
@@ -5082,7 +5263,9 @@ public struct FfiConverterTypeMobileHomePhase: FfiConverterRustBuffer {
case 4: return .integrating
case 5: return .finishing
case 5: return .sending
case 6: return .finishing
default: throw UniffiInternalError.unexpectedEnumCase
}
@@ -5108,9 +5291,13 @@ public struct FfiConverterTypeMobileHomePhase: FfiConverterRustBuffer {
writeInt(&buf, Int32(4))
case .finishing:
case .sending:
writeInt(&buf, Int32(5))
case .finishing:
writeInt(&buf, Int32(6))
}
}
}
@@ -6428,6 +6615,30 @@ fileprivate struct FfiConverterOptionTypeMobileTotpPage: FfiConverterRustBuffer
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeMobileHomeActionKind: FfiConverterRustBuffer {
typealias SwiftType = MobileHomeActionKind?
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
guard let value = value else {
writeInt(&buf, Int8(0))
return
}
writeInt(&buf, Int8(1))
FfiConverterTypeMobileHomeActionKind.write(value, into: &buf)
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
switch try readInt(&buf) as Int8 {
case 0: return nil
case 1: return try FfiConverterTypeMobileHomeActionKind.read(from: &buf)
default: throw UniffiInternalError.unexpectedOptionalTag
}
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -6553,6 +6764,31 @@ fileprivate struct FfiConverterSequenceTypeMobileEntrySection: FfiConverterRustB
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeMobileHomeAction: FfiConverterRustBuffer {
typealias SwiftType = [MobileHomeAction]
public static func write(_ value: [MobileHomeAction], into buf: inout [UInt8]) {
let len = Int32(value.count)
writeInt(&buf, len)
for item in value {
FfiConverterTypeMobileHomeAction.write(item, into: &buf)
}
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [MobileHomeAction] {
let len: Int32 = try readInt(&buf)
var seq = [MobileHomeAction]()
seq.reserveCapacity(Int(len))
for _ in 0 ..< len {
seq.append(try FfiConverterTypeMobileHomeAction.read(from: &buf))
}
return seq
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -6784,10 +7020,11 @@ public func mobileAuthentication()throws -> MobileAuthentication {
)
})
}
public func mobileHomeOperation() -> MobileHomeOperation {
public func mobileHomeOperation(authentication: MobileAuthentication) -> MobileHomeOperation {
return try! FfiConverterTypeMobileHomeOperation_lift(try! rustCall() {
uniffiCallStatus in
uniffi_ironstorage_apple_fn_func_mobile_home_operation(uniffiCallStatus
uniffi_ironstorage_apple_fn_func_mobile_home_operation(
FfiConverterTypeMobileAuthentication_lower(authentication),uniffiCallStatus
)
})
}
@@ -6888,7 +7125,7 @@ private let initializationResult: InitializationResult = {
if (uniffi_ironstorage_apple_checksum_func_mobile_authentication() != 38258) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_func_mobile_home_operation() != 10595) {
if (uniffi_ironstorage_apple_checksum_func_mobile_home_operation() != 64540) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_func_mobile_key_transfer() != 57389) {
@@ -7020,13 +7257,19 @@ private let initializationResult: InitializationResult = {
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_cancel() != 13921) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_commit() != 28659) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_fetch() != 29855) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_progress() != 4980) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_pull() != 9011) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_refresh() != 50081) {
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_push() != 33176) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_refresh_if_stale() != 27818) {
@@ -7082,4 +7325,4 @@ public func uniffiEnsureIronstorageAppleInitialized() {
}
}
// swiftlint:enable all
// swiftlint:enable all