Files
lunasea/lib/core/filesystem.dart
Jagandeep Brar 5cf33b3abd [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
2020-10-13 09:43:28 -05:00

63 lines
2.1 KiB
Dart

import 'dart:io';
import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart';
class LunaFileSystem {
LunaFileSystem._();
static String get configFileName {
String _now = DateFormat('y-MM-dd kk-mm-ss').format(DateTime.now());
return '$_now.json';
}
static Future<String> get appDirectory async {
Directory appDocDir;
if(Platform.isIOS) appDocDir = await getApplicationDocumentsDirectory();
if(Platform.isAndroid) appDocDir = await getExternalStorageDirectory();
return '${appDocDir.path}';
}
static Future<String> get configDirectory async {
String _appDirectory = await appDirectory;
return '$_appDirectory/configurations';
}
static Future<String> get downloadDirectory async {
String _appDirectory = await appDirectory;
return '$_appDirectory/downloads';
}
static Future<String> get configFullPath async {
String path = await configDirectory;
String name = configFileName;
return '$path/$name';
}
static Future<String> downloadFullPath(String name) async {
String path = await downloadDirectory;
return '$path/$name';
}
static Future<void> exportConfigToFilesystem(String config) async {
String _file = await configFullPath;
String _directory = await configDirectory;
//Create configuration folder if needed
Directory directory = Directory(_directory);
await directory.create(recursive: true);
//Write the configuration to the filsystem
File file = File(_file);
await file?.writeAsString(config);
}
static Future<void> exportDownloadToFilesystem(String name, String data) async {
String _nzb = await downloadFullPath(name);
String _directory = await downloadDirectory;
//Create download folder if needed
Directory directory = Directory(_directory);
await directory.create(recursive: true);
//Write the NZB to the filesystem
File file = File(_nzb);
await file?.writeAsString(data);
}
}