diff --git a/app/lib/engine/transmission/transmission.dart b/app/lib/engine/transmission/transmission.dart index 7fdd51b..197c30d 100644 --- a/app/lib/engine/transmission/transmission.dart +++ b/app/lib/engine/transmission/transmission.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'package:flutter_libtransmission/flutter_libtransmission.dart' as flutter_libtransmission; import 'package:path_provider/path_provider.dart'; -import 'package:pikatorrent/engine/file.dart' as torrentFile; +import 'package:pikatorrent/engine/file.dart' as torrent_file; import 'package:pikatorrent/engine/engine.dart'; import 'package:pikatorrent/engine/session.dart'; import 'package:pikatorrent/engine/torrent.dart'; @@ -133,6 +133,7 @@ class TransmissionEngine implements Engine { @override void dispose() { + print('dispose'); flutter_libtransmission.closeSession(); } @@ -254,7 +255,7 @@ class TransmissionEngine implements Engine { files: torrent.files ?.asMap() .entries - .map((entry) => torrentFile.File( + .map((entry) => torrent_file.File( name: entry.value.name, length: entry.value.length, bytesCompleted: entry.value.bytesCompleted, @@ -288,15 +289,6 @@ class TransmissionEngine implements Engine { @override Future resetSettings() async { - // Close transmission session - dispose(); - // Delete settings.json - final settingsFilePath = - path.join((await getConfigDir()).path, 'settings.json'); - File settingsFile = File(settingsFilePath); - // Delete settings file - settingsFile.deleteSync(); - // Re-init transmission - init(); + flutter_libtransmission.resetSettings(); } } diff --git a/app/lib/screens/settings/dialogs/reset_torrent_settings.dart b/app/lib/screens/settings/dialogs/reset_torrent_settings.dart index e569d17..fc74d17 100644 --- a/app/lib/screens/settings/dialogs/reset_torrent_settings.dart +++ b/app/lib/screens/settings/dialogs/reset_torrent_settings.dart @@ -12,10 +12,9 @@ class ResetTorrentsSettingsDialog extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - title: const Text('Reset torrents settings'), content: const Column( mainAxisSize: MainAxisSize.min, - children: [Text('All torrents settings will be reset. Torrents will be stopped and restarted.')], + children: [Text('All torrents settings will be reset.')], ), actions: [ TextButton( @@ -25,7 +24,7 @@ class ResetTorrentsSettingsDialog extends StatelessWidget { }, ), TextButton( - child: const Text('OK'), + child: const Text('Reset'), onPressed: () { Navigator.of(context).pop(); handleOK(); diff --git a/app/lib/screens/settings/settings.dart b/app/lib/screens/settings/settings.dart index fb65a39..28345f2 100644 --- a/app/lib/screens/settings/settings.dart +++ b/app/lib/screens/settings/settings.dart @@ -102,8 +102,6 @@ class _SettingsScreenState extends State { return Consumer2( builder: (context, app, sessionModel, child) { var downloadDir = sessionModel.session?.downloadDir ?? ''; - var downloadQueueEnabled = - sessionModel.session?.downloadQueueEnabled ?? ''; var downloadQueueSize = sessionModel.session?.downloadQueueSize ?? ''; return ListView(children: [ diff --git a/app/pubspec.lock b/app/pubspec.lock index 8c7901f..925374b 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -234,8 +234,8 @@ packages: dependency: "direct main" description: path: "." - ref: c1968b54f937306e0218c95629da686720ffb76b - resolved-ref: c1968b54f937306e0218c95629da686720ffb76b + ref: "10fcbfc23cd8339e29dd12cc656457b9568ad86f" + resolved-ref: "10fcbfc23cd8339e29dd12cc656457b9568ad86f" url: "https://github.com/G-Ray/flutter_libtransmission" source: git version: "0.0.1" diff --git a/app/pubspec.yaml b/app/pubspec.yaml index dfad9f9..7a184c3 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -33,7 +33,7 @@ dependencies: flutter_libtransmission: git: url: "https://github.com/G-Ray/flutter_libtransmission" - ref: c1968b54f937306e0218c95629da686720ffb76b + ref: 10fcbfc23cd8339e29dd12cc656457b9568ad86f # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.