-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (61 loc) · 2.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<script data-ionic="inject">
(function(w){var i=w.Ionic=w.Ionic||{};i.version='^3.6.1';i.angular='^4.4.3';i.staticDir='build/';})(window);
</script>
<meta charset="UTF-8">
<title>Ionic App</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#4e8ef7">
<!-- cordova.js required for cordova apps -->
<!-- <script src="cordova.js"></script> -->
<script>
if ('serviceWorker' in navigator && 'PushManager' in window) {
navigator.serviceWorker.register('service-worker.js')
.then((registration) => {
console.log('service worker installed');
return registration.pushManager.getSubscription().then(
(subscription) => {
if(subscription){
return subscription;
}
return registration.pushManager.subscribe({userVisibleOnly: true});
}).then(function(subscription){
var rawKey = subscription.getKey ? subscription.getKey('p256dh') : '';
key = rawKey ?
btoa(String.fromCharCode.apply(null, new Uint8Array(rawKey))) : '';
var rawAuthSecret = subscription.getKey ? subscription.getKey('auth') : '';
authSecret = rawAuthSecret ? btoa(String.fromCharCode.apply(null, new Uint8Array(rawAuthSecret))) : '';
var endpoint = subscription.endpoint;
fetch('https://us-central1-stop-847d8.cloudfunctions.net/registerUser?'+
'endpoint='+ subscription.endpoint+'&key='+ key +'&authSecret=' + authSecret, {
method: 'get',
headers: {
'Content-type': 'application/json'
}
});
});
}).catch(err => console.log('Error', err));
}
else{
console.warn('Push Messaging not supported');
}
</script>
<link href="build/main.css" rel="stylesheet">
</head>
<body>
s
<!-- Ionic's root component and where the app will load -->
<ion-app></ion-app>
<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>
<script src="build/vendor.js"></script>
<!-- The bundle js is generated during the build process -->
<script src="build/main.js"></script>
</body>
</html>