From 38e1c51b45404aad2b2d80368716c4251796a841 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 26 Mar 2025 23:32:23 +0800 Subject: [PATCH] :bug: Fix linux compile issue --- .github/workflows/nightly.yml | 9 +++++---- assets/translations/en-US.json | 4 +++- assets/translations/zh-CN.json | 4 +++- lib/providers/config.dart | 10 ++++++++++ lib/providers/notification.dart | 2 +- lib/screens/settings.dart | 15 +++++++++++++++ 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 32606cd..ac6bd10 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -52,10 +52,11 @@ jobs: - run: | sudo apt-get update -y sudo apt-get install -y ninja-build libgtk-3-dev - sudo apt-get install libmpv-dev mpv - sudo apt-get install libayatana-appindicator3-dev - sudo apt-get install keybinder-3.0 - sudo apt-get install libnotify-dev + sudo apt-get install -y libmpv-dev mpv + sudo apt-get install -y libayatana-appindicator3-dev + sudo apt-get install -y keybinder-3.0 + sudo apt-get install -y libnotify-dev + sudo apt-get install -y gstreamer-1.0 - run: flutter pub get - run: flutter build linux - name: Archive production artifacts diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index c158e8a..e5b9440 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -933,5 +933,7 @@ "punishmentExpiredAt": "Expired at {}", "punishmentExpiredNever": "Never expired", "punishmentModerator": "Moderator who made this punishment", - "punishmentMadeBySystem": "Made by auto-mod system" + "punishmentMadeBySystem": "Made by auto-mod system", + "settingsAprilFoolFeatures": "April Fool Features", + "settingsAprilFoolFeaturesDescription": "Enable April Fool features during April Fool, this option will only be visible during April Fool." } diff --git a/assets/translations/zh-CN.json b/assets/translations/zh-CN.json index 2e08e69..cfb9009 100644 --- a/assets/translations/zh-CN.json +++ b/assets/translations/zh-CN.json @@ -930,5 +930,7 @@ "punishmentExpiredAt": "到期于 {}", "punishmentExpiredNever": "永久生效", "punishmentModerator": "责任管理员", - "punishmentMadeBySystem": "由系统自动裁决" + "punishmentMadeBySystem": "由系统自动裁决", + "settingsAprilFoolFeatures": "愚人节特性", + "settingsAprilFoolFeaturesDescription": "在愚人节期间启用愚人节特性,该选项只会在愚人节期间显示。" } diff --git a/lib/providers/config.dart b/lib/providers/config.dart index 52bdcb9..df950e4 100644 --- a/lib/providers/config.dart +++ b/lib/providers/config.dart @@ -22,6 +22,7 @@ const kAppCustomFonts = 'app_custom_fonts'; const kAppMixedFeed = 'app_mixed_feed'; const kAppAutoTranslate = 'app_auto_translate'; const kAppHideBottomNav = 'app_hide_bottom_nav'; +const kAppAprilFoolFeatures = 'app_april_fool_features'; const Map kImageQualityLevel = { 'settingsImageQualityLowest': FilterQuality.none, @@ -96,6 +97,15 @@ class ConfigProvider extends ChangeNotifier { return prefs.getBool(kAppHideBottomNav) ?? false; } + bool get aprilFoolFeatures { + return prefs.getBool(kAppAprilFoolFeatures) ?? true; + } + + set aprilFoolFeatures(bool value) { + prefs.setBool(kAppAprilFoolFeatures, value); + notifyListeners(); + } + set hideBottomNav(bool value) { prefs.setBool(kAppHideBottomNav, value); notifyListeners(); diff --git a/lib/providers/notification.dart b/lib/providers/notification.dart index 49f982b..b592a27 100644 --- a/lib/providers/notification.dart +++ b/lib/providers/notification.dart @@ -100,7 +100,7 @@ class NotificationProvider extends ChangeNotifier { if (doHaptic) HapticFeedback.mediumImpact(); // April fool notification sfx - if (doHaptic) { + if (_cfg.prefs.getBool(kAppAprilFoolFeatures) ?? true) { final now = DateTime.now(); if (now.day == 1 && now.month == 4) { _notifySoundPlayer.play( diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 94ac244..cce8912 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -80,6 +80,9 @@ class _SettingsScreenState extends State { Widget build(BuildContext context) { final sn = context.read(); final dt = context.read(); + final cfg = context.watch(); + + final now = DateTime.now(); return AppScaffold( appBar: AppBar( @@ -741,6 +744,18 @@ class _SettingsScreenState extends State { GoRouter.of(context).pushNamed('about'); }, ), + if (now.day == 1 && now.month == 4) + CheckboxListTile( + title: Text('settingsAprilFoolFeatures').tr(), + subtitle: Text('settingsAprilFoolFeaturesDescription').tr(), + contentPadding: const EdgeInsets.only(left: 24, right: 17), + secondary: const Icon(Symbols.new_releases), + value: cfg.aprilFoolFeatures, + onChanged: (value) { + cfg.aprilFoolFeatures = value ?? false; + setState(() {}); + }, + ) ], ), ],