[Release] v4.2.0+40200001 (#287)

NEW
- [Settings/Modules] Add an information/help button with module descriptions and links

TWEAKS
- [Radarr] Always show the amount of days content will be available instead of limiting it to only content in the next 30 days
- [Settings] Moved "Backup & Restore" and "Logs" to "System" section
- [Settings] Merged "Customization" and "Modules" sections into "Configuration"
- [Settings/Sonarr] Removed the need to enable Sonarr to test the connection
- [Settings/Tautulli] Removed the need to enable Tautulli to test the connection

FIXES
- [IAPs] Ensure all IAPs are marked as "consumed"
- [Flutter] Updated packages
- [Logging] Updated Sentry to v4 framework to improve capturing fatal/crashing bugs
- [Settings/Logs] Hide exception and stack trace buttons when an error is not available
- [Sonarr/History] Fixed history fetching the oldest entries, not the newest
- [State] Correctly clear state when clearing LunaSea's configuration
- [Tautulli/Activity] Fixed consistency of hardware transcoding indicator compared to the web UI
- [UI/Divider] Fix consistency of divider width across regular and AMOLED dark theme
This commit is contained in:
Jagandeep Brar
2020-12-22 08:46:25 -06:00
committed by GitHub
parent b6333b014d
commit f7807ed762
561 changed files with 6995 additions and 8535 deletions

View File

@@ -1,68 +1,76 @@
// Imports
import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
import './adapters.dart';
import 'package:lunasea/modules.dart' show
HomeDatabase,
SearchDatabase,
SettingsDatabase,
LidarrDatabase,
RadarrDatabase,
SonarrDatabase,
NZBGetDatabase,
SABnzbdDatabase;
import 'package:lunasea/core.dart';
import 'package:lunasea/modules/home/core.dart' show HomeDatabase;
import 'package:lunasea/modules/search/core.dart' show SearchDatabase;
import 'package:lunasea/modules/settings/core.dart' show SettingsDatabase;
import 'package:lunasea/modules/lidarr/core.dart' show LidarrDatabase;
import 'package:lunasea/modules/radarr/core.dart' show RadarrDatabase;
import 'package:lunasea/modules/sonarr/core.dart' show SonarrDatabase;
import 'package:lunasea/modules/nzbget/core.dart' show NZBGetDatabase;
import 'package:lunasea/modules/sabnzbd/core.dart' show SABnzbdDatabase;
import 'package:lunasea/modules/ombi/core.dart' show OmbiDatabase;
import 'package:lunasea/modules/tautulli/core.dart' show TautulliDatabase;
// Exports
export 'package:hive/hive.dart';
export 'package:hive_flutter/hive_flutter.dart';
/// Next HiveType: 16
///
/// Dead Fields:
class Database {
Database._();
class Database {
static const String _DATABASE_PATH = 'database';
/// Initialize the database.
///
/// - Initializes Hive database path
/// - Register all adapters
/// - Open all boxes
/// - Set default database state of necessary
static Future<void> initialize() async {
await Hive.initFlutter('database');
await Hive.initFlutter(_DATABASE_PATH);
_registerAdapters();
await _openBoxes();
if(profilesBox.keys.length == 0) setDefaults();
}
/// Deinitialize the database by closing all open hive boxes.
static Future<void> deinitialize() async => await Hive.close();
/// Registers all necessary object adapters for Hive.
static void _registerAdapters() {
//Core
Hive.registerAdapter(IndexerHiveObjectAdapter());
Hive.registerAdapter(ProfileHiveObjectAdapter());
//General
LunaSeaDatabase.registerAdapters();
HomeDatabase.registerAdapters();
SearchDatabase.registerAdapters();
SettingsDatabase.registerAdapters();
LunaDatabase().registerAdapters();
HomeDatabase().registerAdapters();
SearchDatabase().registerAdapters();
SettingsDatabase().registerAdapters();
//Automation
LidarrDatabase.registerAdapters();
RadarrDatabase.registerAdapters();
SonarrDatabase.registerAdapters();
LidarrDatabase().registerAdapters();
RadarrDatabase().registerAdapters();
SonarrDatabase().registerAdapters();
//Clients
NZBGetDatabase.registerAdapters();
SABnzbdDatabase.registerAdapters();
NZBGetDatabase().registerAdapters();
SABnzbdDatabase().registerAdapters();
//Monitoring
OmbiDatabase().registerAdapters();
TautulliDatabase().registerAdapters();
}
/// Open all Hive boxes for reading.
static Future<void> _openBoxes() async {
await Hive.openBox('lunasea');
await Hive.openBox<IndexerHiveObject>('indexers');
await Hive.openBox<ProfileHiveObject>('profiles');
}
/// Set the default state for all hive boxes.
static void setDefaults() {
//Clear all the boxes
clearLunaSeaBox();
clearProfilesBox();
clearIndexersBox();
clearAllBoxes();
//Set default profile & enabled profile
profilesBox.put('default', ProfileHiveObject.empty());
lunaSeaBox.put(LunaSeaDatabaseValue.ENABLED_PROFILE.key, 'default');
lunaSeaBox.put(LunaDatabaseValue.ENABLED_PROFILE.key, 'default');
}
//Get boxes
@@ -74,6 +82,11 @@ class Database {
static void clearLunaSeaBox() => lunaSeaBox.deleteAll(lunaSeaBox.keys);
static void clearProfilesBox() => profilesBox.deleteAll(profilesBox.keys);
static void clearIndexersBox() => indexersBox.deleteAll(indexersBox.keys);
static void clearAllBoxes() {
clearLunaSeaBox();
clearProfilesBox();
clearIndexersBox();
}
//Profile values
static String get currentProfile => lunaSeaBox.get('profile');