-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,266 additions
and
284 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "fcm-listener-1" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"hosting": { | ||
"public": "dist", | ||
"ignore": [ | ||
"firebase.json", | ||
"**/.*", | ||
"**/node_modules/**" | ||
], | ||
"rewrites": [ | ||
{ | ||
"source": "**", | ||
"destination": "/index.html" | ||
} | ||
] | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Empty file.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<template> | ||
<div class="hello"> | ||
<h1>Chat</h1> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import firebase from 'firebase'; | ||
import "firebase/messaging"; | ||
firebase.initializeApp(); | ||
const messaging = firebase.messaging(); | ||
messaging.usePublicVapidKey(); | ||
export default { | ||
name: 'Chat', | ||
props: { | ||
msg: String | ||
}, | ||
methods: { | ||
onFCMTokenReceived: function(token) { | ||
if (token) { | ||
//sendTokenToServer(currentToken); | ||
//updateUIForPushEnabled(currentToken); | ||
console.log('token', token); | ||
} else { | ||
// Show permission request. | ||
console.log('Unable to retrieve token - check permissions'); | ||
// Show permission UI. | ||
//updateUIForPushPermissionRequired(); | ||
//setTokenSentToServer(false); | ||
} | ||
}, | ||
getFCMToken: function() { | ||
messaging.getToken() | ||
.then(currentToken => this.onFCMTokenReceived(currentToken)) | ||
.catch((err) => console.log('An error occurred while retrieving token. ', err)); | ||
} | ||
}, | ||
mounted() { | ||
Notification.requestPermission().then(permission => { | ||
if (permission === 'granted') { | ||
console.log('Notification permission granted.'); | ||
this.getFCMToken(); | ||
messaging.onTokenRefresh(() => this.getFCMToken()); | ||
} else { | ||
console.log('Unable to get permission to notify.'); | ||
} | ||
}); | ||
} | ||
} | ||
</script> | ||
|
||
<!-- Add "scoped" attribute to limit CSS to this component only --> | ||
<style scoped lang="scss"> | ||
h3 { | ||
margin: 40px 0 0; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
|
||
li { | ||
display: inline-block; | ||
margin: 0 10px; | ||
} | ||
|
||
a { | ||
color: #42b983; | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<template> | ||
<div class="home"> | ||
<img alt="Vue logo" src="../assets/logo.png"> | ||
<HelloWorld msg="Welcome to Your Vue.js App"/> | ||
<Chat/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
// @ is an alias to /src | ||
import HelloWorld from '@/components/HelloWorld.vue' | ||
import Chat from '@/components/Chat.vue' | ||
export default { | ||
name: 'home', | ||
components: { | ||
HelloWorld | ||
Chat | ||
} | ||
} | ||
</script> |