Compare commits

..

No commits in common. "ad0ee971c19696d9481d48073dcbf871ce327f6a" and "2027eab49b6e635e678cfa56a19829fcc89950ba" have entirely different histories.

7 changed files with 20 additions and 48 deletions

View File

@ -719,7 +719,6 @@
"stickersNewDescription": "Create a new sticker belongs to this pack.", "stickersNewDescription": "Create a new sticker belongs to this pack.",
"stickersPackNew": "New Sticker Pack", "stickersPackNew": "New Sticker Pack",
"trayMenuShow": "Show", "trayMenuShow": "Show",
"trayMenuMuteNotification": "Do Not Disturb",
"update": "Update", "update": "Update",
"forceUpdate": "Force Update", "forceUpdate": "Force Update",
"forceUpdateDescription": "Force to show the application update popup, even the new version is not available." "forceUpdateDescription": "Force to show the application update popup, even the new version is not available."

View File

@ -717,7 +717,6 @@
"stickersNewDescription": "创建一个新的贴图。", "stickersNewDescription": "创建一个新的贴图。",
"stickersPackNew": "新建贴图包", "stickersPackNew": "新建贴图包",
"trayMenuShow": "显示", "trayMenuShow": "显示",
"trayMenuMuteNotification": "静音通知",
"update": "更新", "update": "更新",
"forceUpdate": "强制更新", "forceUpdate": "强制更新",
"forceUpdateDescription": "强制更新应用程序,即使有更新的版本可能不可用。" "forceUpdateDescription": "强制更新应用程序,即使有更新的版本可能不可用。"

View File

@ -717,7 +717,6 @@
"stickersNewDescription": "創建一個新的貼圖。", "stickersNewDescription": "創建一個新的貼圖。",
"stickersPackNew": "新建貼圖包", "stickersPackNew": "新建貼圖包",
"trayMenuShow": "顯示", "trayMenuShow": "顯示",
"trayMenuMuteNotification": "靜音通知",
"update": "更新", "update": "更新",
"forceUpdate": "強制更新", "forceUpdate": "強制更新",
"forceUpdateDescription": "強制更新應用程序,即使有更新的版本可能不可用。" "forceUpdateDescription": "強制更新應用程序,即使有更新的版本可能不可用。"

View File

@ -717,7 +717,6 @@
"stickersNewDescription": "創建一個新的貼圖。", "stickersNewDescription": "創建一個新的貼圖。",
"stickersPackNew": "新建貼圖包", "stickersPackNew": "新建貼圖包",
"trayMenuShow": "顯示", "trayMenuShow": "顯示",
"trayMenuMuteNotification": "靜音通知",
"update": "更新", "update": "更新",
"forceUpdate": "強制更新", "forceUpdate": "強制更新",
"forceUpdateDescription": "強制更新應用程序,即使有更新的版本可能不可用。" "forceUpdateDescription": "強制更新應用程序,即使有更新的版本可能不可用。"

View File

@ -333,20 +333,25 @@ class _AppSplashScreenState extends State<_AppSplashScreen> with TrayListener {
} }
} }
final Menu _appTrayMenu = Menu( Future<void> _trayInitialization() async {
if (kIsWeb || Platform.isAndroid || Platform.isIOS) return;
final icon = Platform.isWindows
? 'assets/icon/tray-icon.ico'
: 'assets/icon/tray-icon.png';
final appVersion = await PackageInfo.fromPlatform();
trayManager.addListener(this);
await trayManager.setIcon(icon);
Menu menu = Menu(
items: [ items: [
MenuItem( MenuItem(
key: 'version_label', key: 'version_label',
label: 'Solian', label: 'Solian ${appVersion.version}+${appVersion.buildNumber}',
disabled: true, disabled: true,
), ),
MenuItem.separator(), MenuItem.separator(),
MenuItem.checkbox(
checked: false,
key: 'mute_notification',
label: 'trayMenuMuteNotification'.tr(),
),
MenuItem.separator(),
MenuItem( MenuItem(
key: 'window_show', key: 'window_show',
label: 'trayMenuShow'.tr(), label: 'trayMenuShow'.tr(),
@ -357,25 +362,7 @@ class _AppSplashScreenState extends State<_AppSplashScreen> with TrayListener {
), ),
], ],
); );
await trayManager.setContextMenu(menu);
Future<void> _trayInitialization() async {
if (kIsWeb || Platform.isAndroid || Platform.isIOS) return;
final icon = Platform.isWindows
? 'assets/icon/tray-icon.ico'
: 'assets/icon/tray-icon.png';
final appVersion = await PackageInfo.fromPlatform();
trayManager.addListener(this);
await trayManager.setIcon(icon);
_appTrayMenu.items![0] = MenuItem(
key: 'version_label',
label: 'Solian ${appVersion.version}+${appVersion.buildNumber}',
disabled: true,
);
await trayManager.setContextMenu(_appTrayMenu);
} }
Future<void> _notifyInitialization() async { Future<void> _notifyInitialization() async {
@ -437,15 +424,8 @@ class _AppSplashScreenState extends State<_AppSplashScreen> with TrayListener {
@override @override
void onTrayMenuItemClick(MenuItem menuItem) { void onTrayMenuItemClick(MenuItem menuItem) {
switch (menuItem.key) { switch (menuItem.key) {
case 'mute_notification':
final nty = context.read<NotificationProvider>();
nty.isMuted = !nty.isMuted;
_appTrayMenu.items![2].checked = nty.isMuted;
trayManager.setContextMenu(_appTrayMenu);
break;
case 'window_show': case 'window_show':
// To prevent the window from being hide after just show on macOS appWindow.show();
Timer(const Duration(milliseconds: 100), () => appWindow.show());
break; break;
case 'exit': case 'exit':
_appLifecycleListener?.dispose(); _appLifecycleListener?.dispose();

View File

@ -79,7 +79,6 @@ class NotificationProvider extends ChangeNotifier {
List<SnNotification> notifications = List.empty(growable: true); List<SnNotification> notifications = List.empty(growable: true);
int? skippableNotifyChannel; int? skippableNotifyChannel;
bool isMuted = false;
void listen() { void listen() {
_ws.pk.stream.listen((event) { _ws.pk.stream.listen((event) {
@ -108,7 +107,7 @@ class NotificationProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
updateTray(); updateTray();
if (!kIsWeb && !isMuted) { if (!kIsWeb) {
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) { if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
LocalNotification notify = LocalNotification( LocalNotification notify = LocalNotification(
title: notification.title, title: notification.title,

View File

@ -188,9 +188,6 @@ class AppRootScaffold extends StatelessWidget {
child: Text( child: Text(
'Solar Network', 'Solar Network',
style: GoogleFonts.spaceGrotesk(), style: GoogleFonts.spaceGrotesk(),
textAlign: Platform.isMacOS
? TextAlign.center
: TextAlign.start,
).padding(horizontal: 12, vertical: 5), ).padding(horizontal: 12, vertical: 5),
), ),
if (!Platform.isMacOS) if (!Platform.isMacOS)