freezer/lib/api/cache.g.dart
Pato05 950969b774
use dartfix, make more stuff constant +
add favorite button in notifications\nfix android tv\ntry to fix library tracks (unsuccessful)\nbetter MenuSheet
2023-10-13 00:09:37 +02:00

199 lines
5.9 KiB
Dart

// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'cache.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class CacheAdapter extends TypeAdapter<Cache> {
@override
final int typeId = 22;
@override
Cache read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return Cache()
..libraryTracks =
fields[0] == null ? [] : (fields[0] as List).cast<String>()
..loggedTrackId = fields[1] as String?
..history = (fields[2] as List).cast<Track>()
..sorts = (fields[3] as List).cast<Sorting?>()
..searchHistory = (fields[4] as List).cast<SearchHistoryItem>()
..threadsWarning = fields[5] as bool
..lastUpdateCheck = fields[6] as DateTime?
..favoritesPlaylistId = fields[7] as String?;
}
@override
void write(BinaryWriter writer, Cache obj) {
writer
..writeByte(8)
..writeByte(0)
..write(obj.libraryTracks)
..writeByte(1)
..write(obj.loggedTrackId)
..writeByte(2)
..write(obj.history)
..writeByte(3)
..write(obj.sorts)
..writeByte(4)
..write(obj.searchHistory)
..writeByte(5)
..write(obj.threadsWarning)
..writeByte(6)
..write(obj.lastUpdateCheck)
..writeByte(7)
..write(obj.favoritesPlaylistId);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is CacheAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
class SearchHistoryItemAdapter extends TypeAdapter<SearchHistoryItem> {
@override
final int typeId = 20;
@override
SearchHistoryItem read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return SearchHistoryItem(
fields[1] as dynamic,
fields[0] as SearchHistoryItemType,
);
}
@override
void write(BinaryWriter writer, SearchHistoryItem obj) {
writer
..writeByte(2)
..writeByte(0)
..write(obj.type)
..writeByte(1)
..write(obj.data);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is SearchHistoryItemAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
class SearchHistoryItemTypeAdapter extends TypeAdapter<SearchHistoryItemType> {
@override
final int typeId = 21;
@override
SearchHistoryItemType read(BinaryReader reader) {
switch (reader.readByte()) {
case 0:
return SearchHistoryItemType.track;
case 1:
return SearchHistoryItemType.album;
case 2:
return SearchHistoryItemType.artist;
case 3:
return SearchHistoryItemType.playlist;
default:
return SearchHistoryItemType.track;
}
}
@override
void write(BinaryWriter writer, SearchHistoryItemType obj) {
switch (obj) {
case SearchHistoryItemType.track:
writer.writeByte(0);
break;
case SearchHistoryItemType.album:
writer.writeByte(1);
break;
case SearchHistoryItemType.artist:
writer.writeByte(2);
break;
case SearchHistoryItemType.playlist:
writer.writeByte(3);
break;
}
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is SearchHistoryItemTypeAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Cache _$CacheFromJson(Map<String, dynamic> json) => Cache()
..libraryTracks = (json['libraryTracks'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
[]
..history = (json['history'] as List<dynamic>?)
?.map((e) => Track.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..sorts = (json['sorts'] as List<dynamic>?)
?.map((e) =>
e == null ? null : Sorting.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..searchHistory = (json['searchHistory2'] as List<dynamic>?)
?.map((e) => SearchHistoryItem.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..threadsWarning = json['threadsWarning'] as bool? ?? false
..lastUpdateCheck = json['lastUpdateCheck'] == null
? null
: DateTime.parse(json['lastUpdateCheck'] as String)
..favoritesPlaylistId = json['favoritesPlaylistId'] as String?;
Map<String, dynamic> _$CacheToJson(Cache instance) => <String, dynamic>{
'libraryTracks': instance.libraryTracks,
'history': instance.history.map((e) => e.toJson()).toList(),
'sorts': instance.sorts.map((e) => e?.toJson()).toList(),
'searchHistory2': instance.searchHistory.map((e) => e.toJson()).toList(),
'threadsWarning': instance.threadsWarning,
'lastUpdateCheck': instance.lastUpdateCheck?.toIso8601String(),
'favoritesPlaylistId': instance.favoritesPlaylistId,
};
SearchHistoryItem _$SearchHistoryItemFromJson(Map<String, dynamic> json) =>
SearchHistoryItem(
json['data'],
SearchHistoryItem._searchHistoryItemTypeFromJson(json['type'] as int),
);
Map<String, dynamic> _$SearchHistoryItemToJson(SearchHistoryItem instance) =>
<String, dynamic>{
'type': SearchHistoryItem._searchHistoryItemTypeToJson(instance.type),
'data': instance.data,
};