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
130 lines
4.7 KiB
Dart
130 lines
4.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core.dart';
|
|
import '../../lidarr.dart';
|
|
|
|
class LidarrSearchResultTile extends StatelessWidget {
|
|
final LidarrReleaseData data;
|
|
|
|
LidarrSearchResultTile({
|
|
Key key,
|
|
@required this.data,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) => LSCardTile(
|
|
title: LSTitle(text: data.title),
|
|
subtitle: RichText(
|
|
text: TextSpan(
|
|
style: TextStyle(
|
|
color: Colors.white70,
|
|
fontSize: 14.0,
|
|
),
|
|
children: <TextSpan>[
|
|
TextSpan(
|
|
text: data.protocol.lsLanguage_Capitalize(),
|
|
style: TextStyle(
|
|
color: data.isTorrent ? Colors.orange : Color(Constants.ACCENT_COLOR),
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
if(data.isTorrent) TextSpan(
|
|
text: '${data.isTorrent ? " (${data.seeders}/${data.leechers})" : ''}',
|
|
style: TextStyle(
|
|
color: Colors.orange,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: '\t•\t${data.ageHours?.lsTime_releaseAgeString() ?? 'Unknown'}\n',
|
|
),
|
|
TextSpan(
|
|
text: '${data.quality ?? 'Unknown'}\t•\t',
|
|
),
|
|
TextSpan(
|
|
text: '${data.size?.lsBytes_BytesToString() ?? 'Unknown'}',
|
|
),
|
|
]
|
|
),
|
|
),
|
|
trailing: InkWell(
|
|
child: LSIconButton(
|
|
icon: data.approved
|
|
? Icons.file_download
|
|
: Icons.report,
|
|
color: data.approved
|
|
? Colors.white
|
|
: LSColors.red,
|
|
onPressed: () async => _trailingOnPressed(context),
|
|
),
|
|
onLongPress: () async => _trailingLongPressed(context),
|
|
),
|
|
onTap: () async => _enterDetails(context),
|
|
padContent: true,
|
|
);
|
|
|
|
Future<void> _trailingOnPressed(BuildContext context) async {
|
|
if(data.approved) {
|
|
await _startDownload()
|
|
.then((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Downloading...',
|
|
message: data.title,
|
|
type: SNACKBAR_TYPE.success,
|
|
showButton: true,
|
|
buttonText: 'Back',
|
|
buttonOnPressed: () => Navigator.of(context).popUntil(ModalRoute.withName(Lidarr.ROUTE_NAME)),
|
|
))
|
|
.catchError((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Failed to Start Downloading',
|
|
message: Constants.CHECK_LOGS_MESSAGE,
|
|
type: SNACKBAR_TYPE.failure,
|
|
));
|
|
} else {
|
|
_showWarnings(context);
|
|
}
|
|
}
|
|
|
|
Future<void> _trailingLongPressed(BuildContext context) async {
|
|
if(!data.approved) {
|
|
List<dynamic> values = await LidarrDialogs.downloadWarning(context);
|
|
if(values[0]) await _startDownload()
|
|
.then((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Downloading...',
|
|
message: data.title,
|
|
type: SNACKBAR_TYPE.success,
|
|
showButton: true,
|
|
buttonText: 'Back',
|
|
buttonOnPressed: () => Navigator.of(context).popUntil(ModalRoute.withName(Lidarr.ROUTE_NAME)),
|
|
))
|
|
.catchError((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Failed to Start Downloading',
|
|
message: Constants.CHECK_LOGS_MESSAGE,
|
|
type: SNACKBAR_TYPE.failure,
|
|
));
|
|
}
|
|
}
|
|
|
|
Future<void> _showWarnings(BuildContext context) async {
|
|
String reject = '';
|
|
for(var i=0; i<data.rejections.length; i++) {
|
|
reject += '${i+1}. ${data.rejections[i]}\n';
|
|
}
|
|
await GlobalDialogs.textPreview(context, 'Rejection Reasons', reject.substring(0, reject.length-1));
|
|
}
|
|
|
|
Future<bool> _startDownload() async {
|
|
LidarrAPI _api = LidarrAPI.from(Database.currentProfileObject);
|
|
return await _api.downloadRelease(data.guid, data.indexerId);
|
|
}
|
|
|
|
Future<void> _enterDetails(BuildContext context) async => Navigator.of(context).pushNamed(
|
|
LidarrSearchDetails.ROUTE_NAME,
|
|
arguments: LidarrSearchDetailsArguments(
|
|
data: data,
|
|
),
|
|
);
|
|
}
|