Present iPhone Git actions (#51)
This commit is contained in:
@@ -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
|
||||
@@ -428,6 +428,16 @@ RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_cached(uint64_
|
||||
void uniffi_ironstorage_apple_fn_method_mobilehomeoperation_cancel(uint64_t ptr, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_COMMIT
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_COMMIT
|
||||
RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_commit(uint64_t ptr, RustBuffer message, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_FETCH
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_FETCH
|
||||
RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_fetch(uint64_t ptr, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_PROGRESS
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_PROGRESS
|
||||
RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_progress(uint64_t ptr, RustCallStatus *_Nonnull out_status
|
||||
@@ -438,9 +448,9 @@ RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_progress(uint6
|
||||
RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_pull(uint64_t ptr, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_REFRESH
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_REFRESH
|
||||
RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_refresh(uint64_t ptr, RustCallStatus *_Nonnull out_status
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_PUSH
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_PUSH
|
||||
RustBuffer uniffi_ironstorage_apple_fn_method_mobilehomeoperation_push(uint64_t ptr, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEHOMEOPERATION_REFRESH_IF_STALE
|
||||
@@ -551,8 +561,7 @@ uint64_t uniffi_ironstorage_apple_fn_func_mobile_authentication(RustCallStatus *
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_HOME_OPERATION
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_HOME_OPERATION
|
||||
uint64_t uniffi_ironstorage_apple_fn_func_mobile_home_operation(RustCallStatus *_Nonnull out_status
|
||||
|
||||
uint64_t uniffi_ironstorage_apple_fn_func_mobile_home_operation(uint64_t authentication, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_FUNC_MOBILE_KEY_TRANSFER
|
||||
@@ -1137,6 +1146,18 @@ uint16_t uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_cached(voi
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_CANCEL
|
||||
uint16_t uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_cancel(void
|
||||
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_COMMIT
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_COMMIT
|
||||
uint16_t uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_commit(void
|
||||
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_FETCH
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_FETCH
|
||||
uint16_t uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_fetch(void
|
||||
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_PROGRESS
|
||||
@@ -1151,9 +1172,9 @@ uint16_t uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_pull(void
|
||||
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_REFRESH
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_REFRESH
|
||||
uint16_t uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_refresh(void
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_PUSH
|
||||
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_CHECKSUM_METHOD_MOBILEHOMEOPERATION_PUSH
|
||||
uint16_t uniffi_ironstorage_apple_checksum_method_mobilehomeoperation_push(void
|
||||
|
||||
);
|
||||
#endif
|
||||
|
||||
@@ -93,8 +93,8 @@ private final class AppContext: NSObject, UITabBarControllerDelegate {
|
||||
TotpListViewController(shellPage: page, authentication: authentication)
|
||||
case .preferences:
|
||||
PreferencesViewController(page: page, authentication: authentication)
|
||||
default:
|
||||
ShellViewController(page: page)
|
||||
case .home:
|
||||
ShellViewController(page: page, authentication: authentication)
|
||||
}
|
||||
let navigation = UINavigationController(rootViewController: root)
|
||||
navigation.navigationBar.prefersLargeTitles = true
|
||||
@@ -182,6 +182,7 @@ private final class AppContext: NSObject, UITabBarControllerDelegate {
|
||||
@MainActor
|
||||
private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
fileprivate let shellTab: MobileTab
|
||||
private let authentication: MobileAuthentication?
|
||||
private var page: MobilePage
|
||||
private var loadTask: Task<Void, Never>?
|
||||
private var loadGeneration = 0
|
||||
@@ -202,12 +203,20 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
|
||||
private enum HomeRequest: Equatable {
|
||||
case refreshIfStale
|
||||
case refresh
|
||||
case commit(String)
|
||||
case fetch
|
||||
case pull
|
||||
case push
|
||||
|
||||
var changesLocalStore: Bool {
|
||||
if case .pull = self { return true }
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
init(page: MobilePage) {
|
||||
init(page: MobilePage, authentication: MobileAuthentication?) {
|
||||
shellTab = page.tab
|
||||
self.authentication = authentication
|
||||
self.page = page
|
||||
super.init(style: .insetGrouped)
|
||||
title = page.title
|
||||
@@ -344,6 +353,43 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
)
|
||||
}
|
||||
|
||||
override func tableView(
|
||||
_ tableView: UITableView,
|
||||
trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath
|
||||
) -> UISwipeActionsConfiguration? {
|
||||
let actions = homeActions(at: indexPath).map { action in
|
||||
let contextual = UIContextualAction(style: .normal, title: action.title) {
|
||||
[weak self] _, _, completion in
|
||||
self?.perform(action)
|
||||
completion(true)
|
||||
}
|
||||
contextual.image = UIImage(systemName: action.systemImage)
|
||||
contextual.backgroundColor = actionColor(action.kind)
|
||||
return contextual
|
||||
}
|
||||
guard !actions.isEmpty else { return nil }
|
||||
let configuration = UISwipeActionsConfiguration(actions: actions)
|
||||
configuration.performsFirstActionWithFullSwipe = actions.count == 1
|
||||
return configuration
|
||||
}
|
||||
|
||||
override func tableView(
|
||||
_ tableView: UITableView,
|
||||
contextMenuConfigurationForRowAt indexPath: IndexPath,
|
||||
point: CGPoint
|
||||
) -> UIContextMenuConfiguration? {
|
||||
let actions = homeActions(at: indexPath)
|
||||
guard !actions.isEmpty else { return nil }
|
||||
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { [weak self] _ in
|
||||
UIMenu(children: actions.map { action in
|
||||
UIAction(
|
||||
title: action.title,
|
||||
image: UIImage(systemName: action.systemImage)
|
||||
) { [weak self] _ in self?.perform(action) }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func refreshRequested() {
|
||||
if shellTab == .home, page.state == .ready {
|
||||
guard !isHomeWorking else {
|
||||
@@ -434,7 +480,13 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
}
|
||||
|
||||
@objc private func statusRefreshRequested() {
|
||||
runHome(.refresh)
|
||||
runHome(.fetch)
|
||||
}
|
||||
|
||||
@objc private func cancelHomeRequested() {
|
||||
homeOperation?.cancel()
|
||||
navigationItem.leftBarButtonItem?.isEnabled = false
|
||||
navigationItem.prompt = "Cancelling the current Git action…"
|
||||
}
|
||||
|
||||
private var homeSections: [HomeSection] {
|
||||
@@ -466,18 +518,25 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
content.text = row.title
|
||||
content.secondaryText = row.detail
|
||||
cell.selectionStyle = .none
|
||||
cell.accessibilityCustomActions = accessibilityActions(row.actions)
|
||||
case .incoming:
|
||||
configureCommit(
|
||||
homePage.incoming[indexPath.row],
|
||||
content: &content,
|
||||
cell: cell
|
||||
)
|
||||
cell.accessibilityCustomActions = accessibilityActions(
|
||||
homePage.incoming[indexPath.row].actions
|
||||
)
|
||||
case .outgoing:
|
||||
configureCommit(
|
||||
homePage.outgoing[indexPath.row],
|
||||
content: &content,
|
||||
cell: cell
|
||||
)
|
||||
cell.accessibilityCustomActions = accessibilityActions(
|
||||
homePage.outgoing[indexPath.row].actions
|
||||
)
|
||||
case .empty:
|
||||
content.image = UIImage(systemName: "checkmark.circle")
|
||||
content.text = "No Remote Activity"
|
||||
@@ -533,7 +592,11 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
guard homePage == nil, homeTask == nil, !isHomeWorking else { return }
|
||||
homeGeneration += 1
|
||||
let current = homeGeneration
|
||||
let operation = mobileHomeOperation()
|
||||
guard let authentication else {
|
||||
showHomeFailure(.unavailable)
|
||||
return
|
||||
}
|
||||
let operation = mobileHomeOperation(authentication: authentication)
|
||||
homeOperation = operation
|
||||
isHomeWorking = true
|
||||
navigationItem.rightBarButtonItem?.isEnabled = false
|
||||
@@ -558,10 +621,14 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
|
||||
private func runHome(_ request: HomeRequest) {
|
||||
guard page.state == .ready, shellTab == .home, !isHomeWorking else { return }
|
||||
guard let authentication else {
|
||||
showHomeFailure(.unavailable)
|
||||
return
|
||||
}
|
||||
cancelHomeWork()
|
||||
homeGeneration += 1
|
||||
let current = homeGeneration
|
||||
let operation = mobileHomeOperation()
|
||||
let operation = mobileHomeOperation(authentication: authentication)
|
||||
homeOperation = operation
|
||||
isHomeWorking = true
|
||||
navigationItem.rightBarButtonItem?.isEnabled = false
|
||||
@@ -582,8 +649,10 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
do {
|
||||
let page: MobileHomePage = switch request {
|
||||
case .refreshIfStale: try operation.refreshIfStale()
|
||||
case .refresh: try operation.refresh()
|
||||
case let .commit(message): try operation.commit(message: message)
|
||||
case .fetch: try operation.fetch()
|
||||
case .pull: try operation.pull()
|
||||
case .push: try operation.push()
|
||||
}
|
||||
return Result<MobileHomePage, HomeFailure>.success(page)
|
||||
} catch let error as MobileHomeFfiError {
|
||||
@@ -609,24 +678,32 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
navigationItem.titleView = nil
|
||||
navigationItem.prompt = nil
|
||||
navigationItem.rightBarButtonItem?.isEnabled = true
|
||||
navigationItem.leftBarButtonItem = nil
|
||||
refreshControl?.endRefreshing()
|
||||
switch result {
|
||||
case let .success(homePage):
|
||||
self.homePage = homePage
|
||||
contentUnavailableConfiguration = nil
|
||||
tableView.reloadData()
|
||||
if request == .pull {
|
||||
if request?.changesLocalStore == true {
|
||||
NotificationCenter.default.post(name: .ironStorageLocalStoreDidChange, object: nil)
|
||||
if let notice = homePage.notice {
|
||||
UIAccessibility.post(notification: .announcement, argument: notice.title)
|
||||
}
|
||||
NotificationCenter.default.post(
|
||||
name: .ironStorageWatchSnapshotDidChange,
|
||||
object: nil
|
||||
)
|
||||
}
|
||||
if let notice = homePage.notice {
|
||||
UIAccessibility.post(notification: .announcement, argument: notice.title)
|
||||
}
|
||||
case let .failure(failure):
|
||||
tableView.reloadData()
|
||||
if homePage == nil {
|
||||
showHomeFailure(failure)
|
||||
} else if failure.kind != .interrupted {
|
||||
presentHomeFailure(failure)
|
||||
presentHomeFailure(failure, retry: request ?? .fetch)
|
||||
} else if failure.kind == .interrupted {
|
||||
UIAccessibility.post(notification: .announcement, argument: failure.title)
|
||||
} else {
|
||||
presentHomeFailure(failure, retry: request ?? .fetch)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -646,7 +723,7 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
contentUnavailableConfiguration = configuration
|
||||
}
|
||||
|
||||
private func presentHomeFailure(_ failure: HomeFailure) {
|
||||
private func presentHomeFailure(_ failure: HomeFailure, retry: HomeRequest) {
|
||||
let alert = UIAlertController(
|
||||
title: failure.title,
|
||||
message: failure.detail,
|
||||
@@ -661,6 +738,9 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
} ?? tabs.selectedIndex
|
||||
})
|
||||
}
|
||||
alert.addAction(UIAlertAction(title: "Retry", style: .default) { [weak self] _ in
|
||||
self?.runHome(retry)
|
||||
})
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .cancel))
|
||||
present(alert, animated: true)
|
||||
}
|
||||
@@ -677,6 +757,12 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
stack.spacing = 8
|
||||
navigationItem.titleView = stack
|
||||
navigationItem.prompt = progress.detail
|
||||
navigationItem.leftBarButtonItem = UIBarButtonItem(
|
||||
title: "Cancel",
|
||||
style: .plain,
|
||||
target: self,
|
||||
action: #selector(cancelHomeRequested)
|
||||
)
|
||||
}
|
||||
|
||||
private func cancelHomeWork() {
|
||||
@@ -690,10 +776,70 @@ private final class ShellViewController: UITableViewController, MobileTabRoot {
|
||||
isHomeWorking = false
|
||||
navigationItem.titleView = nil
|
||||
navigationItem.prompt = nil
|
||||
navigationItem.leftBarButtonItem = nil
|
||||
refreshControl?.endRefreshing()
|
||||
navigationItem.rightBarButtonItem?.isEnabled = true
|
||||
}
|
||||
|
||||
private func homeActions(at indexPath: IndexPath) -> [MobileHomeAction] {
|
||||
guard let homePage, homeSections.indices.contains(indexPath.section) else { return [] }
|
||||
return switch homeSections[indexPath.section] {
|
||||
case .summary where homePage.summaries.indices.contains(indexPath.row):
|
||||
homePage.summaries[indexPath.row].actions
|
||||
case .incoming where homePage.incoming.indices.contains(indexPath.row):
|
||||
homePage.incoming[indexPath.row].actions
|
||||
case .outgoing where homePage.outgoing.indices.contains(indexPath.row):
|
||||
homePage.outgoing[indexPath.row].actions
|
||||
default:
|
||||
[]
|
||||
}
|
||||
}
|
||||
|
||||
private func perform(_ action: MobileHomeAction) {
|
||||
switch action.kind {
|
||||
case .commit: promptForCommitMessage()
|
||||
case .fetch: runHome(.fetch)
|
||||
case .pull: runHome(.pull)
|
||||
case .push: runHome(.push)
|
||||
}
|
||||
}
|
||||
|
||||
private func promptForCommitMessage() {
|
||||
let alert = UIAlertController(
|
||||
title: "Commit Changes",
|
||||
message: "Enter the message for all current password-store changes.",
|
||||
preferredStyle: .alert
|
||||
)
|
||||
alert.addTextField { field in
|
||||
field.placeholder = "Commit message"
|
||||
field.autocapitalizationType = .sentences
|
||||
field.returnKeyType = .done
|
||||
}
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel))
|
||||
alert.addAction(UIAlertAction(title: "Commit", style: .default) { [weak self, weak alert] _ in
|
||||
self?.runHome(.commit(alert?.textFields?.first?.text ?? ""))
|
||||
})
|
||||
present(alert, animated: true)
|
||||
}
|
||||
|
||||
private func accessibilityActions(_ actions: [MobileHomeAction]) -> [UIAccessibilityCustomAction] {
|
||||
actions.map { action in
|
||||
UIAccessibilityCustomAction(name: action.title) { [weak self] _ in
|
||||
self?.perform(action)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func actionColor(_ kind: MobileHomeActionKind) -> UIColor {
|
||||
switch kind {
|
||||
case .commit: .systemOrange
|
||||
case .fetch: .systemGray
|
||||
case .pull: .systemBlue
|
||||
case .push: .systemGreen
|
||||
}
|
||||
}
|
||||
|
||||
private func stateImage(_ state: MobileShellState) -> String {
|
||||
switch state {
|
||||
case .loading: "hourglass"
|
||||
@@ -5275,6 +5421,12 @@ private struct HomeFailure: Error, Sendable {
|
||||
detail: "IronStorage could not load the storage-provided Home page."
|
||||
)
|
||||
|
||||
static let unavailable = HomeFailure(
|
||||
kind: .configuration,
|
||||
title: "Home Is Unavailable",
|
||||
detail: "Complete password-store setup before using Git actions."
|
||||
)
|
||||
|
||||
private init(kind: MobileHomeErrorKind, title: String, detail: String) {
|
||||
self.kind = kind
|
||||
self.title = title
|
||||
|
||||
Reference in New Issue
Block a user