From 3e6bab7aab15a02f05fa12ce0e1b167b956db046 Mon Sep 17 00:00:00 2001 From: Markus Wageringel Date: Wed, 20 Jul 2022 21:59:01 +0200 Subject: [PATCH 1/4] separate build dependencies for android and web Additionally use rsvg-convert for rasterization instead of Inkscape, replace wget by curl and disable flutter analytics. --- Makefile | 50 ++++++++++++++++++++++++++++++-------------------- README.md | 2 +- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 8ac2eb6..36296a7 100644 --- a/Makefile +++ b/Makefile @@ -1,52 +1,62 @@ -all: app web -app: fonts icons - flutter build apk +FLUTTER=flutter BASEHREF=/demo/ -web: fonts icons - flutter build web --base-href=$(BASEHREF) --release + +all: app web +app: assets-android + $(FLUTTER) config --no-analytics + $(FLUTTER) build apk +web: assets-web + $(FLUTTER) build web --base-href=$(BASEHREF) --release rm -rf website/demo/ cp -p -r build/web/ website/demo/ gh-pages: - flutter clean - make BASEHREF=/everest/demo/ web + $(FLUTTER) clean + $(MAKE) BASEHREF=/everest/demo/ web # assumes worktree gh-pages is checked out in ./gh-pages/ cd gh-pages && git rm -rf . --ignore-unmatch && cp -p -r ../website/* . && git add . && git commit --amend --no-edit host: cd website && python -m http.server 8000 -run: fonts icons - flutter run +run: assets-android assets-web + $(FLUTTER) run test: - flutter test test/expressions_test.dart + $(FLUTTER) test test/expressions_test.dart clean: icons-clean - flutter clean + $(FLUTTER) clean rm -rf website/demo/ -icons: android/app/src/main/res/mipmap-hdpi/ic_launcher.png website/favicon.ico web/favicon.ico web/icons/Icon-192.png web/icons/Icon-maskable-192.png web/icons/Icon-512.png web/icons/Icon-maskable-512.png -android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png - flutter pub get - flutter pub run flutter_launcher_icons:main +assets-android: fonts icons-android +assets-web: fonts icons-web + +# rasterized icons are generated from an svg file +icons-android: android/app/src/main/res/mipmap-hdpi/ic_launcher.png assets/launcher_icon.png: assets/launcher_icon.svg - inkscape -w 1024 -h 1024 assets/launcher_icon.svg -o assets/launcher_icon.png + rsvg-convert --width=1024 --height=1024 --keep-aspect-ratio assets/launcher_icon.svg > $@ +android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png + $(FLUTTER) pub get + $(FLUTTER) pub run flutter_launcher_icons:main + +icons-web: website/favicon.ico web/favicon.ico web/icons/Icon-192.png web/icons/Icon-maskable-192.png web/icons/Icon-512.png web/icons/Icon-maskable-512.png web/favicon.ico website/favicon.ico: assets/launcher_icon.svg magick -background none assets/launcher_icon.svg -define icon:auto-resize $@ web/icons/Icon-192.png web/icons/Icon-maskable-192.png: assets/launcher_icon.svg mkdir -p web/icons/ - inkscape -w 192 -h 192 assets/launcher_icon.svg -o $@ + rsvg-convert --width=192 --height=192 --keep-aspect-ratio assets/launcher_icon.svg > $@ web/icons/Icon-512.png web/icons/Icon-maskable-512.png: assets/launcher_icon.svg mkdir -p web/icons/ - inkscape -w 512 -h 512 assets/launcher_icon.svg -o $@ + rsvg-convert --width=512 --height=512 --keep-aspect-ratio assets/launcher_icon.svg > $@ icons-clean: rm -f android/app/src/main/res/mipmap-*/ic_launcher.png rm -f website/favicon.ico web/favicon.ico web/icons/*.png rm -f assets/launcher_icon.png +# fonts are downloaded and bundled into the app fonts: fonts/NotoSansMath-Regular.ttf fonts/NotoSansMath-Regular.ttf: | build/upstream/Noto_Sans_Math.zip mkdir -p fonts/ unzip -o build/upstream/Noto_Sans_Math.zip -d fonts/ build/upstream/Noto_Sans_Math.zip: mkdir -p build/upstream/ - wget -O build/upstream/Noto_Sans_Math.zip https://fonts.google.com/download?family=Noto%20Sans%20Math + curl --output build/upstream/Noto_Sans_Math.zip https://fonts.google.com/download?family=Noto%20Sans%20Math .INTERMEDIATE: build/upstream/Noto_Sans_Math.zip -.PHONY: all app web gh-pages host run test zip fonts icons icons-clean clean +.PHONY: all app web gh-pages host run test assets-android assets-web fonts icons-android icons-web icons-clean clean diff --git a/README.md b/README.md index a609361..2ccf779 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ A mathematical puzzle game. Try it at https://mwageringel.github.io/everest/ ## Build dependencies -Building with `make` requires `flutter, python, inkscape, imagemagick`. +Building with `make` requires `flutter, curl, rsvg-convert, imagemagick`. From 02c45974b250a73d01a78f78f4c78117c1aefcd8 Mon Sep 17 00:00:00 2001 From: Markus Wageringel Date: Thu, 21 Jul 2022 19:09:38 +0200 Subject: [PATCH 2/4] add apk signing certificate fingerprint to readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 2ccf779..f1ebaf3 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,8 @@ A mathematical puzzle game. Try it at https://mwageringel.github.io/everest/ ## Build dependencies Building with `make` requires `flutter, curl, rsvg-convert, imagemagick`. + + +APK signing certificate fingerprint (SHA-256): + + 576bae61b2aba5d1d32a17d373baa36e05beaaefb67d9b47218d004c0e8333d9 From b52747972d77093f61cb19edec93a82f627cea24 Mon Sep 17 00:00:00 2001 From: Markus Wageringel Date: Fri, 22 Jul 2022 18:26:30 +0200 Subject: [PATCH 3/4] change icon and add adaptive icon This also fixes the scaling of the maskable web icons. --- .gitignore | 2 + Makefile | 16 ++++-- assets/launcher_icon.svg | 75 ++++++++++++++++--------- assets/launcher_icon_adaptive.svg | 92 +++++++++++++++++++++++++++++++ pubspec.yaml | 2 + web/manifest.json | 4 +- 6 files changed, 158 insertions(+), 33 deletions(-) create mode 100644 assets/launcher_icon_adaptive.svg diff --git a/.gitignore b/.gitignore index 52c5622..b50b39b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ *.ico *.apk *.apk.sha1 +/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +/android/app/src/main/res/values/colors.xml # Miscellaneous *.class diff --git a/Makefile b/Makefile index 36296a7..d907b72 100644 --- a/Makefile +++ b/Makefile @@ -31,23 +31,31 @@ assets-web: fonts icons-web icons-android: android/app/src/main/res/mipmap-hdpi/ic_launcher.png assets/launcher_icon.png: assets/launcher_icon.svg rsvg-convert --width=1024 --height=1024 --keep-aspect-ratio assets/launcher_icon.svg > $@ -android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png +assets/launcher_icon_adaptive.png: assets/launcher_icon_adaptive.svg + rsvg-convert --page-width=1024 --page-height=1024 --width=584 --height=584 --top=220 --left=220 --keep-aspect-ratio assets/launcher_icon_adaptive.svg > $@ +android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png assets/launcher_icon_adaptive.png $(FLUTTER) pub get $(FLUTTER) pub run flutter_launcher_icons:main icons-web: website/favicon.ico web/favicon.ico web/icons/Icon-192.png web/icons/Icon-maskable-192.png web/icons/Icon-512.png web/icons/Icon-maskable-512.png web/favicon.ico website/favicon.ico: assets/launcher_icon.svg magick -background none assets/launcher_icon.svg -define icon:auto-resize $@ -web/icons/Icon-192.png web/icons/Icon-maskable-192.png: assets/launcher_icon.svg +web/icons/Icon-192.png: assets/launcher_icon.svg mkdir -p web/icons/ rsvg-convert --width=192 --height=192 --keep-aspect-ratio assets/launcher_icon.svg > $@ -web/icons/Icon-512.png web/icons/Icon-maskable-512.png: assets/launcher_icon.svg +web/icons/Icon-512.png: assets/launcher_icon.svg mkdir -p web/icons/ rsvg-convert --width=512 --height=512 --keep-aspect-ratio assets/launcher_icon.svg > $@ +web/icons/Icon-maskable-192.png: assets/launcher_icon_adaptive.svg + mkdir -p web/icons/ + rsvg-convert --page-width=192 --page-height=192 --width=150 --height=150 --top=21 --left=21 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_adaptive.svg > $@ +web/icons/Icon-maskable-512.png: assets/launcher_icon_adaptive.svg + mkdir -p web/icons/ + rsvg-convert --page-width=512 --page-height=512 --width=400 --height=400 --top=56 --left=56 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_adaptive.svg > $@ icons-clean: rm -f android/app/src/main/res/mipmap-*/ic_launcher.png rm -f website/favicon.ico web/favicon.ico web/icons/*.png - rm -f assets/launcher_icon.png + rm -f assets/launcher_icon.png assets/launcher_icon_adaptive.png # fonts are downloaded and bundled into the app fonts: fonts/NotoSansMath-Regular.ttf diff --git a/assets/launcher_icon.svg b/assets/launcher_icon.svg index 7397272..5510bb0 100644 --- a/assets/launcher_icon.svg +++ b/assets/launcher_icon.svg @@ -7,10 +7,11 @@ viewBox="0 0 60.235294 60.235294" version="1.1" id="svg1791" - inkscape:version="1.2 (dc2aedaf03, 2022-05-15)" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" sodipodi:docname="launcher_icon.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> + inkscape:current-layer="layer3" /> - + + + + + + + + - + style="fill:#536dfe;fill-opacity:1;fill-rule:evenodd;stroke-width:0.285539" + d="m 528.86287,535.68072 -19.71379,42.5658 51.68888,-0.0382 -19.0253,-35.53374 -4.17353,8.30178 z m 1.1324,14.7102 6.98504,11.16235 4.05343,-8.28159 9.77124,18.26745 -30.97297,-0.16891 z" + sodipodi:nodetypes="cccccccccccc" /> + sodipodi:nodetypes="ccccccc" /> diff --git a/assets/launcher_icon_adaptive.svg b/assets/launcher_icon_adaptive.svg new file mode 100644 index 0000000..fbe47db --- /dev/null +++ b/assets/launcher_icon_adaptive.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + diff --git a/pubspec.yaml b/pubspec.yaml index 510c7df..c23043f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -107,3 +107,5 @@ flutter_icons: android: true ios: false image_path: assets/launcher_icon.png + adaptive_icon_foreground: assets/launcher_icon_adaptive.png + adaptive_icon_background: "#536dfe" diff --git a/web/manifest.json b/web/manifest.json index 20a155d..31d3e31 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -3,8 +3,8 @@ "short_name": "everest", "start_url": ".", "display": "standalone", - "background_color": "#0175C2", - "theme_color": "#0175C2", + "background_color": "#536dfe", + "theme_color": "#536dfe", "description": "A mathematical puzzle game.", "orientation": "portrait-primary", "prefer_related_applications": false, From 8ec6eb46d2576c8071af1fbe524164644984565c Mon Sep 17 00:00:00 2001 From: Markus Wageringel Date: Fri, 22 Jul 2022 19:45:07 +0200 Subject: [PATCH 4/4] compatibility with older rsvg-convert The `--page-width` paramater is only supported since rsvg-convert version 2.52. For the time being, we avoid it and, instead, add copies of the launcher icon SVG file with different viewports. --- Makefile | 10 ++-- assets/launcher_icon_adaptive.svg | 2 +- assets/launcher_icon_alt.svg | 92 +++++++++++++++++++++++++++++++ assets/launcher_icon_maskable.svg | 92 +++++++++++++++++++++++++++++++ 4 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 assets/launcher_icon_alt.svg create mode 100644 assets/launcher_icon_maskable.svg diff --git a/Makefile b/Makefile index d907b72..3b6517e 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ icons-android: android/app/src/main/res/mipmap-hdpi/ic_launcher.png assets/launcher_icon.png: assets/launcher_icon.svg rsvg-convert --width=1024 --height=1024 --keep-aspect-ratio assets/launcher_icon.svg > $@ assets/launcher_icon_adaptive.png: assets/launcher_icon_adaptive.svg - rsvg-convert --page-width=1024 --page-height=1024 --width=584 --height=584 --top=220 --left=220 --keep-aspect-ratio assets/launcher_icon_adaptive.svg > $@ + rsvg-convert --width=1024 --height=1024 --keep-aspect-ratio assets/launcher_icon_adaptive.svg > $@ android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png assets/launcher_icon_adaptive.png $(FLUTTER) pub get $(FLUTTER) pub run flutter_launcher_icons:main @@ -46,12 +46,12 @@ web/icons/Icon-192.png: assets/launcher_icon.svg web/icons/Icon-512.png: assets/launcher_icon.svg mkdir -p web/icons/ rsvg-convert --width=512 --height=512 --keep-aspect-ratio assets/launcher_icon.svg > $@ -web/icons/Icon-maskable-192.png: assets/launcher_icon_adaptive.svg +web/icons/Icon-maskable-192.png: assets/launcher_icon_maskable.svg mkdir -p web/icons/ - rsvg-convert --page-width=192 --page-height=192 --width=150 --height=150 --top=21 --left=21 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_adaptive.svg > $@ -web/icons/Icon-maskable-512.png: assets/launcher_icon_adaptive.svg + rsvg-convert --width=192 --height=192 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_maskable.svg > $@ +web/icons/Icon-maskable-512.png: assets/launcher_icon_maskable.svg mkdir -p web/icons/ - rsvg-convert --page-width=512 --page-height=512 --width=400 --height=400 --top=56 --left=56 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_adaptive.svg > $@ + rsvg-convert --width=512 --height=512 --keep-aspect-ratio -b '#536dfeff' assets/launcher_icon_maskable.svg > $@ icons-clean: rm -f android/app/src/main/res/mipmap-*/ic_launcher.png rm -f website/favicon.ico web/favicon.ico web/icons/*.png diff --git a/assets/launcher_icon_adaptive.svg b/assets/launcher_icon_adaptive.svg index fbe47db..5aa445b 100644 --- a/assets/launcher_icon_adaptive.svg +++ b/assets/launcher_icon_adaptive.svg @@ -4,7 +4,7 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/launcher_icon_maskable.svg b/assets/launcher_icon_maskable.svg new file mode 100644 index 0000000..38d1cba --- /dev/null +++ b/assets/launcher_icon_maskable.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + +