-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_notification_icons.js
31 lines (26 loc) · 1.11 KB
/
add_notification_icons.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
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var rootDir = process.argv[2];
//specify your input, output folders and icon name
var inputFolder = path.join(rootDir, 'resources/android/push_icons/');
var outputFolder = path.join(rootDir, '/platforms/android/res/');
var iconName = 'ic_stat_onesignal_default.png';
var inputFile = null;
var outputFile = null;
console.log('------------------------------------------------------------------------------------------');
console.log("Running hook: " + path.basename(process.env.CORDOVA_HOOK));
console.log('------------------------------------------------------------------------------------------');
fs.readdir(inputFolder, function (err, folders) {
folders.forEach(function (folder) {
if (folder.indexOf('drawable') === 0) {
inputFile = inputFolder + folder + '/' + iconName;
if (inputFile) {
outputFile = outputFolder + folder + '/' + iconName;
fs.createReadStream(inputFile)
.pipe(fs.createWriteStream(outputFile));
console.log('copying: ' + inputFile + ' to --> ' + outputFile);
}
}
});
});