Add full-server activity to iOS home (#65)

This commit is contained in:
Georg Bauer
2026-08-15 17:25:25 +02:00
parent 6d271e7402
commit f84ab774e6
15 changed files with 492 additions and 15 deletions

View File

@@ -683,6 +683,8 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
func selectServer(index: UInt32) throws
func serverActivity(page: UInt32) async throws -> ServerActivityPage
func serverEditor(index: UInt32) throws -> ServerEditor
func servers() -> [ServerRow]
@@ -1348,6 +1350,22 @@ open func selectServer(index: UInt32)throws {try rustCallWithError(FfiConverte
}
}
open func serverActivity(page: UInt32)async throws -> ServerActivityPage {
return
try await uniffiRustCallAsync(
rustFutureFunc: {
uniffi_gotcha_core_fn_method_gotchacore_server_activity(
self.uniffiCloneHandle(),FfiConverterUInt32.lower(page)
)
},
pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
liftFunc: FfiConverterTypeServerActivityPage_lift,
errorHandler: FfiConverterTypeGotchaError_lift
)
}
open func serverEditor(index: UInt32)throws -> ServerEditor {
return try FfiConverterTypeServerEditor_lift(try rustCallWithError(FfiConverterTypeGotchaError_lift) {
uniffiCallStatus in
@@ -3709,6 +3727,60 @@ public func FfiConverterTypeRepositoryRow_lower(_ value: RepositoryRow) -> RustB
}
public struct ServerActivityPage: Equatable, Hashable {
public var rows: [ActivityRow]
public var hasMore: Bool
// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(rows: [ActivityRow], hasMore: Bool) {
self.rows = rows
self.hasMore = hasMore
}
}
#if compiler(>=6)
extension ServerActivityPage: Sendable {}
#endif
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeServerActivityPage: FfiConverterRustBuffer {
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ServerActivityPage {
return
try ServerActivityPage(
rows: FfiConverterSequenceTypeActivityRow.read(from: &buf),
hasMore: FfiConverterBool.read(from: &buf)
)
}
public static func write(_ value: ServerActivityPage, into buf: inout [UInt8]) {
FfiConverterSequenceTypeActivityRow.write(value.rows, into: &buf)
FfiConverterBool.write(value.hasMore, into: &buf)
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerActivityPage_lift(_ buf: RustBuffer) throws -> ServerActivityPage {
return try FfiConverterTypeServerActivityPage.lift(buf)
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerActivityPage_lower(_ value: ServerActivityPage) -> RustBuffer {
return FfiConverterTypeServerActivityPage.lower(value)
}
public struct ServerEditor: Equatable, Hashable {
public var name: String
public var url: String
@@ -5589,6 +5661,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_gotcha_core_checksum_method_gotchacore_select_server() != 10204) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_server_activity() != 35959) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_server_editor() != 36193) {
return InitializationResult.apiChecksumMismatch
}