fix: cloud sync (#769)

This commit is contained in:
lollipopkit🏳️‍⚧️
2025-06-04 00:11:31 +08:00
committed by GitHub
parent 9547d92ac5
commit 0c1ada0067
70 changed files with 2348 additions and 1906 deletions

View File

@@ -12,7 +12,8 @@ part of 'app.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$AppState {
@@ -47,15 +48,16 @@ class _$AppStateCopyWithImpl<$Res, $Val extends AppState>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? desktopMode = null,
}) {
return _then(_value.copyWith(
desktopMode: null == desktopMode
? _value.desktopMode
: desktopMode // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
$Res call({Object? desktopMode = null}) {
return _then(
_value.copyWith(
desktopMode: null == desktopMode
? _value.desktopMode
: desktopMode // ignore: cast_nullable_to_non_nullable
as bool,
)
as $Val,
);
}
}
@@ -63,8 +65,9 @@ class _$AppStateCopyWithImpl<$Res, $Val extends AppState>
abstract class _$$AppStateImplCopyWith<$Res>
implements $AppStateCopyWith<$Res> {
factory _$$AppStateImplCopyWith(
_$AppStateImpl value, $Res Function(_$AppStateImpl) then) =
__$$AppStateImplCopyWithImpl<$Res>;
_$AppStateImpl value,
$Res Function(_$AppStateImpl) then,
) = __$$AppStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool desktopMode});
@@ -75,22 +78,23 @@ class __$$AppStateImplCopyWithImpl<$Res>
extends _$AppStateCopyWithImpl<$Res, _$AppStateImpl>
implements _$$AppStateImplCopyWith<$Res> {
__$$AppStateImplCopyWithImpl(
_$AppStateImpl _value, $Res Function(_$AppStateImpl) _then)
: super(_value, _then);
_$AppStateImpl _value,
$Res Function(_$AppStateImpl) _then,
) : super(_value, _then);
/// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? desktopMode = null,
}) {
return _then(_$AppStateImpl(
desktopMode: null == desktopMode
? _value.desktopMode
: desktopMode // ignore: cast_nullable_to_non_nullable
as bool,
));
$Res call({Object? desktopMode = null}) {
return _then(
_$AppStateImpl(
desktopMode: null == desktopMode
? _value.desktopMode
: desktopMode // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}

View File

@@ -13,8 +13,9 @@ String _$appProviderHash() => r'8378ec9d0a9c8d99cc05805047cd2d52ac4dbb56';
final appProviderProvider = NotifierProvider<AppProvider, AppState>.internal(
AppProvider.new,
name: r'appProviderProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$appProviderHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$appProviderHash,
dependencies: null,
allTransitiveDependencies: null,
);

View File

@@ -49,8 +49,7 @@ class ServerProvider extends Provider {
/// #258
/// If not [shouldReconnect], then keep the old state.
if (originServer != null &&
!originServer.value.spi.shouldReconnect(spi)) {
if (originServer != null && !originServer.value.spi.shouldReconnect(spi)) {
newServer.conn = originServer.value.conn;
}
servers[spi.id] = newServer.vn;
@@ -174,12 +173,16 @@ class ServerProvider extends Provider {
static void _closeOneServer(String id) {
final s = servers[id];
final item = s?.value;
item?.client?.close();
item?.client = null;
item?.conn = ServerConn.disconnected;
if (s == null) {
Loggers.app.warning('Server with id $id not found');
return;
}
final item = s.value;
item.client?.close();
item.client = null;
item.conn = ServerConn.disconnected;
_manualDisconnectedIds.add(id);
s?.notify();
s.notify();
}
static void addServer(Spi spi) {