-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from HUNG-rushb/noti
Noti
- Loading branch information
Showing
14 changed files
with
1,822 additions
and
258 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -114,3 +114,19 @@ export const DEFAULT_DEFINED_SKILL_LIST = [ | |
'Wedding', | ||
'White Balance', | ||
]; | ||
|
||
export const googleApplicationCredentials = { | ||
type: 'service_account', | ||
project_id: 'noti-flens', | ||
private_key_id: 'd5b516cd19b60c188144258820df3c2644fe53b2', | ||
private_key: | ||
'-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCf6WjHA69eVx+U\n+BUv58rtSGurlHZqFbCbjBMwE432veLIAFF4TOc0ReG5KcVaKa4lNOBD/c72T6bc\nnDey/Z+iK1bohvDaN35tbNBnyG971QsPDyF7HTADXlTT+ALKqxb66odkFwuGLQ+Y\nqJiKD8BZps94yQ56VoI2VFW6FATG/j38CiGZ451Fg+aFPVA7cN7GwDKfkXWhjR5i\nS+AigJGjn9A+sGwC3GRIB9t2o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XTZ7s/QfE4M7Le\nndPTGjsJiX7rPbjc5OZlGSY25OKZS9iGGBVONCMAfNFFvQlTrvUdMpcEe9yOo296\nsdl9TTziUoa97+qOoV5463g3vQ1rN+bsnhg8Sos3AoGBAI+od/8B4PUNbvSqX0o0\nsjkpuyMF0I+XWiozjeNk/MIAB0agXB/ZU28CUHiQSauosqMv9WexUatoU+4QvXm+\nmtPRu9n6kYHCC/WJoGInWn4BrLsy057ktVI1YgIMIEemEII+ZnpJo8822JPeefM3\nm7QYkQn9FDjoRI4yKPmpB7T4\n-----END PRIVATE KEY-----\n', | ||
client_email: '[email protected]', | ||
client_id: '100889841805636667459', | ||
auth_uri: 'https://accounts.google.com/o/oauth2/auth', | ||
token_uri: 'https://oauth2.googleapis.com/token', | ||
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs', | ||
client_x509_cert_url: | ||
'https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-p9pt7%40noti-flens.iam.gserviceaccount.com', | ||
universe_domain: 'googleapis.com', | ||
}; |
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,27 @@ | ||
// https://firebase.google.com/docs/cloud-messaging/send-message | ||
import { firebaseMessaging } from './index.js'; | ||
|
||
export const sendNotificationToClient = (tokens, data, notification) => { | ||
// Send a message to the devices corresponding to the provided | ||
// registration tokens. | ||
firebaseMessaging | ||
.sendMulticast({ tokens, data, notification }) | ||
.then((response) => { | ||
// Response is an object of the form { responses: [] } | ||
const successes = response.responses.filter( | ||
(r) => r.success === true, | ||
).length; | ||
|
||
const failures = response.responses.filter( | ||
(r) => r.success === false, | ||
).length; | ||
|
||
console.log( | ||
'Notifications sent:', | ||
`${successes} successful, ${failures} failed`, | ||
); | ||
}) | ||
.catch((error) => { | ||
console.log('Error sending message:', error); | ||
}); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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