core-bundle icon indicating copy to clipboard operation
core-bundle copied to clipboard

Add manifest.json for basic progressive web app support

Open may17 opened this issue 7 years ago • 15 comments

Progressive web apps are on their way to become the next big thing on the web. One of the basic features is the web app manifest. As promised on the Contao Nordtag here are my thoughts to implement this feature.

The simple solution

  1. Each root page becomes a new checkbox add web app manifest. This checkbox is only visible when https ist flagged.
  2. When the web app manifest is checked the user becomes the ability to define a name for it.
  3. Contao will create an blueprint manifest.json (see here https://developer.mozilla.org/en-US/docs/Web/Manifest) file on the folder where the sitemap.xml files are located. Each file will be prefixed with manifest.custom-name json.
  4. On the frontend contao adds to the header
  5. Now its up to the developer to fill out the manifest file

An alternative solution for auto generating could be an option like "select an json file with the filepicker".

The user friendly solution

Mostly same like the simple solution but with one important difference. The user becomes fields for every web app manifest option to easily fill them out. On save Contao generates the file.

Another solution could be to display an extra widget with predefined fields. This solution would reduce the amount of new table fields.

Anyway there should be the ability to add custom stuff like adding firebase cloud messaging informations.

What do you think?

P.s. And yes there already exists an extension but it seems like it isn`t supported anymore, did not support contao 4 and the implementation is far away from the root page. You will find it here https://contao.org/de/erweiterungsliste/view/web_app_manifest.en.html

may17 avatar Mar 09 '18 20:03 may17

I haven't been at Contao Nordtag, so don't what has been discussed beforehand. I may be missing a point but to me the task is pretty much like with CSS: write the code to a file and then <link> it in your HTML. I don't see why Contao hat to be a manifest.json generator. There seem to be plenty of online generators available.

fiedsch avatar Mar 09 '18 20:03 fiedsch

Perhaps i should add some more informations. The main idea is that Contao should support pwa for several reasons:

  1. Better page ranks
  2. Easy install Web Page as app
  3. Microsoft and google announced also Desktop Support also listing in their stores
  4. offline caching
  5. support for further Features like webpush, Payment or cam api
  6. state of the technological Art and many more further stuff

Perhaps Even the Contao Backend could use Pwa Features like offline editing some day.

The Web App Manifest is just the lowest hanging Fruit and the basic to implement further Features.

Sooner or later there will come Extensions for offline caching, webpush and so on and the worst case would be when everyone is implementing their own Web App Manifest Logic.

may17 avatar Mar 09 '18 22:03 may17

@leofeyer Is there already a solution or an idea how this should be implemented?

MDevster avatar Jun 13 '18 06:06 MDevster

No. Maybe @may17 knows? 😉

leofeyer avatar Jun 13 '18 07:06 leofeyer

@leofeyer should it be in the core or rather as an extension?

MDevster avatar Jun 13 '18 07:06 MDevster

No Extension please. This would end up in to many implementations see my arguments before. Perhaps an own official pwa bundle is an good alternativ.

may17 avatar Jun 13 '18 07:06 may17

Ich glaube nicht dass es realistisch ist eine korrekte Lösung bereits in die 4.6 einzubauen. Wir müssten die möglichen Optionen erst besprechen, am Mumble Call und/oder Entwicklertreffen besprechen. Natürlich wäre ein Pull Request für einen Draft auch vorher sinnvoll, falls jemand dafür Zeit hätte, aber ausser @may17 hat ja afaik niemand damit Erfahrung?

aschempp avatar Jun 13 '18 08:06 aschempp

Imho müsste es eine Route sein, weil sie kann pro Domain anders sein (auch die robots.txt sollte das....) und dann würde ich dort einen Event feuern, damit man sie ändern kann. Die Frage ist eher wann sie invalidiert wird, aber dafür liesse sich eine Lösung finden, denk ich.

Toflar avatar Jun 13 '18 08:06 Toflar

Switch to german - ich denke das ein Contao bundle Pwa sinnvoll wäre. Ähnlich wie bei news oder calendar. Es sollte aber ein offizielles Contao bundle sein. Der Vorteil wäre das es für alle Contao 4 Versionen gültig wäre. Für 3.5 könnte man ggf. Über die Friends of Contao was anbieten.

may17 avatar Jun 14 '18 07:06 may17

Ich habe das ganze mal begonnen und werde versuchen fast jeden Tag eine neue Funktion zu implementieren. Da ich aktuell nicht weiß ob es mal Core wird, bündel ich das hier https://github.com/pdir/pwa-bundle Die Einstellungen für die Website habe ich schon, Morgen dann die Generierung des manifest JSON.

MDevster avatar Jun 19 '18 07:06 MDevster

Ich finde es gut das du so Gas gibst aber m.E. Ist dass genau der falsche Weg. Das ist dann schon die zweite Erweiterung die ein Web App Manifest erstellt.

Würde es besser finden wenn die Energie in eine zentralisierte Lösung fließen würde.

may17 avatar Jun 19 '18 10:06 may17

Hey Joe, es spricht ja nichts dagegen das mein Prototyp später mal Core wird ;) Welche Erweiterung meinst du?

MDevster avatar Jun 19 '18 14:06 MDevster

Hey Mathias,

klar spricht da nichts dagegen und natürlich kann und soll jeder das tun was er für richtig hält. Meiner Meinung nach ist es halt der falsche Weg. Die Intention des Tickets ist es eine gemeinsame Lösung zu finden und eben zu vermeiden das es nachher x Extensions gibt (wie bei Wordpress z.B.). Besonders im Hinblick auf Erweiterbarkeit und Flexibilität ist es wichtig das im Team zu lösen. Auch wenn das Manifest nur eine json Datei ist gibt es da ein paar Dinge zu beachten. U.a. denke ich das es nicht unbedingt der beste Weg ist alle Felder in der Seitenstruktur abzubilden.

Dass das Feature kommt ist ja schon mehr oder minder bestätigt dadurch das es einen Milestone und das Flag feature hat. Daher bin ich der Meinung, dass man die möglichen Optionen im nächsten Mumble Call evaluieren sollte und dann gemeinsam eine Entscheidung trifft die im Sinne aller ist.

Ich meine die Erweiterung https://contao.org/de/erweiterungsliste/view/web_app_manifest.10000009.en.html

may17 avatar Jun 19 '18 14:06 may17

Ich sehe das feature nicht mehr in der 4.6 ;) Lass mir doch mal deine Bedenken zukommen oder Teile sie hier mit uns. Ich packe die Felder in die Seitenstruktur um ein Multidomain/Mehrsprachigkeit zu unterstützen.

Mein Fahrplan sieht bisher so aus:

  • Manifest json pro Website erstellen
  • Service Worker für Frontend wo sich Erweiterungen registrieren können
  • Caching von Ressourcen über Service Worker
  • Push Nachrichten von beliebiger Quelle über Service Worker

Eine Ausbaustufe wäre dann Anpassungen für Unterseiten wo Einstellungen vererbt werden um "mehrere" Apps in einer Domain zu unterstützen.

MDevster avatar Jun 19 '18 15:06 MDevster

Du hast Recht in der 4.6 nicht mehr aber die 4.7 kommt und wir haben es nicht eilig bzw. brauch das m.E. einfach etwas mehr Planung als mal eben schnell implementiert zu werden.

Anyway das ist ein feature Request an das contao core bundle da sollte es sich nicht um das implementieren von Features für third party bundles drehen. Also back to Topic. Ich drücke dir auf jeden Fall die Daumen.

may17 avatar Jun 19 '18 19:06 may17