Browse Source

Merge pull request #255 from provokateurin/refactor/logo-loading

tool,neon,app: Refactor logo loading
pull/261/head
Kate 2 years ago committed by GitHub
parent
commit
773d9586f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      packages/app/assets/logo.svg
  2. 6
      packages/app/lib/branding.dart
  3. 2
      packages/app/linux/my_application.cc
  4. 2
      packages/app/pubspec.lock
  5. 1
      packages/app/pubspec.yaml
  6. 2
      packages/neon/neon/lib/src/app.dart
  7. 7
      packages/neon/neon/lib/src/pages/login.dart
  8. 7
      packages/neon/neon/lib/src/pages/settings.dart
  9. 3
      packages/neon/neon/lib/src/utils/branding.dart
  10. 2
      packages/neon/neon/lib/src/utils/push_utils.dart
  11. 8
      tool/generate-neon.sh

0
packages/app/assets/logo_neon.svg → packages/app/assets/logo.svg

Before

Width:  |  Height:  |  Size: 842 B

After

Width:  |  Height:  |  Size: 842 B

6
packages/app/lib/branding.dart

@ -1,12 +1,6 @@
import 'package:flutter_svg/flutter_svg.dart';
import 'package:neon/neon.dart'; import 'package:neon/neon.dart';
Branding getNeonBranding() => Branding( Branding getNeonBranding() => Branding(
name: 'Nextcloud Neon', name: 'Nextcloud Neon',
legalese: 'Copyright © 2023, provokateurin\nUnder GPLv3 license', legalese: 'Copyright © 2023, provokateurin\nUnder GPLv3 license',
buildLogo: (final context, final size) => SvgPicture.asset(
'assets/logo_neon.svg',
width: size.width,
height: size.height,
),
); );

2
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(FlDartProject) project = fl_dart_project_new();
g_autoptr(GError) error = nullptr; 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) { if (error != nullptr) {
g_warning("Failed to set icon: %s", error->message); g_warning("Failed to set icon: %s", error->message);
} }

2
packages/app/pubspec.lock

@ -256,7 +256,7 @@ packages:
source: hosted source: hosted
version: "2.0.9" version: "2.0.9"
flutter_svg: flutter_svg:
dependency: "direct main" dependency: transitive
description: description:
name: flutter_svg name: flutter_svg
sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2" sha256: "6ff9fa12892ae074092de2fa6a9938fb21dbabfdaa2ff57dc697ff912fc8d4b2"

1
packages/app/pubspec.yaml

@ -10,7 +10,6 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_native_splash: ^2.2.0+1 flutter_native_splash: ^2.2.0+1
flutter_svg: ^1.1.6
neon: neon:
path: ../neon/neon path: ../neon/neon
neon_files: neon_files:

2
packages/neon/neon/lib/src/app.dart

@ -133,7 +133,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
_globalOptions.systemTrayEnabled.stream.listen((final enabled) async { _globalOptions.systemTrayEnabled.stream.listen((final enabled) async {
if (enabled) { if (enabled) {
// TODO: This works on Linux, but maybe not on macOS or Windows // 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) { if (mounted) {
await tray.trayManager.setContextMenu( await tray.trayManager.setContextMenu(
tray.Menu( tray.Menu(

7
packages/neon/neon/lib/src/pages/login.dart

@ -172,9 +172,10 @@ class _LoginPageState extends State<LoginPage> {
height: MediaQuery.of(context).size.height / 2, height: MediaQuery.of(context).size.height / 2,
child: Column( child: Column(
children: [ children: [
Provider.of<Branding>(context, listen: false).buildLogo( SvgPicture.asset(
context, 'assets/logo.svg',
const Size(100, 100), width: 100,
height: 100,
), ),
Text( Text(
Provider.of<Branding>(context, listen: false).name, Provider.of<Branding>(context, listen: false).name,

7
packages/neon/neon/lib/src/pages/settings.dart

@ -222,9 +222,10 @@ class _SettingsPageState extends State<SettingsPage> {
showLicensePage( showLicensePage(
context: context, context: context,
applicationName: branding.name, applicationName: branding.name,
applicationIcon: branding.buildLogo( applicationIcon: SvgPicture.asset(
context, 'assets/logo.svg',
const Size(100, 100), width: 100,
height: 100,
), ),
applicationLegalese: branding.legalese, applicationLegalese: branding.legalese,
applicationVersion: Provider.of<PackageInfo>(context, listen: false).version, applicationVersion: Provider.of<PackageInfo>(context, listen: false).version,

3
packages/neon/neon/lib/src/utils/branding.dart

@ -3,13 +3,10 @@ part of '../../neon.dart';
class Branding { class Branding {
Branding({ Branding({
required this.name, required this.name,
required this.buildLogo,
this.legalese, this.legalese,
}); });
final String name; final String name;
final Widget Function(BuildContext, Size) buildLogo;
final String? legalese; final String? legalese;
} }

2
packages/neon/neon/lib/src/utils/push_utils.dart

@ -27,7 +27,7 @@ class PushUtils {
android: const AndroidInitializationSettings('@mipmap/ic_launcher'), android: const AndroidInitializationSettings('@mipmap/ic_launcher'),
linux: LinuxInitializationSettings( linux: LinuxInitializationSettings(
defaultActionName: 'Open', defaultActionName: 'Open',
defaultIcon: AssetsLinuxIcon('assets/logo_neon.svg'), defaultIcon: AssetsLinuxIcon('assets/logo.svg'),
), ),
), ),
onDidReceiveNotificationResponse: onDidReceiveNotificationResponse, onDidReceiveNotificationResponse: onDidReceiveNotificationResponse,

8
tool/generate-neon.sh

@ -60,16 +60,16 @@ copy_nextcloud_app_svg notifications external/nextcloud-notifications
cd packages/app cd packages/app
# Neon logo # Neon logo
wget https://raw.githubusercontent.com/Templarian/MaterialDesign/master/svg/cable-data.svg -O assets/logo_neon.svg wget https://raw.githubusercontent.com/Templarian/MaterialDesign/master/svg/cable-data.svg -O assets/logo.svg
sed -i "s/<path /<path fill=\"$color\" /g" assets/logo_neon.svg sed -i "s/<path /<path fill=\"$color\" /g" assets/logo.svg
# Splash screens # Splash screens
inkscape assets/logo_neon.svg -o img/splash_icon.png -w 768 -h 768 # 768px at xxxhdpi is 192dp inkscape assets/logo.svg -o img/splash_icon.png -w 768 -h 768 # 768px at xxxhdpi is 192dp
convert -size 1152x1152 xc:none img/splash_icon.png -gravity center -composite img/splash_icon_android_12.png # 1152px at xxxhdpi is 288dp convert -size 1152x1152 xc:none img/splash_icon.png -gravity center -composite img/splash_icon_android_12.png # 1152px at xxxhdpi is 288dp
exiftool -overwrite_original -all= img/splash_icon_android_12.png # To remove timestamps exiftool -overwrite_original -all= img/splash_icon_android_12.png # To remove timestamps
# Android launcher icons # Android launcher icons
export_mipmap_icon_all "assets/logo_neon.svg" "ic_launcher" & export_mipmap_icon_all "assets/logo.svg" "ic_launcher" &
for id in files news notes notifications; do for id in files news notes notifications; do
export_mipmap_icon_all "../neon/neon_$id/assets/app.svg" "app_$id" & export_mipmap_icon_all "../neon/neon_$id/assets/app.svg" "app_$id" &
done done

Loading…
Cancel
Save