From 03b332f67768d8aea261fed2d1a207c375b9adbd Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 14 Jan 2026 00:56:28 +0800 Subject: [PATCH] :bug: Adjust analytics service initialization --- lib/main.dart | 9 + lib/models/file.dart | 41 +- lib/models/file.freezed.dart | 707 +++++++++++++++++++++-- lib/models/file.g.dart | 72 ++- lib/pods/chat/chat_subscribe.g.dart | 2 +- lib/services/analytics_service.dart | 9 +- lib/services/app_intents/ios.dart | 3 +- lib/widgets/content/file_info_sheet.dart | 61 +- 8 files changed, 784 insertions(+), 120 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 5893d594..d104ca4b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,6 +12,7 @@ import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hotkey_manager/hotkey_manager.dart'; import 'package:image_picker_android/image_picker_android.dart'; +import 'package:island/services/analytics_service.dart'; import 'package:island/talker.dart'; import 'package:island/firebase_options.dart'; import 'package:island/pods/config.dart'; @@ -123,6 +124,14 @@ void main() async { ); } + try { + talker.info("[Analytics] Initializing Analytics service..."); + final analyticsService = AnalyticsService(); + analyticsService.initialize(); + } catch (err) { + talker.error("[Analytics] Failed to initialize Analytics service... $err"); + } + final prefs = await SharedPreferences.getInstance(); if (!kIsWeb && (Platform.isMacOS || Platform.isLinux || Platform.isWindows)) { diff --git a/lib/models/file.dart b/lib/models/file.dart index e6559d6e..71c26659 100644 --- a/lib/models/file.dart +++ b/lib/models/file.dart @@ -37,6 +37,45 @@ sealed class UniversalFile with _$UniversalFile { } } +@freezed +sealed class SnFileReplica with _$SnFileReplica { + const factory SnFileReplica({ + required String id, + required String objectId, + required String poolId, + required SnFilePool? pool, + required String storageId, + required int status, + required bool isPrimary, + required DateTime createdAt, + required DateTime updatedAt, + required DateTime? deletedAt, + }) = _SnFileReplica; + + factory SnFileReplica.fromJson(Map json) => + _$SnFileReplicaFromJson(json); +} + +@freezed +sealed class SnCloudFileObject with _$SnCloudFileObject { + const factory SnCloudFileObject({ + required String id, + required int size, + required Map? meta, + required String? mimeType, + required String? hash, + required bool hasCompression, + required bool hasThumbnail, + required List fileReplicas, + required DateTime createdAt, + required DateTime updatedAt, + required DateTime? deletedAt, + }) = _SnCloudFileObject; + + factory SnCloudFileObject.fromJson(Map json) => + _$SnCloudFileObjectFromJson(json); +} + @freezed sealed class SnCloudFile with _$SnCloudFile { const factory SnCloudFile({ @@ -45,13 +84,11 @@ sealed class SnCloudFile with _$SnCloudFile { required String? description, required Map? fileMeta, required Map? userMeta, - required SnFilePool? pool, @Default([]) List sensitiveMarks, required String? mimeType, required String? hash, required int size, required DateTime? uploadedAt, - required String? uploadedTo, required DateTime createdAt, required DateTime updatedAt, required DateTime? deletedAt, diff --git a/lib/models/file.freezed.dart b/lib/models/file.freezed.dart index d7063918..f4a9852b 100644 --- a/lib/models/file.freezed.dart +++ b/lib/models/file.freezed.dart @@ -279,42 +279,42 @@ as String?, /// @nodoc -mixin _$SnCloudFile { +mixin _$SnFileReplica { - String get id; String get name; String? get description; Map? get fileMeta; Map? get userMeta; SnFilePool? get pool; List get sensitiveMarks; String? get mimeType; String? get hash; int get size; DateTime? get uploadedAt; String? get uploadedTo; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String? get url; -/// Create a copy of SnCloudFile + String get id; String get objectId; String get poolId; SnFilePool? get pool; String get storageId; int get status; bool get isPrimary; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; +/// Create a copy of SnFileReplica /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$SnCloudFileCopyWith get copyWith => _$SnCloudFileCopyWithImpl(this as SnCloudFile, _$identity); +$SnFileReplicaCopyWith get copyWith => _$SnFileReplicaCopyWithImpl(this as SnFileReplica, _$identity); - /// Serializes this SnCloudFile to a JSON map. + /// Serializes this SnFileReplica to a JSON map. Map toJson(); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.fileMeta, fileMeta)&&const DeepCollectionEquality().equals(other.userMeta, userMeta)&&(identical(other.pool, pool) || other.pool == pool)&&const DeepCollectionEquality().equals(other.sensitiveMarks, sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.uploadedTo, uploadedTo) || other.uploadedTo == uploadedTo)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SnFileReplica&&(identical(other.id, id) || other.id == id)&&(identical(other.objectId, objectId) || other.objectId == objectId)&&(identical(other.poolId, poolId) || other.poolId == poolId)&&(identical(other.pool, pool) || other.pool == pool)&&(identical(other.storageId, storageId) || other.storageId == storageId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(fileMeta),const DeepCollectionEquality().hash(userMeta),pool,const DeepCollectionEquality().hash(sensitiveMarks),mimeType,hash,size,uploadedAt,uploadedTo,createdAt,updatedAt,deletedAt,url); +int get hashCode => Object.hash(runtimeType,id,objectId,poolId,pool,storageId,status,isPrimary,createdAt,updatedAt,deletedAt); @override String toString() { - return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, pool: $pool, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)'; + return 'SnFileReplica(id: $id, objectId: $objectId, poolId: $poolId, pool: $pool, storageId: $storageId, status: $status, isPrimary: $isPrimary, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; } } /// @nodoc -abstract mixin class $SnCloudFileCopyWith<$Res> { - factory $SnCloudFileCopyWith(SnCloudFile value, $Res Function(SnCloudFile) _then) = _$SnCloudFileCopyWithImpl; +abstract mixin class $SnFileReplicaCopyWith<$Res> { + factory $SnFileReplicaCopyWith(SnFileReplica value, $Res Function(SnFileReplica) _then) = _$SnFileReplicaCopyWithImpl; @useResult $Res call({ - String id, String name, String? description, Map? fileMeta, Map? userMeta, SnFilePool? pool, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url + String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -322,37 +322,31 @@ $SnFilePoolCopyWith<$Res>? get pool; } /// @nodoc -class _$SnCloudFileCopyWithImpl<$Res> - implements $SnCloudFileCopyWith<$Res> { - _$SnCloudFileCopyWithImpl(this._self, this._then); +class _$SnFileReplicaCopyWithImpl<$Res> + implements $SnFileReplicaCopyWith<$Res> { + _$SnFileReplicaCopyWithImpl(this._self, this._then); - final SnCloudFile _self; - final $Res Function(SnCloudFile) _then; + final SnFileReplica _self; + final $Res Function(SnFileReplica) _then; -/// Create a copy of SnCloudFile +/// Create a copy of SnFileReplica /// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? pool = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) { +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? objectId = null,Object? poolId = null,Object? pool = freezed,Object? storageId = null,Object? status = null,Object? isPrimary = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { return _then(_self.copyWith( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable -as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable -as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable -as String?,fileMeta: freezed == fileMeta ? _self.fileMeta : fileMeta // ignore: cast_nullable_to_non_nullable -as Map?,userMeta: freezed == userMeta ? _self.userMeta : userMeta // ignore: cast_nullable_to_non_nullable -as Map?,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable -as SnFilePool?,sensitiveMarks: null == sensitiveMarks ? _self.sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable -as List,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable -as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable -as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable -as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable -as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo // ignore: cast_nullable_to_non_nullable -as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as String,objectId: null == objectId ? _self.objectId : objectId // ignore: cast_nullable_to_non_nullable +as String,poolId: null == poolId ? _self.poolId : poolId // ignore: cast_nullable_to_non_nullable +as String,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable +as SnFilePool?,storageId: null == storageId ? _self.storageId : storageId // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as int,isPrimary: null == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable +as bool,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable -as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable -as String?, +as DateTime?, )); } -/// Create a copy of SnCloudFile +/// Create a copy of SnFileReplica /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') @@ -368,6 +362,607 @@ $SnFilePoolCopyWith<$Res>? get pool { } +/// Adds pattern-matching-related methods to [SnFileReplica]. +extension SnFileReplicaPatterns on SnFileReplica { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SnFileReplica value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SnFileReplica() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SnFileReplica value) $default,){ +final _that = this; +switch (_that) { +case _SnFileReplica(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SnFileReplica value)? $default,){ +final _that = this; +switch (_that) { +case _SnFileReplica() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SnFileReplica() when $default != null: +return $default(_that.id,_that.objectId,_that.poolId,_that.pool,_that.storageId,_that.status,_that.isPrimary,_that.createdAt,_that.updatedAt,_that.deletedAt);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this; +switch (_that) { +case _SnFileReplica(): +return $default(_that.id,_that.objectId,_that.poolId,_that.pool,_that.storageId,_that.status,_that.isPrimary,_that.createdAt,_that.updatedAt,_that.deletedAt);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this; +switch (_that) { +case _SnFileReplica() when $default != null: +return $default(_that.id,_that.objectId,_that.poolId,_that.pool,_that.storageId,_that.status,_that.isPrimary,_that.createdAt,_that.updatedAt,_that.deletedAt);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SnFileReplica implements SnFileReplica { + const _SnFileReplica({required this.id, required this.objectId, required this.poolId, required this.pool, required this.storageId, required this.status, required this.isPrimary, required this.createdAt, required this.updatedAt, required this.deletedAt}); + factory _SnFileReplica.fromJson(Map json) => _$SnFileReplicaFromJson(json); + +@override final String id; +@override final String objectId; +@override final String poolId; +@override final SnFilePool? pool; +@override final String storageId; +@override final int status; +@override final bool isPrimary; +@override final DateTime createdAt; +@override final DateTime updatedAt; +@override final DateTime? deletedAt; + +/// Create a copy of SnFileReplica +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SnFileReplicaCopyWith<_SnFileReplica> get copyWith => __$SnFileReplicaCopyWithImpl<_SnFileReplica>(this, _$identity); + +@override +Map toJson() { + return _$SnFileReplicaToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnFileReplica&&(identical(other.id, id) || other.id == id)&&(identical(other.objectId, objectId) || other.objectId == objectId)&&(identical(other.poolId, poolId) || other.poolId == poolId)&&(identical(other.pool, pool) || other.pool == pool)&&(identical(other.storageId, storageId) || other.storageId == storageId)&&(identical(other.status, status) || other.status == status)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,objectId,poolId,pool,storageId,status,isPrimary,createdAt,updatedAt,deletedAt); + +@override +String toString() { + return 'SnFileReplica(id: $id, objectId: $objectId, poolId: $poolId, pool: $pool, storageId: $storageId, status: $status, isPrimary: $isPrimary, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; +} + + +} + +/// @nodoc +abstract mixin class _$SnFileReplicaCopyWith<$Res> implements $SnFileReplicaCopyWith<$Res> { + factory _$SnFileReplicaCopyWith(_SnFileReplica value, $Res Function(_SnFileReplica) _then) = __$SnFileReplicaCopyWithImpl; +@override @useResult +$Res call({ + String id, String objectId, String poolId, SnFilePool? pool, String storageId, int status, bool isPrimary, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt +}); + + +@override $SnFilePoolCopyWith<$Res>? get pool; + +} +/// @nodoc +class __$SnFileReplicaCopyWithImpl<$Res> + implements _$SnFileReplicaCopyWith<$Res> { + __$SnFileReplicaCopyWithImpl(this._self, this._then); + + final _SnFileReplica _self; + final $Res Function(_SnFileReplica) _then; + +/// Create a copy of SnFileReplica +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? objectId = null,Object? poolId = null,Object? pool = freezed,Object? storageId = null,Object? status = null,Object? isPrimary = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { + return _then(_SnFileReplica( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,objectId: null == objectId ? _self.objectId : objectId // ignore: cast_nullable_to_non_nullable +as String,poolId: null == poolId ? _self.poolId : poolId // ignore: cast_nullable_to_non_nullable +as String,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable +as SnFilePool?,storageId: null == storageId ? _self.storageId : storageId // ignore: cast_nullable_to_non_nullable +as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable +as int,isPrimary: null == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable +as bool,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable +as DateTime?, + )); +} + +/// Create a copy of SnFileReplica +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$SnFilePoolCopyWith<$Res>? get pool { + if (_self.pool == null) { + return null; + } + + return $SnFilePoolCopyWith<$Res>(_self.pool!, (value) { + return _then(_self.copyWith(pool: value)); + }); +} +} + + +/// @nodoc +mixin _$SnCloudFileObject { + + String get id; int get size; Map? get meta; String? get mimeType; String? get hash; bool get hasCompression; bool get hasThumbnail; List get fileReplicas; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; +/// Create a copy of SnCloudFileObject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SnCloudFileObjectCopyWith get copyWith => _$SnCloudFileObjectCopyWithImpl(this as SnCloudFileObject, _$identity); + + /// Serializes this SnCloudFileObject to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SnCloudFileObject&&(identical(other.id, id) || other.id == id)&&(identical(other.size, size) || other.size == size)&&const DeepCollectionEquality().equals(other.meta, meta)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.hasCompression, hasCompression) || other.hasCompression == hasCompression)&&(identical(other.hasThumbnail, hasThumbnail) || other.hasThumbnail == hasThumbnail)&&const DeepCollectionEquality().equals(other.fileReplicas, fileReplicas)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,size,const DeepCollectionEquality().hash(meta),mimeType,hash,hasCompression,hasThumbnail,const DeepCollectionEquality().hash(fileReplicas),createdAt,updatedAt,deletedAt); + +@override +String toString() { + return 'SnCloudFileObject(id: $id, size: $size, meta: $meta, mimeType: $mimeType, hash: $hash, hasCompression: $hasCompression, hasThumbnail: $hasThumbnail, fileReplicas: $fileReplicas, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; +} + + +} + +/// @nodoc +abstract mixin class $SnCloudFileObjectCopyWith<$Res> { + factory $SnCloudFileObjectCopyWith(SnCloudFileObject value, $Res Function(SnCloudFileObject) _then) = _$SnCloudFileObjectCopyWithImpl; +@useResult +$Res call({ + String id, int size, Map? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt +}); + + + + +} +/// @nodoc +class _$SnCloudFileObjectCopyWithImpl<$Res> + implements $SnCloudFileObjectCopyWith<$Res> { + _$SnCloudFileObjectCopyWithImpl(this._self, this._then); + + final SnCloudFileObject _self; + final $Res Function(SnCloudFileObject) _then; + +/// Create a copy of SnCloudFileObject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? size = null,Object? meta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? hasCompression = null,Object? hasThumbnail = null,Object? fileReplicas = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable +as int,meta: freezed == meta ? _self.meta : meta // ignore: cast_nullable_to_non_nullable +as Map?,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable +as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable +as String?,hasCompression: null == hasCompression ? _self.hasCompression : hasCompression // ignore: cast_nullable_to_non_nullable +as bool,hasThumbnail: null == hasThumbnail ? _self.hasThumbnail : hasThumbnail // ignore: cast_nullable_to_non_nullable +as bool,fileReplicas: null == fileReplicas ? _self.fileReplicas : fileReplicas // ignore: cast_nullable_to_non_nullable +as List,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable +as DateTime?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SnCloudFileObject]. +extension SnCloudFileObjectPatterns on SnCloudFileObject { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _SnCloudFileObject value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SnCloudFileObject() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _SnCloudFileObject value) $default,){ +final _that = this; +switch (_that) { +case _SnCloudFileObject(): +return $default(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SnCloudFileObject value)? $default,){ +final _that = this; +switch (_that) { +case _SnCloudFileObject() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, int size, Map? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SnCloudFileObject() when $default != null: +return $default(_that.id,_that.size,_that.meta,_that.mimeType,_that.hash,_that.hasCompression,_that.hasThumbnail,_that.fileReplicas,_that.createdAt,_that.updatedAt,_that.deletedAt);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String id, int size, Map? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this; +switch (_that) { +case _SnCloudFileObject(): +return $default(_that.id,_that.size,_that.meta,_that.mimeType,_that.hash,_that.hasCompression,_that.hasThumbnail,_that.fileReplicas,_that.createdAt,_that.updatedAt,_that.deletedAt);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, int size, Map? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this; +switch (_that) { +case _SnCloudFileObject() when $default != null: +return $default(_that.id,_that.size,_that.meta,_that.mimeType,_that.hash,_that.hasCompression,_that.hasThumbnail,_that.fileReplicas,_that.createdAt,_that.updatedAt,_that.deletedAt);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SnCloudFileObject implements SnCloudFileObject { + const _SnCloudFileObject({required this.id, required this.size, required final Map? meta, required this.mimeType, required this.hash, required this.hasCompression, required this.hasThumbnail, required final List fileReplicas, required this.createdAt, required this.updatedAt, required this.deletedAt}): _meta = meta,_fileReplicas = fileReplicas; + factory _SnCloudFileObject.fromJson(Map json) => _$SnCloudFileObjectFromJson(json); + +@override final String id; +@override final int size; + final Map? _meta; +@override Map? get meta { + final value = _meta; + if (value == null) return null; + if (_meta is EqualUnmodifiableMapView) return _meta; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); +} + +@override final String? mimeType; +@override final String? hash; +@override final bool hasCompression; +@override final bool hasThumbnail; + final List _fileReplicas; +@override List get fileReplicas { + if (_fileReplicas is EqualUnmodifiableListView) return _fileReplicas; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_fileReplicas); +} + +@override final DateTime createdAt; +@override final DateTime updatedAt; +@override final DateTime? deletedAt; + +/// Create a copy of SnCloudFileObject +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SnCloudFileObjectCopyWith<_SnCloudFileObject> get copyWith => __$SnCloudFileObjectCopyWithImpl<_SnCloudFileObject>(this, _$identity); + +@override +Map toJson() { + return _$SnCloudFileObjectToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFileObject&&(identical(other.id, id) || other.id == id)&&(identical(other.size, size) || other.size == size)&&const DeepCollectionEquality().equals(other._meta, _meta)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.hasCompression, hasCompression) || other.hasCompression == hasCompression)&&(identical(other.hasThumbnail, hasThumbnail) || other.hasThumbnail == hasThumbnail)&&const DeepCollectionEquality().equals(other._fileReplicas, _fileReplicas)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,size,const DeepCollectionEquality().hash(_meta),mimeType,hash,hasCompression,hasThumbnail,const DeepCollectionEquality().hash(_fileReplicas),createdAt,updatedAt,deletedAt); + +@override +String toString() { + return 'SnCloudFileObject(id: $id, size: $size, meta: $meta, mimeType: $mimeType, hash: $hash, hasCompression: $hasCompression, hasThumbnail: $hasThumbnail, fileReplicas: $fileReplicas, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt)'; +} + + +} + +/// @nodoc +abstract mixin class _$SnCloudFileObjectCopyWith<$Res> implements $SnCloudFileObjectCopyWith<$Res> { + factory _$SnCloudFileObjectCopyWith(_SnCloudFileObject value, $Res Function(_SnCloudFileObject) _then) = __$SnCloudFileObjectCopyWithImpl; +@override @useResult +$Res call({ + String id, int size, Map? meta, String? mimeType, String? hash, bool hasCompression, bool hasThumbnail, List fileReplicas, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt +}); + + + + +} +/// @nodoc +class __$SnCloudFileObjectCopyWithImpl<$Res> + implements _$SnCloudFileObjectCopyWith<$Res> { + __$SnCloudFileObjectCopyWithImpl(this._self, this._then); + + final _SnCloudFileObject _self; + final $Res Function(_SnCloudFileObject) _then; + +/// Create a copy of SnCloudFileObject +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? size = null,Object? meta = freezed,Object? mimeType = freezed,Object? hash = freezed,Object? hasCompression = null,Object? hasThumbnail = null,Object? fileReplicas = null,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,}) { + return _then(_SnCloudFileObject( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable +as int,meta: freezed == meta ? _self._meta : meta // ignore: cast_nullable_to_non_nullable +as Map?,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable +as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable +as String?,hasCompression: null == hasCompression ? _self.hasCompression : hasCompression // ignore: cast_nullable_to_non_nullable +as bool,hasThumbnail: null == hasThumbnail ? _self.hasThumbnail : hasThumbnail // ignore: cast_nullable_to_non_nullable +as bool,fileReplicas: null == fileReplicas ? _self._fileReplicas : fileReplicas // ignore: cast_nullable_to_non_nullable +as List,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable +as DateTime?, + )); +} + + +} + + +/// @nodoc +mixin _$SnCloudFile { + + String get id; String get name; String? get description; Map? get fileMeta; Map? get userMeta; List get sensitiveMarks; String? get mimeType; String? get hash; int get size; DateTime? get uploadedAt; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; String? get url; +/// Create a copy of SnCloudFile +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SnCloudFileCopyWith get copyWith => _$SnCloudFileCopyWithImpl(this as SnCloudFile, _$identity); + + /// Serializes this SnCloudFile to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other.fileMeta, fileMeta)&&const DeepCollectionEquality().equals(other.userMeta, userMeta)&&const DeepCollectionEquality().equals(other.sensitiveMarks, sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(fileMeta),const DeepCollectionEquality().hash(userMeta),const DeepCollectionEquality().hash(sensitiveMarks),mimeType,hash,size,uploadedAt,createdAt,updatedAt,deletedAt,url); + +@override +String toString() { + return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)'; +} + + +} + +/// @nodoc +abstract mixin class $SnCloudFileCopyWith<$Res> { + factory $SnCloudFileCopyWith(SnCloudFile value, $Res Function(SnCloudFile) _then) = _$SnCloudFileCopyWithImpl; +@useResult +$Res call({ + String id, String name, String? description, Map? fileMeta, Map? userMeta, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url +}); + + + + +} +/// @nodoc +class _$SnCloudFileCopyWithImpl<$Res> + implements $SnCloudFileCopyWith<$Res> { + _$SnCloudFileCopyWithImpl(this._self, this._then); + + final SnCloudFile _self; + final $Res Function(SnCloudFile) _then; + +/// Create a copy of SnCloudFile +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable +as String?,fileMeta: freezed == fileMeta ? _self.fileMeta : fileMeta // ignore: cast_nullable_to_non_nullable +as Map?,userMeta: freezed == userMeta ? _self.userMeta : userMeta // ignore: cast_nullable_to_non_nullable +as Map?,sensitiveMarks: null == sensitiveMarks ? _self.sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable +as List,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable +as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable +as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable +as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable +as DateTime?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable +as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable +as String?, + )); +} + +} + + /// Adds pattern-matching-related methods to [SnCloudFile]. extension SnCloudFilePatterns on SnCloudFile { /// A variant of `map` that fallback to returning `orElse`. @@ -443,10 +1038,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String name, String? description, Map? fileMeta, Map? userMeta, SnFilePool? pool, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String name, String? description, Map? fileMeta, Map? userMeta, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _SnCloudFile() when $default != null: -return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.pool,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.uploadedTo,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _: +return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _: return orElse(); } @@ -464,10 +1059,10 @@ return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userM /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String name, String? description, Map? fileMeta, Map? userMeta, SnFilePool? pool, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String name, String? description, Map? fileMeta, Map? userMeta, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url) $default,) {final _that = this; switch (_that) { case _SnCloudFile(): -return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.pool,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.uploadedTo,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);} +return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);} } /// A variant of `when` that fallback to returning `null` /// @@ -481,10 +1076,10 @@ return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userM /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String name, String? description, Map? fileMeta, Map? userMeta, SnFilePool? pool, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String name, String? description, Map? fileMeta, Map? userMeta, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url)? $default,) {final _that = this; switch (_that) { case _SnCloudFile() when $default != null: -return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.pool,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.uploadedTo,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _: +return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userMeta,_that.sensitiveMarks,_that.mimeType,_that.hash,_that.size,_that.uploadedAt,_that.createdAt,_that.updatedAt,_that.deletedAt,_that.url);case _: return null; } @@ -496,7 +1091,7 @@ return $default(_that.id,_that.name,_that.description,_that.fileMeta,_that.userM @JsonSerializable() class _SnCloudFile implements SnCloudFile { - const _SnCloudFile({required this.id, required this.name, required this.description, required final Map? fileMeta, required final Map? userMeta, required this.pool, final List sensitiveMarks = const [], required this.mimeType, required this.hash, required this.size, required this.uploadedAt, required this.uploadedTo, required this.createdAt, required this.updatedAt, required this.deletedAt, this.url}): _fileMeta = fileMeta,_userMeta = userMeta,_sensitiveMarks = sensitiveMarks; + const _SnCloudFile({required this.id, required this.name, required this.description, required final Map? fileMeta, required final Map? userMeta, final List sensitiveMarks = const [], required this.mimeType, required this.hash, required this.size, required this.uploadedAt, required this.createdAt, required this.updatedAt, required this.deletedAt, this.url}): _fileMeta = fileMeta,_userMeta = userMeta,_sensitiveMarks = sensitiveMarks; factory _SnCloudFile.fromJson(Map json) => _$SnCloudFileFromJson(json); @override final String id; @@ -520,7 +1115,6 @@ class _SnCloudFile implements SnCloudFile { return EqualUnmodifiableMapView(value); } -@override final SnFilePool? pool; final List _sensitiveMarks; @override@JsonKey() List get sensitiveMarks { if (_sensitiveMarks is EqualUnmodifiableListView) return _sensitiveMarks; @@ -532,7 +1126,6 @@ class _SnCloudFile implements SnCloudFile { @override final String? hash; @override final int size; @override final DateTime? uploadedAt; -@override final String? uploadedTo; @override final DateTime createdAt; @override final DateTime updatedAt; @override final DateTime? deletedAt; @@ -551,16 +1144,16 @@ Map toJson() { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._fileMeta, _fileMeta)&&const DeepCollectionEquality().equals(other._userMeta, _userMeta)&&(identical(other.pool, pool) || other.pool == pool)&&const DeepCollectionEquality().equals(other._sensitiveMarks, _sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.uploadedTo, uploadedTo) || other.uploadedTo == uploadedTo)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SnCloudFile&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&const DeepCollectionEquality().equals(other._fileMeta, _fileMeta)&&const DeepCollectionEquality().equals(other._userMeta, _userMeta)&&const DeepCollectionEquality().equals(other._sensitiveMarks, _sensitiveMarks)&&(identical(other.mimeType, mimeType) || other.mimeType == mimeType)&&(identical(other.hash, hash) || other.hash == hash)&&(identical(other.size, size) || other.size == size)&&(identical(other.uploadedAt, uploadedAt) || other.uploadedAt == uploadedAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.deletedAt, deletedAt) || other.deletedAt == deletedAt)&&(identical(other.url, url) || other.url == url)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(_fileMeta),const DeepCollectionEquality().hash(_userMeta),pool,const DeepCollectionEquality().hash(_sensitiveMarks),mimeType,hash,size,uploadedAt,uploadedTo,createdAt,updatedAt,deletedAt,url); +int get hashCode => Object.hash(runtimeType,id,name,description,const DeepCollectionEquality().hash(_fileMeta),const DeepCollectionEquality().hash(_userMeta),const DeepCollectionEquality().hash(_sensitiveMarks),mimeType,hash,size,uploadedAt,createdAt,updatedAt,deletedAt,url); @override String toString() { - return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, pool: $pool, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, uploadedTo: $uploadedTo, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)'; + return 'SnCloudFile(id: $id, name: $name, description: $description, fileMeta: $fileMeta, userMeta: $userMeta, sensitiveMarks: $sensitiveMarks, mimeType: $mimeType, hash: $hash, size: $size, uploadedAt: $uploadedAt, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, url: $url)'; } @@ -571,11 +1164,11 @@ abstract mixin class _$SnCloudFileCopyWith<$Res> implements $SnCloudFileCopyWith factory _$SnCloudFileCopyWith(_SnCloudFile value, $Res Function(_SnCloudFile) _then) = __$SnCloudFileCopyWithImpl; @override @useResult $Res call({ - String id, String name, String? description, Map? fileMeta, Map? userMeta, SnFilePool? pool, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, String? uploadedTo, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url + String id, String name, String? description, Map? fileMeta, Map? userMeta, List sensitiveMarks, String? mimeType, String? hash, int size, DateTime? uploadedAt, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt, String? url }); -@override $SnFilePoolCopyWith<$Res>? get pool; + } /// @nodoc @@ -588,21 +1181,19 @@ class __$SnCloudFileCopyWithImpl<$Res> /// Create a copy of SnCloudFile /// with the given fields replaced by the non-null parameter values. -@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? pool = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? uploadedTo = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) { +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? description = freezed,Object? fileMeta = freezed,Object? userMeta = freezed,Object? sensitiveMarks = null,Object? mimeType = freezed,Object? hash = freezed,Object? size = null,Object? uploadedAt = freezed,Object? createdAt = null,Object? updatedAt = null,Object? deletedAt = freezed,Object? url = freezed,}) { return _then(_SnCloudFile( id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String?,fileMeta: freezed == fileMeta ? _self._fileMeta : fileMeta // ignore: cast_nullable_to_non_nullable as Map?,userMeta: freezed == userMeta ? _self._userMeta : userMeta // ignore: cast_nullable_to_non_nullable -as Map?,pool: freezed == pool ? _self.pool : pool // ignore: cast_nullable_to_non_nullable -as SnFilePool?,sensitiveMarks: null == sensitiveMarks ? _self._sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable +as Map?,sensitiveMarks: null == sensitiveMarks ? _self._sensitiveMarks : sensitiveMarks // ignore: cast_nullable_to_non_nullable as List,mimeType: freezed == mimeType ? _self.mimeType : mimeType // ignore: cast_nullable_to_non_nullable as String?,hash: freezed == hash ? _self.hash : hash // ignore: cast_nullable_to_non_nullable as String?,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable as int,uploadedAt: freezed == uploadedAt ? _self.uploadedAt : uploadedAt // ignore: cast_nullable_to_non_nullable -as DateTime?,uploadedTo: freezed == uploadedTo ? _self.uploadedTo : uploadedTo // ignore: cast_nullable_to_non_nullable -as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable +as DateTime?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable as DateTime,deletedAt: freezed == deletedAt ? _self.deletedAt : deletedAt // ignore: cast_nullable_to_non_nullable as DateTime?,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable @@ -610,19 +1201,7 @@ as String?, )); } -/// Create a copy of SnCloudFile -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$SnFilePoolCopyWith<$Res>? get pool { - if (_self.pool == null) { - return null; - } - return $SnFilePoolCopyWith<$Res>(_self.pool!, (value) { - return _then(_self.copyWith(pool: value)); - }); -} } diff --git a/lib/models/file.g.dart b/lib/models/file.g.dart index 8ddb4fa6..22e9e926 100644 --- a/lib/models/file.g.dart +++ b/lib/models/file.g.dart @@ -29,15 +29,78 @@ const _$UniversalFileTypeEnumMap = { UniversalFileType.file: 'file', }; +_SnFileReplica _$SnFileReplicaFromJson(Map json) => + _SnFileReplica( + id: json['id'] as String, + objectId: json['object_id'] as String, + poolId: json['pool_id'] as String, + pool: json['pool'] == null + ? null + : SnFilePool.fromJson(json['pool'] as Map), + storageId: json['storage_id'] as String, + status: (json['status'] as num).toInt(), + isPrimary: json['is_primary'] as bool, + createdAt: DateTime.parse(json['created_at'] as String), + updatedAt: DateTime.parse(json['updated_at'] as String), + deletedAt: json['deleted_at'] == null + ? null + : DateTime.parse(json['deleted_at'] as String), + ); + +Map _$SnFileReplicaToJson(_SnFileReplica instance) => + { + 'id': instance.id, + 'object_id': instance.objectId, + 'pool_id': instance.poolId, + 'pool': instance.pool?.toJson(), + 'storage_id': instance.storageId, + 'status': instance.status, + 'is_primary': instance.isPrimary, + 'created_at': instance.createdAt.toIso8601String(), + 'updated_at': instance.updatedAt.toIso8601String(), + 'deleted_at': instance.deletedAt?.toIso8601String(), + }; + +_SnCloudFileObject _$SnCloudFileObjectFromJson(Map json) => + _SnCloudFileObject( + id: json['id'] as String, + size: (json['size'] as num).toInt(), + meta: json['meta'] as Map?, + mimeType: json['mime_type'] as String?, + hash: json['hash'] as String?, + hasCompression: json['has_compression'] as bool, + hasThumbnail: json['has_thumbnail'] as bool, + fileReplicas: (json['file_replicas'] as List) + .map((e) => SnFileReplica.fromJson(e as Map)) + .toList(), + createdAt: DateTime.parse(json['created_at'] as String), + updatedAt: DateTime.parse(json['updated_at'] as String), + deletedAt: json['deleted_at'] == null + ? null + : DateTime.parse(json['deleted_at'] as String), + ); + +Map _$SnCloudFileObjectToJson(_SnCloudFileObject instance) => + { + 'id': instance.id, + 'size': instance.size, + 'meta': instance.meta, + 'mime_type': instance.mimeType, + 'hash': instance.hash, + 'has_compression': instance.hasCompression, + 'has_thumbnail': instance.hasThumbnail, + 'file_replicas': instance.fileReplicas.map((e) => e.toJson()).toList(), + 'created_at': instance.createdAt.toIso8601String(), + 'updated_at': instance.updatedAt.toIso8601String(), + 'deleted_at': instance.deletedAt?.toIso8601String(), + }; + _SnCloudFile _$SnCloudFileFromJson(Map json) => _SnCloudFile( id: json['id'] as String, name: json['name'] as String, description: json['description'] as String?, fileMeta: json['file_meta'] as Map?, userMeta: json['user_meta'] as Map?, - pool: json['pool'] == null - ? null - : SnFilePool.fromJson(json['pool'] as Map), sensitiveMarks: (json['sensitive_marks'] as List?) ?.map((e) => (e as num).toInt()) @@ -49,7 +112,6 @@ _SnCloudFile _$SnCloudFileFromJson(Map json) => _SnCloudFile( uploadedAt: json['uploaded_at'] == null ? null : DateTime.parse(json['uploaded_at'] as String), - uploadedTo: json['uploaded_to'] as String?, createdAt: DateTime.parse(json['created_at'] as String), updatedAt: DateTime.parse(json['updated_at'] as String), deletedAt: json['deleted_at'] == null @@ -65,13 +127,11 @@ Map _$SnCloudFileToJson(_SnCloudFile instance) => 'description': instance.description, 'file_meta': instance.fileMeta, 'user_meta': instance.userMeta, - 'pool': instance.pool?.toJson(), 'sensitive_marks': instance.sensitiveMarks, 'mime_type': instance.mimeType, 'hash': instance.hash, 'size': instance.size, 'uploaded_at': instance.uploadedAt?.toIso8601String(), - 'uploaded_to': instance.uploadedTo, 'created_at': instance.createdAt.toIso8601String(), 'updated_at': instance.updatedAt.toIso8601String(), 'deleted_at': instance.deletedAt?.toIso8601String(), diff --git a/lib/pods/chat/chat_subscribe.g.dart b/lib/pods/chat/chat_subscribe.g.dart index 5c20d100..d06ed26e 100644 --- a/lib/pods/chat/chat_subscribe.g.dart +++ b/lib/pods/chat/chat_subscribe.g.dart @@ -59,7 +59,7 @@ final class ChatSubscribeNotifierProvider } String _$chatSubscribeNotifierHash() => - r'b7624ae45ace2944a88f8b4d14ddce556c236371'; + r'944cb0c1b1805050470d4b79c60937f622d7b716'; final class ChatSubscribeNotifierFamily extends $Family with diff --git a/lib/services/analytics_service.dart b/lib/services/analytics_service.dart index d6e53874..267490af 100644 --- a/lib/services/analytics_service.dart +++ b/lib/services/analytics_service.dart @@ -1,21 +1,20 @@ import 'dart:io'; import 'package:firebase_analytics/firebase_analytics.dart'; +import 'package:flutter/foundation.dart'; import 'package:island/talker.dart'; class AnalyticsService { static final AnalyticsService _instance = AnalyticsService._internal(); factory AnalyticsService() => _instance; - AnalyticsService._internal() { - _init(); - } + AnalyticsService._internal(); FirebaseAnalytics? _analytics; bool _enabled = true; bool get _supportsAnalytics => - Platform.isAndroid || Platform.isIOS || Platform.isMacOS; + kIsWeb || (Platform.isAndroid || Platform.isIOS || Platform.isMacOS); - void _init() { + void initialize() { if (!_supportsAnalytics) return; try { _analytics = FirebaseAnalytics.instance; diff --git a/lib/services/app_intents/ios.dart b/lib/services/app_intents/ios.dart index 2049ea82..c555a6c9 100644 --- a/lib/services/app_intents/ios.dart +++ b/lib/services/app_intents/ios.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:dio/dio.dart'; import 'package:firebase_analytics/firebase_analytics.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter_app_intents/flutter_app_intents.dart'; import 'package:go_router/go_router.dart'; import 'package:island/models/auth.dart'; @@ -21,7 +22,7 @@ class AppIntentsService { Dio? _dio; Future initialize() async { - if (!Platform.isIOS) { + if (kIsWeb || !Platform.isIOS) { talker.warning('[AppIntents] App Intents only supported on iOS'); return; } diff --git a/lib/widgets/content/file_info_sheet.dart b/lib/widgets/content/file_info_sheet.dart index 079e5f6a..b08e51db 100644 --- a/lib/widgets/content/file_info_sheet.dart +++ b/lib/widgets/content/file_info_sheet.dart @@ -124,24 +124,6 @@ class FileInfoSheet extends StatelessWidget { }, ), ), - if (item.pool != null) - ListTile( - leading: const Icon(Symbols.calendar_today), - title: Text('File Pool').tr(), - subtitle: Text( - item.pool!.name, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - contentPadding: EdgeInsets.symmetric(horizontal: 24), - trailing: IconButton( - icon: const Icon(Icons.copy), - onPressed: () { - Clipboard.setData(ClipboardData(text: item.pool!.id)); - showSnackBar('fileNameCopied'.tr()); - }, - ), - ), ListTile( leading: const Icon(Symbols.launch), title: Text('openInBrowser').tr(), @@ -176,15 +158,14 @@ class FileInfoSheet extends StatelessWidget { contentPadding: EdgeInsets.symmetric( horizontal: 24, ), - title: - Text( - entry.key.contains('-') - ? entry.key.split('-').last - : entry.key, - style: theme.textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w500, - ), - ).bold(), + title: Text( + entry.key.contains('-') + ? entry.key.split('-').last + : entry.key, + style: theme.textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + ), + ).bold(), subtitle: Text( '${entry.value}'.isNotEmpty ? '${entry.value}' @@ -227,13 +208,12 @@ class FileInfoSheet extends StatelessWidget { contentPadding: EdgeInsets.symmetric( horizontal: 24, ), - title: - Text( - entry.key, - style: theme.textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w500, - ), - ).bold(), + title: Text( + entry.key, + style: theme.textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + ), + ).bold(), subtitle: Text( jsonEncode(entry.value), style: theme.textTheme.bodyMedium, @@ -276,13 +256,12 @@ class FileInfoSheet extends StatelessWidget { contentPadding: EdgeInsets.symmetric( horizontal: 24, ), - title: - Text( - entry.key, - style: theme.textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w500, - ), - ).bold(), + title: Text( + entry.key, + style: theme.textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + ), + ).bold(), subtitle: Text( jsonEncode(entry.value), style: theme.textTheme.bodyMedium,