mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
* [Packages] Updated packages * [Sonarr/Series] Switched to bottom navigation, removed sliver app bar * [Sonarr/Series] Removed bottom padding from overview * [README] Added AltStore, Removed Feedback, Updated Android APK Build (#213) * [Snackbar] Fixed cases where iOS swipe-back would lock UI * [Android/Back Button] Back button now shows drawer on primary routes instead of closing app * [Wake on LAN] Added configuration to hive * [Settings/Modules] Added Wake on LAN section * [Wake on LAN] Added entry to drawer * [Lidarr/Details] Removed sliver app bar, removed fanart, switched to bottom navigation bar * [Radarr/Details] Removed sliver app bar, removed fanart, switched to bottom navigation bar * [Wake on LAN] Show toast on action * [Wake on LAN] Created RawDatagramSocket binding * [WoL] Full support for Wake on LAN functionality * [Semantics] Cleanup * [TestFlight] v2.3.0 (230002) * [Settings/Modules] Implemented settings UI for custom headers * [Custom Headers] Finished UI implementation * [Custom Headers] Integrated into API calls * [TestFlight] v2.3.0 (230003) * [Images] Attach custom headers to all network image requests * [Everything] Many Changes (Read Notes) (#218) - Unified the structure of each module (core, routes, widgets at the root of every module) - Cleaned Most Remaining Dialogs (SABnzbd and NZBGet remain) - Reduced font-size across dialogs - Unified padding across all dialogs (that have been cleaned so far) - Changelog is now a routed page, not a dialog prompt - SABnzbd: Fixed bug where setting priority to "stop" would cause a fatal crash * [Networking] Added RegExp Validation for IPv4 & MAC Addresses * [Networking] Improved network address classes * Finished Dialog Rework * [TestFlight] v2.3.0 (230004) * [README] Updated README for v2.3.0
109 lines
3.9 KiB
Dart
109 lines
3.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core.dart';
|
|
import '../../nzbget.dart';
|
|
|
|
class NZBGetHistoryTile extends StatelessWidget {
|
|
final NZBGetHistoryData data;
|
|
final Function() refresh;
|
|
|
|
NZBGetHistoryTile({
|
|
@required this.data,
|
|
@required this.refresh,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => LSCardTile(
|
|
title: LSTitle(text: data.name),
|
|
subtitle: RichText(
|
|
text: TextSpan(
|
|
style: TextStyle(
|
|
color: Colors.white70,
|
|
),
|
|
children: [
|
|
TextSpan(text: data.completeTime),
|
|
TextSpan(text: '\t•\t'),
|
|
TextSpan(text: data.sizeReadable),
|
|
TextSpan(text: '\n'),
|
|
TextSpan(
|
|
text: data.statusString,
|
|
style: TextStyle(
|
|
color: data.statusColor,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
maxLines: 2,
|
|
overflow: TextOverflow.fade,
|
|
softWrap: false,
|
|
),
|
|
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
|
padContent: true,
|
|
onTap: () async => _enterDetails(context),
|
|
onLongPress: () async => _handlePopup(context),
|
|
);
|
|
|
|
Future<void> _enterDetails(BuildContext context) async {
|
|
final dynamic result = await Navigator.of(context).pushNamed(
|
|
NZBGetHistoryDetails.ROUTE_NAME,
|
|
arguments: NZBGetHistoryDetailsArguments(data: data),
|
|
);
|
|
if(result != null) switch(result[0]) {
|
|
case 'delete': _handleDelete((context), 'History Deleted'); break;
|
|
case 'hide': _handleDelete((context), 'History Hidden'); break;
|
|
default: Logger.warning('NZBGetHistoryTile', '_enterDetails', 'Unknown Case: ${result[0]}');
|
|
}
|
|
}
|
|
|
|
Future<void> _handlePopup(BuildContext context) async {
|
|
List values = await NZBGetDialogs.historySettings(context, data.name);
|
|
if(values[0]) switch(values[1]) {
|
|
case 'retry': {
|
|
await NZBGetAPI.from(Database.currentProfileObject).retryHistoryEntry(data.id)
|
|
.then((_) {
|
|
refresh();
|
|
LSSnackBar(
|
|
context: context,
|
|
title: 'Retrying Job...',
|
|
message: data.name,
|
|
);
|
|
})
|
|
.catchError((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Failed to Retry Job',
|
|
message: Constants.CHECK_LOGS_MESSAGE,
|
|
type: SNACKBAR_TYPE.failure,
|
|
));
|
|
break;
|
|
}
|
|
case 'hide': await NZBGetAPI.from(Database.currentProfileObject).deleteHistoryEntry(data.id, hide: true)
|
|
.then((_) => _handleDelete(context, 'History Hidden'))
|
|
.catchError((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Failed to Hide History',
|
|
message: Constants.CHECK_LOGS_MESSAGE,
|
|
type: SNACKBAR_TYPE.failure,
|
|
));
|
|
break;
|
|
case 'delete': await NZBGetAPI.from(Database.currentProfileObject).deleteHistoryEntry(data.id, hide: true)
|
|
.then((_) => _handleDelete(context, 'History Deleted'))
|
|
.catchError((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Failed to Delete History',
|
|
message: Constants.CHECK_LOGS_MESSAGE,
|
|
type: SNACKBAR_TYPE.failure,
|
|
));
|
|
}
|
|
}
|
|
|
|
void _handleDelete(BuildContext context, String title) {
|
|
LSSnackBar(
|
|
context: context,
|
|
title: title,
|
|
message: data.name,
|
|
type: SNACKBAR_TYPE.success,
|
|
);
|
|
refresh();
|
|
}
|
|
}
|