summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/phonegap-plugin-push/hooks/windows/setToastCapable.js
blob: 5b784582105beabba7dfb01c294b6e086e3ef6a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module.exports = function(context) {
    console.log('Updating appxmanifests with ToastCapable=true ...');
    var path = require('path');
    var fs = require('fs');

    var platformProjPath = path.join(context.opts.projectRoot, 'platforms/windows');
    if (!fs.existsSync(platformProjPath)) {
        platformProjPath = context.opts.projectRoot;
    }
    
    var AppxManifest = require(path.join(platformProjPath, 'cordova/lib/AppxManifest'));

    ['package.phone.appxmanifest', 'package.windows.appxmanifest'].forEach(function(manifestPath) {
        var manifest = AppxManifest.get(path.join(platformProjPath, manifestPath));
        manifest.getVisualElements().setToastCapable(true);
        manifest.write();
    });
}