refactor: remove unreachable code paths and unused members
Drops dead code across services, models, utils and widgets, including the connection auth service, which had no implementer, and the Live TV DVR provisioning models, which had no caller. Tests that only covered deleted behaviour are removed or trimmed. No behaviour change.
This commit is contained in:
@@ -34,8 +34,6 @@ sealed class DownloadProgress with _$DownloadProgress {
|
||||
double get progressPercent => progress / 100.0;
|
||||
|
||||
String get speedFormatted => ByteFormatter.formatSpeed(speed);
|
||||
String get downloadedFormatted => ByteFormatter.formatBytes(downloadedBytes);
|
||||
String get totalFormatted => ByteFormatter.formatBytes(totalBytes);
|
||||
|
||||
bool get hasArtworkPaths => thumbPath != null;
|
||||
}
|
||||
|
||||
@@ -37,18 +37,4 @@ class PlexHome {
|
||||
Map<String, dynamic> toJson() => _$PlexHomeToJson(this);
|
||||
|
||||
PlexHomeUser? get adminUser => users.where((user) => user.admin).firstOrNull;
|
||||
|
||||
List<PlexHomeUser> get managedUsers => users.where((user) => !user.admin).toList();
|
||||
|
||||
List<PlexHomeUser> get restrictedUsers => users.where((user) => user.restricted).toList();
|
||||
|
||||
PlexHomeUser? getUserByUUID(String uuid) {
|
||||
try {
|
||||
return users.firstWhere((user) => user.uuid == uuid);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
bool get hasMultipleUsers => users.length > 1;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,4 @@ class PlexVideoPlaybackData {
|
||||
});
|
||||
|
||||
bool get hasValidVideoUrl => videoUrl != null && videoUrl!.isNotEmpty;
|
||||
|
||||
bool get hasMediaInfo => mediaInfo != null;
|
||||
}
|
||||
|
||||
@@ -5,45 +5,13 @@ import 'seerr_media.dart';
|
||||
part 'seerr_details.g.dart';
|
||||
|
||||
/// Full movie detail from `GET /movie/{tmdbId}` — the subset the catalog
|
||||
/// surfaces need (credits, external ids, availability, air status).
|
||||
/// surfaces need (credits, availability).
|
||||
@JsonSerializable(createToJson: false)
|
||||
class SeerrMovieDetails {
|
||||
final int id;
|
||||
final String? title;
|
||||
final String? overview;
|
||||
final String? posterPath;
|
||||
final String? backdropPath;
|
||||
final String? releaseDate;
|
||||
|
||||
/// Minutes.
|
||||
final int? runtime;
|
||||
|
||||
/// `Released` / `In Production` / `Post Production` / `Planned` /
|
||||
/// `Canceled` / `Rumored`.
|
||||
final String? status;
|
||||
final double? voteAverage;
|
||||
final int? voteCount;
|
||||
final List<SeerrGenre>? genres;
|
||||
final SeerrCredits? credits;
|
||||
final SeerrExternalIds? externalIds;
|
||||
final SeerrMediaInfo? mediaInfo;
|
||||
|
||||
const SeerrMovieDetails({
|
||||
required this.id,
|
||||
this.title,
|
||||
this.overview,
|
||||
this.posterPath,
|
||||
this.backdropPath,
|
||||
this.releaseDate,
|
||||
this.runtime,
|
||||
this.status,
|
||||
this.voteAverage,
|
||||
this.voteCount,
|
||||
this.genres,
|
||||
this.credits,
|
||||
this.externalIds,
|
||||
this.mediaInfo,
|
||||
});
|
||||
const SeerrMovieDetails({this.credits, this.mediaInfo});
|
||||
|
||||
factory SeerrMovieDetails.fromJson(Map<String, dynamic> json) => _$SeerrMovieDetailsFromJson(json);
|
||||
}
|
||||
@@ -51,66 +19,15 @@ class SeerrMovieDetails {
|
||||
/// Full TV detail from `GET /tv/{tmdbId}`.
|
||||
@JsonSerializable(createToJson: false)
|
||||
class SeerrTvDetails {
|
||||
final int id;
|
||||
final String? name;
|
||||
final String? overview;
|
||||
final String? posterPath;
|
||||
final String? backdropPath;
|
||||
final String? firstAirDate;
|
||||
final List<int>? episodeRunTime;
|
||||
|
||||
/// `Returning Series` / `Ended` / `Canceled` / `In Production` /
|
||||
/// `Planned` / `Pilot`.
|
||||
final String? status;
|
||||
final double? voteAverage;
|
||||
final int? voteCount;
|
||||
final List<SeerrGenre>? genres;
|
||||
final List<SeerrNetwork>? networks;
|
||||
final int? numberOfEpisodes;
|
||||
final int? numberOfSeasons;
|
||||
final List<SeerrSeason>? seasons;
|
||||
final SeerrCredits? credits;
|
||||
final SeerrExternalIds? externalIds;
|
||||
final SeerrMediaInfo? mediaInfo;
|
||||
|
||||
const SeerrTvDetails({
|
||||
required this.id,
|
||||
this.name,
|
||||
this.overview,
|
||||
this.posterPath,
|
||||
this.backdropPath,
|
||||
this.firstAirDate,
|
||||
this.episodeRunTime,
|
||||
this.status,
|
||||
this.voteAverage,
|
||||
this.voteCount,
|
||||
this.genres,
|
||||
this.networks,
|
||||
this.numberOfEpisodes,
|
||||
this.numberOfSeasons,
|
||||
this.seasons,
|
||||
this.credits,
|
||||
this.externalIds,
|
||||
this.mediaInfo,
|
||||
});
|
||||
const SeerrTvDetails({this.seasons, this.credits, this.mediaInfo});
|
||||
|
||||
factory SeerrTvDetails.fromJson(Map<String, dynamic> json) => _$SeerrTvDetailsFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
||||
class SeerrGenre {
|
||||
final String? name;
|
||||
const SeerrGenre({this.name});
|
||||
factory SeerrGenre.fromJson(Map<String, dynamic> json) => _$SeerrGenreFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
||||
class SeerrNetwork {
|
||||
final String? name;
|
||||
const SeerrNetwork({this.name});
|
||||
factory SeerrNetwork.fromJson(Map<String, dynamic> json) => _$SeerrNetworkFromJson(json);
|
||||
}
|
||||
|
||||
/// One TMDB season entry (`TvDetails.seasons[]`). Season 0 is specials.
|
||||
@JsonSerializable(createToJson: false)
|
||||
class SeerrSeason {
|
||||
@@ -141,13 +58,3 @@ class SeerrCastMember {
|
||||
|
||||
factory SeerrCastMember.fromJson(Map<String, dynamic> json) => _$SeerrCastMemberFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
||||
class SeerrExternalIds {
|
||||
final String? imdbId;
|
||||
final int? tvdbId;
|
||||
|
||||
const SeerrExternalIds({this.imdbId, this.tvdbId});
|
||||
|
||||
factory SeerrExternalIds.fromJson(Map<String, dynamic> json) => _$SeerrExternalIdsFromJson(json);
|
||||
}
|
||||
|
||||
@@ -8,27 +8,9 @@ part of 'seerr_details.dart';
|
||||
|
||||
SeerrMovieDetails _$SeerrMovieDetailsFromJson(Map<String, dynamic> json) =>
|
||||
SeerrMovieDetails(
|
||||
id: (json['id'] as num).toInt(),
|
||||
title: json['title'] as String?,
|
||||
overview: json['overview'] as String?,
|
||||
posterPath: json['posterPath'] as String?,
|
||||
backdropPath: json['backdropPath'] as String?,
|
||||
releaseDate: json['releaseDate'] as String?,
|
||||
runtime: (json['runtime'] as num?)?.toInt(),
|
||||
status: json['status'] as String?,
|
||||
voteAverage: (json['voteAverage'] as num?)?.toDouble(),
|
||||
voteCount: (json['voteCount'] as num?)?.toInt(),
|
||||
genres: (json['genres'] as List<dynamic>?)
|
||||
?.map((e) => SeerrGenre.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
credits: json['credits'] == null
|
||||
? null
|
||||
: SeerrCredits.fromJson(json['credits'] as Map<String, dynamic>),
|
||||
externalIds: json['externalIds'] == null
|
||||
? null
|
||||
: SeerrExternalIds.fromJson(
|
||||
json['externalIds'] as Map<String, dynamic>,
|
||||
),
|
||||
mediaInfo: json['mediaInfo'] == null
|
||||
? null
|
||||
: SeerrMediaInfo.fromJson(json['mediaInfo'] as Map<String, dynamic>),
|
||||
@@ -36,48 +18,17 @@ SeerrMovieDetails _$SeerrMovieDetailsFromJson(Map<String, dynamic> json) =>
|
||||
|
||||
SeerrTvDetails _$SeerrTvDetailsFromJson(Map<String, dynamic> json) =>
|
||||
SeerrTvDetails(
|
||||
id: (json['id'] as num).toInt(),
|
||||
name: json['name'] as String?,
|
||||
overview: json['overview'] as String?,
|
||||
posterPath: json['posterPath'] as String?,
|
||||
backdropPath: json['backdropPath'] as String?,
|
||||
firstAirDate: json['firstAirDate'] as String?,
|
||||
episodeRunTime: (json['episodeRunTime'] as List<dynamic>?)
|
||||
?.map((e) => (e as num).toInt())
|
||||
.toList(),
|
||||
status: json['status'] as String?,
|
||||
voteAverage: (json['voteAverage'] as num?)?.toDouble(),
|
||||
voteCount: (json['voteCount'] as num?)?.toInt(),
|
||||
genres: (json['genres'] as List<dynamic>?)
|
||||
?.map((e) => SeerrGenre.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
networks: (json['networks'] as List<dynamic>?)
|
||||
?.map((e) => SeerrNetwork.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
numberOfEpisodes: (json['numberOfEpisodes'] as num?)?.toInt(),
|
||||
numberOfSeasons: (json['numberOfSeasons'] as num?)?.toInt(),
|
||||
seasons: (json['seasons'] as List<dynamic>?)
|
||||
?.map((e) => SeerrSeason.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
credits: json['credits'] == null
|
||||
? null
|
||||
: SeerrCredits.fromJson(json['credits'] as Map<String, dynamic>),
|
||||
externalIds: json['externalIds'] == null
|
||||
? null
|
||||
: SeerrExternalIds.fromJson(
|
||||
json['externalIds'] as Map<String, dynamic>,
|
||||
),
|
||||
mediaInfo: json['mediaInfo'] == null
|
||||
? null
|
||||
: SeerrMediaInfo.fromJson(json['mediaInfo'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
SeerrGenre _$SeerrGenreFromJson(Map<String, dynamic> json) =>
|
||||
SeerrGenre(name: json['name'] as String?);
|
||||
|
||||
SeerrNetwork _$SeerrNetworkFromJson(Map<String, dynamic> json) =>
|
||||
SeerrNetwork(name: json['name'] as String?);
|
||||
|
||||
SeerrSeason _$SeerrSeasonFromJson(Map<String, dynamic> json) => SeerrSeason(
|
||||
seasonNumber: (json['seasonNumber'] as num).toInt(),
|
||||
name: json['name'] as String?,
|
||||
@@ -97,9 +48,3 @@ SeerrCastMember _$SeerrCastMemberFromJson(Map<String, dynamic> json) =>
|
||||
character: json['character'] as String?,
|
||||
profilePath: json['profilePath'] as String?,
|
||||
);
|
||||
|
||||
SeerrExternalIds _$SeerrExternalIdsFromJson(Map<String, dynamic> json) =>
|
||||
SeerrExternalIds(
|
||||
imdbId: json['imdbId'] as String?,
|
||||
tvdbId: (json['tvdbId'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
@@ -117,44 +117,4 @@ class UserSwitchResponse {
|
||||
attributionPartner: optString('attributionPartner'),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'uuid': uuid,
|
||||
'username': username,
|
||||
'title': title,
|
||||
'email': email,
|
||||
'friendlyName': friendlyName,
|
||||
'locale': locale,
|
||||
'confirmed': confirmed,
|
||||
'joinedAt': joinedAt,
|
||||
'emailOnlyAuth': emailOnlyAuth,
|
||||
'hasPassword': hasPassword,
|
||||
'protected': protected,
|
||||
'thumb': thumb,
|
||||
'authToken': authToken,
|
||||
'mailingListActive': mailingListActive,
|
||||
'scrobbleTypes': scrobbleTypes,
|
||||
'country': country,
|
||||
'restricted': restricted,
|
||||
'anonymous': anonymous,
|
||||
'home': home,
|
||||
'guest': guest,
|
||||
'homeSize': homeSize,
|
||||
'homeAdmin': homeAdmin,
|
||||
'maxHomeSize': maxHomeSize,
|
||||
'profile': profile.toJson()['profile'],
|
||||
'twoFactorEnabled': twoFactorEnabled,
|
||||
'backupCodesCreated': backupCodesCreated,
|
||||
'attributionPartner': attributionPartner,
|
||||
};
|
||||
}
|
||||
|
||||
String get displayName => friendlyName ?? title;
|
||||
|
||||
bool get isAdminUser => homeAdmin;
|
||||
bool get isRestrictedUser => restricted;
|
||||
bool get isGuestUser => guest;
|
||||
bool get requiresPassword => hasPassword;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user