mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
[Release/TestFlight] v4.1.0+40100001 (#266)
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
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/adapter.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
@@ -28,7 +25,7 @@ class CalendarAPI extends API {
|
||||
|
||||
void logError(String methodName, String text, Object error, StackTrace trace, {
|
||||
bool uploadToSentry = true,
|
||||
}) => Logger.error(
|
||||
}) => LunaLogger.error(
|
||||
'package:lunasea/core/api/calendar/api.dart',
|
||||
methodName,
|
||||
'Home: $text',
|
||||
@@ -37,7 +34,7 @@ class CalendarAPI extends API {
|
||||
uploadToSentry: uploadToSentry,
|
||||
);
|
||||
|
||||
void logWarning(String methodName, String text) => Logger.warning(
|
||||
void logWarning(String methodName, String text) => LunaLogger.warning(
|
||||
'package:lunasea/core/api/calendar/api.dart',
|
||||
methodName,
|
||||
'Home: $text',
|
||||
@@ -80,11 +77,6 @@ class CalendarAPI extends API {
|
||||
maxRedirects: 5,
|
||||
),
|
||||
);
|
||||
if(!lidarr['strict_tls']) {
|
||||
(_client.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
};
|
||||
}
|
||||
Response response = await _client.get('calendar');
|
||||
if(response.data.length > 0) {
|
||||
for(var entry in response.data) {
|
||||
@@ -126,11 +118,6 @@ class CalendarAPI extends API {
|
||||
maxRedirects: 5,
|
||||
),
|
||||
);
|
||||
if(!radarr['strict_tls']) {
|
||||
(_client.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
};
|
||||
}
|
||||
Response response = await _client.get('calendar');
|
||||
if(response.data.length > 0) {
|
||||
for(var entry in response.data) {
|
||||
@@ -173,11 +160,6 @@ class CalendarAPI extends API {
|
||||
maxRedirects: 5,
|
||||
),
|
||||
);
|
||||
if(!sonarr['strict_tls']) {
|
||||
(_client.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
};
|
||||
}
|
||||
Response response = await _client.get('calendar');
|
||||
if(response.data.length > 0) {
|
||||
for(var entry in response.data) {
|
||||
|
||||
@@ -48,7 +48,7 @@ class CalendarLidarrData extends CalendarData {
|
||||
text: '\nDownloaded',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -43,7 +43,7 @@ class CalendarRadarrData extends CalendarData {
|
||||
text: '\nDownloaded ($fileQualityProfile)',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -52,7 +52,7 @@ class CalendarSonarrData extends CalendarData {
|
||||
text: '\nDownloaded ($fileQualityProfile)',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -66,12 +66,9 @@ class CalendarSonarrData extends CalendarData {
|
||||
: '';
|
||||
}
|
||||
|
||||
Future<void> enterContent(BuildContext context) async => Navigator.of(context).pushNamed(
|
||||
SonarrDetailsSeries.ROUTE_NAME,
|
||||
arguments: SonarrDetailsSeriesArguments(
|
||||
data: null,
|
||||
seriesID: seriesID,
|
||||
),
|
||||
Future<void> enterContent(BuildContext context) async => SonarrSeriesDetailsRouter.navigateTo(
|
||||
context,
|
||||
seriesId: seriesID,
|
||||
);
|
||||
|
||||
Widget trailing(BuildContext context) => InkWell(
|
||||
@@ -98,23 +95,40 @@ class CalendarSonarrData extends CalendarData {
|
||||
if(airTimeObject != null) {
|
||||
return LunaSeaDatabaseValue.USE_24_HOUR_TIME.data
|
||||
? DateFormat.Hm().format(airTimeObject)
|
||||
: DateFormat('KK:mm\na').format(airTimeObject);
|
||||
: DateFormat('hh:mm\na').format(airTimeObject);
|
||||
}
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> trailingOnPress(BuildContext context) async {
|
||||
await SonarrAPI.from(Database.currentProfileObject).searchEpisodes([id])
|
||||
.then((_) => LSSnackBar(context: context, title: 'Searching...', message: episodeTitle))
|
||||
.catchError((_) => LSSnackBar(context: context, title: 'Failed to Search', message: Constants.CHECK_LOGS_MESSAGE, type: SNACKBAR_TYPE.failure));
|
||||
if(context.read<SonarrState>().api != null) context.read<SonarrState>().api.command.episodeSearch(episodeIds: [id])
|
||||
.then((_) => LSSnackBar(
|
||||
context: context,
|
||||
title: 'Searching for Episode...',
|
||||
message: episodeTitle,
|
||||
type: SNACKBAR_TYPE.success,
|
||||
))
|
||||
.catchError((error, stack) {
|
||||
LunaLogger.error(
|
||||
'CalendarSonarrData',
|
||||
'trailingOnPress',
|
||||
'Failed to search for episode: $id',
|
||||
error,
|
||||
stack,
|
||||
uploadToSentry: !(error is DioError),
|
||||
);
|
||||
LSSnackBar(
|
||||
context: context,
|
||||
title: 'Failed to Search',
|
||||
type: SNACKBAR_TYPE.failure,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> trailingOnLongPress(BuildContext context) async => Navigator.of(context).pushNamed(
|
||||
SonarrSearchResults.ROUTE_NAME,
|
||||
arguments: SonarrSearchResultsArguments(
|
||||
episodeID: id,
|
||||
title: episodeTitle,
|
||||
),
|
||||
Future<void> trailingOnLongPress(BuildContext context) async => SonarrReleasesRouter.navigateTo(
|
||||
context,
|
||||
episodeId: id,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ class HomeConstants {
|
||||
|
||||
static const MODULE_KEY = 'home';
|
||||
|
||||
static const ModuleMap MODULE_MAP = ModuleMap(
|
||||
static const LunaModuleMap MODULE_MAP = LunaModuleMap(
|
||||
name: 'Home',
|
||||
description: 'Home',
|
||||
settingsDescription: 'Configure the Home Screen',
|
||||
icon: CustomIcons.home,
|
||||
route: '/',
|
||||
color: Color(Constants.ACCENT_COLOR),
|
||||
color: Color(LunaColours.ACCENT_COLOR),
|
||||
);
|
||||
|
||||
//ignore: non_constant_identifier_names
|
||||
|
||||
@@ -23,7 +23,7 @@ class HomeDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: HomeNavigationBar.titles[index],
|
||||
icon: HomeNavigationBar.icons[index],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, index),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,36 +1,2 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
|
||||
class HomeState extends ChangeNotifier {
|
||||
HomeState() {
|
||||
reset(initialize: true);
|
||||
}
|
||||
|
||||
/// Reset the state of Home back to the default
|
||||
///
|
||||
/// If `initialize` is true, resets everything.
|
||||
/// If false, the navigation index, etc. are not reset.
|
||||
void reset({ bool initialize = false }) {
|
||||
if(initialize) {
|
||||
_navigationIndex = HomeDatabaseValue.NAVIGATION_INDEX.data;
|
||||
_calendarStartingType = HomeDatabaseValue.CALENDAR_STARTING_TYPE.data;
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
int _navigationIndex;
|
||||
int get navigationIndex => _navigationIndex;
|
||||
set navigationIndex(int navigationIndex) {
|
||||
assert(navigationIndex != null);
|
||||
_navigationIndex = navigationIndex;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
CalendarStartingType _calendarStartingType;
|
||||
CalendarStartingType get calendarStartingType => _calendarStartingType;
|
||||
set calendarStartingType(CalendarStartingType calendarStartingType) {
|
||||
assert(calendarStartingType != null);
|
||||
_calendarStartingType = calendarStartingType;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
export 'state/global.dart';
|
||||
export 'state/local.dart';
|
||||
|
||||
23
lib/modules/home/core/state/global.dart
Normal file
23
lib/modules/home/core/state/global.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
|
||||
class HomeState extends LunaGlobalState {
|
||||
@override
|
||||
void reset() {}
|
||||
|
||||
int _navigationIndex = HomeDatabaseValue.NAVIGATION_INDEX.data;
|
||||
int get navigationIndex => _navigationIndex;
|
||||
set navigationIndex(int navigationIndex) {
|
||||
assert(navigationIndex != null);
|
||||
_navigationIndex = navigationIndex;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
CalendarStartingType _calendarStartingType = HomeDatabaseValue.CALENDAR_STARTING_TYPE.data;
|
||||
CalendarStartingType get calendarStartingType => _calendarStartingType;
|
||||
set calendarStartingType(CalendarStartingType calendarStartingType) {
|
||||
assert(calendarStartingType != null);
|
||||
_calendarStartingType = calendarStartingType;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
0
lib/modules/home/core/state/local.dart
Normal file
0
lib/modules/home/core/state/local.dart
Normal file
@@ -19,7 +19,7 @@ class _State extends State<Home> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
HomescreenActions.initialize(context);
|
||||
LunaQuickActions.initialize(context);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -56,8 +56,11 @@ class _State extends State<Home> {
|
||||
|
||||
Widget get _drawer => LSDrawer(page: 'home');
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
title: Constants.APPLICATION_NAME,
|
||||
popUntil: null,
|
||||
hideLeading: true,
|
||||
actions: Database.currentProfileObject.anyAutomationEnabled
|
||||
? <Widget>[
|
||||
Selector<HomeState, Tuple2<int, CalendarStartingType>>(
|
||||
|
||||
@@ -49,7 +49,7 @@ class _State extends State<HomeQuickAccess> with AutomaticKeepAliveClientMixin {
|
||||
route: Constants.MODULE_MAP[SettingsConstants.MODULE_KEY].route,
|
||||
color: Constants.MODULE_MAP[SettingsConstants.MODULE_KEY].color,
|
||||
);
|
||||
ModuleMap data = Constants.MODULE_MAP[widget.profile.enabledModules[_hasIndexers ? index-1 : index]];
|
||||
LunaModuleMap data = Constants.MODULE_MAP[widget.profile.enabledModules[_hasIndexers ? index-1 : index]];
|
||||
if(data != null) return HomeSummaryTile(
|
||||
title: data.name,
|
||||
subtitle: data.description,
|
||||
|
||||
@@ -30,7 +30,7 @@ class _State extends State<HomeCalendarWidget> with TickerProviderStateMixin {
|
||||
fontSize: Constants.UI_FONT_SIZE_SUBTITLE,
|
||||
);
|
||||
final TextStyle weekdayTitleStyle = TextStyle(
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: Constants.UI_FONT_SIZE_SUBTITLE,
|
||||
);
|
||||
@@ -69,7 +69,6 @@ class _State extends State<HomeCalendarWidget> with TickerProviderStateMixin {
|
||||
child: Column(
|
||||
children: [
|
||||
_calendar,
|
||||
LSDivider(),
|
||||
_list,
|
||||
],
|
||||
),
|
||||
@@ -92,9 +91,9 @@ class _State extends State<HomeCalendarWidget> with TickerProviderStateMixin {
|
||||
events: widget.events,
|
||||
startingDayOfWeek: (HomeDatabaseValue.CALENDAR_STARTING_DAY.data as CalendarStartingDay).data,
|
||||
calendarStyle: CalendarStyle(
|
||||
selectedColor: LSColors.accent.withOpacity(0.25),
|
||||
selectedColor: LunaColours.accent.withOpacity(0.25),
|
||||
markersMaxAmount: 1,
|
||||
markersColor: LSColors.accent,
|
||||
markersColor: LunaColours.accent,
|
||||
weekendStyle: dayTileStyle,
|
||||
weekdayStyle: dayTileStyle,
|
||||
outsideStyle: outsideDayTileStyle,
|
||||
@@ -102,7 +101,7 @@ class _State extends State<HomeCalendarWidget> with TickerProviderStateMixin {
|
||||
outsideWeekendStyle: outsideDayTileStyle,
|
||||
renderDaysOfWeek: true,
|
||||
highlightToday: true,
|
||||
todayColor: LSColors.primary,
|
||||
todayColor: LunaColours.primary,
|
||||
todayStyle: dayTileStyle,
|
||||
outsideDaysVisible: false,
|
||||
),
|
||||
|
||||
@@ -30,9 +30,9 @@ class HomeSummaryTile extends StatelessWidget {
|
||||
icon: icon,
|
||||
color: HomeDatabaseValue.MODULES_BRAND_COLOURS.data
|
||||
? color
|
||||
: LSColors.list(index),
|
||||
: LunaColours.list(index),
|
||||
),
|
||||
onTap: () async => BIOS.navigatorKey.currentState.pushNamedAndRemoveUntil(route, (Route<dynamic> route) => false),
|
||||
onTap: () async => LunaBIOS.navigatorKey.currentState.pushNamedAndRemoveUntil(route, (Route<dynamic> route) => false),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -2,5 +2,5 @@ export 'core/api.dart';
|
||||
export 'core/constants.dart';
|
||||
export 'core/database.dart';
|
||||
export 'core/dialogs.dart';
|
||||
export 'core/state_global.dart';
|
||||
export 'core/state.dart';
|
||||
export 'core/sorting.dart';
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
import 'package:dio/adapter.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/lidarr.dart';
|
||||
@@ -25,18 +23,13 @@ class LidarrAPI extends API {
|
||||
maxRedirects: 5,
|
||||
),
|
||||
);
|
||||
if(!profile.getLidarr()['strict_tls']) {
|
||||
(_client.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
};
|
||||
}
|
||||
return LidarrAPI._internal(
|
||||
profile.getLidarr(),
|
||||
_client,
|
||||
);
|
||||
}
|
||||
|
||||
void logWarning(String methodName, String text) => Logger.warning(
|
||||
void logWarning(String methodName, String text) => LunaLogger.warning(
|
||||
'package:lunasea/core/api/lidarr/api.dart',
|
||||
methodName,
|
||||
'Lidarr: $text',
|
||||
@@ -44,7 +37,7 @@ class LidarrAPI extends API {
|
||||
|
||||
void logError(String methodName, String text, Object error, StackTrace trace, {
|
||||
bool uploadToSentry = true,
|
||||
}) => Logger.error(
|
||||
}) => LunaLogger.error(
|
||||
'package:lunasea/core/api/lidarr/api.dart',
|
||||
methodName,
|
||||
'Lidarr: $text',
|
||||
|
||||
@@ -57,7 +57,7 @@ class LidarrHistoryDataGeneric extends LidarrHistoryData {
|
||||
TextSpan(
|
||||
text: '$eventType',
|
||||
style: TextStyle(
|
||||
color: LSColors.purple,
|
||||
color: LunaColours.purple,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -111,7 +111,7 @@ class LidarrHistoryDataTrackFileImported extends LidarrHistoryData {
|
||||
TextSpan(
|
||||
text: '${LidarrConstants.EVENT_TYPE_MESSAGES[eventType]} ($quality)',
|
||||
style: TextStyle(
|
||||
color: Color(Constants.ACCENT_COLOR),
|
||||
color: Color(LunaColours.ACCENT_COLOR),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
@@ -138,7 +138,7 @@ class LidarrHistoryDataDownloadImported extends LidarrHistoryData {
|
||||
TextSpan(
|
||||
text: '${LidarrConstants.EVENT_TYPE_MESSAGES[eventType]} ($quality)',
|
||||
style: TextStyle(
|
||||
color: Color(Constants.ACCENT_COLOR),
|
||||
color: Color(LunaColours.ACCENT_COLOR),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
@@ -213,7 +213,7 @@ class LidarrHistoryDataTrackFileRenamed extends LidarrHistoryData {
|
||||
TextSpan(
|
||||
text: '${LidarrConstants.EVENT_TYPE_MESSAGES[eventType]}',
|
||||
style: TextStyle(
|
||||
color: Color(Constants.ACCENT_COLOR),
|
||||
color: Color(LunaColours.ACCENT_COLOR),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ class LidarrTrackData {
|
||||
return TextSpan(
|
||||
text: 'Downloaded',
|
||||
style: TextStyle(
|
||||
color: monitored ? Color(Constants.ACCENT_COLOR) : Color(Constants.ACCENT_COLOR).withOpacity(0.30),
|
||||
color: monitored ? Color(LunaColours.ACCENT_COLOR) : Color(LunaColours.ACCENT_COLOR).withOpacity(0.30),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ class LidarrConstants {
|
||||
|
||||
static const MODULE_KEY = 'lidarr';
|
||||
|
||||
static const ModuleMap MODULE_MAP = ModuleMap(
|
||||
static const LunaModuleMap MODULE_MAP = LunaModuleMap(
|
||||
name: 'Lidarr',
|
||||
description: 'Manage Music',
|
||||
settingsDescription: 'Configure Lidarr',
|
||||
|
||||
@@ -22,7 +22,7 @@ class LidarrDialogs {
|
||||
qualities.length,
|
||||
(index) => LSDialog.tile(
|
||||
icon: Icons.portrait,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
text: qualities[index].name,
|
||||
onTap: () => _setValues(true, qualities[index]),
|
||||
),
|
||||
@@ -49,7 +49,7 @@ class LidarrDialogs {
|
||||
metadatas.length,
|
||||
(index) => LSDialog.tile(
|
||||
icon: Icons.portrait,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
text: metadatas[index].name,
|
||||
onTap: () => _setValues(true, metadatas[index]),
|
||||
),
|
||||
@@ -75,12 +75,12 @@ class LidarrDialogs {
|
||||
buttons: [
|
||||
LSDialog.button(
|
||||
text: 'Remove + Files',
|
||||
textColor: LSColors.red,
|
||||
textColor: LunaColours.red,
|
||||
onPressed: () => _setValues(true, true),
|
||||
),
|
||||
LSDialog.button(
|
||||
text: 'Remove',
|
||||
textColor: LSColors.red,
|
||||
textColor: LunaColours.red,
|
||||
onPressed: () => _setValues(true, false),
|
||||
),
|
||||
],
|
||||
@@ -164,7 +164,7 @@ class LidarrDialogs {
|
||||
_options.length,
|
||||
(index) => LSDialog.tile(
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
text: _options[index][0],
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
@@ -197,7 +197,7 @@ class LidarrDialogs {
|
||||
],
|
||||
),
|
||||
icon: Icons.folder,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, folders[index]),
|
||||
),
|
||||
),
|
||||
@@ -231,7 +231,7 @@ class LidarrDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -258,7 +258,7 @@ class LidarrDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: LidarrNavigationBar.titles[index],
|
||||
icon: LidarrNavigationBar.icons[index],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, index),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -46,7 +46,7 @@ extension LidarrCatalogueSortingExtension on LidarrCatalogueSorting {
|
||||
) => _sorter.byType(data, this, ascending);
|
||||
}
|
||||
|
||||
class _Sorter extends Sorter<LidarrCatalogueSorting> {
|
||||
class _Sorter extends LunaSorter<LidarrCatalogueSorting> {
|
||||
@override
|
||||
List byType(
|
||||
List data,
|
||||
|
||||
@@ -43,7 +43,7 @@ extension LidarrReleasesSortingExtension on LidarrReleasesSorting {
|
||||
) => _sorter.byType(data, this, ascending);
|
||||
}
|
||||
|
||||
class _Sorter extends Sorter<LidarrReleasesSorting> {
|
||||
class _Sorter extends LunaSorter<LidarrReleasesSorting> {
|
||||
@override
|
||||
List byType(
|
||||
List data,
|
||||
|
||||
2
lib/modules/lidarr/core/state.dart
Normal file
2
lib/modules/lidarr/core/state.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'state/global.dart';
|
||||
export 'state/local.dart';
|
||||
@@ -1,9 +1,15 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/lidarr.dart';
|
||||
|
||||
class LidarrModel extends ChangeNotifier {
|
||||
///Catalogue Sticky Header Content
|
||||
class LidarrState extends LunaGlobalState {
|
||||
LidarrState() {
|
||||
reset();
|
||||
}
|
||||
|
||||
@override
|
||||
void reset() {}
|
||||
|
||||
///Catalogue Sticky Header Content
|
||||
String _searchCatalogueFilter = '';
|
||||
String get searchCatalogueFilter => _searchCatalogueFilter;
|
||||
set searchCatalogueFilter(String searchCatalogueFilter) {
|
||||
0
lib/modules/lidarr/core/state/local.dart
Normal file
0
lib/modules/lidarr/core/state/local.dart
Normal file
@@ -101,8 +101,10 @@ class _State extends State<LidarrAddDetails> {
|
||||
|
||||
Widget get _appBar => _arguments == null
|
||||
? null
|
||||
: LSAppBar(
|
||||
: LunaAppBar(
|
||||
context: context,
|
||||
title: _arguments.data.title,
|
||||
popUntil: '/lidarr',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.link,
|
||||
@@ -147,7 +149,6 @@ class _State extends State<LidarrAddDetails> {
|
||||
squareImage: true,
|
||||
headers: Database.currentProfileObject.getLidarr()['headers'],
|
||||
),
|
||||
LSDivider(),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LidarrDatabaseValue.ADD_MONITORED.key]),
|
||||
builder: (context, box, widget) {
|
||||
@@ -219,7 +220,6 @@ class _State extends State<LidarrAddDetails> {
|
||||
);
|
||||
},
|
||||
),
|
||||
LSDivider(),
|
||||
LSContainerRow(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
@@ -232,7 +232,7 @@ class _State extends State<LidarrAddDetails> {
|
||||
Expanded(
|
||||
child: LSButton(
|
||||
text: 'Add + Search',
|
||||
backgroundColor: LSColors.orange,
|
||||
backgroundColor: LunaColours.orange,
|
||||
onTap: () async => _addArtist(true),
|
||||
reducedMargin: true,
|
||||
),
|
||||
|
||||
@@ -31,7 +31,7 @@ class _State extends State<LidarrAddSearch> {
|
||||
);
|
||||
|
||||
Future<void> _refresh() async {
|
||||
final _model = Provider.of<LidarrModel>(context, listen: false);
|
||||
final _model = Provider.of<LidarrState>(context, listen: false);
|
||||
final _api = LidarrAPI.from(Database.currentProfileObject);
|
||||
setState(() {
|
||||
_future = _api.searchArtists(_model.addSearchQuery);
|
||||
@@ -44,7 +44,11 @@ class _State extends State<LidarrAddSearch> {
|
||||
.catchError((_) => _availableIDs = []);
|
||||
}
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Add Artist');
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
title: 'Add Artist',
|
||||
popUntil: '/lidarr',
|
||||
);
|
||||
|
||||
Widget get _body => LSRefreshIndicator(
|
||||
refreshKey: _refreshKey,
|
||||
|
||||
@@ -37,7 +37,7 @@ class _State extends State<LidarrCatalogue> with AutomaticKeepAliveClientMixin {
|
||||
final _api = LidarrAPI.from(Database.currentProfileObject);
|
||||
if(mounted) setState(() => { _future = _api.getAllArtists() });
|
||||
//Clear the search filter using a microtask
|
||||
Future.microtask(() => Provider.of<LidarrModel>(context, listen: false)?.searchCatalogueFilter = '');
|
||||
Future.microtask(() => Provider.of<LidarrState>(context, listen: false)?.searchCatalogueFilter = '');
|
||||
}
|
||||
|
||||
void _refreshState() => setState(() {});
|
||||
@@ -91,7 +91,7 @@ class _State extends State<LidarrCatalogue> with AutomaticKeepAliveClientMixin {
|
||||
buttonText: 'Refresh',
|
||||
onTapHandler: () => _refresh(),
|
||||
)
|
||||
: Consumer<LidarrModel>(
|
||||
: Consumer<LidarrState>(
|
||||
builder: (context, model, widget) {
|
||||
//Filter and sort the results
|
||||
List<LidarrCatalogueData> _filtered = _sort(model, _filter(model.searchCatalogueFilter));
|
||||
@@ -129,8 +129,8 @@ class _State extends State<LidarrCatalogue> with AutomaticKeepAliveClientMixin {
|
||||
: entry.title.toLowerCase().contains(filter.toLowerCase())
|
||||
).toList();
|
||||
|
||||
List<LidarrCatalogueData> _sort(LidarrModel model, List<LidarrCatalogueData> data) {
|
||||
if(data != null && data.length != 0) return model.sortCatalogueType.sort(data, model.sortCatalogueAscending);
|
||||
List<LidarrCatalogueData> _sort(LidarrState state, List<LidarrCatalogueData> data) {
|
||||
if(data != null && data.length != 0) return state.sortCatalogueType.sort(data, state.sortCatalogueAscending);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ class _State extends State<LidarrDetailsAlbum> {
|
||||
appBar: _appBar,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/lidarr',
|
||||
title: _arguments == null ? 'Details Album' : _arguments.title,
|
||||
actions: <Widget>[
|
||||
InkWell(
|
||||
|
||||
@@ -31,7 +31,7 @@ class _State extends State<LidarrDetailsArtist> {
|
||||
super.initState();
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
_arguments = ModalRoute.of(context).settings.arguments;
|
||||
Provider.of<LidarrModel>(context, listen: false).artistNavigationIndex = 1;
|
||||
Provider.of<LidarrState>(context, listen: false).artistNavigationIndex = 1;
|
||||
_fetch();
|
||||
});
|
||||
}
|
||||
@@ -65,7 +65,9 @@ class _State extends State<LidarrDetailsArtist> {
|
||||
: null,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/lidarr',
|
||||
title: _arguments == null || _arguments.data == null
|
||||
? 'Artist Details'
|
||||
: _arguments.data.title,
|
||||
@@ -93,7 +95,7 @@ class _State extends State<LidarrDetailsArtist> {
|
||||
onPageChanged: _onPageChanged,
|
||||
);
|
||||
|
||||
void _onPageChanged(int index) => Provider.of<LidarrModel>(context, listen: false).artistNavigationIndex = index;
|
||||
void _onPageChanged(int index) => Provider.of<LidarrState>(context, listen: false).artistNavigationIndex = index;
|
||||
|
||||
Future<void> _removeCallback(bool withData) async => Navigator.of(context).pop(['remove_artist', withData]);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,11 @@ class _State extends State<LidarrEditArtist> {
|
||||
.catchError((error) => Future.error(error));
|
||||
}
|
||||
|
||||
Widget get _appBar => LSAppBar(title: _arguments?.entry?.title ?? 'Edit Artist');
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/lidarr',
|
||||
title: _arguments?.entry?.title ?? 'Edit Artist',
|
||||
);
|
||||
|
||||
Widget get _body => FutureBuilder(
|
||||
future: _future,
|
||||
@@ -147,7 +151,6 @@ class _State extends State<LidarrEditArtist> {
|
||||
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
||||
onTap: () => _changeMetadata(),
|
||||
),
|
||||
LSDivider(),
|
||||
LSButton(
|
||||
text: 'Update Artist',
|
||||
onTap: () async => _save().catchError((_) {}),
|
||||
@@ -156,7 +159,7 @@ class _State extends State<LidarrEditArtist> {
|
||||
);
|
||||
|
||||
Future<void> _changePath() async {
|
||||
List<dynamic> _values = await GlobalDialogs.editText(context, 'Artist Path', prefill: _path);
|
||||
List<dynamic> _values = await LunaDialogs.editText(context, 'Artist Path', prefill: _path);
|
||||
if(_values[0] && mounted) setState(() => _path = _values[1]);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class _State extends State<Lidarr> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Future.microtask(() => Provider.of<LidarrModel>(context, listen: false).navigationIndex = 0);
|
||||
Future.microtask(() => Provider.of<LidarrState>(context, listen: false).navigationIndex = 0);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -102,7 +102,7 @@ class _State extends State<Lidarr> {
|
||||
);
|
||||
|
||||
Future<void> _enterAddArtist() async {
|
||||
final _model = Provider.of<LidarrModel>(context, listen: false);
|
||||
final _model = Provider.of<LidarrState>(context, listen: false);
|
||||
_model.addSearchQuery = '';
|
||||
final dynamic result = await Navigator.of(context).pushNamed(LidarrAddSearch.ROUTE_NAME);
|
||||
if(result != null) switch(result[0]) {
|
||||
@@ -124,7 +124,7 @@ class _State extends State<Lidarr> {
|
||||
_refreshAllPages();
|
||||
break;
|
||||
}
|
||||
default: Logger.warning('Lidarr', '_enterAddArtist', 'Unknown Case: ${result[0]}');
|
||||
default: LunaLogger.warning('Lidarr', '_enterAddArtist', 'Unknown Case: ${result[0]}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,11 +151,11 @@ class _State extends State<Lidarr> {
|
||||
.catchError((_) => LSSnackBar(context: context, title: 'Failed to Search', message: Constants.CHECK_LOGS_MESSAGE, type: SNACKBAR_TYPE.failure));
|
||||
break;
|
||||
}
|
||||
default: Logger.warning('Lidarr', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
default: LunaLogger.warning('Lidarr', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
}
|
||||
}
|
||||
|
||||
void _onPageChanged(int index) => Provider.of<LidarrModel>(context, listen: false).navigationIndex = index;
|
||||
void _onPageChanged(int index) => Provider.of<LidarrState>(context, listen: false).navigationIndex = index;
|
||||
|
||||
void _refreshProfile() {
|
||||
_api = LidarrAPI.from(Database.currentProfileObject);
|
||||
|
||||
@@ -43,7 +43,7 @@ class _State extends State<LidarrSearchResults> {
|
||||
final _api = LidarrAPI.from(Database.currentProfileObject);
|
||||
setState(() => { _future = _api.getReleases(_arguments.albumID) });
|
||||
//Clear the search filter using a microtask
|
||||
Future.microtask(() => Provider.of<LidarrModel>(context, listen: false)?.searchReleasesFilter = '');
|
||||
Future.microtask(() => Provider.of<LidarrState>(context, listen: false)?.searchReleasesFilter = '');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -55,7 +55,11 @@ class _State extends State<LidarrSearchResults> {
|
||||
|
||||
Widget get _appBar => _arguments == null
|
||||
? null
|
||||
: LSAppBar(title: _arguments.title);
|
||||
: LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/lidarr',
|
||||
title: _arguments.title,
|
||||
);
|
||||
|
||||
Widget get _body => _arguments == null
|
||||
? null
|
||||
@@ -97,7 +101,7 @@ class _State extends State<LidarrSearchResults> {
|
||||
buttonText: 'Refresh',
|
||||
onTapHandler: () => _refresh(),
|
||||
)
|
||||
: Consumer<LidarrModel>(
|
||||
: Consumer<LidarrState>(
|
||||
builder: (context, model, widget) {
|
||||
List<LidarrReleaseData> _filtered = _sort(model, _filter(model.searchReleasesFilter));
|
||||
_filtered = model.hideRejectedReleases ? _hide(_filtered) : _filtered;
|
||||
@@ -129,8 +133,8 @@ class _State extends State<LidarrSearchResults> {
|
||||
: entry.title.toLowerCase().contains(filter.toLowerCase())
|
||||
).toList();
|
||||
|
||||
List<LidarrReleaseData> _sort(LidarrModel model, List<LidarrReleaseData> data) {
|
||||
if(data != null && data.length != 0) return model.sortReleasesType.sort(data, model.sortReleasesAscending);
|
||||
List<LidarrReleaseData> _sort(LidarrState state, List<LidarrReleaseData> data) {
|
||||
if(data != null && data.length != 0) return state.sortReleasesType.sort(data, state.sortReleasesAscending);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ class _State extends State<LidarrAddSearchBar> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final model = Provider.of<LidarrModel>(context, listen: false);
|
||||
final model = Provider.of<LidarrState>(context, listen: false);
|
||||
_controller.text = model.addSearchQuery;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Expanded(
|
||||
child: Consumer<LidarrModel>(
|
||||
child: Consumer<LidarrState>(
|
||||
builder: (context, model, widget) => LSTextInputBar(
|
||||
controller: _controller,
|
||||
autofocus: true,
|
||||
@@ -36,8 +36,8 @@ class _State extends State<LidarrAddSearchBar> {
|
||||
),
|
||||
);
|
||||
|
||||
void _onChange(LidarrModel model, String text, bool updateController) {
|
||||
model.addSearchQuery = text;
|
||||
void _onChange(LidarrState state, String text, bool updateController) {
|
||||
state.addSearchQuery = text;
|
||||
if(updateController) _controller.text = text;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class LidarrAddSearchResultTile extends StatelessWidget {
|
||||
);
|
||||
if(result != null) switch(result[0]) {
|
||||
case 'artist_added': Navigator.of(context).pop(result); break;
|
||||
default: Logger.warning('LidarrAddSearchResultTile', '_enterDetails', 'Unknown Case: ${result[0]}');
|
||||
default: LunaLogger.warning('LidarrAddSearchResultTile', '_enterDetails', 'Unknown Case: ${result[0]}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ class _State extends State<LidarrArtistNavigationBar> {
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Selector<LidarrModel, int>(
|
||||
selector: (_, model) => model.artistNavigationIndex,
|
||||
Widget build(BuildContext context) => Selector<LidarrState, int>(
|
||||
selector: (_, state) => state.artistNavigationIndex,
|
||||
builder: (context, index, _) => LSBottomNavigationBar(
|
||||
index: index,
|
||||
icons: _navbarIcons,
|
||||
@@ -41,6 +41,6 @@ class _State extends State<LidarrArtistNavigationBar> {
|
||||
index,
|
||||
duration: Duration(milliseconds: Constants.UI_NAVIGATION_SPEED),
|
||||
curve: Curves.easeOutSine,
|
||||
).then((_) => Provider.of<LidarrModel>(context, listen: false).artistNavigationIndex = index);
|
||||
).then((_) => Provider.of<LidarrState>(context, listen: false).artistNavigationIndex = index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class LidarrCatalogueHideButton extends StatefulWidget {
|
||||
class _State extends State<LidarrCatalogueHideButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCard(
|
||||
child: Consumer<LidarrModel>(
|
||||
child: Consumer<LidarrState>(
|
||||
builder: (context, model, widget) => InkWell(
|
||||
child: LSIconButton(
|
||||
icon: model.hideUnmonitoredArtists
|
||||
|
||||
@@ -12,18 +12,18 @@ class _State extends State<LidarrCatalogueSearchBar> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Expanded(
|
||||
child: Consumer<LidarrModel>(
|
||||
builder: (context, model, widget) => LSTextInputBar(
|
||||
child: Consumer<LidarrState>(
|
||||
builder: (context, state, widget) => LSTextInputBar(
|
||||
controller: _textController,
|
||||
labelText: 'Search Artists...',
|
||||
onChanged: (text, update) => _onChanged(model, text, update),
|
||||
onChanged: (text, update) => _onChanged(state, text, update),
|
||||
margin: EdgeInsets.fromLTRB(12.0, 0.0, 12.0, 12.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
void _onChanged(LidarrModel model, String text, bool update) {
|
||||
model.searchCatalogueFilter = text;
|
||||
void _onChanged(LidarrState state, String text, bool update) {
|
||||
state.searchCatalogueFilter = text;
|
||||
if(update) _textController.text = '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class LidarrCatalogueSortButton extends StatefulWidget {
|
||||
class _State extends State<LidarrCatalogueSortButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCard(
|
||||
child: Consumer<LidarrModel>(
|
||||
child: Consumer<LidarrState>(
|
||||
builder: (context, model, widget) => PopupMenuButton<LidarrCatalogueSorting>(
|
||||
shape: LunaSeaDatabaseValue.THEME_AMOLED.data && LunaSeaDatabaseValue.THEME_AMOLED_BORDER.data
|
||||
? LSRoundedShapeWithBorder()
|
||||
@@ -50,7 +50,7 @@ class _State extends State<LidarrCatalogueSortButton> {
|
||||
? Icons.arrow_upward
|
||||
: Icons.arrow_downward,
|
||||
size: Constants.UI_FONT_SIZE_SUBTITLE+2.0,
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -26,8 +26,8 @@ class _State extends State<LidarrCatalogueTile> {
|
||||
text: widget.data.title,
|
||||
darken: !widget.data.monitored,
|
||||
),
|
||||
subtitle: Selector<LidarrModel, LidarrCatalogueSorting>(
|
||||
selector: (_, model) => model.sortCatalogueType,
|
||||
subtitle: Selector<LidarrState, LidarrCatalogueSorting>(
|
||||
selector: (_, state) => state.sortCatalogueType,
|
||||
builder: (context, type, _) => LSSubtitle(
|
||||
text: widget.data.subtitle(type),
|
||||
darken: !widget.data.monitored,
|
||||
@@ -47,7 +47,6 @@ class _State extends State<LidarrCatalogueTile> {
|
||||
decoration: LSCardBackground(
|
||||
uri: widget.data.bannerURI(),
|
||||
headers: Database.currentProfileObject.getLidarr()['headers'],
|
||||
darken: !widget.data.monitored,
|
||||
),
|
||||
onTap: () async => _enterArtist(),
|
||||
onLongPress: () async => _handlePopup(),
|
||||
@@ -95,7 +94,7 @@ class _State extends State<LidarrCatalogueTile> {
|
||||
widget.refresh();
|
||||
break;
|
||||
}
|
||||
default: Logger.warning('LidarrCatalogueTile', '_enterArtist', 'Unknown Case: ${result[0]}');
|
||||
default: LunaLogger.warning('LidarrCatalogueTile', '_enterArtist', 'Unknown Case: ${result[0]}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +104,7 @@ class _State extends State<LidarrCatalogueTile> {
|
||||
case 'refresh_artist': _refreshArtist(); break;
|
||||
case 'edit_artist': _enterEditArtist(); break;
|
||||
case 'remove_artist': _removeArtist(); break;
|
||||
default: Logger.warning('LidarrCatalogueTile', '_handlePopup', 'Invalid method passed through popup. (${values[1]})');
|
||||
default: LunaLogger.warning('LidarrCatalogueTile', '_handlePopup', 'Invalid method passed through popup. (${values[1]})');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +133,7 @@ class _State extends State<LidarrCatalogueTile> {
|
||||
List values = await LidarrDialogs.deleteArtist(context);
|
||||
if(values[0]) {
|
||||
if(values[1]) {
|
||||
values = await GlobalDialogs.deleteCatalogueWithFiles(context, widget.data.title);
|
||||
values = await LunaDialogs.deleteCatalogueWithFiles(context, widget.data.title);
|
||||
if(values[0]) {
|
||||
await _api.removeArtist(widget.data.artistID, deleteFiles: true)
|
||||
.then((_) {
|
||||
|
||||
@@ -65,7 +65,7 @@ class _State extends State<LidarrDetailsAlbumList> with AutomaticKeepAliveClient
|
||||
),
|
||||
);
|
||||
|
||||
Widget get _list => Consumer<LidarrModel>(
|
||||
Widget get _list => Consumer<LidarrState>(
|
||||
builder: (context, model, widget) {
|
||||
List<LidarrAlbumData> _filtered = model.hideUnmonitoredAlbums ? _hide(_results) : _results;
|
||||
return LSListViewBuilder(
|
||||
|
||||
@@ -50,7 +50,7 @@ class _State extends State<LidarrDetailsAlbumTile> {
|
||||
TextSpan(
|
||||
text: '\n${widget.data.releaseDateString}',
|
||||
style: TextStyle(
|
||||
color: widget.data.monitored ? LSColors.accent : LSColors.accent.withOpacity(0.30),
|
||||
color: widget.data.monitored ? LunaColours.accent : LunaColours.accent.withOpacity(0.30),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -17,7 +17,7 @@ class LidarrDetailsEditButton extends StatefulWidget {
|
||||
|
||||
class _State extends State<LidarrDetailsEditButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<LidarrModel>(
|
||||
Widget build(BuildContext context) => Consumer<LidarrState>(
|
||||
builder: (context, model, widget) => LSIconButton(
|
||||
icon: Icons.edit,
|
||||
onPressed: () async => _handlePopup(context),
|
||||
@@ -30,7 +30,7 @@ class _State extends State<LidarrDetailsEditButton> {
|
||||
case 'refresh_artist': _refreshArtist(context); break;
|
||||
case 'edit_artist': _enterEditArtist(context); break;
|
||||
case 'remove_artist': _removeArtist(context); break;
|
||||
default: Logger.warning('LidarrDetailsEditButton', '_handlePopup', 'Invalid method passed through popup. (${values[1]})');
|
||||
default: LunaLogger.warning('LidarrDetailsEditButton', '_handlePopup', 'Invalid method passed through popup. (${values[1]})');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class _State extends State<LidarrDetailsEditButton> {
|
||||
List values = await LidarrDialogs.deleteArtist(context);
|
||||
if(values[0]) {
|
||||
if(values[1]) {
|
||||
values = await GlobalDialogs.deleteCatalogueWithFiles(context, widget.data.title);
|
||||
values = await LunaDialogs.deleteCatalogueWithFiles(context, widget.data.title);
|
||||
if(values[0]) {
|
||||
await _api.removeArtist(widget.data.artistID, deleteFiles: true)
|
||||
.then((_) => widget.remove(true))
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:lunasea/modules/lidarr.dart';
|
||||
|
||||
class LidarrDetailsHideButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<LidarrModel>(
|
||||
Widget build(BuildContext context) => Consumer<LidarrState>(
|
||||
builder: (context, model, widget) => LSIconButton(
|
||||
icon: model.hideUnmonitoredAlbums ? Icons.visibility_off : Icons.visibility,
|
||||
onPressed: () => model.hideUnmonitoredAlbums = !model.hideUnmonitoredAlbums,
|
||||
|
||||
@@ -36,7 +36,7 @@ class _State extends State<LidarrDetailsOverview> with AutomaticKeepAliveClientM
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Artist Path', centerText: true),
|
||||
subtitle: LSSubtitle(text: widget?.data?.path ?? 'Unknown', centerText: true),
|
||||
onTap: () => GlobalDialogs.textPreview(context, 'Artist Path', widget?.data?.path ?? 'Unknown'),
|
||||
onTap: () => LunaDialogs.textPreview(context, 'Artist Path', widget?.data?.path ?? 'Unknown'),
|
||||
),
|
||||
LSContainerRow(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -31,13 +31,13 @@ class _State extends State<LidarrNavigationBar> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
SchedulerBinding.instance.scheduleFrameCallback((_) {
|
||||
Provider.of<LidarrModel>(context, listen: false).navigationIndex = LidarrDatabaseValue.NAVIGATION_INDEX.data;
|
||||
Provider.of<LidarrState>(context, listen: false).navigationIndex = LidarrDatabaseValue.NAVIGATION_INDEX.data;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Selector<LidarrModel, int>(
|
||||
selector: (_, model) => model.navigationIndex,
|
||||
Widget build(BuildContext context) => Selector<LidarrState, int>(
|
||||
selector: (_, state) => state.navigationIndex,
|
||||
builder: (context, index, _) => LSBottomNavigationBar(
|
||||
index: index,
|
||||
icons: LidarrNavigationBar.icons,
|
||||
@@ -52,6 +52,6 @@ class _State extends State<LidarrNavigationBar> {
|
||||
duration: Duration(milliseconds: Constants.UI_NAVIGATION_SPEED),
|
||||
curve: Curves.easeOutSine,
|
||||
);
|
||||
Provider.of<LidarrModel>(context, listen: false).navigationIndex = index;
|
||||
Provider.of<LidarrState>(context, listen: false).navigationIndex = index;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class LidarrReleasesHideButton extends StatefulWidget {
|
||||
class _State extends State<LidarrReleasesHideButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCard(
|
||||
child: Consumer<LidarrModel>(
|
||||
child: Consumer<LidarrState>(
|
||||
builder: (context, model, widget) => InkWell(
|
||||
child: LSIconButton(
|
||||
icon: model.hideRejectedReleases
|
||||
|
||||
@@ -24,18 +24,18 @@ class _State extends State<LidarrReleasesSearchBar> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Expanded(
|
||||
child: Consumer<LidarrModel>(
|
||||
builder: (context, model, widget) => LSTextInputBar(
|
||||
child: Consumer<LidarrState>(
|
||||
builder: (context, state, widget) => LSTextInputBar(
|
||||
controller: _textController,
|
||||
labelText: 'Search Releases...',
|
||||
onChanged: (text, update) => _onChanged(model, text, update),
|
||||
onChanged: (text, update) => _onChanged(state, text, update),
|
||||
margin: EdgeInsets.fromLTRB(12.0, 0.0, 12.0, 12.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
void _onChanged(LidarrModel model, String text, bool update) {
|
||||
model.searchReleasesFilter = text;
|
||||
void _onChanged(LidarrState state, String text, bool update) {
|
||||
state.searchReleasesFilter = text;
|
||||
if(update) _textController.text = '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class LidarrReleasesSortButton extends StatefulWidget {
|
||||
class _State extends State<LidarrReleasesSortButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCard(
|
||||
child: Consumer<LidarrModel>(
|
||||
child: Consumer<LidarrState>(
|
||||
builder: (context, model, widget) => PopupMenuButton<LidarrReleasesSorting>(
|
||||
shape: LunaSeaDatabaseValue.THEME_AMOLED.data && LunaSeaDatabaseValue.THEME_AMOLED_BORDER.data
|
||||
? LSRoundedShapeWithBorder()
|
||||
@@ -50,7 +50,7 @@ class _State extends State<LidarrReleasesSortButton> {
|
||||
? Icons.arrow_upward
|
||||
: Icons.arrow_downward,
|
||||
size: Constants.UI_FONT_SIZE_SUBTITLE+2.0,
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -38,8 +38,8 @@ class LidarrSearchResultTile extends StatelessWidget {
|
||||
LSTextHighlighted(
|
||||
text: data.protocol.lsLanguage_Capitalize(),
|
||||
bgColor: data.isTorrent
|
||||
? LSColors.purple
|
||||
: LSColors.blue,
|
||||
? LunaColours.purple
|
||||
: LunaColours.blue,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -56,7 +56,7 @@ class LidarrSearchResultTile extends StatelessWidget {
|
||||
if(data.isTorrent) TextSpan(
|
||||
text: '${data.seeders} Seeders\t•\t${data.leechers} Leechers\n',
|
||||
style: TextStyle(
|
||||
color: LSColors.purple,
|
||||
color: LunaColours.purple,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -85,7 +85,7 @@ class LidarrSearchResultTile extends StatelessWidget {
|
||||
if(!data.approved) Expanded(
|
||||
child: LSButtonSlim(
|
||||
text: 'Rejected',
|
||||
backgroundColor: LSColors.red,
|
||||
backgroundColor: LunaColours.red,
|
||||
onTap: () => _showWarnings(context),
|
||||
margin: EdgeInsets.only(left: 6.0),
|
||||
),
|
||||
@@ -118,8 +118,8 @@ class LidarrSearchResultTile extends StatelessWidget {
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
color: data.isTorrent
|
||||
? LSColors.purple
|
||||
: LSColors.blue,
|
||||
? LunaColours.purple
|
||||
: LunaColours.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
text: data.protocol.lsLanguage_Capitalize(),
|
||||
@@ -127,7 +127,7 @@ class LidarrSearchResultTile extends StatelessWidget {
|
||||
if(data.isTorrent) TextSpan(
|
||||
text: ' (${data.seeders}/${data.leechers})',
|
||||
style: TextStyle(
|
||||
color: LSColors.purple,
|
||||
color: LunaColours.purple,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -144,7 +144,7 @@ class LidarrSearchResultTile extends StatelessWidget {
|
||||
: Icons.report,
|
||||
color: data.approved
|
||||
? Colors.white
|
||||
: LSColors.red,
|
||||
: LunaColours.red,
|
||||
onPressed: () async => data.approved
|
||||
? _startDownload(context)
|
||||
: _showWarnings(context),
|
||||
@@ -182,6 +182,6 @@ class LidarrSearchResultTile extends StatelessWidget {
|
||||
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));
|
||||
await LunaDialogs.textPreview(context, 'Rejection Reasons', reject.substring(0, reject.length-1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ export 'core/api.dart';
|
||||
export 'core/constants.dart';
|
||||
export 'core/database.dart';
|
||||
export 'core/dialogs.dart';
|
||||
export 'core/state_global.dart';
|
||||
export 'core/state.dart';
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'package:dio/adapter.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/nzbget.dart';
|
||||
@@ -31,21 +29,16 @@ class NZBGetAPI extends API {
|
||||
maxRedirects: 5,
|
||||
),
|
||||
);
|
||||
if(!profile.getNZBGet()['strict_tls']) {
|
||||
(_client.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
};
|
||||
}
|
||||
return NZBGetAPI._internal(
|
||||
profile.getNZBGet(),
|
||||
_client,
|
||||
);
|
||||
}
|
||||
|
||||
void logWarning(String methodName, String text) => Logger.warning('NZBGetAPI', methodName, 'NZBGet: $text');
|
||||
void logWarning(String methodName, String text) => LunaLogger.warning('NZBGetAPI', methodName, 'NZBGet: $text');
|
||||
void logError(String methodName, String text, Object error, StackTrace trace, {
|
||||
bool uploadToSentry = true,
|
||||
}) => Logger.error(
|
||||
}) => LunaLogger.error(
|
||||
'NZBGetAPI',
|
||||
methodName,
|
||||
'NZBGet: $text',
|
||||
|
||||
@@ -66,11 +66,11 @@ class NZBGetHistoryData {
|
||||
|
||||
Color get statusColor {
|
||||
switch(status.substring(0, 7)) {
|
||||
case 'SUCCESS': return LSColors.accent;
|
||||
case 'WARNING': return LSColors.orange;
|
||||
case 'DELETED': return LSColors.purple;
|
||||
case 'FAILURE': return LSColors.red;
|
||||
default: return LSColors.blueGrey;
|
||||
case 'SUCCESS': return LunaColours.accent;
|
||||
case 'WARNING': return LunaColours.orange;
|
||||
case 'DELETED': return LunaColours.purple;
|
||||
case 'FAILURE': return LunaColours.red;
|
||||
default: return LunaColours.blueGrey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class NZBGetConstants {
|
||||
|
||||
static const MODULE_KEY = 'nzbget';
|
||||
|
||||
static const ModuleMap MODULE_MAP = ModuleMap(
|
||||
static const LunaModuleMap MODULE_MAP = LunaModuleMap(
|
||||
name: 'NZBGet',
|
||||
description: 'Manage Usenet Downloads',
|
||||
settingsDescription: 'Configure NZBGet',
|
||||
|
||||
@@ -29,7 +29,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -66,7 +66,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -89,7 +89,7 @@ class NZBGetDialogs {
|
||||
buttons: [
|
||||
LSDialog.button(
|
||||
text: 'Delete',
|
||||
textColor: LSColors.red,
|
||||
textColor: LunaColours.red,
|
||||
onPressed: () => _setValues(true),
|
||||
),
|
||||
],
|
||||
@@ -158,7 +158,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: NZBGetPriority.values[index].name,
|
||||
icon: Icons.low_priority,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, NZBGetPriority.values[index]),
|
||||
),
|
||||
),
|
||||
@@ -185,7 +185,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: categories[index].name,
|
||||
icon: Icons.category,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, categories[index]),
|
||||
),
|
||||
),
|
||||
@@ -254,7 +254,7 @@ class NZBGetDialogs {
|
||||
),
|
||||
LSDialog.button(
|
||||
text: 'Delete',
|
||||
textColor: LSColors.red,
|
||||
textColor: LunaColours.red,
|
||||
onPressed: () => _setValues(true, false),
|
||||
),
|
||||
],
|
||||
@@ -284,7 +284,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: NZBGetSort.values[index].name,
|
||||
icon: NZBGetSort.values[index].icon,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, NZBGetSort.values[index]),
|
||||
),
|
||||
),
|
||||
@@ -315,7 +315,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -392,7 +392,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -469,7 +469,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -505,7 +505,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -584,7 +584,7 @@ class NZBGetDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: NZBGetNavigationBar.titles[index],
|
||||
icon: NZBGetNavigationBar.icons[index],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, index),
|
||||
),
|
||||
),
|
||||
|
||||
2
lib/modules/nzbget/core/state.dart
Normal file
2
lib/modules/nzbget/core/state.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'state/global.dart';
|
||||
export 'state/local.dart';
|
||||
@@ -1,6 +1,13 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class NZBGetModel extends ChangeNotifier {
|
||||
class NZBGetState extends LunaGlobalState {
|
||||
NZBGetState() {
|
||||
reset();
|
||||
}
|
||||
|
||||
@override
|
||||
void reset() {}
|
||||
|
||||
bool _error = false;
|
||||
bool get error => _error;
|
||||
set error(bool error) {
|
||||
0
lib/modules/nzbget/core/state/local.dart
Normal file
0
lib/modules/nzbget/core/state/local.dart
Normal file
@@ -35,7 +35,7 @@ class _State extends State<NZBGetHistory> with AutomaticKeepAliveClientMixin {
|
||||
_results = [];
|
||||
final _api = NZBGetAPI.from(Database.currentProfileObject);
|
||||
if(mounted) setState(() { _future = _api.getHistory(); });
|
||||
Future.microtask(() => Provider.of<NZBGetModel>(context, listen: false)?.historySearchFilter = '');
|
||||
Future.microtask(() => Provider.of<NZBGetState>(context, listen: false)?.historySearchFilter = '');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -84,7 +84,7 @@ class _State extends State<NZBGetHistory> with AutomaticKeepAliveClientMixin {
|
||||
buttonText: 'Refresh',
|
||||
onTapHandler: () => _refresh(),
|
||||
)
|
||||
: Selector<NZBGetModel, Tuple2<String, bool>>(
|
||||
: Selector<NZBGetState, Tuple2<String, bool>>(
|
||||
selector: (_, model) => Tuple2(model.historySearchFilter, model.historyHideFailed),
|
||||
builder: (context, data, _) {
|
||||
List<NZBGetHistoryData> _filtered = _filter(data.item1);
|
||||
|
||||
@@ -25,7 +25,7 @@ class _State extends State<NZBGet> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Future.microtask(() => Provider.of<NZBGetModel>(context, listen: false).navigationIndex = 0);
|
||||
Future.microtask(() => Provider.of<NZBGetState>(context, listen: false).navigationIndex = 0);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -80,7 +80,7 @@ class _State extends State<NZBGet> {
|
||||
}),
|
||||
actions: _api.enabled
|
||||
? <Widget>[
|
||||
Selector<NZBGetModel, bool>(
|
||||
Selector<NZBGetState, bool>(
|
||||
selector: (_, model) => model.error,
|
||||
builder: (context, error, widget) => error
|
||||
? Container()
|
||||
@@ -101,7 +101,7 @@ class _State extends State<NZBGet> {
|
||||
case 'add_nzb': _addNZB(); break;
|
||||
case 'sort': _sort(); break;
|
||||
case 'server_details': _serverDetails(); break;
|
||||
default: Logger.warning('NZBGet', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
default: LunaLogger.warning('NZBGet', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class _State extends State<NZBGet> {
|
||||
if(values[0]) switch(values[1]) {
|
||||
case 'link': _addByURL(); break;
|
||||
case 'file': _addByFile(); break;
|
||||
default: Logger.warning('NZBGet', '_addNZB', 'Unknown Case: ${values[1]}');
|
||||
default: LunaLogger.warning('NZBGet', '_addNZB', 'Unknown Case: ${values[1]}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ class _State extends State<NZBGet> {
|
||||
|
||||
Future<void> _serverDetails() async => Navigator.of(context).pushNamed(NZBGetStatistics.ROUTE_NAME);
|
||||
|
||||
void _onPageChanged(int index) => Provider.of<NZBGetModel>(context, listen: false).navigationIndex = index;
|
||||
void _onPageChanged(int index) => Provider.of<NZBGetState>(context, listen: false).navigationIndex = index;
|
||||
|
||||
void _refreshProfile() {
|
||||
_api = NZBGetAPI.from(Database.currentProfileObject);
|
||||
|
||||
@@ -81,7 +81,7 @@ class _State extends State<NZBGetQueue> with TickerProviderStateMixin, Automatic
|
||||
}
|
||||
|
||||
Future<void> _fetchQueue(NZBGetAPI api) async {
|
||||
final _model = Provider.of<NZBGetModel>(context, listen: false);
|
||||
final _model = Provider.of<NZBGetState>(context, listen: false);
|
||||
return await api.getQueue(_model.speed, 100)
|
||||
.then((data) => _queue = data)
|
||||
.catchError((error) => Future.error(error));
|
||||
@@ -91,7 +91,7 @@ class _State extends State<NZBGetQueue> with TickerProviderStateMixin, Automatic
|
||||
return await api.getStatus()
|
||||
.then((data) {
|
||||
if(mounted) {
|
||||
final _model = Provider.of<NZBGetModel>(context, listen: false);
|
||||
final _model = Provider.of<NZBGetState>(context, listen: false);
|
||||
_model.paused = data.paused;
|
||||
_model.speed = data.speed;
|
||||
_model.currentSpeed = data.currentSpeed;
|
||||
@@ -104,7 +104,7 @@ class _State extends State<NZBGetQueue> with TickerProviderStateMixin, Automatic
|
||||
}
|
||||
|
||||
void _setError(bool error) {
|
||||
final _model = Provider.of<NZBGetModel>(context, listen: false);
|
||||
final _model = Provider.of<NZBGetState>(context, listen: false);
|
||||
_model.error = error;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,11 @@ class _State extends State<NZBGetStatistics> {
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Server Statistics');
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/nzbget',
|
||||
title: 'Server Statistics',
|
||||
);
|
||||
|
||||
Widget get _body => LSRefreshIndicator(
|
||||
refreshKey: _refreshKey,
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:lunasea/modules/nzbget.dart';
|
||||
|
||||
class NZBGetAppBarStats extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => Selector<NZBGetModel, Tuple5<bool, String, String, String, String>>(
|
||||
Widget build(BuildContext context) => Selector<NZBGetState, Tuple5<bool, String, String, String, String>>(
|
||||
selector: (_, model) => Tuple5(
|
||||
model.paused, //item1
|
||||
model.currentSpeed, //item2
|
||||
@@ -28,7 +28,7 @@ class NZBGetAppBarStats extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: Constants.UI_FONT_SIZE_HEADER,
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
),
|
||||
),
|
||||
TextSpan(text: '\n'),
|
||||
|
||||
@@ -10,7 +10,7 @@ class NZBGetHistoryHideButton extends StatefulWidget {
|
||||
class _State extends State<NZBGetHistoryHideButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCard(
|
||||
child: Consumer<NZBGetModel>(
|
||||
child: Consumer<NZBGetState>(
|
||||
builder: (context, model, widget) => InkWell(
|
||||
child: LSIconButton(
|
||||
icon: model.historyHideFailed
|
||||
|
||||
@@ -12,7 +12,7 @@ class _State extends State<NZBGetHistorySearchBar> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Expanded(
|
||||
child: Consumer<NZBGetModel>(
|
||||
child: Consumer<NZBGetState>(
|
||||
builder: (context, model, widget) => LSTextInputBar(
|
||||
controller: _textController,
|
||||
labelText: 'Search History...',
|
||||
@@ -22,7 +22,7 @@ class _State extends State<NZBGetHistorySearchBar> {
|
||||
),
|
||||
);
|
||||
|
||||
void _onChanged(NZBGetModel model, String text, bool update) {
|
||||
void _onChanged(NZBGetState model, String text, bool update) {
|
||||
model.historySearchFilter = text;
|
||||
if(update) _textController.text = '';
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class NZBGetHistoryTile extends StatelessWidget {
|
||||
),
|
||||
LSTextHighlighted(
|
||||
text: data.healthString,
|
||||
bgColor: LSColors.blueGrey,
|
||||
bgColor: LunaColours.blueGrey,
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -89,7 +89,7 @@ class NZBGetHistoryTile extends StatelessWidget {
|
||||
Expanded(
|
||||
child: LSButtonSlim(
|
||||
text: 'Delete',
|
||||
backgroundColor: LSColors.red,
|
||||
backgroundColor: LunaColours.red,
|
||||
onTap: () async => _deleteButton(context),
|
||||
margin: EdgeInsets.zero,
|
||||
),
|
||||
|
||||
@@ -14,6 +14,6 @@ class NZBGetLogTile extends StatelessWidget {
|
||||
title: LSTitle(text: data.text),
|
||||
subtitle: LSSubtitle(text: data.timestamp),
|
||||
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
||||
onTap: () async => GlobalDialogs.textPreview(context, 'Log Entry', data.text),
|
||||
onTap: () async => LunaDialogs.textPreview(context, 'Log Entry', data.text),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ class _State extends State<NZBGetNavigationBar> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
SchedulerBinding.instance.scheduleFrameCallback((_) {
|
||||
Provider.of<NZBGetModel>(context, listen: false).navigationIndex = NZBGetDatabaseValue.NAVIGATION_INDEX.data;
|
||||
Provider.of<NZBGetState>(context, listen: false).navigationIndex = NZBGetDatabaseValue.NAVIGATION_INDEX.data;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Selector<NZBGetModel, int>(
|
||||
Widget build(BuildContext context) => Selector<NZBGetState, int>(
|
||||
selector: (_, model) => model.navigationIndex,
|
||||
builder: (context, index, _) => LSBottomNavigationBar(
|
||||
index: index,
|
||||
@@ -50,6 +50,6 @@ class _State extends State<NZBGetNavigationBar> {
|
||||
duration: Duration(milliseconds: Constants.UI_NAVIGATION_SPEED),
|
||||
curve: Curves.easeOutSine,
|
||||
);
|
||||
Provider.of<NZBGetModel>(context, listen: false).navigationIndex = index;
|
||||
Provider.of<NZBGetState>(context, listen: false).navigationIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class _State extends State<NZBGetQueueFAB> with TickerProviderStateMixin {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Selector<NZBGetModel, Tuple2<bool, bool>>(
|
||||
Widget build(BuildContext context) => Selector<NZBGetState, Tuple2<bool, bool>>(
|
||||
selector: (_, model) => Tuple2(model.error, model.paused),
|
||||
builder: (context, data, _) {
|
||||
data.item2
|
||||
@@ -134,7 +134,7 @@ class _State extends State<NZBGetQueueFAB> with TickerProviderStateMixin {
|
||||
_iconController.forward();
|
||||
await api.pauseQueue()
|
||||
.then((_) {
|
||||
Provider.of<NZBGetModel>(context, listen: false).paused = true;
|
||||
Provider.of<NZBGetState>(context, listen: false).paused = true;
|
||||
})
|
||||
.catchError((_) {
|
||||
_iconController.reverse();
|
||||
@@ -151,7 +151,7 @@ class _State extends State<NZBGetQueueFAB> with TickerProviderStateMixin {
|
||||
_iconController.reverse();
|
||||
return await api.resumeQueue()
|
||||
.then((_) {
|
||||
Provider.of<NZBGetModel>(context, listen: false).paused = false;
|
||||
Provider.of<NZBGetState>(context, listen: false).paused = false;
|
||||
})
|
||||
.catchError((_) {
|
||||
_iconController.forward();
|
||||
|
||||
@@ -37,8 +37,8 @@ class _State extends State<NZBGetQueueTile> {
|
||||
child: LinearPercentIndicator(
|
||||
percent: min(1.0, max(0, widget.data.percentageDone/100)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 2.0),
|
||||
progressColor: widget.data.paused ? LSColors.accent.withOpacity(0.30) : LSColors.accent,
|
||||
backgroundColor: widget.data.paused ? LSColors.accent.withOpacity(0.05) : LSColors.accent.withOpacity(0.15),
|
||||
progressColor: widget.data.paused ? LunaColours.accent.withOpacity(0.30) : LunaColours.accent,
|
||||
backgroundColor: widget.data.paused ? LunaColours.accent.withOpacity(0.05) : LunaColours.accent.withOpacity(0.15),
|
||||
lineHeight: 4.0,
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 6.0),
|
||||
@@ -69,7 +69,7 @@ class _State extends State<NZBGetQueueTile> {
|
||||
case 'password': _helper._password(); break;
|
||||
case 'rename': _helper._rename(); break;
|
||||
case 'delete': _helper._delete(); break;
|
||||
default: Logger.warning('NZBGetQueueTile', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
default: LunaLogger.warning('NZBGetQueueTile', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
lib/modules/ombi.dart
Normal file
2
lib/modules/ombi.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'ombi/core.dart';
|
||||
export 'ombi/modules.dart';
|
||||
7
lib/modules/ombi/core.dart
Normal file
7
lib/modules/ombi/core.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
export 'core/constants.dart';
|
||||
export 'core/database.dart';
|
||||
export 'core/dialogs.dart';
|
||||
export 'core/extensions.dart';
|
||||
export 'core/router.dart';
|
||||
export 'core/state.dart';
|
||||
export 'core/types.dart';
|
||||
23
lib/modules/ombi/core/constants.dart
Normal file
23
lib/modules/ombi/core/constants.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class OmbiConstants {
|
||||
OmbiConstants._();
|
||||
|
||||
static const String MODULE_KEY = 'ombi';
|
||||
|
||||
static const LunaModuleMap MODULE_MAP = LunaModuleMap(
|
||||
name: 'Ombi',
|
||||
description: 'Manage Requests for Media',
|
||||
settingsDescription: 'Configure Ombi',
|
||||
icon: CustomIcons.tautulli,
|
||||
route: '/ombi',
|
||||
color: Color(0xFFD4782C),
|
||||
);
|
||||
|
||||
//ignore: non_constant_identifier_names
|
||||
static final ShortcutItem MODULE_QUICK_ACTION = ShortcutItem(
|
||||
type: MODULE_KEY,
|
||||
localizedTitle: MODULE_MAP.name,
|
||||
);
|
||||
}
|
||||
30
lib/modules/ombi/core/database.dart
Normal file
30
lib/modules/ombi/core/database.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class OmbiDatabase {
|
||||
OmbiDatabase._();
|
||||
|
||||
static void registerAdapters() {}
|
||||
}
|
||||
|
||||
enum OmbiDatabaseValue {
|
||||
NAVIGATION_INDEX,
|
||||
}
|
||||
|
||||
extension OmbiDatabaseValueExtension on OmbiDatabaseValue {
|
||||
String get key {
|
||||
switch(this) {
|
||||
case OmbiDatabaseValue.NAVIGATION_INDEX: return 'OMBI_NAVIGATION_INDEX';
|
||||
}
|
||||
throw Exception('key not found');
|
||||
}
|
||||
|
||||
dynamic get data {
|
||||
final _box = Database.lunaSeaBox;
|
||||
switch(this) {
|
||||
case OmbiDatabaseValue.NAVIGATION_INDEX: return _box.get(this.key, defaultValue: 0);
|
||||
}
|
||||
throw Exception('data not found');
|
||||
}
|
||||
|
||||
void put(dynamic value) => Database.lunaSeaBox.put(this.key, value);
|
||||
}
|
||||
3
lib/modules/ombi/core/dialogs.dart
Normal file
3
lib/modules/ombi/core/dialogs.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
class OmbiDialogs {
|
||||
OmbiDialogs._();
|
||||
}
|
||||
0
lib/modules/ombi/core/extensions.dart
Normal file
0
lib/modules/ombi/core/extensions.dart
Normal file
10
lib/modules/ombi/core/router.dart
Normal file
10
lib/modules/ombi/core/router.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:fluro_fork/fluro_fork.dart';
|
||||
import 'package:lunasea/modules/ombi.dart';
|
||||
|
||||
class OmbiRouter {
|
||||
OmbiRouter._();
|
||||
|
||||
static void initialize(Router router) {
|
||||
OmbiHomeRouter.defineRoutes(router);
|
||||
}
|
||||
}
|
||||
6
lib/modules/ombi/core/state.dart
Normal file
6
lib/modules/ombi/core/state.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class OmbiState extends LunaGlobalState {
|
||||
@override
|
||||
void reset() {}
|
||||
}
|
||||
0
lib/modules/ombi/core/types.dart
Normal file
0
lib/modules/ombi/core/types.dart
Normal file
1
lib/modules/ombi/modules.dart
Normal file
1
lib/modules/ombi/modules.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'modules/ombi.dart';
|
||||
1
lib/modules/ombi/modules/ombi.dart
Normal file
1
lib/modules/ombi/modules/ombi.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'ombi/route.dart';
|
||||
53
lib/modules/ombi/modules/ombi/route.dart
Normal file
53
lib/modules/ombi/modules/ombi/route.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:fluro_fork/fluro_fork.dart';
|
||||
import 'package:flutter/material.dart' hide Router;
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class OmbiHomeRouter {
|
||||
static const ROUTE_NAME = '/ombi';
|
||||
|
||||
static Future<void> navigateTo(BuildContext context) async => LunaRouter.router.navigateTo(
|
||||
context,
|
||||
route(),
|
||||
);
|
||||
|
||||
static String route() => ROUTE_NAME;
|
||||
|
||||
static void defineRoutes(Router router) {
|
||||
router.define(
|
||||
ROUTE_NAME,
|
||||
handler: Handler(handlerFunc: (context, params) => _OmbiHomeRoute()),
|
||||
transitionType: LunaRouter.transitionType,
|
||||
);
|
||||
}
|
||||
|
||||
OmbiHomeRouter._();
|
||||
}
|
||||
|
||||
class _OmbiHomeRoute extends StatefulWidget {
|
||||
@override
|
||||
State<_OmbiHomeRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<_OmbiHomeRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => WillPopScope(
|
||||
onWillPop: _onWillPop,
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [ LunaSeaDatabaseValue.ENABLED_PROFILE.key ]),
|
||||
builder: (context, box, _) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
drawer: _drawer,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Future<bool> _onWillPop() async {
|
||||
if(_scaffoldKey.currentState.isDrawerOpen) return true;
|
||||
_scaffoldKey.currentState.openDrawer();
|
||||
return false;
|
||||
}
|
||||
|
||||
Widget get _drawer => LSDrawer(page: 'ombi');
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:dio/adapter.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/radarr.dart';
|
||||
@@ -25,21 +23,16 @@ class RadarrAPI extends API {
|
||||
maxRedirects: 5,
|
||||
),
|
||||
);
|
||||
if(!profile.getRadarr()['strict_tls']) {
|
||||
(_client.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
|
||||
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||
};
|
||||
}
|
||||
return RadarrAPI._internal(
|
||||
profile.getRadarr(),
|
||||
_client,
|
||||
);
|
||||
}
|
||||
|
||||
void logWarning(String methodName, String text) => Logger.warning('package:lunasea/core/api/radarr/api.dart', methodName, 'Radarr: $text');
|
||||
void logWarning(String methodName, String text) => LunaLogger.warning('package:lunasea/core/api/radarr/api.dart', methodName, 'Radarr: $text');
|
||||
void logError(String methodName, String text, Object error, StackTrace trace, {
|
||||
bool uploadToSentry = true,
|
||||
}) => Logger.error(
|
||||
}) => LunaLogger.error(
|
||||
'package:lunasea/core/api/radarr/api.dart',
|
||||
methodName,
|
||||
'Radarr: $text',
|
||||
|
||||
@@ -158,7 +158,7 @@ class RadarrCatalogueData {
|
||||
DateTime now = DateTime.now();
|
||||
if (downloaded) {
|
||||
text = sizeOnDisk?.lsBytes_BytesToString();
|
||||
color = monitored ? Color(Constants.ACCENT_COLOR) : Color(Constants.ACCENT_COLOR).withOpacity(0.30);
|
||||
color = monitored ? Color(LunaColours.ACCENT_COLOR) : Color(LunaColours.ACCENT_COLOR).withOpacity(0.30);
|
||||
} else if(isPhysicallyReleased) {
|
||||
text = '';
|
||||
} else if(isInCinemas) {
|
||||
@@ -173,7 +173,7 @@ class RadarrCatalogueData {
|
||||
}
|
||||
} else if(isTBA) {
|
||||
text = 'TO BE ANNOUNCED';
|
||||
color = monitored ? Color(Constants.ACCENT_COLOR) : Color(Constants.ACCENT_COLOR).withOpacity(0.30);
|
||||
color = monitored ? Color(LunaColours.ACCENT_COLOR) : Color(LunaColours.ACCENT_COLOR).withOpacity(0.30);
|
||||
}
|
||||
return TextSpan(
|
||||
text: text,
|
||||
|
||||
@@ -54,7 +54,7 @@ class RadarrHistoryDataGeneric extends RadarrHistoryData {
|
||||
TextSpan(
|
||||
text: '$eventType',
|
||||
style: TextStyle(
|
||||
color: LSColors.purple,
|
||||
color: LunaColours.purple,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -77,7 +77,7 @@ class RadarrHistoryDataFileRenamed extends RadarrHistoryData {
|
||||
TextSpan(
|
||||
text: '${RadarrConstants.EVENT_TYPE_MESSAGES[eventType]}',
|
||||
style: TextStyle(
|
||||
color: Color(Constants.ACCENT_COLOR),
|
||||
color: Color(LunaColours.ACCENT_COLOR),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -129,7 +129,7 @@ class RadarrHistoryDataDownloadImported extends RadarrHistoryData {
|
||||
TextSpan(
|
||||
text: '${RadarrConstants.EVENT_TYPE_MESSAGES[eventType]} ($quality)',
|
||||
style: TextStyle(
|
||||
color: Color(Constants.ACCENT_COLOR),
|
||||
color: Color(LunaColours.ACCENT_COLOR),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -7,7 +7,7 @@ class RadarrConstants {
|
||||
|
||||
static const String MODULE_KEY = 'radarr';
|
||||
|
||||
static const ModuleMap MODULE_MAP = ModuleMap(
|
||||
static const LunaModuleMap MODULE_MAP = LunaModuleMap(
|
||||
name: 'Radarr',
|
||||
description: 'Manage Movies',
|
||||
settingsDescription: 'Configure Radarr',
|
||||
|
||||
@@ -19,7 +19,7 @@ class RadarrDialogs {
|
||||
buttons: [
|
||||
LSDialog.button(
|
||||
text: 'Delete',
|
||||
textColor: LSColors.red,
|
||||
textColor: LunaColours.red,
|
||||
onPressed: () => _setValues(true),
|
||||
),
|
||||
],
|
||||
@@ -44,7 +44,7 @@ class RadarrDialogs {
|
||||
buttons: [
|
||||
LSDialog.button(
|
||||
text: 'Remove',
|
||||
textColor: LSColors.red,
|
||||
textColor: LunaColours.red,
|
||||
onPressed: () => _setValues(true),
|
||||
),
|
||||
],
|
||||
@@ -102,7 +102,7 @@ class RadarrDialogs {
|
||||
buttons: [
|
||||
LSDialog.button(
|
||||
text: 'Search',
|
||||
textColor: LSColors.accent,
|
||||
textColor: LunaColours.accent,
|
||||
onPressed: () => _setValues(true),
|
||||
),
|
||||
],
|
||||
@@ -137,7 +137,7 @@ class RadarrDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -164,7 +164,7 @@ class RadarrDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: availability[index].name,
|
||||
icon: Icons.folder,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, availability[index]),
|
||||
),
|
||||
),
|
||||
@@ -196,7 +196,7 @@ class RadarrDialogs {
|
||||
],
|
||||
),
|
||||
icon: Icons.folder,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, folders[index]),
|
||||
),
|
||||
),
|
||||
@@ -223,7 +223,7 @@ class RadarrDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: qualities[index].name,
|
||||
icon: Icons.portrait,
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, qualities[index]),
|
||||
),
|
||||
),
|
||||
@@ -282,7 +282,7 @@ class RadarrDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: _options[index][0],
|
||||
icon: _options[index][1],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, _options[index][2]),
|
||||
),
|
||||
),
|
||||
@@ -309,7 +309,7 @@ class RadarrDialogs {
|
||||
(index) => LSDialog.tile(
|
||||
text: RadarrNavigationBar.titles[index],
|
||||
icon: RadarrNavigationBar.icons[index],
|
||||
iconColor: LSColors.list(index),
|
||||
iconColor: LunaColours.list(index),
|
||||
onTap: () => _setValues(true, index),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -46,7 +46,7 @@ extension RadarrCatalogueSortingExtension on RadarrCatalogueSorting {
|
||||
) => _sorter.byType(data, this, ascending);
|
||||
}
|
||||
|
||||
class _Sorter extends Sorter<RadarrCatalogueSorting> {
|
||||
class _Sorter extends LunaSorter<RadarrCatalogueSorting> {
|
||||
@override
|
||||
List byType(
|
||||
List data,
|
||||
|
||||
@@ -43,7 +43,7 @@ extension RadarrReleasesSortingExtension on RadarrReleasesSorting {
|
||||
) => _sorter.byType(data, this, ascending);
|
||||
}
|
||||
|
||||
class _Sorter extends Sorter<RadarrReleasesSorting> {
|
||||
class _Sorter extends LunaSorter<RadarrReleasesSorting> {
|
||||
@override
|
||||
List byType(
|
||||
List data,
|
||||
|
||||
@@ -1,119 +1,2 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:lunasea/modules/radarr.dart';
|
||||
|
||||
class RadarrState extends ChangeNotifier {
|
||||
///Catalogue Sticky Header Content
|
||||
|
||||
String _searchCatalogueFilter = '';
|
||||
String get searchCatalogueFilter => _searchCatalogueFilter;
|
||||
set searchCatalogueFilter(String searchCatalogueFilter) {
|
||||
assert(searchCatalogueFilter != null);
|
||||
_searchCatalogueFilter = searchCatalogueFilter;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
RadarrCatalogueSorting _sortCatalogueType = RadarrCatalogueSorting.alphabetical;
|
||||
RadarrCatalogueSorting get sortCatalogueType => _sortCatalogueType;
|
||||
set sortCatalogueType(RadarrCatalogueSorting sortCatalogueType) {
|
||||
assert(sortCatalogueType != null);
|
||||
_sortCatalogueType = sortCatalogueType;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _sortCatalogueAscending = true;
|
||||
bool get sortCatalogueAscending => _sortCatalogueAscending;
|
||||
set sortCatalogueAscending(bool sortCatalogueAscending) {
|
||||
assert(sortCatalogueAscending != null);
|
||||
_sortCatalogueAscending = sortCatalogueAscending;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _hideUnmonitoredMovies = false;
|
||||
bool get hideUnmonitoredMovies => _hideUnmonitoredMovies;
|
||||
set hideUnmonitoredMovies(bool hideUnmonitoredMovies) {
|
||||
assert(hideUnmonitoredMovies != null);
|
||||
_hideUnmonitoredMovies = hideUnmonitoredMovies;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///Releases Sticky Header Content
|
||||
|
||||
String _searchReleasesFilter = '';
|
||||
String get searchReleasesFilter => _searchReleasesFilter;
|
||||
set searchReleasesFilter(String searchReleasesFilter) {
|
||||
assert(searchReleasesFilter != null);
|
||||
_searchReleasesFilter = searchReleasesFilter;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
RadarrReleasesSorting _sortReleasesType = RadarrReleasesSorting.weight;
|
||||
RadarrReleasesSorting get sortReleasesType => _sortReleasesType;
|
||||
set sortReleasesType(RadarrReleasesSorting sortReleasesType) {
|
||||
assert(sortReleasesType != null);
|
||||
_sortReleasesType = sortReleasesType;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _sortReleasesAscending = true;
|
||||
bool get sortReleasesAscending => _sortReleasesAscending;
|
||||
set sortReleasesAscending(bool sortReleasesAscending) {
|
||||
assert(sortReleasesAscending != null);
|
||||
_sortReleasesAscending = sortReleasesAscending;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _hideRejectedReleases = false;
|
||||
bool get hideRejectedReleases => _hideRejectedReleases;
|
||||
set hideRejectedReleases(bool hideRejectedReleases) {
|
||||
assert(hideRejectedReleases != null);
|
||||
_hideRejectedReleases = hideRejectedReleases;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///Add New Movie Content
|
||||
|
||||
String _addSearchQuery = '';
|
||||
String get addSearchQuery => _addSearchQuery;
|
||||
set addSearchQuery(String addSearchQuery) {
|
||||
assert(addSearchQuery != null);
|
||||
_addSearchQuery = addSearchQuery;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///Delete options
|
||||
|
||||
bool _removeDeleteFiles = false;
|
||||
bool get removeDeleteFiles => _removeDeleteFiles;
|
||||
set removeDeleteFiles(bool removeDeleteFiles) {
|
||||
assert(removeDeleteFiles != null);
|
||||
_removeDeleteFiles = removeDeleteFiles;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _removeAddExclusion = false;
|
||||
bool get removeAddExclusion => _removeAddExclusion;
|
||||
set removeAddExclusion(bool removeAddExclusion) {
|
||||
assert(removeAddExclusion != null);
|
||||
_removeAddExclusion = removeAddExclusion;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///Navigation Indexes
|
||||
|
||||
int _navigationIndex = 0;
|
||||
int get navigationIndex => _navigationIndex;
|
||||
set navigationIndex(int navigationIndex) {
|
||||
assert(navigationIndex != null);
|
||||
_navigationIndex = navigationIndex;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
int _movieNavigationIndex = 0;
|
||||
int get movieNavigationIndex => _movieNavigationIndex;
|
||||
set movieNavigationIndex(int movieNavigationIndex) {
|
||||
assert(movieNavigationIndex != null);
|
||||
_movieNavigationIndex = movieNavigationIndex;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
export 'state/global.dart';
|
||||
export 'state/local.dart';
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:lunasea/modules/sonarr.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/radarr.dart';
|
||||
|
||||
class SonarrModel extends ChangeNotifier {
|
||||
class RadarrState extends LunaGlobalState {
|
||||
@override
|
||||
void reset() {}
|
||||
|
||||
///Catalogue Sticky Header Content
|
||||
|
||||
String _searchCatalogueFilter = '';
|
||||
@@ -12,9 +15,10 @@ class SonarrModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
SonarrCatalogueSorting _sortCatalogueType = SonarrCatalogueSorting.alphabetical;
|
||||
SonarrCatalogueSorting get sortCatalogueType => _sortCatalogueType;
|
||||
set sortCatalogueType(SonarrCatalogueSorting sortCatalogueType) {
|
||||
|
||||
RadarrCatalogueSorting _sortCatalogueType = RadarrCatalogueSorting.alphabetical;
|
||||
RadarrCatalogueSorting get sortCatalogueType => _sortCatalogueType;
|
||||
set sortCatalogueType(RadarrCatalogueSorting sortCatalogueType) {
|
||||
assert(sortCatalogueType != null);
|
||||
_sortCatalogueType = sortCatalogueType;
|
||||
notifyListeners();
|
||||
@@ -28,11 +32,11 @@ class SonarrModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _hideUnmonitoredSeries = false;
|
||||
bool get hideUnmonitoredSeries => _hideUnmonitoredSeries;
|
||||
set hideUnmonitoredSeries(bool hideUnmonitoredSeries) {
|
||||
assert(hideUnmonitoredSeries != null);
|
||||
_hideUnmonitoredSeries = hideUnmonitoredSeries;
|
||||
bool _hideUnmonitoredMovies = false;
|
||||
bool get hideUnmonitoredMovies => _hideUnmonitoredMovies;
|
||||
set hideUnmonitoredMovies(bool hideUnmonitoredMovies) {
|
||||
assert(hideUnmonitoredMovies != null);
|
||||
_hideUnmonitoredMovies = hideUnmonitoredMovies;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -46,9 +50,9 @@ class SonarrModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
SonarrReleasesSorting _sortReleasesType = SonarrReleasesSorting.weight;
|
||||
SonarrReleasesSorting get sortReleasesType => _sortReleasesType;
|
||||
set sortReleasesType(SonarrReleasesSorting sortReleasesType) {
|
||||
RadarrReleasesSorting _sortReleasesType = RadarrReleasesSorting.weight;
|
||||
RadarrReleasesSorting get sortReleasesType => _sortReleasesType;
|
||||
set sortReleasesType(RadarrReleasesSorting sortReleasesType) {
|
||||
assert(sortReleasesType != null);
|
||||
_sortReleasesType = sortReleasesType;
|
||||
notifyListeners();
|
||||
@@ -70,8 +74,8 @@ class SonarrModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Add New Series Content
|
||||
|
||||
///Add New Movie Content
|
||||
|
||||
String _addSearchQuery = '';
|
||||
String get addSearchQuery => _addSearchQuery;
|
||||
set addSearchQuery(String addSearchQuery) {
|
||||
@@ -80,6 +84,24 @@ class SonarrModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///Delete options
|
||||
|
||||
bool _removeDeleteFiles = false;
|
||||
bool get removeDeleteFiles => _removeDeleteFiles;
|
||||
set removeDeleteFiles(bool removeDeleteFiles) {
|
||||
assert(removeDeleteFiles != null);
|
||||
_removeDeleteFiles = removeDeleteFiles;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool _removeAddExclusion = false;
|
||||
bool get removeAddExclusion => _removeAddExclusion;
|
||||
set removeAddExclusion(bool removeAddExclusion) {
|
||||
assert(removeAddExclusion != null);
|
||||
_removeAddExclusion = removeAddExclusion;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///Navigation Indexes
|
||||
|
||||
int _navigationIndex = 0;
|
||||
@@ -90,11 +112,11 @@ class SonarrModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
int _seriesNavigationIndex = 1;
|
||||
int get seriesNavigationIndex => _seriesNavigationIndex;
|
||||
set seriesNavigationIndex(int seriesNavigationIndex) {
|
||||
assert(seriesNavigationIndex != null);
|
||||
_seriesNavigationIndex = seriesNavigationIndex;
|
||||
int _movieNavigationIndex = 0;
|
||||
int get movieNavigationIndex => _movieNavigationIndex;
|
||||
set movieNavigationIndex(int movieNavigationIndex) {
|
||||
assert(movieNavigationIndex != null);
|
||||
_movieNavigationIndex = movieNavigationIndex;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
0
lib/modules/radarr/core/state/local.dart
Normal file
0
lib/modules/radarr/core/state/local.dart
Normal file
@@ -92,7 +92,9 @@ class _State extends State<RadarrAddDetails> {
|
||||
|
||||
Widget get _appBar => _arguments == null
|
||||
? null
|
||||
: LSAppBar(
|
||||
: LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/radarr',
|
||||
title: _arguments.data.title,
|
||||
actions: [
|
||||
LSIconButton(
|
||||
@@ -137,7 +139,6 @@ class _State extends State<RadarrAddDetails> {
|
||||
fallbackImage: 'assets/images/radarr/nomovieposter.png',
|
||||
headers: Database.currentProfileObject.getRadarr()['headers'],
|
||||
),
|
||||
LSDivider(),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [RadarrDatabaseValue.ADD_MONITORED.key]),
|
||||
builder: (context, box, widget) {
|
||||
@@ -196,7 +197,6 @@ class _State extends State<RadarrAddDetails> {
|
||||
);
|
||||
},
|
||||
),
|
||||
LSDivider(),
|
||||
LSContainerRow(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
@@ -209,7 +209,7 @@ class _State extends State<RadarrAddDetails> {
|
||||
Expanded(
|
||||
child: LSButton(
|
||||
text: 'Add + Search',
|
||||
backgroundColor: LSColors.orange,
|
||||
backgroundColor: LunaColours.orange,
|
||||
onTap: () async => _addMovie(true),
|
||||
reducedMargin: true,
|
||||
),
|
||||
|
||||
@@ -44,7 +44,11 @@ class _State extends State<RadarrAddSearch> {
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Add Movie');
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/radarr',
|
||||
title: 'Add Movie',
|
||||
);
|
||||
|
||||
Widget get _body => LSRefreshIndicator(
|
||||
refreshKey: _refreshKey,
|
||||
|
||||
@@ -66,7 +66,9 @@ class _State extends State<RadarrDetailsMovie> {
|
||||
: null,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/radarr',
|
||||
title: _arguments == null || _arguments.data == null
|
||||
? 'Movie Details'
|
||||
: _arguments.data.title,
|
||||
|
||||
@@ -76,7 +76,11 @@ class _State extends State<RadarrEditMovie> {
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: _arguments?.data?.title ?? 'Edit Movie');
|
||||
Widget get _appBar => LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/radarr',
|
||||
title: _arguments?.data?.title ?? 'Edit Movie',
|
||||
);
|
||||
|
||||
Widget get _body => FutureBuilder(
|
||||
future: _future,
|
||||
@@ -130,7 +134,6 @@ class _State extends State<RadarrEditMovie> {
|
||||
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
||||
onTap: () => _changeMinimumAvailability(),
|
||||
),
|
||||
LSDivider(),
|
||||
LSButton(
|
||||
text: 'Update Movie',
|
||||
onTap: () async => _save().catchError((_) {}),
|
||||
@@ -139,7 +142,7 @@ class _State extends State<RadarrEditMovie> {
|
||||
);
|
||||
|
||||
Future<void> _changePath() async {
|
||||
List<dynamic> _values = await GlobalDialogs.editText(context, 'Movie Path', prefill: _path);
|
||||
List<dynamic> _values = await LunaDialogs.editText(context, 'Movie Path', prefill: _path);
|
||||
if(_values[0] && mounted) setState(() => _path = _values[1]);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ class _State extends State<Radarr> {
|
||||
_refreshAllPages();
|
||||
break;
|
||||
}
|
||||
default: Logger.warning('Radarr', '_enterAddMovie', 'Unknown Case: ${result[0]}');
|
||||
default: LunaLogger.warning('Radarr', '_enterAddMovie', 'Unknown Case: ${result[0]}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ class _State extends State<Radarr> {
|
||||
.catchError((_) => LSSnackBar(context: context, title: 'Failed to Search', message: Constants.CHECK_LOGS_MESSAGE, type: SNACKBAR_TYPE.failure));
|
||||
break;
|
||||
}
|
||||
default: Logger.warning('Radarr', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
default: LunaLogger.warning('Radarr', '_handlePopup', 'Unknown Case: ${values[1]}');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,11 @@ class _State extends State<RadarrSearchResults> {
|
||||
|
||||
Widget get _appBar => _arguments == null
|
||||
? null
|
||||
: LSAppBar(title: _arguments.title);
|
||||
: LunaAppBar(
|
||||
context: context,
|
||||
popUntil: '/radarr',
|
||||
title: _arguments.title,
|
||||
);
|
||||
|
||||
Widget get _body => _arguments == null
|
||||
? null
|
||||
|
||||
@@ -41,7 +41,7 @@ class RadarrAddSearchResultTile extends StatelessWidget {
|
||||
);
|
||||
if(result != null) switch(result[0]) {
|
||||
case 'movie_added': Navigator.of(context).pop(result); break;
|
||||
default: Logger.warning('RadarrAddSearchResultTile', '_enterDetails', 'Unknown Case: ${result[0]}');
|
||||
default: LunaLogger.warning('RadarrAddSearchResultTile', '_enterDetails', 'Unknown Case: ${result[0]}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class _State extends State<RadarrCatalogueSortButton> {
|
||||
? Icons.arrow_upward
|
||||
: Icons.arrow_downward,
|
||||
size: Constants.UI_FONT_SIZE_SUBTITLE+2.0,
|
||||
color: LSColors.accent,
|
||||
color: LunaColours.accent,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -61,7 +61,7 @@ class _State extends State<RadarrCatalogueTile> {
|
||||
Icons.check_circle,
|
||||
size: 18.0,
|
||||
color: widget.data.downloaded ?
|
||||
widget.data.monitored ? Color(Constants.ACCENT_COLOR) : Color(Constants.ACCENT_COLOR).withOpacity(0.30) :
|
||||
widget.data.monitored ? Color(LunaColours.ACCENT_COLOR) : Color(LunaColours.ACCENT_COLOR).withOpacity(0.30) :
|
||||
widget.data.monitored ? Colors.grey : Colors.grey.withOpacity(0.30),
|
||||
),
|
||||
padding: EdgeInsets.fromLTRB(0.0, 3.0, 16.0, 3.0),
|
||||
@@ -90,7 +90,6 @@ class _State extends State<RadarrCatalogueTile> {
|
||||
customPadding: EdgeInsets.fromLTRB(12.0, 4.0, 12.0, 0.0),
|
||||
decoration: LSCardBackground(
|
||||
uri: widget.data.posterURI(),
|
||||
darken: !widget.data.monitored,
|
||||
headers: Database.currentProfileObject.getRadarr()['headers'],
|
||||
),
|
||||
);
|
||||
@@ -137,7 +136,7 @@ class _State extends State<RadarrCatalogueTile> {
|
||||
widget.refresh();
|
||||
break;
|
||||
}
|
||||
default: Logger.warning('RadarrCatalogueTile', '_enterMovie', 'Unknown Case: ${result[0]}');
|
||||
default: LunaLogger.warning('RadarrCatalogueTile', '_enterMovie', 'Unknown Case: ${result[0]}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +146,7 @@ class _State extends State<RadarrCatalogueTile> {
|
||||
case 'refresh_movie': _refreshMovie(); break;
|
||||
case 'edit_movie': _editMovie(); break;
|
||||
case 'remove_movie': _removeMovie(); break;
|
||||
default: Logger.warning('RadarrCatalogueTile', '_handlePopup', 'Invalid method passed through popup. (${values[1]})');
|
||||
default: LunaLogger.warning('RadarrCatalogueTile', '_handlePopup', 'Invalid method passed through popup. (${values[1]})');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user