Add configurable iPhone widgets
This commit is contained in:
@@ -693,6 +693,10 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
|
||||
|
||||
func updateServer(index: UInt32, name: String, url: String, token: String, provider: ServerProvider) async throws
|
||||
|
||||
func widgetActivity(serverId: String, limit: UInt32) async throws -> WidgetActivityPage
|
||||
|
||||
func widgetPulls(serverId: String, limit: UInt32) async throws -> WidgetPullPage
|
||||
|
||||
}
|
||||
open class GotchaCore: GotchaCoreProtocol, @unchecked Sendable {
|
||||
fileprivate let handle: UInt64
|
||||
@@ -733,11 +737,12 @@ open class GotchaCore: GotchaCoreProtocol, @unchecked Sendable {
|
||||
public func uniffiCloneHandle() -> UInt64 {
|
||||
return try! rustCall { uniffi_gotcha_core_fn_clone_gotchacore(self.handle, $0) }
|
||||
}
|
||||
public convenience init() {
|
||||
public convenience init(storageDirectory: String?) {
|
||||
let handle =
|
||||
try! rustCall() {
|
||||
uniffiCallStatus in
|
||||
uniffi_gotcha_core_fn_constructor_gotchacore_new(uniffiCallStatus
|
||||
uniffi_gotcha_core_fn_constructor_gotchacore_new(
|
||||
FfiConverterOptionString.lower(storageDirectory),uniffiCallStatus
|
||||
)
|
||||
}
|
||||
self.init(unsafeFromHandle: handle)
|
||||
@@ -1367,6 +1372,38 @@ open func updateServer(index: UInt32, name: String, url: String, token: String,
|
||||
)
|
||||
}
|
||||
|
||||
open func widgetActivity(serverId: String, limit: UInt32)async throws -> WidgetActivityPage {
|
||||
return
|
||||
try await uniffiRustCallAsync(
|
||||
rustFutureFunc: {
|
||||
uniffi_gotcha_core_fn_method_gotchacore_widget_activity(
|
||||
self.uniffiCloneHandle(),FfiConverterString.lower(serverId),FfiConverterUInt32.lower(limit)
|
||||
)
|
||||
},
|
||||
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: FfiConverterTypeWidgetActivityPage_lift,
|
||||
errorHandler: FfiConverterTypeGotchaError_lift
|
||||
)
|
||||
}
|
||||
|
||||
open func widgetPulls(serverId: String, limit: UInt32)async throws -> WidgetPullPage {
|
||||
return
|
||||
try await uniffiRustCallAsync(
|
||||
rustFutureFunc: {
|
||||
uniffi_gotcha_core_fn_method_gotchacore_widget_pulls(
|
||||
self.uniffiCloneHandle(),FfiConverterString.lower(serverId),FfiConverterUInt32.lower(limit)
|
||||
)
|
||||
},
|
||||
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: FfiConverterTypeWidgetPullPage_lift,
|
||||
errorHandler: FfiConverterTypeGotchaError_lift
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3475,6 +3512,10 @@ public struct ServerEditor: Equatable, Hashable {
|
||||
self.url = url
|
||||
self.provider = provider
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
@@ -3501,6 +3542,7 @@ public struct FfiConverterTypeServerEditor: FfiConverterRustBuffer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
@@ -3515,13 +3557,16 @@ public func FfiConverterTypeServerEditor_lower(_ value: ServerEditor) -> RustBuf
|
||||
return FfiConverterTypeServerEditor.lower(value)
|
||||
}
|
||||
|
||||
|
||||
public struct ServerRow: Equatable, Hashable {
|
||||
public var id: String
|
||||
public var name: String
|
||||
public var url: String
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(name: String, url: String) {
|
||||
public init(id: String, name: String, url: String) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.url = url
|
||||
}
|
||||
@@ -3542,12 +3587,14 @@ public struct FfiConverterTypeServerRow: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ServerRow {
|
||||
return
|
||||
try ServerRow(
|
||||
id: FfiConverterString.read(from: &buf),
|
||||
name: FfiConverterString.read(from: &buf),
|
||||
url: FfiConverterString.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: ServerRow, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.id, into: &buf)
|
||||
FfiConverterString.write(value.name, into: &buf)
|
||||
FfiConverterString.write(value.url, into: &buf)
|
||||
}
|
||||
@@ -3627,6 +3674,114 @@ public func FfiConverterTypeSettings_lower(_ value: Settings) -> RustBuffer {
|
||||
}
|
||||
|
||||
|
||||
public struct WidgetActivityPage: Equatable, Hashable {
|
||||
public var serverName: String
|
||||
public var rows: [ActivityRow]
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(serverName: String, rows: [ActivityRow]) {
|
||||
self.serverName = serverName
|
||||
self.rows = rows
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension WidgetActivityPage: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeWidgetActivityPage: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetActivityPage {
|
||||
return
|
||||
try WidgetActivityPage(
|
||||
serverName: FfiConverterString.read(from: &buf),
|
||||
rows: FfiConverterSequenceTypeActivityRow.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: WidgetActivityPage, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.serverName, into: &buf)
|
||||
FfiConverterSequenceTypeActivityRow.write(value.rows, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeWidgetActivityPage_lift(_ buf: RustBuffer) throws -> WidgetActivityPage {
|
||||
return try FfiConverterTypeWidgetActivityPage.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeWidgetActivityPage_lower(_ value: WidgetActivityPage) -> RustBuffer {
|
||||
return FfiConverterTypeWidgetActivityPage.lower(value)
|
||||
}
|
||||
|
||||
|
||||
public struct WidgetPullPage: Equatable, Hashable {
|
||||
public var serverName: String
|
||||
public var rows: [PullRow]
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(serverName: String, rows: [PullRow]) {
|
||||
self.serverName = serverName
|
||||
self.rows = rows
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if compiler(>=6)
|
||||
extension WidgetPullPage: Sendable {}
|
||||
#endif
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public struct FfiConverterTypeWidgetPullPage: FfiConverterRustBuffer {
|
||||
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetPullPage {
|
||||
return
|
||||
try WidgetPullPage(
|
||||
serverName: FfiConverterString.read(from: &buf),
|
||||
rows: FfiConverterSequenceTypePullRow.read(from: &buf)
|
||||
)
|
||||
}
|
||||
|
||||
public static func write(_ value: WidgetPullPage, into buf: inout [UInt8]) {
|
||||
FfiConverterString.write(value.serverName, into: &buf)
|
||||
FfiConverterSequenceTypePullRow.write(value.rows, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeWidgetPullPage_lift(_ buf: RustBuffer) throws -> WidgetPullPage {
|
||||
return try FfiConverterTypeWidgetPullPage.lift(buf)
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public func FfiConverterTypeWidgetPullPage_lower(_ value: WidgetPullPage) -> RustBuffer {
|
||||
return FfiConverterTypeWidgetPullPage.lower(value)
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum ActivityIcon: Equatable, Hashable {
|
||||
|
||||
@@ -5145,7 +5300,13 @@ private let initializationResult: InitializationResult = {
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_update_server() != 31001) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_constructor_gotchacore_new() != 35044) {
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_widget_activity() != 29431) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_widget_pulls() != 23227) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_constructor_gotchacore_new() != 64965) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
|
||||
@@ -5165,4 +5326,4 @@ public func uniffiEnsureGotchaCoreInitialized() {
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable all
|
||||
// swiftlint:enable all
|
||||
@@ -255,8 +255,7 @@ void uniffi_gotcha_core_fn_free_gotchacore(uint64_t handle, RustCallStatus *_Non
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_CONSTRUCTOR_GOTCHACORE_NEW
|
||||
#define UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_CONSTRUCTOR_GOTCHACORE_NEW
|
||||
uint64_t uniffi_gotcha_core_fn_constructor_gotchacore_new(RustCallStatus *_Nonnull out_status
|
||||
|
||||
uint64_t uniffi_gotcha_core_fn_constructor_gotchacore_new(RustBuffer storage_directory, RustCallStatus *_Nonnull out_status
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_COMMIT_DETAILS
|
||||
@@ -484,6 +483,16 @@ RustBuffer uniffi_gotcha_core_fn_method_gotchacore_startup_error(uint64_t ptr, R
|
||||
uint64_t uniffi_gotcha_core_fn_method_gotchacore_update_server(uint64_t ptr, uint32_t index, RustBuffer name, RustBuffer url, RustBuffer token, RustBuffer provider
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_WIDGET_ACTIVITY
|
||||
#define UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_WIDGET_ACTIVITY
|
||||
uint64_t uniffi_gotcha_core_fn_method_gotchacore_widget_activity(uint64_t ptr, RustBuffer server_id, uint32_t limit
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_WIDGET_PULLS
|
||||
#define UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_WIDGET_PULLS
|
||||
uint64_t uniffi_gotcha_core_fn_method_gotchacore_widget_pulls(uint64_t ptr, RustBuffer server_id, uint32_t limit
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_FFI_GOTCHA_CORE_RUSTBUFFER_ALLOC
|
||||
#define UNIFFI_FFIDEF_FFI_GOTCHA_CORE_RUSTBUFFER_ALLOC
|
||||
RustBuffer ffi_gotcha_core_rustbuffer_alloc(uint64_t size, RustCallStatus *_Nonnull out_status
|
||||
@@ -1012,6 +1021,18 @@ uint16_t uniffi_gotcha_core_checksum_method_gotchacore_startup_error(void
|
||||
#define UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_CHECKSUM_METHOD_GOTCHACORE_UPDATE_SERVER
|
||||
uint16_t uniffi_gotcha_core_checksum_method_gotchacore_update_server(void
|
||||
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_CHECKSUM_METHOD_GOTCHACORE_WIDGET_ACTIVITY
|
||||
#define UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_CHECKSUM_METHOD_GOTCHACORE_WIDGET_ACTIVITY
|
||||
uint16_t uniffi_gotcha_core_checksum_method_gotchacore_widget_activity(void
|
||||
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_CHECKSUM_METHOD_GOTCHACORE_WIDGET_PULLS
|
||||
#define UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_CHECKSUM_METHOD_GOTCHACORE_WIDGET_PULLS
|
||||
uint16_t uniffi_gotcha_core_checksum_method_gotchacore_widget_pulls(void
|
||||
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_CHECKSUM_CONSTRUCTOR_GOTCHACORE_NEW
|
||||
|
||||
Reference in New Issue
Block a user