mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-22 01:19:36 +08:00
docs(onesignal): change docs to match new Cordova hook specs
docs(onesignal): change docs to match new Cordova hook specs
This commit is contained in:
commit
292545dc6d
@ -307,13 +307,23 @@ export enum OSActionType {
|
|||||||
* #### Icons
|
* #### Icons
|
||||||
* If you want to use generated icons with command `ionic cordova resources`:
|
* If you want to use generated icons with command `ionic cordova resources`:
|
||||||
*
|
*
|
||||||
* 1. Add a file to your `hooks` directory inside the `after_prepare` folder called `030_copy_android_notification_icons.js`
|
* 1. Add a file to your `hooks` directory called `copy_android_notification_icons.js`
|
||||||
*
|
*
|
||||||
* 2. Put the following code in it:
|
* 2. Configure the hook in your config.xml
|
||||||
|
* ```
|
||||||
|
* <platform name="android">
|
||||||
|
* <hook type="after_prepare" src="hooks/copy_android_notification_icons.js" />
|
||||||
|
* </platform>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* 3. Put the following code in it:
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* #!/usr/bin/env node
|
* #!/usr/bin/env node
|
||||||
*
|
|
||||||
|
* var fs = require('fs');
|
||||||
|
* var path = require('path');
|
||||||
|
|
||||||
* var filestocopy = [{
|
* var filestocopy = [{
|
||||||
* "resources/android/icon/drawable-hdpi-icon.png":
|
* "resources/android/icon/drawable-hdpi-icon.png":
|
||||||
* "platforms/android/res/drawable-hdpi/ic_stat_onesignal_default.png"
|
* "platforms/android/res/drawable-hdpi/ic_stat_onesignal_default.png"
|
||||||
@ -330,26 +340,27 @@ export enum OSActionType {
|
|||||||
* "resources/android/icon/drawable-xxxhdpi-icon.png":
|
* "resources/android/icon/drawable-xxxhdpi-icon.png":
|
||||||
* "platforms/android/res/drawable-xxxhdpi/ic_stat_onesignal_default.png"
|
* "platforms/android/res/drawable-xxxhdpi/ic_stat_onesignal_default.png"
|
||||||
* } ];
|
* } ];
|
||||||
*
|
|
||||||
* var fs = require('fs');
|
* module.exports = function(context) {
|
||||||
* var path = require('path');
|
|
||||||
*
|
* // no need to configure below
|
||||||
* // no need to configure below
|
* var rootdir = context.opts.projectRoot;
|
||||||
* var rootdir = process.argv[2];
|
|
||||||
*
|
* filestocopy.forEach(function(obj) {
|
||||||
* filestocopy.forEach(function(obj) {
|
* Object.keys(obj).forEach(function(key) {
|
||||||
* Object.keys(obj).forEach(function(key) {
|
* var val = obj[key];
|
||||||
* var val = obj[key];
|
* var srcfile = path.join(rootdir, key);
|
||||||
* var srcfile = path.join(rootdir, key);
|
* var destfile = path.join(rootdir, val);
|
||||||
* var destfile = path.join(rootdir, val);
|
* console.log("copying "+srcfile+" to "+destfile);
|
||||||
* //console.log("copying "+srcfile+" to "+destfile);
|
* var destdir = path.dirname(destfile);
|
||||||
* var destdir = path.dirname(destfile);
|
* if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
|
||||||
* if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
|
* fs.createReadStream(srcfile).pipe(
|
||||||
* fs.createReadStream(srcfile).pipe(
|
* fs.createWriteStream(destfile));
|
||||||
* fs.createWriteStream(destfile));
|
* }
|
||||||
* }
|
* });
|
||||||
* });
|
* });
|
||||||
* });
|
|
||||||
|
* };
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* 3. From the root of your project make the file executable:
|
* 3. From the root of your project make the file executable:
|
||||||
|
Loading…
Reference in New Issue
Block a user