mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-22 14:03:44 +08:00
Upgrade to flutter_rust_bridge V2
This commit is contained in:
parent
55f5bac8d9
commit
a6c9b46100
1
.gitignore
vendored
1
.gitignore
vendored
@ -45,3 +45,4 @@ app.*.map.json
|
||||
/pubspec.lock
|
||||
/rust/target/
|
||||
/rust/Cargo.lock
|
||||
/rust_builder/
|
||||
|
2
flutter_rust_bridge.yaml
Normal file
2
flutter_rust_bridge.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
rust_input: rust/src/api/**/*.rs
|
||||
dart_output: lib/common/rust/
|
@ -36,8 +36,8 @@ class Api {
|
||||
|
||||
static Future<Map<String, dynamic>> getAppReleaseDataByVersionName(
|
||||
String version) async {
|
||||
final r = await dio
|
||||
.get("${URLConf.gitlabApiPath}/repos/SCToolBox/Release/releases/tags/$version");
|
||||
final r = await dio.get(
|
||||
"${URLConf.gitlabApiPath}/repos/SCToolBox/Release/releases/tags/$version");
|
||||
return r.data;
|
||||
}
|
||||
|
||||
|
@ -112,8 +112,9 @@ class BaseUIModel extends ChangeNotifier {
|
||||
return _childUIProviders![modelKey]!;
|
||||
}
|
||||
|
||||
T? getCreatedChildUIModel<T extends BaseUIModel>(String modelKey,{bool create = false}) {
|
||||
if (create && _childUIModels?[modelKey] == null) {
|
||||
T? getCreatedChildUIModel<T extends BaseUIModel>(String modelKey,
|
||||
{bool create = false}) {
|
||||
if (create && _childUIModels?[modelKey] == null) {
|
||||
_getChildUIModel(modelKey);
|
||||
}
|
||||
return _childUIModels?[modelKey] as T?;
|
||||
|
@ -8,14 +8,13 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||
import 'package:starcitizen_doctor/api/api.dart';
|
||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/ffi.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/frb_generated.dart';
|
||||
import 'package:starcitizen_doctor/data/app_version_data.dart';
|
||||
import 'package:starcitizen_doctor/global_ui_model.dart';
|
||||
import 'package:starcitizen_doctor/base/ui.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
import '../../base/ui.dart';
|
||||
|
||||
class AppConf {
|
||||
static const String appVersion = "2.10.3 Beta";
|
||||
static const int appVersionCode = 38;
|
||||
@ -67,10 +66,7 @@ class AppConf {
|
||||
}
|
||||
|
||||
/// check Rust bridge
|
||||
if (await rustFii.ping() != "PONG") {
|
||||
dPrint("Rust bridge Error");
|
||||
exit(1);
|
||||
}
|
||||
await RustLib.init();
|
||||
dPrint("---- rust bridge inited -----");
|
||||
await SystemHelper.initPowershellPath();
|
||||
|
||||
|
24
lib/common/rust/api/downloader_api.dart
Normal file
24
lib/common/rust/api/downloader_api.dart
Normal file
@ -0,0 +1,24 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
||||
|
||||
import '../downloader.dart';
|
||||
import '../frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint}) =>
|
||||
RustLib.instance.api.startDownload(
|
||||
url: url,
|
||||
savePath: savePath,
|
||||
fileName: fileName,
|
||||
connectionCount: connectionCount,
|
||||
hint: hint);
|
||||
|
||||
Future<void> cancelDownload({required String id, dynamic hint}) =>
|
||||
RustLib.instance.api.cancelDownload(id: id, hint: hint);
|
@ -1,67 +0,0 @@
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
// Generated by `flutter_rust_bridge`@ 1.82.3.
|
||||
// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, unnecessary_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names, invalid_use_of_internal_member, prefer_is_empty, unnecessary_const
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
|
||||
|
||||
part 'bridge_definitions.freezed.dart';
|
||||
|
||||
abstract class Rust {
|
||||
Future<String> ping({dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kPingConstMeta;
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kStartDownloadConstMeta;
|
||||
|
||||
Future<void> cancelDownload({required String id, dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kCancelDownloadConstMeta;
|
||||
}
|
||||
|
||||
class DownloadCallbackData {
|
||||
final String id;
|
||||
final int total;
|
||||
final int progress;
|
||||
final int speed;
|
||||
final MyDownloaderStatus status;
|
||||
|
||||
const DownloadCallbackData({
|
||||
required this.id,
|
||||
required this.total,
|
||||
required this.progress,
|
||||
required this.speed,
|
||||
required this.status,
|
||||
});
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class MyDownloaderStatus with _$MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus.noStart() = MyDownloaderStatus_NoStart;
|
||||
const factory MyDownloaderStatus.running() = MyDownloaderStatus_Running;
|
||||
const factory MyDownloaderStatus.pending(
|
||||
MyNetworkItemPendingType field0,
|
||||
) = MyDownloaderStatus_Pending;
|
||||
const factory MyDownloaderStatus.error(
|
||||
String field0,
|
||||
) = MyDownloaderStatus_Error;
|
||||
const factory MyDownloaderStatus.finished() = MyDownloaderStatus_Finished;
|
||||
}
|
||||
|
||||
enum MyNetworkItemPendingType {
|
||||
QueueUp,
|
||||
Starting,
|
||||
Stopping,
|
||||
Initializing,
|
||||
}
|
@ -1,382 +0,0 @@
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
// Generated by `flutter_rust_bridge`@ 1.82.3.
|
||||
// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, unnecessary_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names, invalid_use_of_internal_member, prefer_is_empty, unnecessary_const
|
||||
|
||||
import "bridge_definitions.dart";
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import 'dart:ffi' as ffi;
|
||||
|
||||
class RustImpl implements Rust {
|
||||
final RustPlatform _platform;
|
||||
factory RustImpl(ExternalLibrary dylib) => RustImpl.raw(RustPlatform(dylib));
|
||||
|
||||
/// Only valid on web/WASM platforms.
|
||||
factory RustImpl.wasm(FutureOr<WasmModule> module) =>
|
||||
RustImpl(module as ExternalLibrary);
|
||||
RustImpl.raw(this._platform);
|
||||
Future<String> ping({dynamic hint}) {
|
||||
return _platform.executeNormal(FlutterRustBridgeTask(
|
||||
callFfi: (port_) => _platform.inner.wire_ping(port_),
|
||||
parseSuccessData: _wire2api_String,
|
||||
parseErrorData: null,
|
||||
constMeta: kPingConstMeta,
|
||||
argValues: [],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kPingConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "ping",
|
||||
argNames: [],
|
||||
);
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint}) {
|
||||
var arg0 = _platform.api2wire_String(url);
|
||||
var arg1 = _platform.api2wire_String(savePath);
|
||||
var arg2 = _platform.api2wire_String(fileName);
|
||||
var arg3 = api2wire_u8(connectionCount);
|
||||
return _platform.executeStream(FlutterRustBridgeTask(
|
||||
callFfi: (port_) =>
|
||||
_platform.inner.wire_start_download(port_, arg0, arg1, arg2, arg3),
|
||||
parseSuccessData: _wire2api_download_callback_data,
|
||||
parseErrorData: null,
|
||||
constMeta: kStartDownloadConstMeta,
|
||||
argValues: [url, savePath, fileName, connectionCount],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kStartDownloadConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "start_download",
|
||||
argNames: ["url", "savePath", "fileName", "connectionCount"],
|
||||
);
|
||||
|
||||
Future<void> cancelDownload({required String id, dynamic hint}) {
|
||||
var arg0 = _platform.api2wire_String(id);
|
||||
return _platform.executeNormal(FlutterRustBridgeTask(
|
||||
callFfi: (port_) => _platform.inner.wire_cancel_download(port_, arg0),
|
||||
parseSuccessData: _wire2api_unit,
|
||||
parseErrorData: null,
|
||||
constMeta: kCancelDownloadConstMeta,
|
||||
argValues: [id],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kCancelDownloadConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "cancel_download",
|
||||
argNames: ["id"],
|
||||
);
|
||||
|
||||
void dispose() {
|
||||
_platform.dispose();
|
||||
}
|
||||
// Section: wire2api
|
||||
|
||||
String _wire2api_String(dynamic raw) {
|
||||
return raw as String;
|
||||
}
|
||||
|
||||
DownloadCallbackData _wire2api_download_callback_data(dynamic raw) {
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 5)
|
||||
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
|
||||
return DownloadCallbackData(
|
||||
id: _wire2api_String(arr[0]),
|
||||
total: _wire2api_u64(arr[1]),
|
||||
progress: _wire2api_u64(arr[2]),
|
||||
speed: _wire2api_u64(arr[3]),
|
||||
status: _wire2api_my_downloader_status(arr[4]),
|
||||
);
|
||||
}
|
||||
|
||||
int _wire2api_i32(dynamic raw) {
|
||||
return raw as int;
|
||||
}
|
||||
|
||||
MyDownloaderStatus _wire2api_my_downloader_status(dynamic raw) {
|
||||
switch (raw[0]) {
|
||||
case 0:
|
||||
return MyDownloaderStatus_NoStart();
|
||||
case 1:
|
||||
return MyDownloaderStatus_Running();
|
||||
case 2:
|
||||
return MyDownloaderStatus_Pending(
|
||||
_wire2api_my_network_item_pending_type(raw[1]),
|
||||
);
|
||||
case 3:
|
||||
return MyDownloaderStatus_Error(
|
||||
_wire2api_String(raw[1]),
|
||||
);
|
||||
case 4:
|
||||
return MyDownloaderStatus_Finished();
|
||||
default:
|
||||
throw Exception("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
MyNetworkItemPendingType _wire2api_my_network_item_pending_type(dynamic raw) {
|
||||
return MyNetworkItemPendingType.values[raw as int];
|
||||
}
|
||||
|
||||
int _wire2api_u64(dynamic raw) {
|
||||
return castInt(raw);
|
||||
}
|
||||
|
||||
int _wire2api_u8(dynamic raw) {
|
||||
return raw as int;
|
||||
}
|
||||
|
||||
Uint8List _wire2api_uint_8_list(dynamic raw) {
|
||||
return raw as Uint8List;
|
||||
}
|
||||
|
||||
void _wire2api_unit(dynamic raw) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Section: api2wire
|
||||
|
||||
@protected
|
||||
int api2wire_u8(int raw) {
|
||||
return raw;
|
||||
}
|
||||
|
||||
// Section: finalizer
|
||||
|
||||
class RustPlatform extends FlutterRustBridgeBase<RustWire> {
|
||||
RustPlatform(ffi.DynamicLibrary dylib) : super(RustWire(dylib));
|
||||
|
||||
// Section: api2wire
|
||||
|
||||
@protected
|
||||
ffi.Pointer<wire_uint_8_list> api2wire_String(String raw) {
|
||||
return api2wire_uint_8_list(utf8.encoder.convert(raw));
|
||||
}
|
||||
|
||||
@protected
|
||||
ffi.Pointer<wire_uint_8_list> api2wire_uint_8_list(Uint8List raw) {
|
||||
final ans = inner.new_uint_8_list_0(raw.length);
|
||||
ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
|
||||
return ans;
|
||||
}
|
||||
// Section: finalizer
|
||||
|
||||
// Section: api_fill_to_wire
|
||||
}
|
||||
|
||||
// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
|
||||
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
//
|
||||
// Generated by `package:ffigen`.
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// generated by flutter_rust_bridge
|
||||
class RustWire implements FlutterRustBridgeWireBase {
|
||||
@internal
|
||||
late final dartApi = DartApiDl(init_frb_dart_api_dl);
|
||||
|
||||
/// Holds the symbol lookup function.
|
||||
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
_lookup;
|
||||
|
||||
/// The symbols are looked up in [dynamicLibrary].
|
||||
RustWire(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup;
|
||||
|
||||
/// The symbols are looked up with [lookup].
|
||||
RustWire.fromLookup(
|
||||
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
lookup)
|
||||
: _lookup = lookup;
|
||||
|
||||
void store_dart_post_cobject(
|
||||
DartPostCObjectFnType ptr,
|
||||
) {
|
||||
return _store_dart_post_cobject(
|
||||
ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _store_dart_post_cobjectPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>(
|
||||
'store_dart_post_cobject');
|
||||
late final _store_dart_post_cobject = _store_dart_post_cobjectPtr
|
||||
.asFunction<void Function(DartPostCObjectFnType)>();
|
||||
|
||||
Object get_dart_object(
|
||||
int ptr,
|
||||
) {
|
||||
return _get_dart_object(
|
||||
ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _get_dart_objectPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Handle Function(ffi.UintPtr)>>(
|
||||
'get_dart_object');
|
||||
late final _get_dart_object =
|
||||
_get_dart_objectPtr.asFunction<Object Function(int)>();
|
||||
|
||||
void drop_dart_object(
|
||||
int ptr,
|
||||
) {
|
||||
return _drop_dart_object(
|
||||
ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _drop_dart_objectPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.UintPtr)>>(
|
||||
'drop_dart_object');
|
||||
late final _drop_dart_object =
|
||||
_drop_dart_objectPtr.asFunction<void Function(int)>();
|
||||
|
||||
int new_dart_opaque(
|
||||
Object handle,
|
||||
) {
|
||||
return _new_dart_opaque(
|
||||
handle,
|
||||
);
|
||||
}
|
||||
|
||||
late final _new_dart_opaquePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.UintPtr Function(ffi.Handle)>>(
|
||||
'new_dart_opaque');
|
||||
late final _new_dart_opaque =
|
||||
_new_dart_opaquePtr.asFunction<int Function(Object)>();
|
||||
|
||||
int init_frb_dart_api_dl(
|
||||
ffi.Pointer<ffi.Void> obj,
|
||||
) {
|
||||
return _init_frb_dart_api_dl(
|
||||
obj,
|
||||
);
|
||||
}
|
||||
|
||||
late final _init_frb_dart_api_dlPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.IntPtr Function(ffi.Pointer<ffi.Void>)>>(
|
||||
'init_frb_dart_api_dl');
|
||||
late final _init_frb_dart_api_dl = _init_frb_dart_api_dlPtr
|
||||
.asFunction<int Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
void wire_ping(
|
||||
int port_,
|
||||
) {
|
||||
return _wire_ping(
|
||||
port_,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_pingPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>('wire_ping');
|
||||
late final _wire_ping = _wire_pingPtr.asFunction<void Function(int)>();
|
||||
|
||||
void wire_start_download(
|
||||
int port_,
|
||||
ffi.Pointer<wire_uint_8_list> url,
|
||||
ffi.Pointer<wire_uint_8_list> save_path,
|
||||
ffi.Pointer<wire_uint_8_list> file_name,
|
||||
int connection_count,
|
||||
) {
|
||||
return _wire_start_download(
|
||||
port_,
|
||||
url,
|
||||
save_path,
|
||||
file_name,
|
||||
connection_count,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_start_downloadPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Int64,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Uint8)>>('wire_start_download');
|
||||
late final _wire_start_download = _wire_start_downloadPtr.asFunction<
|
||||
void Function(int, ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>, ffi.Pointer<wire_uint_8_list>, int)>();
|
||||
|
||||
void wire_cancel_download(
|
||||
int port_,
|
||||
ffi.Pointer<wire_uint_8_list> id,
|
||||
) {
|
||||
return _wire_cancel_download(
|
||||
port_,
|
||||
id,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_cancel_downloadPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(ffi.Int64,
|
||||
ffi.Pointer<wire_uint_8_list>)>>('wire_cancel_download');
|
||||
late final _wire_cancel_download = _wire_cancel_downloadPtr
|
||||
.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
|
||||
|
||||
ffi.Pointer<wire_uint_8_list> new_uint_8_list_0(
|
||||
int len,
|
||||
) {
|
||||
return _new_uint_8_list_0(
|
||||
len,
|
||||
);
|
||||
}
|
||||
|
||||
late final _new_uint_8_list_0Ptr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Pointer<wire_uint_8_list> Function(ffi.Int32)>>(
|
||||
'new_uint_8_list_0');
|
||||
late final _new_uint_8_list_0 = _new_uint_8_list_0Ptr
|
||||
.asFunction<ffi.Pointer<wire_uint_8_list> Function(int)>();
|
||||
|
||||
void free_WireSyncReturn(
|
||||
WireSyncReturn ptr,
|
||||
) {
|
||||
return _free_WireSyncReturn(
|
||||
ptr,
|
||||
);
|
||||
}
|
||||
|
||||
late final _free_WireSyncReturnPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(WireSyncReturn)>>(
|
||||
'free_WireSyncReturn');
|
||||
late final _free_WireSyncReturn =
|
||||
_free_WireSyncReturnPtr.asFunction<void Function(WireSyncReturn)>();
|
||||
}
|
||||
|
||||
final class _Dart_Handle extends ffi.Opaque {}
|
||||
|
||||
final class wire_uint_8_list extends ffi.Struct {
|
||||
external ffi.Pointer<ffi.Uint8> ptr;
|
||||
|
||||
@ffi.Int32()
|
||||
external int len;
|
||||
}
|
||||
|
||||
typedef DartPostCObjectFnType = ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message)>>;
|
||||
typedef DartPort = ffi.Int64;
|
64
lib/common/rust/downloader.dart
Normal file
64
lib/common/rust/downloader.dart
Normal file
@ -0,0 +1,64 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
||||
|
||||
import 'frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
|
||||
part 'downloader.freezed.dart';
|
||||
|
||||
class DownloadCallbackData {
|
||||
final String id;
|
||||
final int total;
|
||||
final int progress;
|
||||
final int speed;
|
||||
final MyDownloaderStatus status;
|
||||
|
||||
const DownloadCallbackData({
|
||||
required this.id,
|
||||
required this.total,
|
||||
required this.progress,
|
||||
required this.speed,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
id.hashCode ^
|
||||
total.hashCode ^
|
||||
progress.hashCode ^
|
||||
speed.hashCode ^
|
||||
status.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is DownloadCallbackData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
total == other.total &&
|
||||
progress == other.progress &&
|
||||
speed == other.speed &&
|
||||
status == other.status;
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class MyDownloaderStatus with _$MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus.noStart() = MyDownloaderStatus_NoStart;
|
||||
const factory MyDownloaderStatus.running() = MyDownloaderStatus_Running;
|
||||
const factory MyDownloaderStatus.pending(
|
||||
MyNetworkItemPendingType field0,
|
||||
) = MyDownloaderStatus_Pending;
|
||||
const factory MyDownloaderStatus.error(
|
||||
String field0,
|
||||
) = MyDownloaderStatus_Error;
|
||||
const factory MyDownloaderStatus.finished() = MyDownloaderStatus_Finished;
|
||||
}
|
||||
|
||||
enum MyNetworkItemPendingType {
|
||||
queueUp,
|
||||
starting,
|
||||
stopping,
|
||||
initializing,
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'bridge_definitions.dart';
|
||||
part of 'downloader.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
@ -122,7 +122,7 @@ class _$MyDownloaderStatus_NoStartImpl implements MyDownloaderStatus_NoStart {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_NoStartImpl);
|
||||
@ -246,7 +246,7 @@ class _$MyDownloaderStatus_RunningImpl implements MyDownloaderStatus_Running {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_RunningImpl);
|
||||
@ -388,7 +388,7 @@ class _$MyDownloaderStatus_PendingImpl implements MyDownloaderStatus_Pending {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_PendingImpl &&
|
||||
@ -544,7 +544,7 @@ class _$MyDownloaderStatus_ErrorImpl implements MyDownloaderStatus_Error {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_ErrorImpl &&
|
||||
@ -682,7 +682,7 @@ class _$MyDownloaderStatus_FinishedImpl implements MyDownloaderStatus_Finished {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_FinishedImpl);
|
@ -1,23 +0,0 @@
|
||||
// This file initializes the dynamic library and connects it with the stub
|
||||
// generated by flutter_rust_bridge_codegen.
|
||||
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'bridge_generated.dart';
|
||||
import 'bridge_definitions.dart';
|
||||
export 'bridge_definitions.dart';
|
||||
|
||||
// Re-export the bridge so it is only necessary to import this file.
|
||||
export 'bridge_generated.dart';
|
||||
import 'dart:io' as io;
|
||||
|
||||
|
||||
const _base = 'rust';
|
||||
|
||||
// On MacOS, the dynamic library is not bundled with the binary,
|
||||
// but rather directly **linked** against the binary.
|
||||
final _dylib = io.Platform.isWindows ? '$_base.dll' : 'lib$_base.so';
|
||||
|
||||
final Rust rustFii = RustImpl(io.Platform.isIOS || io.Platform.isMacOS
|
||||
? DynamicLibrary.executable()
|
||||
: DynamicLibrary.open(_dylib));
|
395
lib/common/rust/frb_generated.dart
Normal file
395
lib/common/rust/frb_generated.dart
Normal file
@ -0,0 +1,395 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
|
||||
|
||||
import 'api/downloader_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'downloader.dart';
|
||||
import 'frb_generated.io.dart' if (dart.library.html) 'frb_generated.web.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
|
||||
/// Main entrypoint of the Rust API
|
||||
class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
|
||||
@internal
|
||||
static final instance = RustLib._();
|
||||
|
||||
RustLib._();
|
||||
|
||||
/// Initialize flutter_rust_bridge
|
||||
static Future<void> init({
|
||||
RustLibApi? api,
|
||||
BaseHandler? handler,
|
||||
ExternalLibrary? externalLibrary,
|
||||
}) async {
|
||||
await instance.initImpl(
|
||||
api: api,
|
||||
handler: handler,
|
||||
externalLibrary: externalLibrary,
|
||||
);
|
||||
}
|
||||
|
||||
/// Dispose flutter_rust_bridge
|
||||
///
|
||||
/// The call to this function is optional, since flutter_rust_bridge (and everything else)
|
||||
/// is automatically disposed when the app stops.
|
||||
static void dispose() => instance.disposeImpl();
|
||||
|
||||
@override
|
||||
ApiImplConstructor<RustLibApiImpl, RustLibWire> get apiImplConstructor =>
|
||||
RustLibApiImpl.new;
|
||||
|
||||
@override
|
||||
WireConstructor<RustLibWire> get wireConstructor =>
|
||||
RustLibWire.fromExternalLibrary;
|
||||
|
||||
@override
|
||||
Future<void> executeRustInitializers() async {}
|
||||
|
||||
@override
|
||||
ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig =>
|
||||
kDefaultExternalLibraryLoaderConfig;
|
||||
|
||||
@override
|
||||
String get codegenVersion => '2.0.0-dev.23';
|
||||
|
||||
static const kDefaultExternalLibraryLoaderConfig =
|
||||
ExternalLibraryLoaderConfig(
|
||||
stem: 'rust_lib',
|
||||
ioDirectory: 'rust/target/release/',
|
||||
webPrefix: 'pkg/',
|
||||
);
|
||||
}
|
||||
|
||||
abstract class RustLibApi extends BaseApi {
|
||||
Future<void> cancelDownload({required String id, dynamic hint});
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint});
|
||||
}
|
||||
|
||||
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
RustLibApiImpl({
|
||||
required super.handler,
|
||||
required super.wire,
|
||||
required super.generalizedFrbRustBinding,
|
||||
required super.portManager,
|
||||
});
|
||||
|
||||
@override
|
||||
Future<void> cancelDownload({required String id, dynamic hint}) {
|
||||
return handler.executeNormal(NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_String(id, serializer);
|
||||
pdeCallFfi(generalizedFrbRustBinding, serializer,
|
||||
funcId: 2, port: port_);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: null,
|
||||
),
|
||||
constMeta: kCancelDownloadConstMeta,
|
||||
argValues: [id],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kCancelDownloadConstMeta => const TaskConstMeta(
|
||||
debugName: "cancel_download",
|
||||
argNames: ["id"],
|
||||
);
|
||||
|
||||
@override
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint}) {
|
||||
return handler.executeStream(StreamTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_String(url, serializer);
|
||||
sse_encode_String(savePath, serializer);
|
||||
sse_encode_String(fileName, serializer);
|
||||
sse_encode_u_8(connectionCount, serializer);
|
||||
pdeCallFfi(generalizedFrbRustBinding, serializer,
|
||||
funcId: 1, port: port_);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_download_callback_data,
|
||||
decodeErrorData: null,
|
||||
),
|
||||
constMeta: kStartDownloadConstMeta,
|
||||
argValues: [url, savePath, fileName, connectionCount],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kStartDownloadConstMeta => const TaskConstMeta(
|
||||
debugName: "start_download",
|
||||
argNames: ["url", "savePath", "fileName", "connectionCount"],
|
||||
);
|
||||
|
||||
@protected
|
||||
String dco_decode_String(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return raw as String;
|
||||
}
|
||||
|
||||
@protected
|
||||
DownloadCallbackData dco_decode_download_callback_data(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 5)
|
||||
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
|
||||
return DownloadCallbackData(
|
||||
id: dco_decode_String(arr[0]),
|
||||
total: dco_decode_u_64(arr[1]),
|
||||
progress: dco_decode_u_64(arr[2]),
|
||||
speed: dco_decode_u_64(arr[3]),
|
||||
status: dco_decode_my_downloader_status(arr[4]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return raw as int;
|
||||
}
|
||||
|
||||
@protected
|
||||
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return raw as Uint8List;
|
||||
}
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus dco_decode_my_downloader_status(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
switch (raw[0]) {
|
||||
case 0:
|
||||
return MyDownloaderStatus_NoStart();
|
||||
case 1:
|
||||
return MyDownloaderStatus_Running();
|
||||
case 2:
|
||||
return MyDownloaderStatus_Pending(
|
||||
dco_decode_my_network_item_pending_type(raw[1]),
|
||||
);
|
||||
case 3:
|
||||
return MyDownloaderStatus_Error(
|
||||
dco_decode_String(raw[1]),
|
||||
);
|
||||
case 4:
|
||||
return MyDownloaderStatus_Finished();
|
||||
default:
|
||||
throw Exception("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType dco_decode_my_network_item_pending_type(
|
||||
dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return MyNetworkItemPendingType.values[raw as int];
|
||||
}
|
||||
|
||||
@protected
|
||||
int dco_decode_u_64(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return dcoDecodeI64OrU64(raw);
|
||||
}
|
||||
|
||||
@protected
|
||||
int dco_decode_u_8(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return raw as int;
|
||||
}
|
||||
|
||||
@protected
|
||||
void dco_decode_unit(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return;
|
||||
}
|
||||
|
||||
@protected
|
||||
String sse_decode_String(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var inner = sse_decode_list_prim_u_8_strict(deserializer);
|
||||
return utf8.decoder.convert(inner);
|
||||
}
|
||||
|
||||
@protected
|
||||
DownloadCallbackData sse_decode_download_callback_data(
|
||||
SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_id = sse_decode_String(deserializer);
|
||||
var var_total = sse_decode_u_64(deserializer);
|
||||
var var_progress = sse_decode_u_64(deserializer);
|
||||
var var_speed = sse_decode_u_64(deserializer);
|
||||
var var_status = sse_decode_my_downloader_status(deserializer);
|
||||
return DownloadCallbackData(
|
||||
id: var_id,
|
||||
total: var_total,
|
||||
progress: var_progress,
|
||||
speed: var_speed,
|
||||
status: var_status);
|
||||
}
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return deserializer.buffer.getInt32();
|
||||
}
|
||||
|
||||
@protected
|
||||
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var len_ = sse_decode_i_32(deserializer);
|
||||
return deserializer.buffer.getUint8List(len_);
|
||||
}
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus sse_decode_my_downloader_status(
|
||||
SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
var tag_ = sse_decode_i_32(deserializer);
|
||||
switch (tag_) {
|
||||
case 0:
|
||||
return MyDownloaderStatus_NoStart();
|
||||
case 1:
|
||||
return MyDownloaderStatus_Running();
|
||||
case 2:
|
||||
var var_field0 = sse_decode_my_network_item_pending_type(deserializer);
|
||||
return MyDownloaderStatus_Pending(var_field0);
|
||||
case 3:
|
||||
var var_field0 = sse_decode_String(deserializer);
|
||||
return MyDownloaderStatus_Error(var_field0);
|
||||
case 4:
|
||||
return MyDownloaderStatus_Finished();
|
||||
default:
|
||||
throw UnimplementedError('');
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType sse_decode_my_network_item_pending_type(
|
||||
SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var inner = sse_decode_i_32(deserializer);
|
||||
return MyNetworkItemPendingType.values[inner];
|
||||
}
|
||||
|
||||
@protected
|
||||
int sse_decode_u_64(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return deserializer.buffer.getUint64();
|
||||
}
|
||||
|
||||
@protected
|
||||
int sse_decode_u_8(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return deserializer.buffer.getUint8();
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_decode_unit(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
}
|
||||
|
||||
@protected
|
||||
bool sse_decode_bool(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return deserializer.buffer.getUint8() != 0;
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_String(String self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_download_callback_data(
|
||||
DownloadCallbackData self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_String(self.id, serializer);
|
||||
sse_encode_u_64(self.total, serializer);
|
||||
sse_encode_u_64(self.progress, serializer);
|
||||
sse_encode_u_64(self.speed, serializer);
|
||||
sse_encode_my_downloader_status(self.status, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
serializer.buffer.putInt32(self);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_prim_u_8_strict(
|
||||
Uint8List self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_32(self.length, serializer);
|
||||
serializer.buffer.putUint8List(self);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_my_downloader_status(
|
||||
MyDownloaderStatus self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
switch (self) {
|
||||
case MyDownloaderStatus_NoStart():
|
||||
sse_encode_i_32(0, serializer);
|
||||
case MyDownloaderStatus_Running():
|
||||
sse_encode_i_32(1, serializer);
|
||||
case MyDownloaderStatus_Pending(field0: final field0):
|
||||
sse_encode_i_32(2, serializer);
|
||||
sse_encode_my_network_item_pending_type(field0, serializer);
|
||||
case MyDownloaderStatus_Error(field0: final field0):
|
||||
sse_encode_i_32(3, serializer);
|
||||
sse_encode_String(field0, serializer);
|
||||
case MyDownloaderStatus_Finished():
|
||||
sse_encode_i_32(4, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_my_network_item_pending_type(
|
||||
MyNetworkItemPendingType self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_32(self.index, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_u_64(int self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
serializer.buffer.putUint64(self);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_u_8(int self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
serializer.buffer.putUint8(self);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_unit(void self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_bool(bool self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
serializer.buffer.putUint8(self ? 1 : 0);
|
||||
}
|
||||
}
|
130
lib/common/rust/frb_generated.io.dart
Normal file
130
lib/common/rust/frb_generated.io.dart
Normal file
@ -0,0 +1,130 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
|
||||
|
||||
import 'api/downloader_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi' as ffi;
|
||||
import 'downloader.dart';
|
||||
import 'frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart';
|
||||
|
||||
abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
RustLibApiImplPlatform({
|
||||
required super.handler,
|
||||
required super.wire,
|
||||
required super.generalizedFrbRustBinding,
|
||||
required super.portManager,
|
||||
});
|
||||
|
||||
@protected
|
||||
String dco_decode_String(dynamic raw);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData dco_decode_download_callback_data(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus dco_decode_my_downloader_status(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType dco_decode_my_network_item_pending_type(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_8(dynamic raw);
|
||||
|
||||
@protected
|
||||
void dco_decode_unit(dynamic raw);
|
||||
|
||||
@protected
|
||||
String sse_decode_String(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData sse_decode_download_callback_data(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus sse_decode_my_downloader_status(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType sse_decode_my_network_item_pending_type(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_8(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_decode_unit(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
bool sse_decode_bool(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_String(String self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_download_callback_data(
|
||||
DownloadCallbackData self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_prim_u_8_strict(
|
||||
Uint8List self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_downloader_status(
|
||||
MyDownloaderStatus self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_network_item_pending_type(
|
||||
MyNetworkItemPendingType self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_64(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_8(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_unit(void self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_bool(bool self, SseSerializer serializer);
|
||||
}
|
||||
|
||||
// Section: wire_class
|
||||
|
||||
class RustLibWire implements BaseWire {
|
||||
factory RustLibWire.fromExternalLibrary(ExternalLibrary lib) =>
|
||||
RustLibWire(lib.ffiDynamicLibrary);
|
||||
|
||||
/// Holds the symbol lookup function.
|
||||
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
_lookup;
|
||||
|
||||
/// The symbols are looked up in [dynamicLibrary].
|
||||
RustLibWire(ffi.DynamicLibrary dynamicLibrary)
|
||||
: _lookup = dynamicLibrary.lookup;
|
||||
}
|
133
lib/common/rust/frb_generated.web.dart
Normal file
133
lib/common/rust/frb_generated.web.dart
Normal file
@ -0,0 +1,133 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
|
||||
|
||||
import 'api/downloader_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'downloader.dart';
|
||||
import 'frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart';
|
||||
|
||||
abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
RustLibApiImplPlatform({
|
||||
required super.handler,
|
||||
required super.wire,
|
||||
required super.generalizedFrbRustBinding,
|
||||
required super.portManager,
|
||||
});
|
||||
|
||||
@protected
|
||||
String dco_decode_String(dynamic raw);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData dco_decode_download_callback_data(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus dco_decode_my_downloader_status(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType dco_decode_my_network_item_pending_type(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_8(dynamic raw);
|
||||
|
||||
@protected
|
||||
void dco_decode_unit(dynamic raw);
|
||||
|
||||
@protected
|
||||
String sse_decode_String(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData sse_decode_download_callback_data(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus sse_decode_my_downloader_status(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType sse_decode_my_network_item_pending_type(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_8(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_decode_unit(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
bool sse_decode_bool(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_String(String self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_download_callback_data(
|
||||
DownloadCallbackData self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_prim_u_8_strict(
|
||||
Uint8List self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_downloader_status(
|
||||
MyDownloaderStatus self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_network_item_pending_type(
|
||||
MyNetworkItemPendingType self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_64(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_8(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_unit(void self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_bool(bool self, SseSerializer serializer);
|
||||
}
|
||||
|
||||
// Section: wire_class
|
||||
|
||||
class RustLibWire implements BaseWire {
|
||||
RustLibWire.fromExternalLibrary(ExternalLibrary lib);
|
||||
}
|
||||
|
||||
@JS('wasm_bindgen')
|
||||
external RustLibWasmModule get wasmModule;
|
||||
|
||||
@JS()
|
||||
@anonymous
|
||||
class RustLibWasmModule implements WasmModule {
|
||||
@override
|
||||
external Object /* Promise */ call([String? moduleName]);
|
||||
|
||||
@override
|
||||
external RustLibWasmModule bind(dynamic thisArg, String moduleName);
|
||||
}
|
@ -106,10 +106,11 @@ Future showBaseDialog(BuildContext context,
|
||||
builder: (context) => ContentDialog(
|
||||
title: Text(title),
|
||||
content: content,
|
||||
constraints: constraints ?? const BoxConstraints(
|
||||
maxWidth: 512,
|
||||
maxHeight: 756.0,
|
||||
),
|
||||
constraints: constraints ??
|
||||
const BoxConstraints(
|
||||
maxWidth: 512,
|
||||
maxHeight: 756.0,
|
||||
),
|
||||
actions: actions,
|
||||
),
|
||||
);
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -8,13 +8,14 @@
|
||||
|
||||
class AppPlacardData {
|
||||
AppPlacardData({
|
||||
this.version,
|
||||
this.title,
|
||||
this.content,
|
||||
this.link,
|
||||
this.linkType,
|
||||
this.alwaysShow,
|
||||
this.enable,});
|
||||
this.version,
|
||||
this.title,
|
||||
this.content,
|
||||
this.link,
|
||||
this.linkType,
|
||||
this.alwaysShow,
|
||||
this.enable,
|
||||
});
|
||||
|
||||
AppPlacardData.fromJson(dynamic json) {
|
||||
version = json['version'];
|
||||
@ -44,5 +45,4 @@ class AppPlacardData {
|
||||
map['enable'] = enable;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,14 @@
|
||||
|
||||
class AppWebLocalizationVersionsData {
|
||||
AppWebLocalizationVersionsData({
|
||||
this.rsi,
|
||||
this.uex,
|
||||
this.addresses,
|
||||
this.concierge,
|
||||
this.hangar,
|
||||
this.orgs,
|
||||
this.dps,});
|
||||
this.rsi,
|
||||
this.uex,
|
||||
this.addresses,
|
||||
this.concierge,
|
||||
this.hangar,
|
||||
this.orgs,
|
||||
this.dps,
|
||||
});
|
||||
|
||||
AppWebLocalizationVersionsData.fromJson(dynamic json) {
|
||||
rsi = json['rsi'];
|
||||
@ -44,5 +45,4 @@ class AppWebLocalizationVersionsData {
|
||||
map['dps'] = dps;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
class CountdownFestivalItemData {
|
||||
CountdownFestivalItemData({
|
||||
this.name,
|
||||
this.time,
|
||||
this.icon,});
|
||||
this.name,
|
||||
this.time,
|
||||
this.icon,
|
||||
});
|
||||
|
||||
CountdownFestivalItemData.fromJson(dynamic json) {
|
||||
name = json['name'];
|
||||
@ -20,5 +21,4 @@ class CountdownFestivalItemData {
|
||||
map['icon'] = icon;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,15 @@
|
||||
|
||||
class GamePerformanceData {
|
||||
GamePerformanceData({
|
||||
this.key,
|
||||
this.name,
|
||||
this.info,
|
||||
this.type,
|
||||
this.max,
|
||||
this.min,
|
||||
this.value,
|
||||
this.group,});
|
||||
this.key,
|
||||
this.name,
|
||||
this.info,
|
||||
this.type,
|
||||
this.max,
|
||||
this.min,
|
||||
this.value,
|
||||
this.group,
|
||||
});
|
||||
|
||||
GamePerformanceData.fromJson(dynamic json) {
|
||||
key = json['key'];
|
||||
@ -49,5 +50,4 @@ class GamePerformanceData {
|
||||
map['group'] = group;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,13 @@
|
||||
|
||||
class ScLocalizationData {
|
||||
ScLocalizationData({
|
||||
this.enable,
|
||||
this.versionName,
|
||||
this.updateAt,
|
||||
this.info,
|
||||
this.gameChannel,
|
||||
this.note,});
|
||||
this.enable,
|
||||
this.versionName,
|
||||
this.updateAt,
|
||||
this.info,
|
||||
this.gameChannel,
|
||||
this.note,
|
||||
});
|
||||
|
||||
ScLocalizationData.fromJson(dynamic json) {
|
||||
enable = json['enable'];
|
||||
@ -39,5 +40,4 @@ class ScLocalizationData {
|
||||
map['note'] = note;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -44,28 +44,43 @@ class ChatMessage extends $pb.GeneratedMessage {
|
||||
return $result;
|
||||
}
|
||||
ChatMessage._() : super();
|
||||
factory ChatMessage.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory ChatMessage.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
factory ChatMessage.fromBuffer($core.List<$core.int> i,
|
||||
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
create()..mergeFromBuffer(i, r);
|
||||
factory ChatMessage.fromJson($core.String i,
|
||||
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ChatMessage', createEmptyInstance: create)
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
_omitMessageNames ? '' : 'ChatMessage',
|
||||
createEmptyInstance: create)
|
||||
..aOS(1, _omitFieldNames ? '' : 'senderID', protoName: 'senderID')
|
||||
..aOS(2, _omitFieldNames ? '' : 'receiverID', protoName: 'receiverID')
|
||||
..e<ReceiverType>(3, _omitFieldNames ? '' : 'receiverType', $pb.PbFieldType.OE, protoName: 'receiverType', defaultOrMaker: ReceiverType.RoomMsg, valueOf: ReceiverType.valueOf, enumValues: ReceiverType.values)
|
||||
..e<MessageType>(4, _omitFieldNames ? '' : 'messageType', $pb.PbFieldType.OE, protoName: 'messageType', defaultOrMaker: MessageType.System, valueOf: MessageType.valueOf, enumValues: MessageType.values)
|
||||
..e<ReceiverType>(
|
||||
3, _omitFieldNames ? '' : 'receiverType', $pb.PbFieldType.OE,
|
||||
protoName: 'receiverType',
|
||||
defaultOrMaker: ReceiverType.RoomMsg,
|
||||
valueOf: ReceiverType.valueOf,
|
||||
enumValues: ReceiverType.values)
|
||||
..e<MessageType>(
|
||||
4, _omitFieldNames ? '' : 'messageType', $pb.PbFieldType.OE,
|
||||
protoName: 'messageType',
|
||||
defaultOrMaker: MessageType.System,
|
||||
valueOf: MessageType.valueOf,
|
||||
enumValues: MessageType.values)
|
||||
..aOS(5, _omitFieldNames ? '' : 'data')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
..hasRequiredFields = false;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
ChatMessage clone() => ChatMessage()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
ChatMessage copyWith(void Function(ChatMessage) updates) => super.copyWith((message) => updates(message as ChatMessage)) as ChatMessage;
|
||||
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
ChatMessage copyWith(void Function(ChatMessage) updates) =>
|
||||
super.copyWith((message) => updates(message as ChatMessage))
|
||||
as ChatMessage;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@ -74,13 +89,17 @@ class ChatMessage extends $pb.GeneratedMessage {
|
||||
ChatMessage createEmptyInstance() => create();
|
||||
static $pb.PbList<ChatMessage> createRepeated() => $pb.PbList<ChatMessage>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static ChatMessage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ChatMessage>(create);
|
||||
static ChatMessage getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<ChatMessage>(create);
|
||||
static ChatMessage? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.String get senderID => $_getSZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set senderID($core.String v) { $_setString(0, v); }
|
||||
set senderID($core.String v) {
|
||||
$_setString(0, v);
|
||||
}
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasSenderID() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
@ -89,7 +108,10 @@ class ChatMessage extends $pb.GeneratedMessage {
|
||||
@$pb.TagNumber(2)
|
||||
$core.String get receiverID => $_getSZ(1);
|
||||
@$pb.TagNumber(2)
|
||||
set receiverID($core.String v) { $_setString(1, v); }
|
||||
set receiverID($core.String v) {
|
||||
$_setString(1, v);
|
||||
}
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasReceiverID() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
@ -98,7 +120,10 @@ class ChatMessage extends $pb.GeneratedMessage {
|
||||
@$pb.TagNumber(3)
|
||||
ReceiverType get receiverType => $_getN(2);
|
||||
@$pb.TagNumber(3)
|
||||
set receiverType(ReceiverType v) { setField(3, v); }
|
||||
set receiverType(ReceiverType v) {
|
||||
setField(3, v);
|
||||
}
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasReceiverType() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
@ -107,7 +132,10 @@ class ChatMessage extends $pb.GeneratedMessage {
|
||||
@$pb.TagNumber(4)
|
||||
MessageType get messageType => $_getN(3);
|
||||
@$pb.TagNumber(4)
|
||||
set messageType(MessageType v) { setField(4, v); }
|
||||
set messageType(MessageType v) {
|
||||
setField(4, v);
|
||||
}
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasMessageType() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
@ -116,13 +144,16 @@ class ChatMessage extends $pb.GeneratedMessage {
|
||||
@$pb.TagNumber(5)
|
||||
$core.String get data => $_getSZ(4);
|
||||
@$pb.TagNumber(5)
|
||||
set data($core.String v) { $_setString(4, v); }
|
||||
set data($core.String v) {
|
||||
$_setString(4, v);
|
||||
}
|
||||
|
||||
@$pb.TagNumber(5)
|
||||
$core.bool hasData() => $_has(4);
|
||||
@$pb.TagNumber(5)
|
||||
void clearData() => clearField(5);
|
||||
}
|
||||
|
||||
|
||||
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
|
||||
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');
|
||||
const _omitMessageNames =
|
||||
$core.bool.fromEnvironment('protobuf.omit_message_names');
|
||||
|
@ -14,38 +14,45 @@ import 'dart:core' as $core;
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
class ReceiverType extends $pb.ProtobufEnum {
|
||||
static const ReceiverType RoomMsg = ReceiverType._(0, _omitEnumNames ? '' : 'RoomMsg');
|
||||
static const ReceiverType PrivateMsg = ReceiverType._(1, _omitEnumNames ? '' : 'PrivateMsg');
|
||||
static const ReceiverType RoomMsg =
|
||||
ReceiverType._(0, _omitEnumNames ? '' : 'RoomMsg');
|
||||
static const ReceiverType PrivateMsg =
|
||||
ReceiverType._(1, _omitEnumNames ? '' : 'PrivateMsg');
|
||||
|
||||
static const $core.List<ReceiverType> values = <ReceiverType> [
|
||||
static const $core.List<ReceiverType> values = <ReceiverType>[
|
||||
RoomMsg,
|
||||
PrivateMsg,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, ReceiverType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, ReceiverType> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static ReceiverType? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const ReceiverType._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
class MessageType extends $pb.ProtobufEnum {
|
||||
static const MessageType System = MessageType._(0, _omitEnumNames ? '' : 'System');
|
||||
static const MessageType Text = MessageType._(1, _omitEnumNames ? '' : 'Text');
|
||||
static const MessageType Image = MessageType._(2, _omitEnumNames ? '' : 'Image');
|
||||
static const MessageType Markdown = MessageType._(3, _omitEnumNames ? '' : 'Markdown');
|
||||
static const MessageType System =
|
||||
MessageType._(0, _omitEnumNames ? '' : 'System');
|
||||
static const MessageType Text =
|
||||
MessageType._(1, _omitEnumNames ? '' : 'Text');
|
||||
static const MessageType Image =
|
||||
MessageType._(2, _omitEnumNames ? '' : 'Image');
|
||||
static const MessageType Markdown =
|
||||
MessageType._(3, _omitEnumNames ? '' : 'Markdown');
|
||||
|
||||
static const $core.List<MessageType> values = <MessageType> [
|
||||
static const $core.List<MessageType> values = <MessageType>[
|
||||
System,
|
||||
Text,
|
||||
Image,
|
||||
Markdown,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, MessageType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, MessageType> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static MessageType? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const MessageType._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
|
||||
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');
|
||||
|
@ -26,22 +26,26 @@ class ChatServiceClient extends $grpc.Client {
|
||||
'/ChatService/ListenMessage',
|
||||
($0.PreUser value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $1.ChatMessage.fromBuffer(value));
|
||||
static final _$sendMessage = $grpc.ClientMethod<$1.ChatMessage, $0.BaseRespData>(
|
||||
'/ChatService/SendMessage',
|
||||
($1.ChatMessage value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.BaseRespData.fromBuffer(value));
|
||||
static final _$sendMessage =
|
||||
$grpc.ClientMethod<$1.ChatMessage, $0.BaseRespData>(
|
||||
'/ChatService/SendMessage',
|
||||
($1.ChatMessage value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.BaseRespData.fromBuffer(value));
|
||||
|
||||
ChatServiceClient($grpc.ClientChannel channel,
|
||||
{$grpc.CallOptions? options,
|
||||
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
|
||||
: super(channel, options: options,
|
||||
interceptors: interceptors);
|
||||
: super(channel, options: options, interceptors: interceptors);
|
||||
|
||||
$grpc.ResponseStream<$1.ChatMessage> listenMessage($0.PreUser request, {$grpc.CallOptions? options}) {
|
||||
return $createStreamingCall(_$listenMessage, $async.Stream.fromIterable([request]), options: options);
|
||||
$grpc.ResponseStream<$1.ChatMessage> listenMessage($0.PreUser request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createStreamingCall(
|
||||
_$listenMessage, $async.Stream.fromIterable([request]),
|
||||
options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.BaseRespData> sendMessage($1.ChatMessage request, {$grpc.CallOptions? options}) {
|
||||
$grpc.ResponseFuture<$0.BaseRespData> sendMessage($1.ChatMessage request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$sendMessage, request, options: options);
|
||||
}
|
||||
}
|
||||
@ -67,14 +71,18 @@ abstract class ChatServiceBase extends $grpc.Service {
|
||||
($0.BaseRespData value) => value.writeToBuffer()));
|
||||
}
|
||||
|
||||
$async.Stream<$1.ChatMessage> listenMessage_Pre($grpc.ServiceCall call, $async.Future<$0.PreUser> request) async* {
|
||||
$async.Stream<$1.ChatMessage> listenMessage_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$0.PreUser> request) async* {
|
||||
yield* listenMessage(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.BaseRespData> sendMessage_Pre($grpc.ServiceCall call, $async.Future<$1.ChatMessage> request) async {
|
||||
$async.Future<$0.BaseRespData> sendMessage_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$1.ChatMessage> request) async {
|
||||
return sendMessage(call, await request);
|
||||
}
|
||||
|
||||
$async.Stream<$1.ChatMessage> listenMessage($grpc.ServiceCall call, $0.PreUser request);
|
||||
$async.Future<$0.BaseRespData> sendMessage($grpc.ServiceCall call, $1.ChatMessage request);
|
||||
$async.Stream<$1.ChatMessage> listenMessage(
|
||||
$grpc.ServiceCall call, $0.PreUser request);
|
||||
$async.Future<$0.BaseRespData> sendMessage(
|
||||
$grpc.ServiceCall call, $1.ChatMessage request);
|
||||
}
|
||||
|
@ -48,8 +48,22 @@ const ChatMessage$json = {
|
||||
'2': [
|
||||
{'1': 'senderID', '3': 1, '4': 1, '5': 9, '10': 'senderID'},
|
||||
{'1': 'receiverID', '3': 2, '4': 1, '5': 9, '10': 'receiverID'},
|
||||
{'1': 'receiverType', '3': 3, '4': 1, '5': 14, '6': '.ReceiverType', '10': 'receiverType'},
|
||||
{'1': 'messageType', '3': 4, '4': 1, '5': 14, '6': '.MessageType', '10': 'messageType'},
|
||||
{
|
||||
'1': 'receiverType',
|
||||
'3': 3,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.ReceiverType',
|
||||
'10': 'receiverType'
|
||||
},
|
||||
{
|
||||
'1': 'messageType',
|
||||
'3': 4,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.MessageType',
|
||||
'10': 'messageType'
|
||||
},
|
||||
{'1': 'data', '3': 5, '4': 1, '5': 9, '10': 'data'},
|
||||
],
|
||||
};
|
||||
@ -60,4 +74,3 @@ final $typed_data.Uint8List chatMessageDescriptor = $convert.base64Decode(
|
||||
'gCIAEoCVIKcmVjZWl2ZXJJRBIxCgxyZWNlaXZlclR5cGUYAyABKA4yDS5SZWNlaXZlclR5cGVS'
|
||||
'DHJlY2VpdmVyVHlwZRIuCgttZXNzYWdlVHlwZRgEIAEoDjIMLk1lc3NhZ2VUeXBlUgttZXNzYW'
|
||||
'dlVHlwZRISCgRkYXRhGAUgASgJUgRkYXRh');
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,13 +16,17 @@ import 'package:protobuf/protobuf.dart' as $pb;
|
||||
class RoomStatus extends $pb.ProtobufEnum {
|
||||
static const RoomStatus All = RoomStatus._(0, _omitEnumNames ? '' : 'All');
|
||||
static const RoomStatus Open = RoomStatus._(1, _omitEnumNames ? '' : 'Open');
|
||||
static const RoomStatus Private = RoomStatus._(2, _omitEnumNames ? '' : 'Private');
|
||||
static const RoomStatus Private =
|
||||
RoomStatus._(2, _omitEnumNames ? '' : 'Private');
|
||||
static const RoomStatus Full = RoomStatus._(3, _omitEnumNames ? '' : 'Full');
|
||||
static const RoomStatus Closed = RoomStatus._(4, _omitEnumNames ? '' : 'Closed');
|
||||
static const RoomStatus WillOffline = RoomStatus._(5, _omitEnumNames ? '' : 'WillOffline');
|
||||
static const RoomStatus Offline = RoomStatus._(6, _omitEnumNames ? '' : 'Offline');
|
||||
static const RoomStatus Closed =
|
||||
RoomStatus._(4, _omitEnumNames ? '' : 'Closed');
|
||||
static const RoomStatus WillOffline =
|
||||
RoomStatus._(5, _omitEnumNames ? '' : 'WillOffline');
|
||||
static const RoomStatus Offline =
|
||||
RoomStatus._(6, _omitEnumNames ? '' : 'Offline');
|
||||
|
||||
static const $core.List<RoomStatus> values = <RoomStatus> [
|
||||
static const $core.List<RoomStatus> values = <RoomStatus>[
|
||||
All,
|
||||
Open,
|
||||
Private,
|
||||
@ -32,20 +36,26 @@ class RoomStatus extends $pb.ProtobufEnum {
|
||||
Offline,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, RoomStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, RoomStatus> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static RoomStatus? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const RoomStatus._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
class RoomSortType extends $pb.ProtobufEnum {
|
||||
static const RoomSortType Default = RoomSortType._(0, _omitEnumNames ? '' : 'Default');
|
||||
static const RoomSortType MostPlayerNumber = RoomSortType._(1, _omitEnumNames ? '' : 'MostPlayerNumber');
|
||||
static const RoomSortType MinimumPlayerNumber = RoomSortType._(2, _omitEnumNames ? '' : 'MinimumPlayerNumber');
|
||||
static const RoomSortType RecentlyCreated = RoomSortType._(3, _omitEnumNames ? '' : 'RecentlyCreated');
|
||||
static const RoomSortType OldestCreated = RoomSortType._(4, _omitEnumNames ? '' : 'OldestCreated');
|
||||
static const RoomSortType Default =
|
||||
RoomSortType._(0, _omitEnumNames ? '' : 'Default');
|
||||
static const RoomSortType MostPlayerNumber =
|
||||
RoomSortType._(1, _omitEnumNames ? '' : 'MostPlayerNumber');
|
||||
static const RoomSortType MinimumPlayerNumber =
|
||||
RoomSortType._(2, _omitEnumNames ? '' : 'MinimumPlayerNumber');
|
||||
static const RoomSortType RecentlyCreated =
|
||||
RoomSortType._(3, _omitEnumNames ? '' : 'RecentlyCreated');
|
||||
static const RoomSortType OldestCreated =
|
||||
RoomSortType._(4, _omitEnumNames ? '' : 'OldestCreated');
|
||||
|
||||
static const $core.List<RoomSortType> values = <RoomSortType> [
|
||||
static const $core.List<RoomSortType> values = <RoomSortType>[
|
||||
Default,
|
||||
MostPlayerNumber,
|
||||
MinimumPlayerNumber,
|
||||
@ -53,45 +63,53 @@ class RoomSortType extends $pb.ProtobufEnum {
|
||||
OldestCreated,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, RoomSortType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, RoomSortType> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static RoomSortType? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const RoomSortType._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
class RoomUserStatus extends $pb.ProtobufEnum {
|
||||
static const RoomUserStatus RoomUserStatusJoin = RoomUserStatus._(0, _omitEnumNames ? '' : 'RoomUserStatusJoin');
|
||||
static const RoomUserStatus RoomUserStatusLostOffline = RoomUserStatus._(1, _omitEnumNames ? '' : 'RoomUserStatusLostOffline');
|
||||
static const RoomUserStatus RoomUserStatusLeave = RoomUserStatus._(2, _omitEnumNames ? '' : 'RoomUserStatusLeave');
|
||||
static const RoomUserStatus RoomUserStatusWaitingConnect = RoomUserStatus._(3, _omitEnumNames ? '' : 'RoomUserStatusWaitingConnect');
|
||||
static const RoomUserStatus RoomUserStatusJoin =
|
||||
RoomUserStatus._(0, _omitEnumNames ? '' : 'RoomUserStatusJoin');
|
||||
static const RoomUserStatus RoomUserStatusLostOffline =
|
||||
RoomUserStatus._(1, _omitEnumNames ? '' : 'RoomUserStatusLostOffline');
|
||||
static const RoomUserStatus RoomUserStatusLeave =
|
||||
RoomUserStatus._(2, _omitEnumNames ? '' : 'RoomUserStatusLeave');
|
||||
static const RoomUserStatus RoomUserStatusWaitingConnect =
|
||||
RoomUserStatus._(3, _omitEnumNames ? '' : 'RoomUserStatusWaitingConnect');
|
||||
|
||||
static const $core.List<RoomUserStatus> values = <RoomUserStatus> [
|
||||
static const $core.List<RoomUserStatus> values = <RoomUserStatus>[
|
||||
RoomUserStatusJoin,
|
||||
RoomUserStatusLostOffline,
|
||||
RoomUserStatusLeave,
|
||||
RoomUserStatusWaitingConnect,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, RoomUserStatus> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, RoomUserStatus> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static RoomUserStatus? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const RoomUserStatus._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
class RoomUpdateType extends $pb.ProtobufEnum {
|
||||
static const RoomUpdateType RoomUpdateData = RoomUpdateType._(0, _omitEnumNames ? '' : 'RoomUpdateData');
|
||||
static const RoomUpdateType RoomClose = RoomUpdateType._(1, _omitEnumNames ? '' : 'RoomClose');
|
||||
static const RoomUpdateType RoomUpdateData =
|
||||
RoomUpdateType._(0, _omitEnumNames ? '' : 'RoomUpdateData');
|
||||
static const RoomUpdateType RoomClose =
|
||||
RoomUpdateType._(1, _omitEnumNames ? '' : 'RoomClose');
|
||||
|
||||
static const $core.List<RoomUpdateType> values = <RoomUpdateType> [
|
||||
static const $core.List<RoomUpdateType> values = <RoomUpdateType>[
|
||||
RoomUpdateData,
|
||||
RoomClose,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, RoomUpdateType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, RoomUpdateType> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static RoomUpdateType? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const RoomUpdateType._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
|
||||
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');
|
||||
|
@ -33,18 +33,21 @@ class IndexServiceClient extends $grpc.Client {
|
||||
'/IndexService/CreateRoom',
|
||||
($0.RoomData value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.RoomData.fromBuffer(value));
|
||||
static final _$getRoomList = $grpc.ClientMethod<$0.RoomListPageReqData, $0.RoomListData>(
|
||||
'/IndexService/GetRoomList',
|
||||
($0.RoomListPageReqData value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.RoomListData.fromBuffer(value));
|
||||
static final _$getRoomList =
|
||||
$grpc.ClientMethod<$0.RoomListPageReqData, $0.RoomListData>(
|
||||
'/IndexService/GetRoomList',
|
||||
($0.RoomListPageReqData value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.RoomListData.fromBuffer(value));
|
||||
static final _$touchUser = $grpc.ClientMethod<$0.PreUser, $0.RoomData>(
|
||||
'/IndexService/TouchUser',
|
||||
($0.PreUser value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.RoomData.fromBuffer(value));
|
||||
static final _$joinRoom = $grpc.ClientMethod<$0.PreUser, $0.RoomUpdateMessage>(
|
||||
'/IndexService/JoinRoom',
|
||||
($0.PreUser value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.RoomUpdateMessage.fromBuffer(value));
|
||||
static final _$joinRoom =
|
||||
$grpc.ClientMethod<$0.PreUser, $0.RoomUpdateMessage>(
|
||||
'/IndexService/JoinRoom',
|
||||
($0.PreUser value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) =>
|
||||
$0.RoomUpdateMessage.fromBuffer(value));
|
||||
static final _$leaveRoom = $grpc.ClientMethod<$0.PreUser, $0.BaseRespData>(
|
||||
'/IndexService/LeaveRoom',
|
||||
($0.PreUser value) => value.writeToBuffer(),
|
||||
@ -53,34 +56,43 @@ class IndexServiceClient extends $grpc.Client {
|
||||
IndexServiceClient($grpc.ClientChannel channel,
|
||||
{$grpc.CallOptions? options,
|
||||
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
|
||||
: super(channel, options: options,
|
||||
interceptors: interceptors);
|
||||
: super(channel, options: options, interceptors: interceptors);
|
||||
|
||||
$grpc.ResponseFuture<$0.PingData> pingServer($0.PingData request, {$grpc.CallOptions? options}) {
|
||||
$grpc.ResponseFuture<$0.PingData> pingServer($0.PingData request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$pingServer, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.RoomTypesData> getRoomTypes($0.Empty request, {$grpc.CallOptions? options}) {
|
||||
$grpc.ResponseFuture<$0.RoomTypesData> getRoomTypes($0.Empty request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$getRoomTypes, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.RoomData> createRoom($0.RoomData request, {$grpc.CallOptions? options}) {
|
||||
$grpc.ResponseFuture<$0.RoomData> createRoom($0.RoomData request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$createRoom, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.RoomListData> getRoomList($0.RoomListPageReqData request, {$grpc.CallOptions? options}) {
|
||||
$grpc.ResponseFuture<$0.RoomListData> getRoomList(
|
||||
$0.RoomListPageReqData request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$getRoomList, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.RoomData> touchUser($0.PreUser request, {$grpc.CallOptions? options}) {
|
||||
$grpc.ResponseFuture<$0.RoomData> touchUser($0.PreUser request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$touchUser, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseStream<$0.RoomUpdateMessage> joinRoom($0.PreUser request, {$grpc.CallOptions? options}) {
|
||||
return $createStreamingCall(_$joinRoom, $async.Stream.fromIterable([request]), options: options);
|
||||
$grpc.ResponseStream<$0.RoomUpdateMessage> joinRoom($0.PreUser request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createStreamingCall(
|
||||
_$joinRoom, $async.Stream.fromIterable([request]),
|
||||
options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.BaseRespData> leaveRoom($0.PreUser request, {$grpc.CallOptions? options}) {
|
||||
$grpc.ResponseFuture<$0.BaseRespData> leaveRoom($0.PreUser request,
|
||||
{$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$leaveRoom, request, options: options);
|
||||
}
|
||||
}
|
||||
@ -116,7 +128,8 @@ abstract class IndexServiceBase extends $grpc.Service {
|
||||
getRoomList_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $0.RoomListPageReqData.fromBuffer(value),
|
||||
($core.List<$core.int> value) =>
|
||||
$0.RoomListPageReqData.fromBuffer(value),
|
||||
($0.RoomListData value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$0.PreUser, $0.RoomData>(
|
||||
'TouchUser',
|
||||
@ -141,39 +154,53 @@ abstract class IndexServiceBase extends $grpc.Service {
|
||||
($0.BaseRespData value) => value.writeToBuffer()));
|
||||
}
|
||||
|
||||
$async.Future<$0.PingData> pingServer_Pre($grpc.ServiceCall call, $async.Future<$0.PingData> request) async {
|
||||
$async.Future<$0.PingData> pingServer_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$0.PingData> request) async {
|
||||
return pingServer(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.RoomTypesData> getRoomTypes_Pre($grpc.ServiceCall call, $async.Future<$0.Empty> request) async {
|
||||
$async.Future<$0.RoomTypesData> getRoomTypes_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$0.Empty> request) async {
|
||||
return getRoomTypes(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.RoomData> createRoom_Pre($grpc.ServiceCall call, $async.Future<$0.RoomData> request) async {
|
||||
$async.Future<$0.RoomData> createRoom_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$0.RoomData> request) async {
|
||||
return createRoom(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.RoomListData> getRoomList_Pre($grpc.ServiceCall call, $async.Future<$0.RoomListPageReqData> request) async {
|
||||
$async.Future<$0.RoomListData> getRoomList_Pre($grpc.ServiceCall call,
|
||||
$async.Future<$0.RoomListPageReqData> request) async {
|
||||
return getRoomList(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.RoomData> touchUser_Pre($grpc.ServiceCall call, $async.Future<$0.PreUser> request) async {
|
||||
$async.Future<$0.RoomData> touchUser_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$0.PreUser> request) async {
|
||||
return touchUser(call, await request);
|
||||
}
|
||||
|
||||
$async.Stream<$0.RoomUpdateMessage> joinRoom_Pre($grpc.ServiceCall call, $async.Future<$0.PreUser> request) async* {
|
||||
$async.Stream<$0.RoomUpdateMessage> joinRoom_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$0.PreUser> request) async* {
|
||||
yield* joinRoom(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.BaseRespData> leaveRoom_Pre($grpc.ServiceCall call, $async.Future<$0.PreUser> request) async {
|
||||
$async.Future<$0.BaseRespData> leaveRoom_Pre(
|
||||
$grpc.ServiceCall call, $async.Future<$0.PreUser> request) async {
|
||||
return leaveRoom(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.PingData> pingServer($grpc.ServiceCall call, $0.PingData request);
|
||||
$async.Future<$0.RoomTypesData> getRoomTypes($grpc.ServiceCall call, $0.Empty request);
|
||||
$async.Future<$0.RoomData> createRoom($grpc.ServiceCall call, $0.RoomData request);
|
||||
$async.Future<$0.RoomListData> getRoomList($grpc.ServiceCall call, $0.RoomListPageReqData request);
|
||||
$async.Future<$0.RoomData> touchUser($grpc.ServiceCall call, $0.PreUser request);
|
||||
$async.Stream<$0.RoomUpdateMessage> joinRoom($grpc.ServiceCall call, $0.PreUser request);
|
||||
$async.Future<$0.BaseRespData> leaveRoom($grpc.ServiceCall call, $0.PreUser request);
|
||||
$async.Future<$0.PingData> pingServer(
|
||||
$grpc.ServiceCall call, $0.PingData request);
|
||||
$async.Future<$0.RoomTypesData> getRoomTypes(
|
||||
$grpc.ServiceCall call, $0.Empty request);
|
||||
$async.Future<$0.RoomData> createRoom(
|
||||
$grpc.ServiceCall call, $0.RoomData request);
|
||||
$async.Future<$0.RoomListData> getRoomList(
|
||||
$grpc.ServiceCall call, $0.RoomListPageReqData request);
|
||||
$async.Future<$0.RoomData> touchUser(
|
||||
$grpc.ServiceCall call, $0.PreUser request);
|
||||
$async.Stream<$0.RoomUpdateMessage> joinRoom(
|
||||
$grpc.ServiceCall call, $0.PreUser request);
|
||||
$async.Future<$0.BaseRespData> leaveRoom(
|
||||
$grpc.ServiceCall call, $0.PreUser request);
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ const Empty$json = {
|
||||
};
|
||||
|
||||
/// Descriptor for `Empty`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List emptyDescriptor = $convert.base64Decode(
|
||||
'CgVFbXB0eQ==');
|
||||
final $typed_data.Uint8List emptyDescriptor =
|
||||
$convert.base64Decode('CgVFbXB0eQ==');
|
||||
|
||||
@$core.Deprecated('Use baseRespDataDescriptor instead')
|
||||
const BaseRespData$json = {
|
||||
@ -140,7 +140,14 @@ final $typed_data.Uint8List pingDataDescriptor = $convert.base64Decode(
|
||||
const RoomTypesData$json = {
|
||||
'1': 'RoomTypesData',
|
||||
'2': [
|
||||
{'1': 'roomTypes', '3': 1, '4': 3, '5': 11, '6': '.RoomType', '10': 'roomTypes'},
|
||||
{
|
||||
'1': 'roomTypes',
|
||||
'3': 1,
|
||||
'4': 3,
|
||||
'5': 11,
|
||||
'6': '.RoomType',
|
||||
'10': 'roomTypes'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@ -157,7 +164,14 @@ const RoomType$json = {
|
||||
{'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
|
||||
{'1': 'icon', '3': 3, '4': 1, '5': 9, '10': 'icon'},
|
||||
{'1': 'desc', '3': 4, '4': 1, '5': 9, '10': 'desc'},
|
||||
{'1': 'subTypes', '3': 5, '4': 3, '5': 11, '6': '.RoomSubtype', '10': 'subTypes'},
|
||||
{
|
||||
'1': 'subTypes',
|
||||
'3': 5,
|
||||
'4': 3,
|
||||
'5': 11,
|
||||
'6': '.RoomSubtype',
|
||||
'10': 'subTypes'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@ -191,7 +205,14 @@ const RoomData$json = {
|
||||
{'1': 'maxPlayer', '3': 5, '4': 1, '5': 5, '10': 'maxPlayer'},
|
||||
{'1': 'createTime', '3': 6, '4': 1, '5': 3, '10': 'createTime'},
|
||||
{'1': 'curPlayer', '3': 7, '4': 1, '5': 5, '10': 'curPlayer'},
|
||||
{'1': 'status', '3': 8, '4': 1, '5': 14, '6': '.RoomStatus', '10': 'status'},
|
||||
{
|
||||
'1': 'status',
|
||||
'3': 8,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.RoomStatus',
|
||||
'10': 'status'
|
||||
},
|
||||
{'1': 'deviceUUID', '3': 9, '4': 1, '5': 9, '10': 'deviceUUID'},
|
||||
{'1': 'announcement', '3': 10, '4': 1, '5': 9, '10': 'announcement'},
|
||||
{'1': 'avatar', '3': 11, '4': 1, '5': 9, '10': 'avatar'},
|
||||
@ -215,7 +236,14 @@ const RoomListPageReqData$json = {
|
||||
'2': [
|
||||
{'1': 'typeID', '3': 1, '4': 1, '5': 9, '10': 'typeID'},
|
||||
{'1': 'subTypeID', '3': 2, '4': 1, '5': 9, '10': 'subTypeID'},
|
||||
{'1': 'status', '3': 3, '4': 1, '5': 14, '6': '.RoomStatus', '10': 'status'},
|
||||
{
|
||||
'1': 'status',
|
||||
'3': 3,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.RoomStatus',
|
||||
'10': 'status'
|
||||
},
|
||||
{'1': 'sort', '3': 4, '4': 1, '5': 14, '6': '.RoomSortType', '10': 'sort'},
|
||||
{'1': 'pageNum', '3': 5, '4': 1, '5': 4, '10': 'pageNum'},
|
||||
],
|
||||
@ -232,7 +260,14 @@ final $typed_data.Uint8List roomListPageReqDataDescriptor = $convert.base64Decod
|
||||
const RoomListData$json = {
|
||||
'1': 'RoomListData',
|
||||
'2': [
|
||||
{'1': 'pageData', '3': 1, '4': 1, '5': 11, '6': '.BasePageRespData', '10': 'pageData'},
|
||||
{
|
||||
'1': 'pageData',
|
||||
'3': 1,
|
||||
'4': 1,
|
||||
'5': 11,
|
||||
'6': '.BasePageRespData',
|
||||
'10': 'pageData'
|
||||
},
|
||||
{'1': 'rooms', '3': 2, '4': 3, '5': 11, '6': '.RoomData', '10': 'rooms'},
|
||||
],
|
||||
};
|
||||
@ -264,7 +299,14 @@ const RoomUserData$json = {
|
||||
{'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
|
||||
{'1': 'playerName', '3': 2, '4': 1, '5': 9, '10': 'playerName'},
|
||||
{'1': 'Avatar', '3': 3, '4': 1, '5': 9, '10': 'Avatar'},
|
||||
{'1': 'status', '3': 4, '4': 1, '5': 14, '6': '.RoomUserStatus', '10': 'status'},
|
||||
{
|
||||
'1': 'status',
|
||||
'3': 4,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.RoomUserStatus',
|
||||
'10': 'status'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@ -278,9 +320,30 @@ final $typed_data.Uint8List roomUserDataDescriptor = $convert.base64Decode(
|
||||
const RoomUpdateMessage$json = {
|
||||
'1': 'RoomUpdateMessage',
|
||||
'2': [
|
||||
{'1': 'roomData', '3': 1, '4': 1, '5': 11, '6': '.RoomData', '10': 'roomData'},
|
||||
{'1': 'usersData', '3': 2, '4': 3, '5': 11, '6': '.RoomUserData', '10': 'usersData'},
|
||||
{'1': 'roomUpdateType', '3': 3, '4': 1, '5': 14, '6': '.RoomUpdateType', '10': 'roomUpdateType'},
|
||||
{
|
||||
'1': 'roomData',
|
||||
'3': 1,
|
||||
'4': 1,
|
||||
'5': 11,
|
||||
'6': '.RoomData',
|
||||
'10': 'roomData'
|
||||
},
|
||||
{
|
||||
'1': 'usersData',
|
||||
'3': 2,
|
||||
'4': 3,
|
||||
'5': 11,
|
||||
'6': '.RoomUserData',
|
||||
'10': 'usersData'
|
||||
},
|
||||
{
|
||||
'1': 'roomUpdateType',
|
||||
'3': 3,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.RoomUpdateType',
|
||||
'10': 'roomUpdateType'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@ -289,4 +352,3 @@ final $typed_data.Uint8List roomUpdateMessageDescriptor = $convert.base64Decode(
|
||||
'ChFSb29tVXBkYXRlTWVzc2FnZRIlCghyb29tRGF0YRgBIAEoCzIJLlJvb21EYXRhUghyb29tRG'
|
||||
'F0YRIrCgl1c2Vyc0RhdGEYAiADKAsyDS5Sb29tVXNlckRhdGFSCXVzZXJzRGF0YRI3Cg5yb29t'
|
||||
'VXBkYXRlVHlwZRgDIAEoDjIPLlJvb21VcGRhdGVUeXBlUg5yb29tVXBkYXRlVHlwZQ==');
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/ui/splash_ui_model.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
import 'base/ui_model.dart';
|
||||
import 'common/conf/app_conf.dart';
|
||||
import 'global_ui_model.dart';
|
||||
import 'ui/splash_ui.dart';
|
||||
import 'ui/splash_ui_model.dart';
|
||||
|
||||
void main(List<String> args) async {
|
||||
if (runWebViewTitleBarWidget(args,
|
||||
|
@ -41,7 +41,6 @@ class PartyRoomHomeUIModel extends BaseUIModel {
|
||||
|
||||
final pageCtrl = PageController();
|
||||
|
||||
|
||||
@override
|
||||
BaseUIModel? onCreateChildUIModel(modelKey) {
|
||||
switch (modelKey) {
|
||||
|
@ -3,7 +3,9 @@ import 'dart:io';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/ffi.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/api/downloader_api.dart'
|
||||
as rust_downloader;
|
||||
import 'package:starcitizen_doctor/common/rust/downloader.dart';
|
||||
|
||||
class DownloaderDialogUIModel extends BaseUIModel {
|
||||
final String fileName;
|
||||
@ -66,7 +68,7 @@ class DownloaderDialogUIModel extends BaseUIModel {
|
||||
|
||||
final downloaderSavePath = "$savePath//$fileName.downloading";
|
||||
try {
|
||||
rustFii
|
||||
rust_downloader
|
||||
.startDownload(
|
||||
url: downloadUrl,
|
||||
savePath: savePath,
|
||||
@ -112,10 +114,10 @@ class DownloaderDialogUIModel extends BaseUIModel {
|
||||
}
|
||||
}
|
||||
|
||||
doCancel() {
|
||||
doCancel() async {
|
||||
try {
|
||||
if (downloadTaskId != null) {
|
||||
rustFii.cancelDownload(id: downloadTaskId!);
|
||||
await rust_downloader.cancelDownload(id: downloadTaskId!);
|
||||
downloadTaskId = null;
|
||||
} else {
|
||||
Navigator.pop(context!, "cancel");
|
||||
|
@ -55,7 +55,7 @@ dependencies:
|
||||
flutter_tilt: ^2.0.10
|
||||
card_swiper: ^3.0.1
|
||||
ffi: ^2.1.0
|
||||
flutter_rust_bridge: ^1.82.3
|
||||
flutter_rust_bridge: 2.0.0-dev.23
|
||||
freezed_annotation: ^2.4.1
|
||||
meta: ^1.9.1
|
||||
win32: ^5.0.9
|
||||
@ -70,6 +70,8 @@ dependencies:
|
||||
fixnum: ^1.1.0
|
||||
protobuf: ^3.1.0
|
||||
grpc: ^3.2.4
|
||||
rust_builder:
|
||||
path: rust_builder
|
||||
|
||||
dependency_overrides:
|
||||
http: ^1.1.2
|
||||
@ -85,7 +87,6 @@ dev_dependencies:
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^3.0.0
|
||||
msix: ^3.16.4
|
||||
ffigen: ^11.0.0
|
||||
build_runner: ^2.4.6
|
||||
freezed: ^2.4.5
|
||||
|
||||
|
1
rust/.gitignore
vendored
Normal file
1
rust/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
@ -1,16 +1,15 @@
|
||||
[package]
|
||||
name = "rust"
|
||||
name = "rust_lib"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib", "cdylib"]
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
crate-type = ["cdylib", "staticlib"]
|
||||
|
||||
[dependencies]
|
||||
flutter_rust_bridge = "1"
|
||||
flutter_rust_bridge = "=2.0.0-dev.23"
|
||||
http-downloader = { version = "0.3.2", features = ["status-tracker", "speed-tracker", "breakpoint-resume", "bson-file-archiver"] }
|
||||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
|
||||
url = "2.4.1"
|
||||
uuid = { version = "1.5.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
|
||||
url = "2.5.0"
|
||||
uuid = { version = "1.7.0", features = ["v4", "fast-rng", "macro-diagnostics"] }
|
||||
async-std = "1.12.0"
|
||||
|
@ -1,16 +1,11 @@
|
||||
use std::sync::Arc;
|
||||
use async_std::task;
|
||||
use flutter_rust_bridge::StreamSink;
|
||||
use crate::downloader::{do_cancel_download, do_start_download, DownloadCallbackData};
|
||||
|
||||
pub fn ping() -> String {
|
||||
return String::from("PONG");
|
||||
}
|
||||
use crate::frb_generated::StreamSink;
|
||||
|
||||
pub fn start_download(url: String, save_path: String, file_name: String, connection_count: u8, sink: StreamSink<DownloadCallbackData>) {
|
||||
let _ = do_start_download(url, save_path, file_name, connection_count, Arc::new(sink));
|
||||
}
|
||||
|
||||
pub fn cancel_download(id: String) {
|
||||
task::block_on(do_cancel_download(&id))
|
||||
pub async fn cancel_download(id: String) {
|
||||
do_cancel_download(&id).await
|
||||
}
|
5
rust/src/api/mod.rs
Normal file
5
rust/src/api/mod.rs
Normal file
@ -0,0 +1,5 @@
|
||||
//
|
||||
// Do not put code in `mod.rs`, but put in e.g. `simple.rs`.
|
||||
//
|
||||
|
||||
pub mod downloader_api;
|
@ -1,83 +0,0 @@
|
||||
use super::*;
|
||||
// Section: wire functions
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wire_ping(port_: i64) {
|
||||
wire_ping_impl(port_)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wire_start_download(
|
||||
port_: i64,
|
||||
url: *mut wire_uint_8_list,
|
||||
save_path: *mut wire_uint_8_list,
|
||||
file_name: *mut wire_uint_8_list,
|
||||
connection_count: u8,
|
||||
) {
|
||||
wire_start_download_impl(port_, url, save_path, file_name, connection_count)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wire_cancel_download(port_: i64, id: *mut wire_uint_8_list) {
|
||||
wire_cancel_download_impl(port_, id)
|
||||
}
|
||||
|
||||
// Section: allocate functions
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn new_uint_8_list_0(len: i32) -> *mut wire_uint_8_list {
|
||||
let ans = wire_uint_8_list {
|
||||
ptr: support::new_leak_vec_ptr(Default::default(), len),
|
||||
len,
|
||||
};
|
||||
support::new_leak_box_ptr(ans)
|
||||
}
|
||||
|
||||
// Section: related functions
|
||||
|
||||
// Section: impl Wire2Api
|
||||
|
||||
impl Wire2Api<String> for *mut wire_uint_8_list {
|
||||
fn wire2api(self) -> String {
|
||||
let vec: Vec<u8> = self.wire2api();
|
||||
String::from_utf8_lossy(&vec).into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
impl Wire2Api<Vec<u8>> for *mut wire_uint_8_list {
|
||||
fn wire2api(self) -> Vec<u8> {
|
||||
unsafe {
|
||||
let wrap = support::box_from_leak_ptr(self);
|
||||
support::vec_from_leak_ptr(wrap.ptr, wrap.len)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Section: wire structs
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct wire_uint_8_list {
|
||||
ptr: *mut u8,
|
||||
len: i32,
|
||||
}
|
||||
|
||||
// Section: impl NewWithNullPtr
|
||||
|
||||
pub trait NewWithNullPtr {
|
||||
fn new_with_null_ptr() -> Self;
|
||||
}
|
||||
|
||||
impl<T> NewWithNullPtr for *mut T {
|
||||
fn new_with_null_ptr() -> Self {
|
||||
std::ptr::null_mut()
|
||||
}
|
||||
}
|
||||
|
||||
// Section: sync execution mode utility
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn free_WireSyncReturn(ptr: support::WireSyncReturn) {
|
||||
unsafe {
|
||||
let _ = support::box_from_leak_ptr(ptr);
|
||||
};
|
||||
}
|
@ -1,179 +0,0 @@
|
||||
#![allow(
|
||||
non_camel_case_types,
|
||||
unused,
|
||||
clippy::redundant_closure,
|
||||
clippy::useless_conversion,
|
||||
clippy::unit_arg,
|
||||
clippy::double_parens,
|
||||
non_snake_case,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
// Generated by `flutter_rust_bridge`@ 1.82.3.
|
||||
|
||||
use crate::api::*;
|
||||
use core::panic::UnwindSafe;
|
||||
use flutter_rust_bridge::rust2dart::IntoIntoDart;
|
||||
use flutter_rust_bridge::*;
|
||||
use std::ffi::c_void;
|
||||
use std::sync::Arc;
|
||||
|
||||
// Section: imports
|
||||
|
||||
use crate::downloader::DownloadCallbackData;
|
||||
use crate::downloader::MyDownloaderStatus;
|
||||
use crate::downloader::MyNetworkItemPendingType;
|
||||
|
||||
// Section: wire functions
|
||||
|
||||
fn wire_ping_impl(port_: MessagePort) {
|
||||
FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, String, _>(
|
||||
WrapInfo {
|
||||
debug_name: "ping",
|
||||
port: Some(port_),
|
||||
mode: FfiCallMode::Normal,
|
||||
},
|
||||
move || move |task_callback| Result::<_, ()>::Ok(ping()),
|
||||
)
|
||||
}
|
||||
fn wire_start_download_impl(
|
||||
port_: MessagePort,
|
||||
url: impl Wire2Api<String> + UnwindSafe,
|
||||
save_path: impl Wire2Api<String> + UnwindSafe,
|
||||
file_name: impl Wire2Api<String> + UnwindSafe,
|
||||
connection_count: impl Wire2Api<u8> + UnwindSafe,
|
||||
) {
|
||||
FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, (), _>(
|
||||
WrapInfo {
|
||||
debug_name: "start_download",
|
||||
port: Some(port_),
|
||||
mode: FfiCallMode::Stream,
|
||||
},
|
||||
move || {
|
||||
let api_url = url.wire2api();
|
||||
let api_save_path = save_path.wire2api();
|
||||
let api_file_name = file_name.wire2api();
|
||||
let api_connection_count = connection_count.wire2api();
|
||||
move |task_callback| {
|
||||
Result::<_, ()>::Ok(start_download(
|
||||
api_url,
|
||||
api_save_path,
|
||||
api_file_name,
|
||||
api_connection_count,
|
||||
task_callback.stream_sink::<_, DownloadCallbackData>(),
|
||||
))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
fn wire_cancel_download_impl(port_: MessagePort, id: impl Wire2Api<String> + UnwindSafe) {
|
||||
FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, (), _>(
|
||||
WrapInfo {
|
||||
debug_name: "cancel_download",
|
||||
port: Some(port_),
|
||||
mode: FfiCallMode::Normal,
|
||||
},
|
||||
move || {
|
||||
let api_id = id.wire2api();
|
||||
move |task_callback| Result::<_, ()>::Ok(cancel_download(api_id))
|
||||
},
|
||||
)
|
||||
}
|
||||
// Section: wrapper structs
|
||||
|
||||
// Section: static checks
|
||||
|
||||
// Section: allocate functions
|
||||
|
||||
// Section: related functions
|
||||
|
||||
// Section: impl Wire2Api
|
||||
|
||||
pub trait Wire2Api<T> {
|
||||
fn wire2api(self) -> T;
|
||||
}
|
||||
|
||||
impl<T, S> Wire2Api<Option<T>> for *mut S
|
||||
where
|
||||
*mut S: Wire2Api<T>,
|
||||
{
|
||||
fn wire2api(self) -> Option<T> {
|
||||
(!self.is_null()).then(|| self.wire2api())
|
||||
}
|
||||
}
|
||||
|
||||
impl Wire2Api<u8> for u8 {
|
||||
fn wire2api(self) -> u8 {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
// Section: impl IntoDart
|
||||
|
||||
impl support::IntoDart for DownloadCallbackData {
|
||||
fn into_dart(self) -> support::DartAbi {
|
||||
vec![
|
||||
self.id.into_into_dart().into_dart(),
|
||||
self.total.into_into_dart().into_dart(),
|
||||
self.progress.into_into_dart().into_dart(),
|
||||
self.speed.into_into_dart().into_dart(),
|
||||
self.status.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl support::IntoDartExceptPrimitive for DownloadCallbackData {}
|
||||
impl rust2dart::IntoIntoDart<DownloadCallbackData> for DownloadCallbackData {
|
||||
fn into_into_dart(self) -> Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl support::IntoDart for MyDownloaderStatus {
|
||||
fn into_dart(self) -> support::DartAbi {
|
||||
match self {
|
||||
Self::NoStart => vec![0.into_dart()],
|
||||
Self::Running => vec![1.into_dart()],
|
||||
Self::Pending(field0) => vec![2.into_dart(), field0.into_into_dart().into_dart()],
|
||||
Self::Error(field0) => vec![3.into_dart(), field0.into_into_dart().into_dart()],
|
||||
Self::Finished => vec![4.into_dart()],
|
||||
}
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl support::IntoDartExceptPrimitive for MyDownloaderStatus {}
|
||||
impl rust2dart::IntoIntoDart<MyDownloaderStatus> for MyDownloaderStatus {
|
||||
fn into_into_dart(self) -> Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl support::IntoDart for MyNetworkItemPendingType {
|
||||
fn into_dart(self) -> support::DartAbi {
|
||||
match self {
|
||||
Self::QueueUp => 0,
|
||||
Self::Starting => 1,
|
||||
Self::Stopping => 2,
|
||||
Self::Initializing => 3,
|
||||
}
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl support::IntoDartExceptPrimitive for MyNetworkItemPendingType {}
|
||||
impl rust2dart::IntoIntoDart<MyNetworkItemPendingType> for MyNetworkItemPendingType {
|
||||
fn into_into_dart(self) -> Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
// Section: executor
|
||||
|
||||
support::lazy_static! {
|
||||
pub static ref FLUTTER_RUST_BRIDGE_HANDLER: support::DefaultHandler = Default::default();
|
||||
}
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
#[path = "bridge_generated.io.rs"]
|
||||
mod io;
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
pub use io::*;
|
@ -5,11 +5,11 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use async_std::sync::Mutex;
|
||||
use flutter_rust_bridge::for_generated::lazy_static;
|
||||
use http_downloader::{breakpoint_resume::DownloadBreakpointResumeExtension, ExtendedHttpFileDownloader, HttpDownloaderBuilder, speed_tracker::DownloadSpeedTrackerExtension, status_tracker::DownloadStatusTrackerExtension};
|
||||
use http_downloader::bson_file_archiver::{ArchiveFilePath, BsonFileArchiverBuilder};
|
||||
use url::Url;
|
||||
use flutter_rust_bridge::StreamSink;
|
||||
use flutter_rust_bridge::support::lazy_static;
|
||||
use crate::frb_generated::StreamSink;
|
||||
use http_downloader::status_tracker::{DownloaderStatus, NetworkItemPendingType};
|
||||
use uuid::Uuid;
|
||||
|
||||
@ -107,7 +107,7 @@ pub async fn do_start_download(url: String, save_path: String, file_name: String
|
||||
let total_len = total_size_future.await;
|
||||
if let Some(total_len) = total_len {
|
||||
// info!("Total size: {:.2} Mb",total_len.get() as f64 / 1024_f64/ 1024_f64);
|
||||
sink_clone.add(DownloadCallbackData::new(id.to_string(), total_len.get()));
|
||||
sink_clone.add(DownloadCallbackData::new(id.to_string(), total_len.get())).unwrap();
|
||||
}
|
||||
|
||||
while downloaded_len_receiver.changed().await.is_ok() {
|
||||
@ -122,7 +122,7 @@ pub async fn do_start_download(url: String, save_path: String, file_name: String
|
||||
progress: p,
|
||||
speed: _byte_per_second,
|
||||
status: get_my_status(_status),
|
||||
});
|
||||
}).unwrap();
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
@ -137,8 +137,7 @@ pub async fn do_start_download(url: String, save_path: String, file_name: String
|
||||
progress: 0,
|
||||
speed: 0,
|
||||
status: get_my_status(_status),
|
||||
});
|
||||
sink.close();
|
||||
}).unwrap();
|
||||
remove_downloader(&id.to_string()).await;
|
||||
println!("rust downloader download complete");
|
||||
Ok(())
|
||||
|
13
rust/src/frb_generated.io.rs
Normal file
13
rust/src/frb_generated.io.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// Section: imports
|
||||
|
||||
use super::*;
|
||||
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
|
||||
use flutter_rust_bridge::for_generated::transform_result_dco;
|
||||
use flutter_rust_bridge::{Handler, IntoIntoDart};
|
||||
|
||||
// Section: boilerplate
|
||||
|
||||
flutter_rust_bridge::frb_generated_boilerplate_io!();
|
459
rust/src/frb_generated.rs
Normal file
459
rust/src/frb_generated.rs
Normal file
@ -0,0 +1,459 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
#![allow(
|
||||
non_camel_case_types,
|
||||
unused,
|
||||
non_snake_case,
|
||||
clippy::needless_return,
|
||||
clippy::redundant_closure_call,
|
||||
clippy::redundant_closure,
|
||||
clippy::useless_conversion,
|
||||
clippy::unit_arg,
|
||||
clippy::unused_unit,
|
||||
clippy::double_parens,
|
||||
clippy::let_and_return,
|
||||
clippy::too_many_arguments,
|
||||
clippy::match_single_binding
|
||||
)]
|
||||
|
||||
// Section: imports
|
||||
|
||||
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
|
||||
use flutter_rust_bridge::for_generated::transform_result_dco;
|
||||
use flutter_rust_bridge::{Handler, IntoIntoDart};
|
||||
|
||||
// Section: boilerplate
|
||||
|
||||
flutter_rust_bridge::frb_generated_boilerplate!(
|
||||
default_stream_sink_codec = SseCodec,
|
||||
default_rust_opaque = RustOpaqueMoi,
|
||||
default_rust_auto_opaque = RustAutoOpaqueMoi,
|
||||
);
|
||||
const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.23";
|
||||
|
||||
// Section: executor
|
||||
|
||||
flutter_rust_bridge::frb_generated_default_handler!();
|
||||
|
||||
// Section: wire_funcs
|
||||
|
||||
fn wire_cancel_download_impl(
|
||||
port_: flutter_rust_bridge::for_generated::MessagePort,
|
||||
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
|
||||
rust_vec_len_: i32,
|
||||
data_len_: i32,
|
||||
) {
|
||||
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::SseCodec, _, _, _>(
|
||||
flutter_rust_bridge::for_generated::TaskInfo {
|
||||
debug_name: "cancel_download",
|
||||
port: Some(port_),
|
||||
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
|
||||
},
|
||||
move || {
|
||||
let message = unsafe {
|
||||
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
|
||||
ptr_,
|
||||
rust_vec_len_,
|
||||
data_len_,
|
||||
)
|
||||
};
|
||||
let mut deserializer =
|
||||
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
|
||||
let api_id = <String>::sse_decode(&mut deserializer);
|
||||
deserializer.end();
|
||||
move |context| async move {
|
||||
transform_result_sse(
|
||||
(move || async move {
|
||||
Result::<_, ()>::Ok(
|
||||
crate::api::downloader_api::cancel_download(api_id).await,
|
||||
)
|
||||
})()
|
||||
.await,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
fn wire_start_download_impl(
|
||||
port_: flutter_rust_bridge::for_generated::MessagePort,
|
||||
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
|
||||
rust_vec_len_: i32,
|
||||
data_len_: i32,
|
||||
) {
|
||||
FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::SseCodec, _, _>(
|
||||
flutter_rust_bridge::for_generated::TaskInfo {
|
||||
debug_name: "start_download",
|
||||
port: Some(port_),
|
||||
mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream,
|
||||
},
|
||||
move || {
|
||||
let message = unsafe {
|
||||
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
|
||||
ptr_,
|
||||
rust_vec_len_,
|
||||
data_len_,
|
||||
)
|
||||
};
|
||||
let mut deserializer =
|
||||
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
|
||||
let api_url = <String>::sse_decode(&mut deserializer);
|
||||
let api_save_path = <String>::sse_decode(&mut deserializer);
|
||||
let api_file_name = <String>::sse_decode(&mut deserializer);
|
||||
let api_connection_count = <u8>::sse_decode(&mut deserializer);
|
||||
deserializer.end();
|
||||
move |context| {
|
||||
transform_result_sse((move || {
|
||||
Result::<_, ()>::Ok(crate::api::downloader_api::start_download(
|
||||
api_url,
|
||||
api_save_path,
|
||||
api_file_name,
|
||||
api_connection_count,
|
||||
StreamSink::new(
|
||||
context
|
||||
.rust2dart_context()
|
||||
.stream_sink::<_, crate::downloader::DownloadCallbackData>(),
|
||||
),
|
||||
))
|
||||
})())
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// Section: dart2rust
|
||||
|
||||
impl SseDecode for String {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut inner = <Vec<u8>>::sse_decode(deserializer);
|
||||
return String::from_utf8(inner).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::downloader::DownloadCallbackData {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_id = <String>::sse_decode(deserializer);
|
||||
let mut var_total = <u64>::sse_decode(deserializer);
|
||||
let mut var_progress = <u64>::sse_decode(deserializer);
|
||||
let mut var_speed = <u64>::sse_decode(deserializer);
|
||||
let mut var_status = <crate::downloader::MyDownloaderStatus>::sse_decode(deserializer);
|
||||
return crate::downloader::DownloadCallbackData {
|
||||
id: var_id,
|
||||
total: var_total,
|
||||
progress: var_progress,
|
||||
speed: var_speed,
|
||||
status: var_status,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for i32 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
deserializer.cursor.read_i32::<NativeEndian>().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Vec<u8> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut len_ = <i32>::sse_decode(deserializer);
|
||||
let mut ans_ = vec![];
|
||||
for idx_ in 0..len_ {
|
||||
ans_.push(<u8>::sse_decode(deserializer));
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::downloader::MyDownloaderStatus {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut tag_ = <i32>::sse_decode(deserializer);
|
||||
match tag_ {
|
||||
0 => {
|
||||
return crate::downloader::MyDownloaderStatus::NoStart;
|
||||
}
|
||||
1 => {
|
||||
return crate::downloader::MyDownloaderStatus::Running;
|
||||
}
|
||||
2 => {
|
||||
let mut var_field0 =
|
||||
<crate::downloader::MyNetworkItemPendingType>::sse_decode(deserializer);
|
||||
return crate::downloader::MyDownloaderStatus::Pending(var_field0);
|
||||
}
|
||||
3 => {
|
||||
let mut var_field0 = <String>::sse_decode(deserializer);
|
||||
return crate::downloader::MyDownloaderStatus::Error(var_field0);
|
||||
}
|
||||
4 => {
|
||||
return crate::downloader::MyDownloaderStatus::Finished;
|
||||
}
|
||||
_ => {
|
||||
unimplemented!("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::downloader::MyNetworkItemPendingType {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut inner = <i32>::sse_decode(deserializer);
|
||||
return match inner {
|
||||
0 => crate::downloader::MyNetworkItemPendingType::QueueUp,
|
||||
1 => crate::downloader::MyNetworkItemPendingType::Starting,
|
||||
2 => crate::downloader::MyNetworkItemPendingType::Stopping,
|
||||
3 => crate::downloader::MyNetworkItemPendingType::Initializing,
|
||||
_ => unreachable!("Invalid variant for MyNetworkItemPendingType: {}", inner),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for u64 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
deserializer.cursor.read_u64::<NativeEndian>().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for u8 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
deserializer.cursor.read_u8().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for () {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {}
|
||||
}
|
||||
|
||||
impl SseDecode for bool {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
deserializer.cursor.read_u8().unwrap() != 0
|
||||
}
|
||||
}
|
||||
|
||||
fn pde_ffi_dispatcher_primary_impl(
|
||||
func_id: i32,
|
||||
port: flutter_rust_bridge::for_generated::MessagePort,
|
||||
ptr: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
|
||||
rust_vec_len: i32,
|
||||
data_len: i32,
|
||||
) {
|
||||
// Codec=Pde (Serialization + dispatch), see doc to use other codecs
|
||||
match func_id {
|
||||
2 => wire_cancel_download_impl(port, ptr, rust_vec_len, data_len),
|
||||
1 => wire_start_download_impl(port, ptr, rust_vec_len, data_len),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn pde_ffi_dispatcher_sync_impl(
|
||||
func_id: i32,
|
||||
ptr: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
|
||||
rust_vec_len: i32,
|
||||
data_len: i32,
|
||||
) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse {
|
||||
// Codec=Pde (Serialization + dispatch), see doc to use other codecs
|
||||
match func_id {
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
// Section: rust2dart
|
||||
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::downloader::DownloadCallbackData {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.id.into_into_dart().into_dart(),
|
||||
self.total.into_into_dart().into_dart(),
|
||||
self.progress.into_into_dart().into_dart(),
|
||||
self.speed.into_into_dart().into_dart(),
|
||||
self.status.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::downloader::DownloadCallbackData
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::downloader::DownloadCallbackData>
|
||||
for crate::downloader::DownloadCallbackData
|
||||
{
|
||||
fn into_into_dart(self) -> crate::downloader::DownloadCallbackData {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::downloader::MyDownloaderStatus {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
match self {
|
||||
crate::downloader::MyDownloaderStatus::NoStart => [0.into_dart()].into_dart(),
|
||||
crate::downloader::MyDownloaderStatus::Running => [1.into_dart()].into_dart(),
|
||||
crate::downloader::MyDownloaderStatus::Pending(field0) => {
|
||||
[2.into_dart(), field0.into_into_dart().into_dart()].into_dart()
|
||||
}
|
||||
crate::downloader::MyDownloaderStatus::Error(field0) => {
|
||||
[3.into_dart(), field0.into_into_dart().into_dart()].into_dart()
|
||||
}
|
||||
crate::downloader::MyDownloaderStatus::Finished => [4.into_dart()].into_dart(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::downloader::MyDownloaderStatus
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::downloader::MyDownloaderStatus>
|
||||
for crate::downloader::MyDownloaderStatus
|
||||
{
|
||||
fn into_into_dart(self) -> crate::downloader::MyDownloaderStatus {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::downloader::MyNetworkItemPendingType {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
match self {
|
||||
Self::QueueUp => 0.into_dart(),
|
||||
Self::Starting => 1.into_dart(),
|
||||
Self::Stopping => 2.into_dart(),
|
||||
Self::Initializing => 3.into_dart(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::downloader::MyNetworkItemPendingType
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::downloader::MyNetworkItemPendingType>
|
||||
for crate::downloader::MyNetworkItemPendingType
|
||||
{
|
||||
fn into_into_dart(self) -> crate::downloader::MyNetworkItemPendingType {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for String {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<Vec<u8>>::sse_encode(self.into_bytes(), serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::downloader::DownloadCallbackData {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<String>::sse_encode(self.id, serializer);
|
||||
<u64>::sse_encode(self.total, serializer);
|
||||
<u64>::sse_encode(self.progress, serializer);
|
||||
<u64>::sse_encode(self.speed, serializer);
|
||||
<crate::downloader::MyDownloaderStatus>::sse_encode(self.status, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for i32 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
serializer.cursor.write_i32::<NativeEndian>(self).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Vec<u8> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i32>::sse_encode(self.len() as _, serializer);
|
||||
for item in self {
|
||||
<u8>::sse_encode(item, serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::downloader::MyDownloaderStatus {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
match self {
|
||||
crate::downloader::MyDownloaderStatus::NoStart => {
|
||||
<i32>::sse_encode(0, serializer);
|
||||
}
|
||||
crate::downloader::MyDownloaderStatus::Running => {
|
||||
<i32>::sse_encode(1, serializer);
|
||||
}
|
||||
crate::downloader::MyDownloaderStatus::Pending(field0) => {
|
||||
<i32>::sse_encode(2, serializer);
|
||||
<crate::downloader::MyNetworkItemPendingType>::sse_encode(field0, serializer);
|
||||
}
|
||||
crate::downloader::MyDownloaderStatus::Error(field0) => {
|
||||
<i32>::sse_encode(3, serializer);
|
||||
<String>::sse_encode(field0, serializer);
|
||||
}
|
||||
crate::downloader::MyDownloaderStatus::Finished => {
|
||||
<i32>::sse_encode(4, serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::downloader::MyNetworkItemPendingType {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i32>::sse_encode(
|
||||
match self {
|
||||
crate::downloader::MyNetworkItemPendingType::QueueUp => 0,
|
||||
crate::downloader::MyNetworkItemPendingType::Starting => 1,
|
||||
crate::downloader::MyNetworkItemPendingType::Stopping => 2,
|
||||
crate::downloader::MyNetworkItemPendingType::Initializing => 3,
|
||||
_ => {
|
||||
unimplemented!("");
|
||||
}
|
||||
},
|
||||
serializer,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for u64 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
serializer.cursor.write_u64::<NativeEndian>(self).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for u8 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
serializer.cursor.write_u8(self).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for () {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {}
|
||||
}
|
||||
|
||||
impl SseEncode for bool {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
serializer.cursor.write_u8(self as _).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
#[path = "frb_generated.io.rs"]
|
||||
mod io;
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
pub use io::*;
|
||||
|
||||
/// cbindgen:ignore
|
||||
#[cfg(target_family = "wasm")]
|
||||
#[path = "frb_generated.web.rs"]
|
||||
mod web;
|
||||
#[cfg(target_family = "wasm")]
|
||||
pub use web::*;
|
15
rust/src/frb_generated.web.rs
Normal file
15
rust/src/frb_generated.web.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// Section: imports
|
||||
|
||||
use super::*;
|
||||
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
|
||||
use flutter_rust_bridge::for_generated::transform_result_dco;
|
||||
use flutter_rust_bridge::for_generated::wasm_bindgen;
|
||||
use flutter_rust_bridge::for_generated::wasm_bindgen::prelude::*;
|
||||
use flutter_rust_bridge::{Handler, IntoIntoDart};
|
||||
|
||||
// Section: boilerplate
|
||||
|
||||
flutter_rust_bridge::frb_generated_boilerplate_web!();
|
@ -1,3 +1,3 @@
|
||||
mod frb_generated;
|
||||
mod api;
|
||||
mod bridge_generated;
|
||||
mod downloader;
|
||||
|
@ -1,2 +1 @@
|
||||
flutter_rust_bridge_codegen --rust-input rust\src\api.rs --dart-output .\lib\common\rust\bridge_generated.dart --dart-decl-output .\lib\common\rust\bridge_definitions.dart
|
||||
dart run build_runner build
|
||||
flutter_rust_bridge_codegen generate
|
@ -12,6 +12,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
rust_builder
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
Loading…
Reference in New Issue
Block a user