This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Theme to create a blank screen while the TWA is opening --> | |
<style name="Theme.LauncherActivity" parent="Theme.AppCompat.NoActionBar"> | |
<item name="android:windowAnimationStyle">@null</item> | |
<item name="android:windowIsTranslucent">true</item> | |
<item name="android:windowNoTitle">true</item> | |
<item name="android:windowBackground">@android:color/transparent</item> | |
<item name="android:backgroundDimEnabled">false</item> | |
</style> | |
</resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def twaManifest = [ | |
applicationId: 'com.heroku.vanillapwa', | |
hostName: 'vanilla-pwa.herokuapp.com', // The domain being opened in the TWA. | |
launchUrl: '/', // The start path for the TWA. Must be relative to the domain. | |
name: 'Vanilla PWA', // The name shown on the Android Launcher. | |
themeColor: '#3366ff', // The color used for the status bar. | |
backgroundColor: '#3366ff', // The color used for the splash screen background. | |
enableNotifications: false // Set to true to enable notification delegation | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.heroku.vanilla-pwa"> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/appName" | |
android:supportsRtl="true" | |
android:theme="@style/Theme.LauncherActivity"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Vanilla PWA</title> | |
<link rel="manifest" href="/manifest.json" /> | |
<link rel="stylesheet" href="css/style.css" /> | |
<link rel="icon" href="favicon.ico" type="image/x-icon" /> | |
<link rel="apple-touch-icon" href="images/icon/icon-152x152.png" /> | |
<meta name="theme-color" content="white" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Vanilla PWA", | |
"short_name": "PWA", | |
"lang": "pt-BR", | |
"start_url": "/index.html", | |
"display": "standalone", | |
"background_color": "white", | |
"theme_color": "white", | |
"icons": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Vanilla PWA", | |
"short_name": "PWA", | |
"lang": "pt-BR", | |
"start_url": "/index.html", | |
"display": "standalone", | |
"background_color": "white", | |
"theme_color": "white" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Vanilla PWA</title> | |
<link rel="stylesheet" href="css/style.css" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
</head> | |
<body> | |
<div class="flex-container"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = () => { | |
'use strict'; | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('./sw.js'); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cacheName = 'vanilla-pwa'; | |
var filesToCache = ['/', '/index.html', '/css/style.css', '/js/main.js']; | |
/* Start the service worker and cache all of the app's content */ | |
self.addEventListener('install', function(e) { | |
e.waitUntil( | |
caches.open(cacheName).then(function(cache) { | |
return cache.addAll(filesToCache); | |
}) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, | |
body { | |
height: 100%; | |
font-family: sans-serif; | |
margin: 0; | |
} | |
.flex-container { | |
height: 100%; | |
display: flex; | |
align-items: center; |
NewerOlder