-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (30 loc) · 916 Bytes
/
index.js
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
"use strict";
const Config = require("./lib/config");
const mergeTrees = require("broccoli-merge-trees");
const DEFAULT_OPTIONS = {
firebaseVersion: "7.15.0",
defaultBackgroundMessageTitle: "New Message",
projectId: undefined,
messagingSenderId: undefined,
notification: {}
};
module.exports = {
name: require("./package").name,
treeForServiceWorker(swTree, appTree) {
const config = this.config.call(this.app.project, this.app.env);
const options = Object.assign(
{},
DEFAULT_OPTIONS,
config.firebase || {},
config["esw-emberfire-messaging"] || {}
);
/*
Stringify global notification
options object for service worker
*/
options.notification = JSON.stringify(options.notification);
// Convert app options into SW config file
const configFile = new Config([appTree], options);
return mergeTrees([swTree, configFile]);
}
};