From 3e08713ca06009e62dba0935c6132ab1397a4253 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 19 Apr 2023 07:47:21 +0200 Subject: [PATCH] tool,neon,app: Refactor logo loading --- packages/app/assets/{logo_neon.svg => logo.svg} | 0 packages/app/lib/branding.dart | 6 ------ packages/app/linux/my_application.cc | 2 +- packages/app/pubspec.lock | 2 +- packages/app/pubspec.yaml | 1 - packages/neon/neon/lib/src/app.dart | 2 +- packages/neon/neon/lib/src/pages/login.dart | 7 ++++--- packages/neon/neon/lib/src/pages/settings.dart | 7 ++++--- packages/neon/neon/lib/src/utils/branding.dart | 3 --- packages/neon/neon/lib/src/utils/push_utils.dart | 2 +- tool/generate-neon.sh | 8 ++++---- 11 files changed, 16 insertions(+), 24 deletions(-) rename packages/app/assets/{logo_neon.svg => logo.svg} (100%) diff --git a/packages/app/assets/logo_neon.svg b/packages/app/assets/logo.svg similarity index 100% rename from packages/app/assets/logo_neon.svg rename to packages/app/assets/logo.svg diff --git a/packages/app/lib/branding.dart b/packages/app/lib/branding.dart index fdf2c26a..731fd955 100644 --- a/packages/app/lib/branding.dart +++ b/packages/app/lib/branding.dart @@ -1,12 +1,6 @@ -import 'package:flutter_svg/flutter_svg.dart'; import 'package:neon/neon.dart'; Branding getNeonBranding() => Branding( name: 'Nextcloud Neon', legalese: 'Copyright © 2023, provokateurin\nUnder GPLv3 license', - buildLogo: (final context, final size) => SvgPicture.asset( - 'assets/logo_neon.svg', - width: size.width, - height: size.height, - ), ); diff --git a/packages/app/linux/my_application.cc b/packages/app/linux/my_application.cc index ec56935d..936d14e9 100644 --- a/packages/app/linux/my_application.cc +++ b/packages/app/linux/my_application.cc @@ -53,7 +53,7 @@ static void my_application_activate(GApplication* application) { g_autoptr(FlDartProject) project = fl_dart_project_new(); g_autoptr(GError) error = nullptr; - gtk_window_set_icon_from_file(window, g_strconcat(fl_dart_project_get_assets_path(project), "/assets/logo_neon.svg", NULL), &error); + gtk_window_set_icon_from_file(window, g_strconcat(fl_dart_project_get_assets_path(project), "/assets/logo.svg", NULL), &error); if (error != nullptr) { g_warning("Failed to set icon: %s", error->message); } diff --git a/packages/app/pubspec.lock b/packages/app/pubspec.lock index e8b0e269..eef820a1 100644 --- a/packages/app/pubspec.lock +++ b/packages/app/pubspec.lock @@ -256,7 +256,7 @@ packages: source: hosted version: "2.0.9" flutter_svg: - dependency: "direct main" + dependency: transitive description: name: flutter_svg sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2" diff --git a/packages/app/pubspec.yaml b/packages/app/pubspec.yaml index dd6c33fd..6b70669b 100644 --- a/packages/app/pubspec.yaml +++ b/packages/app/pubspec.yaml @@ -10,7 +10,6 @@ dependencies: flutter: sdk: flutter flutter_native_splash: ^2.2.0+1 - flutter_svg: ^1.1.6 neon: path: ../neon/neon neon_files: diff --git a/packages/neon/neon/lib/src/app.dart b/packages/neon/neon/lib/src/app.dart index a39647e8..2d38c625 100644 --- a/packages/neon/neon/lib/src/app.dart +++ b/packages/neon/neon/lib/src/app.dart @@ -133,7 +133,7 @@ class _NeonAppState extends State with WidgetsBindingObserver, tray.Tra _globalOptions.systemTrayEnabled.stream.listen((final enabled) async { if (enabled) { // TODO: This works on Linux, but maybe not on macOS or Windows - await tray.trayManager.setIcon('assets/logo_neon.svg'); + await tray.trayManager.setIcon('assets/logo.svg'); if (mounted) { await tray.trayManager.setContextMenu( tray.Menu( diff --git a/packages/neon/neon/lib/src/pages/login.dart b/packages/neon/neon/lib/src/pages/login.dart index 48a5ca66..4edf6d19 100644 --- a/packages/neon/neon/lib/src/pages/login.dart +++ b/packages/neon/neon/lib/src/pages/login.dart @@ -172,9 +172,10 @@ class _LoginPageState extends State { height: MediaQuery.of(context).size.height / 2, child: Column( children: [ - Provider.of(context, listen: false).buildLogo( - context, - const Size(100, 100), + SvgPicture.asset( + 'assets/logo.svg', + width: 100, + height: 100, ), Text( Provider.of(context, listen: false).name, diff --git a/packages/neon/neon/lib/src/pages/settings.dart b/packages/neon/neon/lib/src/pages/settings.dart index 09562527..7b201f8d 100644 --- a/packages/neon/neon/lib/src/pages/settings.dart +++ b/packages/neon/neon/lib/src/pages/settings.dart @@ -222,9 +222,10 @@ class _SettingsPageState extends State { showLicensePage( context: context, applicationName: branding.name, - applicationIcon: branding.buildLogo( - context, - const Size(100, 100), + applicationIcon: SvgPicture.asset( + 'assets/logo.svg', + width: 100, + height: 100, ), applicationLegalese: branding.legalese, applicationVersion: Provider.of(context, listen: false).version, diff --git a/packages/neon/neon/lib/src/utils/branding.dart b/packages/neon/neon/lib/src/utils/branding.dart index 38d3edfe..eb42738d 100644 --- a/packages/neon/neon/lib/src/utils/branding.dart +++ b/packages/neon/neon/lib/src/utils/branding.dart @@ -3,13 +3,10 @@ part of '../../neon.dart'; class Branding { Branding({ required this.name, - required this.buildLogo, this.legalese, }); final String name; - final Widget Function(BuildContext, Size) buildLogo; - final String? legalese; } diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index 556e4ff5..7a5a24c3 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -27,7 +27,7 @@ class PushUtils { android: const AndroidInitializationSettings('@mipmap/ic_launcher'), linux: LinuxInitializationSettings( defaultActionName: 'Open', - defaultIcon: AssetsLinuxIcon('assets/logo_neon.svg'), + defaultIcon: AssetsLinuxIcon('assets/logo.svg'), ), ), onDidReceiveNotificationResponse: onDidReceiveNotificationResponse, diff --git a/tool/generate-neon.sh b/tool/generate-neon.sh index a224a828..f6ddce33 100755 --- a/tool/generate-neon.sh +++ b/tool/generate-neon.sh @@ -60,16 +60,16 @@ copy_nextcloud_app_svg notifications external/nextcloud-notifications cd packages/app # Neon logo - wget https://raw.githubusercontent.com/Templarian/MaterialDesign/master/svg/cable-data.svg -O assets/logo_neon.svg - sed -i "s/