fix macos

This commit is contained in:
John Smith 2023-05-17 13:38:36 -04:00
parent 51b8de61d0
commit 909b86a04d
17 changed files with 368 additions and 443 deletions

600
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,3 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:xterm/xterm.dart'; import 'package:xterm/xterm.dart';

View File

@ -2,7 +2,6 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:veilid/veilid.dart';
import 'package:flutter_acrylic/flutter_acrylic.dart'; import 'package:flutter_acrylic/flutter_acrylic.dart';
import 'veilid_theme.dart'; import 'veilid_theme.dart';

View File

@ -1,4 +1,4 @@
platform :osx, '10.12.2' platform :osx, '10.14.6'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@ -1,34 +1,35 @@
PODS: PODS:
- flutter_acrylic (0.1.0):
- FlutterMacOS
- FlutterMacOS (1.0.0) - FlutterMacOS (1.0.0)
- path_provider_macos (0.0.1): - macos_window_utils (1.0.0):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS - FlutterMacOS
- veilid (0.0.1): - veilid (0.0.1):
- FlutterMacOS - FlutterMacOS
DEPENDENCIES: DEPENDENCIES:
- flutter_acrylic (from `Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos`)
- FlutterMacOS (from `Flutter/ephemeral`) - FlutterMacOS (from `Flutter/ephemeral`)
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) - macos_window_utils (from `Flutter/ephemeral/.symlinks/plugins/macos_window_utils/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- veilid (from `Flutter/ephemeral/.symlinks/plugins/veilid/macos`) - veilid (from `Flutter/ephemeral/.symlinks/plugins/veilid/macos`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
flutter_acrylic:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos
FlutterMacOS: FlutterMacOS:
:path: Flutter/ephemeral :path: Flutter/ephemeral
path_provider_macos: macos_window_utils:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos :path: Flutter/ephemeral/.symlinks/plugins/macos_window_utils/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
veilid: veilid:
:path: Flutter/ephemeral/.symlinks/plugins/veilid/macos :path: Flutter/ephemeral/.symlinks/plugins/veilid/macos
SPEC CHECKSUMS: SPEC CHECKSUMS:
flutter_acrylic: c3df24ae52ab6597197837ce59ef2a8542640c17 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 macos_window_utils: 933f91f64805e2eb91a5bd057cf97cd097276663
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
veilid: ef97d3a2d5fda3b25a4017eae65c37afa8035203 veilid: a54f57b7bcf0e4e072fe99272d76ca126b2026d0
PODFILE CHECKSUM: baac1aaddb7c3a00c396723592a2ffb396a7fed7 PODFILE CHECKSUM: 73d2f470b1d889e27fcfda1d6e6efec66f98af3f
COCOAPODS: 1.11.3 COCOAPODS: 1.11.3

View File

@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 51; objectVersion = 54;
objects = { objects = {
/* Begin PBXAggregateTarget section */ /* Begin PBXAggregateTarget section */
@ -261,6 +261,7 @@
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = { 3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -409,7 +410,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.12.2; MACOSX_DEPLOYMENT_TARGET = 10.14.6;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx; SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule; SWIFT_COMPILATION_MODE = wholemodule;
@ -496,7 +497,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.12.2; MACOSX_DEPLOYMENT_TARGET = 10.14.6;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx; SDKROOT = macosx;
@ -543,7 +544,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.12.2; MACOSX_DEPLOYMENT_TARGET = 10.14.6;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx; SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule; SWIFT_COMPILATION_MODE = wholemodule;

View File

@ -421,5 +421,5 @@ packages:
source: hosted source: hosted
version: "3.5.0" version: "3.5.0"
sdks: sdks:
dart: ">=3.0.0-417 <4.0.0" dart: ">=3.0.0 <4.0.0"
flutter: ">=3.7.0" flutter: ">=3.7.0"

View File

@ -7,7 +7,7 @@ version: 1.0.0+1
publish_to: "none" # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment: environment:
sdk: ">=2.17.0 <3.0.0" sdk: '>=3.0.0 <4.0.0'
# Dependencies specify other packages that your package needs in order to work. # Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions # To automatically upgrade your package dependencies to the latest versions

View File

@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:convert';
import 'package:change_case/change_case.dart'; import 'package:change_case/change_case.dart';
@ -201,17 +200,15 @@ class ValueData {
enum Stability { enum Stability {
lowLatency, lowLatency,
reliable, reliable;
}
extension StabilityExt on Stability {
String toJson() { String toJson() {
return name.toPascalCase(); return name.toPascalCase();
} }
}
Stability stabilityFromJson(String j) { factory Stability.fromJson(String j) {
return Stability.values.byName(j.toCamelCase()); return Stability.values.byName(j.toCamelCase());
}
} }
////////////////////////////////////// //////////////////////////////////////
@ -220,17 +217,15 @@ Stability stabilityFromJson(String j) {
enum Sequencing { enum Sequencing {
noPreference, noPreference,
preferOrdered, preferOrdered,
ensureOrdered, ensureOrdered;
}
extension SequencingExt on Sequencing {
String toJson() { String toJson() {
return name.toPascalCase(); return name.toPascalCase();
} }
}
Sequencing sequencingFromJson(String j) { factory Sequencing.fromJson(String j) {
return Sequencing.values.byName(j.toCamelCase()); return Sequencing.values.byName(j.toCamelCase());
}
} }
////////////////////////////////////// //////////////////////////////////////

View File

@ -1,22 +1,16 @@
import 'dart:async'; import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:convert';
import 'package:change_case/change_case.dart';
import 'veilid_stub.dart' import 'veilid_stub.dart'
if (dart.library.io) 'veilid_ffi.dart' if (dart.library.io) 'veilid_ffi.dart'
if (dart.library.js) 'veilid_js.dart'; if (dart.library.js) 'veilid_js.dart';
import 'veilid_encoding.dart';
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
import 'routing_context.dart'; import 'routing_context.dart';
import 'veilid_config.dart'; import 'veilid_config.dart';
import 'veilid_crypto.dart'; import 'veilid_crypto.dart';
import 'veilid_table_db.dart'; import 'veilid_table_db.dart';
import 'veilid_api_exception.dart';
import 'veilid_state.dart'; import 'veilid_state.dart';
export 'default_config.dart'; export 'default_config.dart';
@ -126,7 +120,7 @@ class TimestampDuration {
/// Veilid singleton factory /// Veilid singleton factory
abstract class Veilid { abstract class Veilid {
static late Veilid instance = getVeilid(); static Veilid instance = getVeilid();
void initializeVeilidCore(Map<String, dynamic> platformConfigJson); void initializeVeilidCore(Map<String, dynamic> platformConfigJson);
void changeLogLevel(String layer, VeilidConfigLogLevel logLevel); void changeLogLevel(String layer, VeilidConfigLogLevel logLevel);

View File

@ -1,10 +1,5 @@
import 'dart:async';
import 'dart:typed_data';
import 'dart:convert';
import 'package:change_case/change_case.dart'; import 'package:change_case/change_case.dart';
import 'veilid_encoding.dart';
import 'veilid.dart'; import 'veilid.dart';
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@ -28,7 +23,7 @@ class VeilidFFIConfigLoggingTerminal {
VeilidFFIConfigLoggingTerminal.fromJson(dynamic json) VeilidFFIConfigLoggingTerminal.fromJson(dynamic json)
: enabled = json['enabled'], : enabled = json['enabled'],
level = veilidConfigLogLevelFromJson(json['level']); level = VeilidConfigLogLevel.fromJson(json['level']);
} }
class VeilidFFIConfigLoggingOtlp { class VeilidFFIConfigLoggingOtlp {
@ -55,7 +50,7 @@ class VeilidFFIConfigLoggingOtlp {
VeilidFFIConfigLoggingOtlp.fromJson(dynamic json) VeilidFFIConfigLoggingOtlp.fromJson(dynamic json)
: enabled = json['enabled'], : enabled = json['enabled'],
level = veilidConfigLogLevelFromJson(json['level']), level = VeilidConfigLogLevel.fromJson(json['level']),
grpcEndpoint = json['grpc_endpoint'], grpcEndpoint = json['grpc_endpoint'],
serviceName = json['service_name']; serviceName = json['service_name'];
} }
@ -78,7 +73,7 @@ class VeilidFFIConfigLoggingApi {
VeilidFFIConfigLoggingApi.fromJson(dynamic json) VeilidFFIConfigLoggingApi.fromJson(dynamic json)
: enabled = json['enabled'], : enabled = json['enabled'],
level = veilidConfigLogLevelFromJson(json['level']); level = VeilidConfigLogLevel.fromJson(json['level']);
} }
class VeilidFFIConfigLogging { class VeilidFFIConfigLogging {
@ -129,17 +124,15 @@ enum VeilidConfigLogLevel {
warn, warn,
info, info,
debug, debug,
trace, trace;
}
extension VeilidConfigLogLevelExt on VeilidConfigLogLevel {
String toJson() { String toJson() {
return name.toPascalCase(); return name.toPascalCase();
} }
}
VeilidConfigLogLevel veilidConfigLogLevelFromJson(String j) { factory VeilidConfigLogLevel.fromJson(dynamic j) {
return VeilidConfigLogLevel.values.byName(j.toCamelCase()); return VeilidConfigLogLevel.values.byName((j as String).toCamelCase());
}
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@ -169,7 +162,7 @@ class VeilidWASMConfigLoggingPerformance {
VeilidWASMConfigLoggingPerformance.fromJson(dynamic json) VeilidWASMConfigLoggingPerformance.fromJson(dynamic json)
: enabled = json['enabled'], : enabled = json['enabled'],
level = veilidConfigLogLevelFromJson(json['level']), level = VeilidConfigLogLevel.fromJson(json['level']),
logsInTimings = json['logs_in_timings'], logsInTimings = json['logs_in_timings'],
logsInConsole = json['logs_in_console']; logsInConsole = json['logs_in_console'];
} }
@ -192,7 +185,7 @@ class VeilidWASMConfigLoggingApi {
VeilidWASMConfigLoggingApi.fromJson(dynamic json) VeilidWASMConfigLoggingApi.fromJson(dynamic json)
: enabled = json['enabled'], : enabled = json['enabled'],
level = veilidConfigLogLevelFromJson(json['level']); level = VeilidConfigLogLevel.fromJson(json['level']);
} }
class VeilidWASMConfigLogging { class VeilidWASMConfigLogging {
@ -574,7 +567,7 @@ class VeilidConfigDHT {
'min_peer_count': minPeerCount, 'min_peer_count': minPeerCount,
'min_peer_refresh_time_ms': minPeerRefreshTimeMs, 'min_peer_refresh_time_ms': minPeerRefreshTimeMs,
'validate_dial_info_receipt_time_ms': validateDialInfoReceiptTimeMs, 'validate_dial_info_receipt_time_ms': validateDialInfoReceiptTimeMs,
'local_subkey_cache_size: 128': localSubkeyCacheSize, 'local_subkey_cache_size': localSubkeyCacheSize,
'local_max_subkey_cache_memory_mb': localMaxSubkeyCacheMemoryMb, 'local_max_subkey_cache_memory_mb': localMaxSubkeyCacheMemoryMb,
'remote_subkey_cache_size': remoteSubkeyCacheSize, 'remote_subkey_cache_size': remoteSubkeyCacheSize,
'remote_max_records': remoteMaxRecords, 'remote_max_records': remoteMaxRecords,

View File

@ -305,7 +305,7 @@ typedef _VeilidVersionStringC = Pointer<Utf8> Function();
typedef _VeilidVersionStringDart = Pointer<Utf8> Function(); typedef _VeilidVersionStringDart = Pointer<Utf8> Function();
// fn veilid_version() -> VeilidVersion // fn veilid_version() -> VeilidVersion
class VeilidVersionFFI extends Struct { final class VeilidVersionFFI extends Struct {
@Uint32() @Uint32()
external int major; external int major;
@Uint32() @Uint32()
@ -582,7 +582,7 @@ class _Ctx {
class VeilidRoutingContextFFI implements VeilidRoutingContext { class VeilidRoutingContextFFI implements VeilidRoutingContext {
final _Ctx _ctx; final _Ctx _ctx;
static final Finalizer<_Ctx> _finalizer = static final Finalizer<_Ctx> _finalizer =
Finalizer((ctx) => {ctx.ffi._releaseRoutingContext(ctx.id)}); Finalizer((ctx) => ctx.ffi._releaseRoutingContext(ctx.id));
VeilidRoutingContextFFI._(this._ctx) { VeilidRoutingContextFFI._(this._ctx) {
_finalizer.attach(this, _ctx, detach: this); _finalizer.attach(this, _ctx, detach: this);
@ -751,7 +751,7 @@ class _TDBT {
class VeilidTableDBTransactionFFI extends VeilidTableDBTransaction { class VeilidTableDBTransactionFFI extends VeilidTableDBTransaction {
final _TDBT _tdbt; final _TDBT _tdbt;
static final Finalizer<_TDBT> _finalizer = static final Finalizer<_TDBT> _finalizer =
Finalizer((tdbt) => {tdbt.ffi._releaseTableDbTransaction(tdbt.id)}); Finalizer((tdbt) => tdbt.ffi._releaseTableDbTransaction(tdbt.id));
VeilidTableDBTransactionFFI._(this._tdbt) { VeilidTableDBTransactionFFI._(this._tdbt) {
_finalizer.attach(this, _tdbt, detach: this); _finalizer.attach(this, _tdbt, detach: this);
@ -822,7 +822,7 @@ class _TDB {
class VeilidTableDBFFI extends VeilidTableDB { class VeilidTableDBFFI extends VeilidTableDB {
final _TDB _tdb; final _TDB _tdb;
static final Finalizer<_TDB> _finalizer = static final Finalizer<_TDB> _finalizer =
Finalizer((tdb) => {tdb.ffi._releaseTableDb(tdb.id)}); Finalizer((tdb) => tdb.ffi._releaseTableDb(tdb.id));
VeilidTableDBFFI._(this._tdb) { VeilidTableDBFFI._(this._tdb) {
_finalizer.attach(this, _tdb, detach: this); _finalizer.attach(this, _tdb, detach: this);
@ -985,7 +985,7 @@ class VeilidCryptoSystemFFI implements VeilidCryptoSystem {
final recvPort = ReceivePort("crypto_derive_shared_secret"); final recvPort = ReceivePort("crypto_derive_shared_secret");
final sendPort = recvPort.sendPort; final sendPort = recvPort.sendPort;
_ffi._cryptoHashPassword( _ffi._cryptoDeriveSharedSecret(
sendPort.nativePort, _kind, nativeEncodedPassword, nativeEncodedSalt); sendPort.nativePort, _kind, nativeEncodedPassword, nativeEncodedSalt);
return processFutureJson(SharedSecret.fromJson, recvPort.first); return processFutureJson(SharedSecret.fromJson, recvPort.first);
} }

View File

@ -30,9 +30,8 @@ class _Ctx {
// JS implementation of VeilidRoutingContext // JS implementation of VeilidRoutingContext
class VeilidRoutingContextJS implements VeilidRoutingContext { class VeilidRoutingContextJS implements VeilidRoutingContext {
final _Ctx _ctx; final _Ctx _ctx;
static final Finalizer<_Ctx> _finalizer = Finalizer((ctx) => { static final Finalizer<_Ctx> _finalizer = Finalizer(
js_util.callMethod(wasm, "release_routing_context", [ctx.id]) (ctx) => js_util.callMethod(wasm, "release_routing_context", [ctx.id]));
});
VeilidRoutingContextJS._(this._ctx) { VeilidRoutingContextJS._(this._ctx) {
_finalizer.attach(this, _ctx, detach: this); _finalizer.attach(this, _ctx, detach: this);
@ -338,9 +337,8 @@ class _TDBT {
// JS implementation of VeilidTableDBTransaction // JS implementation of VeilidTableDBTransaction
class VeilidTableDBTransactionJS extends VeilidTableDBTransaction { class VeilidTableDBTransactionJS extends VeilidTableDBTransaction {
final _TDBT _tdbt; final _TDBT _tdbt;
static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) => { static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) =>
js_util.callMethod(wasm, "release_table_db_transaction", [tdbt.id]) js_util.callMethod(wasm, "release_table_db_transaction", [tdbt.id]));
});
VeilidTableDBTransactionJS._(this._tdbt) { VeilidTableDBTransactionJS._(this._tdbt) {
_finalizer.attach(this, _tdbt, detach: this); _finalizer.attach(this, _tdbt, detach: this);
@ -388,9 +386,8 @@ class _TDB {
// JS implementation of VeilidTableDB // JS implementation of VeilidTableDB
class VeilidTableDBJS extends VeilidTableDB { class VeilidTableDBJS extends VeilidTableDB {
final _TDB _tdb; final _TDB _tdb;
static final Finalizer<_TDB> _finalizer = Finalizer((tdb) => { static final Finalizer<_TDB> _finalizer = Finalizer(
js_util.callMethod(wasm, "release_table_db", [tdb.id]) (tdb) => js_util.callMethod(wasm, "release_table_db", [tdb.id]));
});
VeilidTableDBJS._(this._tdb) { VeilidTableDBJS._(this._tdb) {
_finalizer.attach(this, _tdb, detach: this); _finalizer.attach(this, _tdb, detach: this);

View File

@ -16,17 +16,15 @@ enum AttachmentState {
attachedStrong, attachedStrong,
fullyAttached, fullyAttached,
overAttached, overAttached,
detaching, detaching;
}
extension AttachmentStateExt on AttachmentState {
String toJson() { String toJson() {
return name.toPascalCase(); return name.toPascalCase();
} }
}
AttachmentState attachmentStateFromJson(String j) { factory AttachmentState.fromJson(String j) {
return AttachmentState.values.byName(j.toCamelCase()); return AttachmentState.values.byName(j.toCamelCase());
}
} }
////////////////////////////////////// //////////////////////////////////////
@ -37,17 +35,15 @@ enum VeilidLogLevel {
warn, warn,
info, info,
debug, debug,
trace, trace;
}
extension VeilidLogLevelExt on VeilidLogLevel {
String toJson() { String toJson() {
return name.toPascalCase(); return name.toPascalCase();
} }
}
VeilidLogLevel veilidLogLevelFromJson(String j) { factory VeilidLogLevel.fromJson(String j) {
return VeilidLogLevel.values.byName(j.toCamelCase()); return VeilidLogLevel.values.byName(j.toCamelCase());
}
} }
//////////// ////////////
@ -221,7 +217,7 @@ class PeerStats {
class PeerTableData { class PeerTableData {
List<TypedKey> nodeIds; List<TypedKey> nodeIds;
PeerAddress peerAddress; String peerAddress;
PeerStats peerStats; PeerStats peerStats;
PeerTableData({ PeerTableData({
@ -233,7 +229,7 @@ class PeerTableData {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return { return {
'node_ids': nodeIds.map((p) => p.toJson()).toList(), 'node_ids': nodeIds.map((p) => p.toJson()).toList(),
'peer_address': peerAddress.toJson(), 'peer_address': peerAddress,
'peer_stats': peerStats.toJson(), 'peer_stats': peerStats.toJson(),
}; };
} }
@ -241,53 +237,10 @@ class PeerTableData {
PeerTableData.fromJson(dynamic json) PeerTableData.fromJson(dynamic json)
: nodeIds = List<TypedKey>.from( : nodeIds = List<TypedKey>.from(
json['node_ids'].map((j) => TypedKey.fromJson(j))), json['node_ids'].map((j) => TypedKey.fromJson(j))),
peerAddress = PeerAddress.fromJson(json['peer_address']), peerAddress = json['peer_address'],
peerStats = PeerStats.fromJson(json['peer_stats']); peerStats = PeerStats.fromJson(json['peer_stats']);
} }
//////////////////////////////////////
/// AttachmentState
enum ProtocolType {
udp,
tcp,
ws,
wss,
}
extension ProtocolTypeExt on ProtocolType {
String toJson() {
return name.toUpperCase();
}
}
ProtocolType protocolTypeFromJson(String j) {
return ProtocolType.values.byName(j.toLowerCase());
}
////////////
class PeerAddress {
ProtocolType protocolType;
String socketAddress;
PeerAddress({
required this.protocolType,
required this.socketAddress,
});
Map<String, dynamic> toJson() {
return {
'protocol_type': protocolType.toJson(),
'socket_address': socketAddress,
};
}
PeerAddress.fromJson(dynamic json)
: protocolType = protocolTypeFromJson(json['protocol_type']),
socketAddress = json['socket_address'];
}
////////////////////////////////////// //////////////////////////////////////
/// VeilidUpdate /// VeilidUpdate
@ -297,7 +250,7 @@ abstract class VeilidUpdate {
case "Log": case "Log":
{ {
return VeilidLog( return VeilidLog(
logLevel: veilidLogLevelFromJson(json["log_level"]), logLevel: VeilidLogLevel.fromJson(json["log_level"]),
message: json["message"], message: json["message"],
backtrace: json["backtrace"]); backtrace: json["backtrace"]);
} }
@ -509,7 +462,7 @@ class VeilidStateAttachment {
this.state, this.publicInternetReady, this.localNetworkReady); this.state, this.publicInternetReady, this.localNetworkReady);
VeilidStateAttachment.fromJson(dynamic json) VeilidStateAttachment.fromJson(dynamic json)
: state = attachmentStateFromJson(json['state']), : state = AttachmentState.fromJson(json['state']),
publicInternetReady = json['public_internet_ready'], publicInternetReady = json['public_internet_ready'],
localNetworkReady = json['local_network_ready']; localNetworkReady = json['local_network_ready'];

View File

@ -16,8 +16,8 @@ Veilid Network Plugin
s.source_files = 'Classes/**/*' s.source_files = 'Classes/**/*'
s.dependency 'FlutterMacOS' s.dependency 'FlutterMacOS'
s.platform = :osx, '10.12.2' s.platform = :osx, '10.14.6'
s.osx.deployment_target = '10.12.2' s.osx.deployment_target = '10.14.6'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.swift_version = '5.0' s.swift_version = '5.0'

View File

@ -5,8 +5,7 @@ homepage: https://veilid.com
publish_to: "none" # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment: environment:
sdk: ">=2.16.1 <3.0.0" sdk: '>=3.0.0 <4.0.0'
flutter: ">=2.5.0"
dependencies: dependencies:
flutter: flutter:

View File

@ -11,6 +11,6 @@ void main() {
tearDown(() {}); tearDown(() {});
test('veilidVersionString', () async { test('veilidVersionString', () async {
expect(Veilid.instance.veilidVersionString(), '0.1.0'); expect(api.veilidVersionString(), '0.1.0');
}); });
} }