Slide 1

Slide 1 text

Progressive Web Apps A truly cross-platform application model Christian Liebel @christianliebel Consultant

Slide 2

Slide 2 text

Hello, it’s me. Progressive Web Apps A truly cross-platform application model Christian Liebel Twitter: @christianliebel Email: christian.liebel @thinktecture.com Angular & PWA Slides: thinktecture.com /christian-liebel

Slide 3

Slide 3 text

A truly cross-platform application model Progressive Web Apps Responsive Linkable Discoverable Installable App-like Connectivity Independent Fresh Safe Re-engageable Progressive

Slide 4

Slide 4 text

Progressive Web Apps A truly cross-platform application model Demo Use Case

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Progressive Web Apps A truly cross-platform application model Target Platforms PROGRESSIVE WEB APPS + cars, smart fridges, …

Slide 7

Slide 7 text

Progressive Web Apps A truly cross-platform application model Web App Manifest Service Worker

Slide 8

Slide 8 text

Web App Manifest Distinguishes Web Apps from Websites JSON-based file containing metadata for apps only Apps can be identified by search engines, app store providers, etc. Progressive Web Apps A truly cross-platform application model PWA

Slide 9

Slide 9 text

manifest.webmanifest { "short_name": "Paint", "name": "Paint Workshop", "theme_color": "white", "icons": [{ "src": "icon.png", "sizes": "512x512" }], "start_url": "/index.html", "display": "standalone", "shortcuts": [/* … */] } Progressive Web Apps A truly cross-platform application model PWA Names Icons Display Mode Shortcuts Start URL Theme color (status bar/window bar)

Slide 10

Slide 10 text

Manifest Display Modes Progressive Web Apps A truly cross-platform application model PWA browser minimal-ui standalone fullscreen

Slide 11

Slide 11 text

Manifest Icon Purposes (any) any context (e.g. app icon) monochrome different color requirements (at risk) maskable user agent masks icon as required Progressive Web Apps A truly cross-platform application model PWA Safe Zone Windows iOS Android

Slide 12

Slide 12 text

Manifest Shortcuts Progressive Web Apps A truly cross-platform application model PWA Secondary entrypoints for your application (e.g., home screen quick actions, jump lists, …) Static definition in Web App Manifest Dynamic API may follow in the future Supported by Google Chrome for Android, macOS and Windows

Slide 13

Slide 13 text

Web App Dark Mode V2 Progressive Web Apps A truly cross-platform application model PWA Additional theme/background colors based on media queries (currently in origin trial) { "theme_color": "#fff", "background_color": "#fff", "theme_colors": [ { "color": "#000", "media": "(prefers-color-scheme: dark)" } ], "background_colors": [ { "color": "#000", "media": "(prefers-color-scheme: dark)" } ] }

Slide 14

Slide 14 text

Web App Manifest – Chrome Install Criteria 1. Web App is not already installed 2. Meets a user engagement heuristic (user has interacted and clicked with origin for at least 30 seconds) 3. Includes a Web App Manifest that has short_name or name, at least a 192px and 512px icon, a start_url and a display mode of fullscreen, standalone or minimal-ui 4. Served over HTTPS 5. A service worker is no longer required! Progressive Web Apps A truly cross-platform application model PWA https://web.dev/install-criteria/

Slide 15

Slide 15 text

Service Worker JavaScript executed in an own thread, registered by the website Acts as a controller, proxy, or interceptor Has a cache to store responses (for offline availability and performance) Can wake up even when the website is closed and perform background tasks (e.g., push notifications or sync) Progressive Web Apps A truly cross-platform application model PWA

Slide 16

Slide 16 text

Service Worker Progressive Web Apps A truly cross-platform application model PWA Service Worker Internet Website HTML/JS Cache fetch

Slide 17

Slide 17 text

Workbox Toolchain by Google Includes a CLI Generates a service worker implementation from directory contents (e.g., build output, or our development directory) Allows you to modify the service worker behavior (maximum flexibility) Progressive Web Apps A truly cross-platform application model PWA

Slide 18

Slide 18 text

Push Notifications Just as native apps, PWAs can receive push notifications Combination of two technologies: Web Notifications and Push API Supported by Chrome, Edge, Firefox, Safari Progressive Web Apps A truly cross-platform application model PWA

Slide 19

Slide 19 text

Progressive Web Apps A truly cross-platform application model

Slide 20

Slide 20 text

Project Fugu Progressive Web Apps A truly cross-platform application model Capabilities »Let’s bring the web back – API by API« Thomas Steiner, Google

Slide 21

Slide 21 text

https://paint.js.org – Productivity app – Draw images – Lots of actions & tools – Installable – Read/save files – Copy/paste images from/to clipboard – Share files to other apps – Register for file extensions Progressive Web Apps A truly cross-platform application model Demo Use Case

Slide 22

Slide 22 text

Progressive Web Apps A truly cross-platform application model Capabilities Contacts Picker Screen Wake Lock API File System Access API Shape Detection API

Slide 23

Slide 23 text

Progressive Web Apps A truly cross-platform application model Capabilities https://goo.gle/fugu-api-tracker

Slide 24

Slide 24 text

Browser Progressive Web Apps A truly cross-platform application model Capabilities navigator.share({ url: 'http://example.com' }); ShareIntent DataTransferManager … NSSharingServicePicker

Slide 25

Slide 25 text

File System Access API Some applications heavily rely on working with files (e.g. Visual Studio Code, Adobe Photoshop, …) File System Access API allows you to open, save and override files and directories Supported by Chrome, Edge Progressive Web Apps A truly cross-platform application model Capabilities

Slide 26

Slide 26 text

Async Clipboard API Allows reading from/writing to the clipboard in an asynchronous manner (UI won’t freeze during long-running operations) Supported by Chrome, Edge and Safari and Firefox (plain- text only) Progressive Web Apps A truly cross-platform application model Capabilities

Slide 27

Slide 27 text

Web Share API Allows sharing a title, URL, text, or files API can only be invoked as a result of a user action (i.e. a click or keypress) Supported by Chrome, Edge, Safari and Firefox (Android only) Progressive Web Apps A truly cross-platform application model Capabilities

Slide 28

Slide 28 text

File Handling API Register your PWA as a handler for file extensions New: Ability to define icons Requires installing the application first Declare supported extensions in Web App Manifest and add imperative code to your application logic Progressive Web Apps A truly cross-platform application model Capabilities

Slide 29

Slide 29 text

Summary - Project Fugu helps the web to become more and more capable - Project Fugu APIs could bring many more app experiences to the web (IDEs, productivity apps, etc.) - But: Web is threatened by alternative approaches and platforms, support for modern Web API varies from platform to platform - You can make a difference! - File bugs in browser engine bugtrackers - File Fugu requests: https://goo.gle/new-fugu-request Progressive Web Apps A truly cross-platform application model Capabilities

Slide 30

Slide 30 text

Overview Use available interfaces and functions of a system (opposite of Graceful Degradation) Users with modern, feature-rich browsers get a better experience Apps are available on older browsers, but with limited functionality Concept: Browser feature support should grow over time—thereby more users can enjoy an increasing number of features Progressive Web Apps A truly cross-platform application model Progressive Enhancement

Slide 31

Slide 31 text

Overview if ('serviceWorker' in navigator) { navigator.serviceWorker.register(…) .then(() => /* … */); } In JavaScript: check whether an API/feature is available. If yes—use it! Otherwise: 1. Disable the functionality 2. Fall back to an alternative API (if available) Progressive Web Apps A truly cross-platform application model Progressive Enhancement

Slide 32

Slide 32 text

Isolated Web Apps – Packaged and signed for stronger security – Deployed through app stores, platform- specific bundles or installers – These additional trust anchors enable even more powerful APIs (e.g., Direct Sockets API) for IWAs – Still web-based, cross-platform and using open standards – But without the bloat of Electron Progressive Web Apps A truly cross-platform application model Outlook

Slide 33

Slide 33 text

Isolated Web Apps Progressive Web Apps A truly cross-platform application model Outlook JS HTML CSS Enterprise Deploy App Store MSI, APK, … Signed Web Bundle Platform- specific

Slide 34

Slide 34 text

Spotify Progressive Web Apps A truly cross-platform application model Use Cases https://open.spotify.com/

Slide 35

Slide 35 text

VS Code Progressive Web Apps A truly cross-platform application model Use Cases https://vscode.dev/

Slide 36

Slide 36 text

Photoshop Progressive Web Apps A truly cross-platform application model Use Cases https://creativecloud.adobe.com/cc/photoshop

Slide 37

Slide 37 text

Progressive Web Apps are now installable, offline-capable and able to receive push notifications on all operating systems New powerful APIs regularly ship with new releases of Chromium-based browsers If needed, you can still wrap your application in a platform-specific package à your investment in web apps always pays off! Let’s make the web a more capable platform! Progressive Web Apps A truly cross-platform application model Summary

Slide 38

Slide 38 text

Thank you for your kind attention! Christian Liebel @christianliebel [email protected]