mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 20:52:32 +00:00
NEW - [Networking] Strict TLS/SSL validation is now disabled globally - [Routing] Hold the AppBar back button to pop back to the home page of the module - [Settings/Sonarr] Toggle to enable Sonarr v3 features - [Sonarr] Complete rewrite of Sonarr - [Sonarr] State is now held across module switches - [Sonarr/Overview] View tags applied to series - [Sonarr/Catalogue] (v3 only) Ability to set and update language profile - [Sonarr/Catalogue] Ability to view all, only monitored, or only unmonitored series - [Sonarr/Releases] (v3 only) Ability to interactively search for season packs - [Sonarr/Releases] Ability to view all, only approved, or only rejected releases TWEAKS - [Settings] Removed all toggles for strict TLS - [Sonarr] Many tweaks to Sonarr's design - [Sonarr/Add] (v3 only) Tapping an already-added series will take you to the series page - [Sonarr/Add] Automatically navigate to newly added series - [Sonarr/Series] Toggling monitored state of series has now been moved to the edit prompt FIXES - [Images] Images will now load for invalid/self-signed certificates - [Tautulli/Activity] Fix grey screen for music activity - [TextField] Fix TextField actions (cut, copy, paste, etc.) not showing - [Timestamps] Fix 12:xx AM being shown as 00:xx AM - Additional small bug fixes
76 lines
3.1 KiB
Dart
76 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core.dart';
|
|
import 'package:lunasea/modules/lidarr.dart';
|
|
|
|
class LidarrDetailsEditButton extends StatefulWidget {
|
|
final LidarrCatalogueData data;
|
|
final Function(bool) remove;
|
|
|
|
LidarrDetailsEditButton({
|
|
@required this.data,
|
|
@required this.remove,
|
|
});
|
|
|
|
@override
|
|
State<LidarrDetailsEditButton> createState() => _State();
|
|
}
|
|
|
|
class _State extends State<LidarrDetailsEditButton> {
|
|
@override
|
|
Widget build(BuildContext context) => Consumer<LidarrState>(
|
|
builder: (context, model, widget) => LSIconButton(
|
|
icon: Icons.edit,
|
|
onPressed: () async => _handlePopup(context),
|
|
),
|
|
);
|
|
|
|
Future<void> _handlePopup(BuildContext context) async {
|
|
List<dynamic> values = await LidarrDialogs.editArtist(context, widget.data);
|
|
if(values[0]) switch(values[1]) {
|
|
case 'refresh_artist': _refreshArtist(context); break;
|
|
case 'edit_artist': _enterEditArtist(context); break;
|
|
case 'remove_artist': _removeArtist(context); break;
|
|
default: LunaLogger.warning('LidarrDetailsEditButton', '_handlePopup', 'Invalid method passed through popup. (${values[1]})');
|
|
}
|
|
}
|
|
|
|
Future<void> _enterEditArtist(BuildContext context) async {
|
|
final dynamic result = await Navigator.of(context).pushNamed(
|
|
LidarrEditArtist.ROUTE_NAME,
|
|
arguments: LidarrEditArtistArguments(entry: widget.data),
|
|
);
|
|
if(result != null && result[0]) LSSnackBar(
|
|
context: context,
|
|
title: 'Updated',
|
|
message: widget.data.title,
|
|
type: SNACKBAR_TYPE.success,
|
|
);
|
|
}
|
|
|
|
Future<void> _refreshArtist(BuildContext context) async {
|
|
final _api = LidarrAPI.from(Database.currentProfileObject);
|
|
await _api.refreshArtist(widget.data.artistID)
|
|
.then((_) => LSSnackBar(context: context, title: 'Refreshing...', message: widget.data.title))
|
|
.catchError((_) => LSSnackBar(context: context, title: 'Failed to Refresh', message: Constants.CHECK_LOGS_MESSAGE, type: SNACKBAR_TYPE.failure));
|
|
}
|
|
|
|
Future<void> _removeArtist(BuildContext context) async {
|
|
final _api = LidarrAPI.from(Database.currentProfileObject);
|
|
List values = await LidarrDialogs.deleteArtist(context);
|
|
if(values[0]) {
|
|
if(values[1]) {
|
|
values = await LunaDialogs.deleteCatalogueWithFiles(context, widget.data.title);
|
|
if(values[0]) {
|
|
await _api.removeArtist(widget.data.artistID, deleteFiles: true)
|
|
.then((_) => widget.remove(true))
|
|
.catchError((_) => LSSnackBar(context: context, title: 'Failed to Remove (With Data)', message: Constants.CHECK_LOGS_MESSAGE, type: SNACKBAR_TYPE.failure));
|
|
}
|
|
} else {
|
|
await _api.removeArtist(widget.data.artistID)
|
|
.then((_) => widget.remove(false))
|
|
.catchError((_) => LSSnackBar(context: context, title: 'Failed to Remove', message: Constants.CHECK_LOGS_MESSAGE, type: SNACKBAR_TYPE.failure));
|
|
}
|
|
}
|
|
}
|
|
}
|