mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-07 23:03:19 +08:00
docs(): add copy icons instructions (#1670)
Add how to copy icons to use in push notifications.
This commit is contained in:
parent
85a1f6a35b
commit
9eb29f8924
@ -268,6 +268,58 @@ export enum OSActionType {
|
|||||||
*
|
*
|
||||||
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
|
* Requires Cordova plugin: `onesignal-cordova-plugin`. For more info, please see the [OneSignal Cordova Docs](https://documentation.onesignal.com/docs/phonegap-sdk-installation).
|
||||||
*
|
*
|
||||||
|
* #### Icons
|
||||||
|
* 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`
|
||||||
|
*
|
||||||
|
* 2. Put the following code in it:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* #!/usr/bin/env node
|
||||||
|
*
|
||||||
|
* var filestocopy = [{
|
||||||
|
* "resources/android/icon/drawable-hdpi-icon.png":
|
||||||
|
* "platforms/android/res/drawable-hdpi/ic_stat_onesignal_default.png"
|
||||||
|
* }, {
|
||||||
|
* "resources/android/icon/drawable-mdpi-icon.png":
|
||||||
|
* "platforms/android/res/drawable-mdpi/ic_stat_onesignal_default.png"
|
||||||
|
* }, {
|
||||||
|
* "resources/android/icon/drawable-xhdpi-icon.png":
|
||||||
|
* "platforms/android/res/drawable-xhdpi/ic_stat_onesignal_default.png"
|
||||||
|
* }, {
|
||||||
|
* "resources/android/icon/drawable-xxhdpi-icon.png":
|
||||||
|
* "platforms/android/res/drawable-xxhdpi/ic_stat_onesignal_default.png"
|
||||||
|
* }, {
|
||||||
|
* "resources/android/icon/drawable-xxxhdpi-icon.png":
|
||||||
|
* "platforms/android/res/drawable-xxxhdpi/ic_stat_onesignal_default.png"
|
||||||
|
* } ];
|
||||||
|
*
|
||||||
|
* var fs = require('fs');
|
||||||
|
* var path = require('path');
|
||||||
|
*
|
||||||
|
* // no need to configure below
|
||||||
|
* var rootdir = process.argv[2];
|
||||||
|
*
|
||||||
|
* filestocopy.forEach(function(obj) {
|
||||||
|
* Object.keys(obj).forEach(function(key) {
|
||||||
|
* var val = obj[key];
|
||||||
|
* var srcfile = path.join(rootdir, key);
|
||||||
|
* var destfile = path.join(rootdir, val);
|
||||||
|
* //console.log("copying "+srcfile+" to "+destfile);
|
||||||
|
* var destdir = path.dirname(destfile);
|
||||||
|
* if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
|
||||||
|
* fs.createReadStream(srcfile).pipe(
|
||||||
|
* fs.createWriteStream(destfile));
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* 3. From the root of your project make the file executable:
|
||||||
|
* `$ chmod +x hooks/after_prepare/030_copy_android_notification_icons.js`
|
||||||
|
*
|
||||||
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```typescript
|
* ```typescript
|
||||||
* import { OneSignal } from '@ionic-native/onesignal';
|
* import { OneSignal } from '@ionic-native/onesignal';
|
||||||
|
Loading…
Reference in New Issue
Block a user