[version] add updater

This commit is contained in:
jscampucci 2024-07-10 09:24:49 +02:00
parent e41f11a8c3
commit 52be0507d9
5 changed files with 31 additions and 14 deletions

13
appcast.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://sparkle-project.org/documentation/publishing/ -->
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>noTube</title>
<item>
<title>Version 0.0.22</title>
<description>Base updater</description>
<pubDate>Tue, 09 Jul 2024 15:20:11 +0000</pubDate>
<enclosure url="https://jscampucci.fr/Libu/noTube/noTube-0.0.22-Win.zip" sparkle:version="0.0.22" sparkle:os="windows" />
</item>
</channel>
</rss>

View File

@ -14,6 +14,7 @@ import 'package:upgrader/upgrader.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:notube/videoList/cubit/videos_cubit.dart'; import 'package:notube/videoList/cubit/videos_cubit.dart';
import 'package:notube/services/file_logger.dart'; import 'package:notube/services/file_logger.dart';
import 'package:package_info_plus/package_info_plus.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -30,6 +31,7 @@ void main() async {
await windowManager.show(); await windowManager.show();
await windowManager.focus(); await windowManager.focus();
}); });
WidgetsFlutterBinding.ensureInitialized();
await FileLogger().init(); await FileLogger().init();
@ -54,11 +56,14 @@ class NoTubeApp extends StatefulWidget {
} }
class _NoTubeAppState extends State<NoTubeApp> { class _NoTubeAppState extends State<NoTubeApp> {
static const appcastURL = static const appcastURL = 'https://jscampucci.fr/Libu/noTube/appcast.xml';
'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml';
final upgrader = Upgrader( final upgrader = Upgrader(
storeController: UpgraderStoreController( storeController: UpgraderStoreController(
onAndroid: () => UpgraderAppcastStore(appcastURL: appcastURL), onAndroid: () => UpgraderAppcastStore(appcastURL: appcastURL),
oniOS: () => UpgraderAppcastStore(appcastURL: appcastURL),
onWindows: () => UpgraderAppcastStore(appcastURL: appcastURL),
onLinux: () => UpgraderAppcastStore(appcastURL: appcastURL),
onMacOS: () => UpgraderAppcastStore(appcastURL: appcastURL),
), ),
); );

View File

@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:filesystem_picker/filesystem_picker.dart'; import 'package:filesystem_picker/filesystem_picker.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:package_info_plus/package_info_plus.dart';
class Settings extends StatefulWidget { class Settings extends StatefulWidget {
Settings({super.key}); Settings({super.key});
@ -17,12 +18,14 @@ class Settings extends StatefulWidget {
class _SettingsState extends State<Settings> { class _SettingsState extends State<Settings> {
late Directory downloadFolder; late Directory downloadFolder;
late SharedPreferences prefs; late SharedPreferences prefs;
late PackageInfo packageInfo;
Future<String> _init() async { Future<String> _init() async {
prefs = await SharedPreferences.getInstance(); prefs = await SharedPreferences.getInstance();
Directory defaultDownloadDirectory = await getDownloadDirectory(); Directory defaultDownloadDirectory = await getDownloadDirectory();
downloadFolder = Directory( downloadFolder = Directory(
prefs.getString('downloadFolder') ?? defaultDownloadDirectory.path); prefs.getString('downloadFolder') ?? defaultDownloadDirectory.path);
packageInfo = await PackageInfo.fromPlatform();
return 'ok'; return 'ok';
} }
@ -97,7 +100,11 @@ class _SettingsState extends State<Settings> {
} }
}, },
), ),
) ),
ListTile(
title: Text('build_version').tr(),
subtitle: Text(packageInfo.version),
),
], ],
)), )),
], ],

View File

@ -137,14 +137,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.0.2" version: "0.0.2"
english_words:
dependency: "direct main"
description:
name: english_words
sha256: "6a7ef6473a97bd8571b6b641d006a6e58a7c67e65fb6f3d6d1151cb46b0e983c"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
equatable: equatable:
dependency: "direct main" dependency: "direct main"
description: description:
@ -382,7 +374,7 @@ packages:
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
package_info_plus: package_info_plus:
dependency: transitive dependency: "direct main"
description: description:
name: package_info_plus name: package_info_plus
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0 sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0

View File

@ -3,7 +3,7 @@ description: noTube
publish_to: "none" # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 0.0.20 version: 0.0.21
environment: environment:
sdk: ">=3.0.0 <4.0.0" sdk: ">=3.0.0 <4.0.0"
@ -12,7 +12,6 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
english_words: ^4.0.0
provider: ^6.1.2 provider: ^6.1.2
flutter_localization: ^0.2.0 flutter_localization: ^0.2.0
easy_localization: ^3.0.7 easy_localization: ^3.0.7
@ -34,6 +33,7 @@ dependencies:
file_picker: ^8.0.6 file_picker: ^8.0.6
rename: ^3.0.2 rename: ^3.0.2
logger: ^2.3.0 logger: ^2.3.0
package_info_plus: ^8.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: