mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-15 08:58:51 +00:00
add release notice to inform user of the new changement
This commit is contained in:
parent
10561ba542
commit
bd9bf517b4
17
babylonia_terminal_launcher/CHANGELOG.md
Normal file
17
babylonia_terminal_launcher/CHANGELOG.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.1] - 2024-10-23
|
||||
|
||||
### Added
|
||||
|
||||
- Notice for new release
|
||||
|
||||
[unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/0.1.1...HEAD
|
||||
[0.1.1]: https://github.com/olivierlacan/keep-a-changelog/compare/0.1.1
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:yaru/yaru.dart';
|
||||
|
||||
@ -7,6 +8,8 @@ import './screens/setup_screen.dart';
|
||||
import './providers/providers.dart';
|
||||
import './models/error_reporter.dart';
|
||||
import './models/game.dart';
|
||||
import './models/release_notice.dart';
|
||||
import './widgets/release_notice_widget.dart';
|
||||
|
||||
class BabyloniaLauncher extends StatelessWidget {
|
||||
BabyloniaLauncher(
|
||||
@ -59,6 +62,26 @@ class Menu extends StatefulWidget {
|
||||
class _MenuState extends State<Menu> {
|
||||
int _selectedIndex = 0;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
final provider = Provider.of<SettingsProvider>(context, listen: false);
|
||||
final pkgsInfo = await PackageInfo.fromPlatform();
|
||||
final currentVersion = pkgsInfo.version;
|
||||
if (provider.lastVersion != currentVersion) {
|
||||
final releaseInfo = await ReleaseNoticeInfo.getInfo(currentVersion);
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
ReleaseNotice(currentVersion: currentVersion, info: releaseInfo),
|
||||
);
|
||||
|
||||
provider.lastVersion = currentVersion;
|
||||
}
|
||||
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> items = Screens.drawerItem(
|
||||
|
||||
29
babylonia_terminal_launcher/lib/models/release_notice.dart
Normal file
29
babylonia_terminal_launcher/lib/models/release_notice.dart
Normal file
@ -0,0 +1,29 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:xml/xml.dart';
|
||||
import 'package:xml/xpath.dart';
|
||||
|
||||
class ReleaseNoticeInfo {
|
||||
static const _releaseInfoUrl =
|
||||
"https://raw.githubusercontent.com/ALEZ-DEV/Babylonia-terminal-flatpak-builds/refs/heads/main/moe.celica.BabyloniaTerminal.metainfo.xml";
|
||||
|
||||
static Future<String> getInfo(String currentVersion) async {
|
||||
final content = await rootBundle.loadString("CHANGELOG.md");
|
||||
return parseChangelog(content, currentVersion);
|
||||
}
|
||||
|
||||
static String parseChangelog(String content, String currentVersion) {
|
||||
final regex = RegExp(r'(## \[' +
|
||||
currentVersion +
|
||||
'].+)(?<content>(.|\n)*)(?=(\[unreleased\]|(## \[\d\.\d\.\d\])))');
|
||||
final match = regex.firstMatch(content);
|
||||
if (match != null) {
|
||||
final changelogContent = match.namedGroup("content");
|
||||
|
||||
if (changelogContent != null) {
|
||||
return changelogContent;
|
||||
}
|
||||
}
|
||||
return "### Failed to parse info";
|
||||
}
|
||||
}
|
||||
@ -30,13 +30,22 @@ class Settings {
|
||||
);
|
||||
}
|
||||
|
||||
String firstTimeKey = 'first_time';
|
||||
final String _firstTimeKey = 'first_time';
|
||||
bool? get firstTime {
|
||||
return prefs.getBool(firstTimeKey);
|
||||
return prefs.getBool(_firstTimeKey);
|
||||
}
|
||||
|
||||
set firstTime(bool? value) {
|
||||
prefs.setBool(firstTimeKey, value!);
|
||||
prefs.setBool(_firstTimeKey, value!);
|
||||
}
|
||||
|
||||
final String _lastVersionKey = 'last_version';
|
||||
String? get lastVersion {
|
||||
return prefs.getString(_lastVersionKey);
|
||||
}
|
||||
|
||||
set lastVersion(String? value) {
|
||||
prefs.setString(_lastVersionKey, value!);
|
||||
}
|
||||
|
||||
String? get launchOptions {
|
||||
@ -49,14 +58,14 @@ class Settings {
|
||||
}
|
||||
|
||||
BackgroundType? _backgroundType;
|
||||
String backgroundTypeKey = 'background_type';
|
||||
final String _backgroundTypeKey = 'background_type';
|
||||
|
||||
BackgroundType get selectedBackgroundType {
|
||||
final bt = prefs.getString(backgroundTypeKey);
|
||||
final bt = prefs.getString(_backgroundTypeKey);
|
||||
if (bt == null) {
|
||||
_backgroundType = BackgroundType.disable;
|
||||
prefs.setString(
|
||||
backgroundTypeKey,
|
||||
_backgroundTypeKey,
|
||||
getStringNameOfBackgroundType(_backgroundType!),
|
||||
);
|
||||
} else {
|
||||
@ -69,7 +78,7 @@ class Settings {
|
||||
set selectedBackgroundType(BackgroundType selectedBackground) {
|
||||
_backgroundType = selectedBackground;
|
||||
prefs.setString(
|
||||
backgroundTypeKey,
|
||||
_backgroundTypeKey,
|
||||
getStringNameOfBackgroundType(selectedBackground),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import './../models/settings.dart';
|
||||
import './../models/config.dart';
|
||||
@ -29,6 +28,18 @@ class SettingsProvider with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
String get lastVersion {
|
||||
final result = _settings.lastVersion;
|
||||
if (result == null) {
|
||||
return '';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
set lastVersion(String value) {
|
||||
_settings.lastVersion = value;
|
||||
}
|
||||
|
||||
set setSelectedBackgroundType(BackgroundType selectedBackground) {
|
||||
_settings.selectedBackgroundType = selectedBackground;
|
||||
notifyListeners();
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:yaru/yaru.dart';
|
||||
|
||||
class ReleaseNotice extends StatelessWidget {
|
||||
const ReleaseNotice(
|
||||
{super.key, required this.currentVersion, required this.info});
|
||||
|
||||
final String currentVersion;
|
||||
final String info;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
titlePadding: EdgeInsets.zero,
|
||||
title: const YaruDialogTitleBar(
|
||||
title: Text('Release notice'),
|
||||
isClosable: true,
|
||||
),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
content: SizedBox(
|
||||
height: 400,
|
||||
width: 700,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
"Version $currentVersion just dropped!",
|
||||
style: const TextStyle(
|
||||
fontSize: 32,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 25.0),
|
||||
child: Text(
|
||||
"What's new :",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30.0),
|
||||
child: SizedBox(
|
||||
height: 300,
|
||||
child: Markdown(data: info),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -150,6 +150,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
flutter_markdown:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_markdown
|
||||
sha256: f0e599ba89c9946c8e051780f0ec99aba4ba15895e0380a7ab68f420046fc44e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.4+1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@ -248,6 +256,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
markdown:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: markdown
|
||||
sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.2.2"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -361,13 +377,13 @@ packages:
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
package_info_plus:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info_plus
|
||||
sha256: a75164ade98cb7d24cfd0a13c6408927c6b217fa60dee5a7ff5c116a58f28918
|
||||
sha256: df3eb3e0aed5c1107bb0fdb80a8e82e778114958b1c5ac5644fb1ac9cae8a998
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.0.2"
|
||||
version: "8.1.0"
|
||||
package_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -1,48 +1,18 @@
|
||||
name: babylonia_terminal_launcher
|
||||
description: "A new Flutter project."
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
description: "A launcher to play a certain anime game on linux"
|
||||
publish_to: 'none'
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
version: 0.1.1
|
||||
|
||||
environment:
|
||||
sdk: '>=3.3.4 <4.0.0'
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||
# dependencies can be manually updated by changing the version numbers below to
|
||||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.6
|
||||
yaru: ^4.1.0
|
||||
# media_kit: ^1.1.10+1
|
||||
# media_kit_video: ^1.2.4
|
||||
# media_kit_libs_video: ^1.0.4
|
||||
# media_kit: any
|
||||
# media_kit_video: any
|
||||
# media_kit_libs_video: any
|
||||
# media_kit_native_event_loop: any
|
||||
provider: ^6.1.2
|
||||
rinf: ^6.9.0
|
||||
protobuf: ^3.1.0
|
||||
@ -54,79 +24,19 @@ dependencies:
|
||||
media_kit_video: ^1.2.5
|
||||
media_kit_libs_video: ^1.0.5
|
||||
yaru_window: ^0.2.1
|
||||
|
||||
#dependency_overrides:
|
||||
# media_kit:
|
||||
# git:
|
||||
# url: https://github.com/media-kit/media-kit
|
||||
# path: media_kit
|
||||
# ref: main
|
||||
# media_kit_video:
|
||||
# git:
|
||||
# url: https://github.com/media-kit/media-kit
|
||||
# path: media_kit_video
|
||||
# ref: main
|
||||
# media_kit_libs_video:
|
||||
# git:
|
||||
# url: https://github.com/media-kit/media-kit
|
||||
# path: libs/universal/media_kit_libs_video
|
||||
# ref: main
|
||||
#
|
||||
# media_kit_native_event_loop:
|
||||
# git:
|
||||
# url: https://github.com/media-kit/media-kit
|
||||
# path: media_kit_native_event_loop
|
||||
# ref: main
|
||||
package_info_plus: ^8.1.0
|
||||
flutter_markdown: ^0.7.4+1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^3.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- assets/images/Lee6.png
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
|
||||
# To add custom fonts to your application, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
- CHANGELOG.md
|
||||
|
||||
Loading…
Reference in New Issue
Block a user