@awesome-cordova-plugins/onesignal 5.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ <a style="float:right;font-size:12px;" href="http://github.com/danielsogl/awesome-cordova-plugins/edit/master/src/@awesome-cordova-plugins/plugins/onesignal/index.ts#L325">
2
+ Improve this doc
3
+ </a>
4
+
5
+ # OneSignal
6
+
7
+ ```
8
+ $ ionic cordova plugin add onesignal-cordova-plugin
9
+ $ npm install @ionic-native/plugins/onesignal
10
+ ```
11
+
12
+ ## [Usage Documentation](https://ionicframework.com/docs/native/onesignal/)
13
+
14
+ Plugin Repo: [https://github.com/OneSignal/OneSignal-Cordova-SDK](https://github.com/OneSignal/OneSignal-Cordova-SDK)
15
+
16
+ The OneSignal plugin is an client implementation for using the [OneSignal](https://onesignal.com/) Service.
17
+ OneSignal is a simple implementation for delivering push notifications.
18
+
19
+ Please view the official [OneSignal Ionic SDK Installation](https://documentation.onesignal.com/docs/ionic-sdk-setup) guide
20
+ for more information.
21
+
22
+ #### Icons
23
+ If you want to use generated icons with command `ionic cordova resources`:
24
+
25
+ 1. Add a file to your `hooks` directory called `copy_android_notification_icons.js`
26
+
27
+ 2. Configure the hook in your config.xml
28
+ ```
29
+ <platform name="android">
30
+ <hook type="after_prepare" src="hooks/copy_android_notification_icons.js" />
31
+ </platform>
32
+ ```
33
+
34
+ 3. Put the following code in it:
35
+
36
+ ```
37
+ #!/usr/bin/env node
38
+
39
+ var fs = require('fs');
40
+ var path = require('path');
41
+
42
+ var filestocopy = [{
43
+ "resources/android/icon/drawable-hdpi-icon.png":
44
+ "platforms/android/app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png"
45
+ }, {
46
+ "resources/android/icon/drawable-mdpi-icon.png":
47
+ "platforms/android/app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png"
48
+ }, {
49
+ "resources/android/icon/drawable-xhdpi-icon.png":
50
+ "platforms/android/app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png"
51
+ }, {
52
+ "resources/android/icon/drawable-xxhdpi-icon.png":
53
+ "platforms/android/app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png"
54
+ }, {
55
+ "resources/android/icon/drawable-xxxhdpi-icon.png":
56
+ "platforms/android/app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png"
57
+ } ];
58
+
59
+ module.exports = function(context) {
60
+
61
+ // no need to configure below
62
+ var rootdir = context.opts.projectRoot;
63
+
64
+ filestocopy.forEach(function(obj) {
65
+ Object.keys(obj).forEach(function(key) {
66
+ var val = obj[key];
67
+ var srcfile = path.join(rootdir, key);
68
+ var destfile = path.join(rootdir, val);
69
+ console.log("copying "+srcfile+" to "+destfile);
70
+ var destdir = path.dirname(destfile);
71
+ if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
72
+ fs.createReadStream(srcfile).pipe(
73
+ fs.createWriteStream(destfile));
74
+ }
75
+ });
76
+ });
77
+
78
+ };
79
+ ```
80
+
81
+ 3. From the root of your project make the file executable:
82
+ `$ chmod +x hooks/copy_android_notification_icons.js`
83
+
84
+ ## Supported platforms
85
+
86
+ - Amazon Fire OS
87
+ - Android
88
+ - iOS
89
+ - Windows
90
+
91
+
92
+