Skip to content

Commit 9d7b7cc

Browse files
committed
πŸ› Fix url launcher not launching url
🚚 Change default Storage path to Downloads/FluTube πŸ”– Bump version to 0.5.0
1 parent c3babd7 commit 9d7b7cc

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

β€Žlib/providers/download_path.dart

+10-6
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ import 'package:flutter/foundation.dart';
44
import 'package:flutube/utils/shared_prefs.dart';
55
import 'package:flutube/utils/utils.dart';
66
import 'package:hooks_riverpod/hooks_riverpod.dart';
7+
import 'package:path/path.dart' as p;
78
import 'package:path_provider/path_provider.dart';
89

9-
final downloadPathProvider = ChangeNotifierProvider((_) => DownloadPathNotifier());
10+
final downloadPathProvider =
11+
ChangeNotifierProvider((_) => DownloadPathNotifier());
1012

1113
class DownloadPathNotifier extends ChangeNotifier {
1214
late String _path;
1315
String get path => _path;
1416

1517
set path(String? newPath) {
1618
if (newPath != null && newPath != path && Directory(newPath).existsSync()) {
17-
var _newPath = newPath.endsWith("/") || Platform.isWindows && newPath.endsWith("\\")
18-
? newPath
19-
: newPath + (Platform.isWindows ? '\\' : '/');
19+
var _newPath =
20+
newPath.endsWith("/") || Platform.isWindows && newPath.endsWith("\\")
21+
? newPath
22+
: newPath + (Platform.isWindows ? '\\' : '/');
2023
MyPrefs().prefs.setString('downloadPath', _newPath);
2124
_path = _newPath;
2225
notifyListeners();
@@ -26,8 +29,9 @@ class DownloadPathNotifier extends ChangeNotifier {
2629
init() async {
2730
_path = MyPrefs().prefs.getString('downloadPath') ??
2831
(Platform.isAndroid
29-
? "/storage/emulated/0/${myApp.name}/"
30-
: (await getDownloadsDirectory())!.path.replaceAll('Downloads', '${myApp.name}/'));
32+
? "/storage/emulated/0/Downloads/${myApp.name}/"
33+
: p.join((await getDownloadsDirectory())!.path, myApp.name) +
34+
(Platform.isWindows ? '\\' : '/'));
3135
if (!await Directory(path).exists()) await Directory(path).create();
3236
}
3337

β€Žlib/utils/extensions/string.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import 'package:url_launcher/url_launcher.dart';
1+
import 'package:url_launcher/url_launcher.dart' as url_launcher;
22

33
extension UrlLauncher on String {
4-
launchIt() async => await canLaunch(this) ? await launch(this) : throw 'Could not launch $this';
4+
launchIt() async => await url_launcher.launch(this);
55

66
Duration parseDuration() {
77
int hours = 0;

β€Žlinux/packaging/usr/share/metainfo/flutube.appdata.xml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
</screenshots>
3636
<launchable type="desktop-id">flutube.desktop</launchable>
3737
<releases>
38+
<release version="0.5.0" date="2021-09-29"/>
3839
<release version="0.4.5" date="2021-09-28"/>
3940
<release version="0.4.0" date="2021-09-28"/>
4041
</releases>

β€Žpubspec.lock

+4-6
Original file line numberDiff line numberDiff line change
@@ -1036,12 +1036,10 @@ packages:
10361036
youtube_explode_dart:
10371037
dependency: "direct main"
10381038
description:
1039-
path: "."
1040-
ref: HEAD
1041-
resolved-ref: "70531a0632d54784f288938e3dfb766cbfe6d6dc"
1042-
url: "https://github.com/Hexer10/youtube_explode_dart"
1043-
source: git
1044-
version: "1.10.7-dev.1"
1039+
name: youtube_explode_dart
1040+
url: "https://pub.dartlang.org"
1041+
source: hosted
1042+
version: "1.10.7+1"
10451043
sdks:
10461044
dart: ">=2.14.0 <3.0.0"
10471045
flutter: ">=2.5.0"

β€Žpubspec.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Youtube video downloader made using flutter.
33

44
publish_to: "none"
55

6-
version: 0.4.5
6+
version: 0.5.0
77

88
environment:
99
sdk: ">=2.12.0 <3.0.0"
@@ -41,9 +41,7 @@ dependencies:
4141
sticky_headers: ^0.2.0
4242
timeago: ^3.1.0
4343
url_launcher: ^6.0.11
44-
youtube_explode_dart: #^1.10.7-dev.1
45-
git:
46-
url: https://github.com/Hexer10/youtube_explode_dart
44+
youtube_explode_dart: ^1.10.7
4745

4846
dev_dependencies:
4947
build_runner: ^2.1.2

0 commit comments

Comments
Β (0)