prepare for multiple apps

This commit is contained in:
Fabian Freund
2026-04-06 12:23:11 +02:00
parent bd1600e8dc
commit 5afc323f04
904 changed files with 29 additions and 29 deletions
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2024-2026 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:fast_equatable/fast_equatable.dart';
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
part 'sync_repository_state.g.dart';
enum SyncEvent { started, completed, error }
@CopyWith()
class SyncRepositoryState with FastEquatable {
final SyncAccountInfo account;
final List<SyncDeviceTabs> remoteTabs;
final List<SyncDevice> devices;
final String? deviceName;
final SyncEvent? lastSyncEvent;
final String? lastSyncError;
SyncRepositoryState({
required this.account,
this.remoteTabs = const <SyncDeviceTabs>[],
this.devices = const <SyncDevice>[],
this.deviceName,
this.lastSyncEvent,
this.lastSyncError,
});
@override
List<Object?> get hashParameters => [
account,
remoteTabs,
devices,
deviceName,
lastSyncEvent,
lastSyncError,
];
}
@@ -0,0 +1,122 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'sync_repository_state.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$SyncRepositoryStateCWProxy {
SyncRepositoryState account(SyncAccountInfo account);
SyncRepositoryState remoteTabs(List<SyncDeviceTabs> remoteTabs);
SyncRepositoryState devices(List<SyncDevice> devices);
SyncRepositoryState deviceName(String? deviceName);
SyncRepositoryState lastSyncEvent(SyncEvent? lastSyncEvent);
SyncRepositoryState lastSyncError(String? lastSyncError);
/// Creates a new instance with the provided field values.
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `SyncRepositoryState(...).copyWith.fieldName(value)`.
///
/// Example:
/// ```dart
/// SyncRepositoryState(...).copyWith(id: 12, name: "My name")
/// ```
SyncRepositoryState call({
SyncAccountInfo account,
List<SyncDeviceTabs> remoteTabs,
List<SyncDevice> devices,
String? deviceName,
SyncEvent? lastSyncEvent,
String? lastSyncError,
});
}
/// Callable proxy for `copyWith` functionality.
/// Use as `instanceOfSyncRepositoryState.copyWith(...)` or call `instanceOfSyncRepositoryState.copyWith.fieldName(value)` for a single field.
class _$SyncRepositoryStateCWProxyImpl implements _$SyncRepositoryStateCWProxy {
const _$SyncRepositoryStateCWProxyImpl(this._value);
final SyncRepositoryState _value;
@override
SyncRepositoryState account(SyncAccountInfo account) =>
call(account: account);
@override
SyncRepositoryState remoteTabs(List<SyncDeviceTabs> remoteTabs) =>
call(remoteTabs: remoteTabs);
@override
SyncRepositoryState devices(List<SyncDevice> devices) =>
call(devices: devices);
@override
SyncRepositoryState deviceName(String? deviceName) =>
call(deviceName: deviceName);
@override
SyncRepositoryState lastSyncEvent(SyncEvent? lastSyncEvent) =>
call(lastSyncEvent: lastSyncEvent);
@override
SyncRepositoryState lastSyncError(String? lastSyncError) =>
call(lastSyncError: lastSyncError);
@override
/// Creates a new instance with the provided field values.
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `SyncRepositoryState(...).copyWith.fieldName(value)`.
///
/// Example:
/// ```dart
/// SyncRepositoryState(...).copyWith(id: 12, name: "My name")
/// ```
SyncRepositoryState call({
Object? account = const $CopyWithPlaceholder(),
Object? remoteTabs = const $CopyWithPlaceholder(),
Object? devices = const $CopyWithPlaceholder(),
Object? deviceName = const $CopyWithPlaceholder(),
Object? lastSyncEvent = const $CopyWithPlaceholder(),
Object? lastSyncError = const $CopyWithPlaceholder(),
}) {
return SyncRepositoryState(
account: account == const $CopyWithPlaceholder() || account == null
? _value.account
// ignore: cast_nullable_to_non_nullable
: account as SyncAccountInfo,
remoteTabs:
remoteTabs == const $CopyWithPlaceholder() || remoteTabs == null
? _value.remoteTabs
// ignore: cast_nullable_to_non_nullable
: remoteTabs as List<SyncDeviceTabs>,
devices: devices == const $CopyWithPlaceholder() || devices == null
? _value.devices
// ignore: cast_nullable_to_non_nullable
: devices as List<SyncDevice>,
deviceName: deviceName == const $CopyWithPlaceholder()
? _value.deviceName
// ignore: cast_nullable_to_non_nullable
: deviceName as String?,
lastSyncEvent: lastSyncEvent == const $CopyWithPlaceholder()
? _value.lastSyncEvent
// ignore: cast_nullable_to_non_nullable
: lastSyncEvent as SyncEvent?,
lastSyncError: lastSyncError == const $CopyWithPlaceholder()
? _value.lastSyncError
// ignore: cast_nullable_to_non_nullable
: lastSyncError as String?,
);
}
}
extension $SyncRepositoryStateCopyWith on SyncRepositoryState {
/// Returns a callable class used to build a new instance with modified fields.
/// Example: `instanceOfSyncRepositoryState.copyWith(...)` or `instanceOfSyncRepositoryState.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$SyncRepositoryStateCWProxy get copyWith =>
_$SyncRepositoryStateCWProxyImpl(this);
}
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024-2026 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import 'package:fast_equatable/fast_equatable.dart';
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
class SyncedTabItem with FastEquatable {
final String deviceId;
final String deviceName;
final SyncRemoteTab tab;
SyncedTabItem({
required this.deviceId,
required this.deviceName,
required this.tab,
});
@override
List<Object?> get hashParameters => [deviceId, deviceName, tab];
}