pushwoosh-cordova-plugin 8.3.35 → 8.3.36
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/.github/ISSUE_TEMPLATE/bug_report.yml +1 -0
- package/README.md +2 -2
- package/example/LICENSE +21 -0
- package/example/README.md +77 -0
- package/example/Screenshots/Android.png +0 -0
- package/example/Screenshots/iOS.png +0 -0
- package/example/Screenshots/xcode_1.png +0 -0
- package/example/newdemo/config.xml +19 -0
- package/example/newdemo/package.json +33 -0
- package/example/newdemo/www/css/index.css +156 -0
- package/example/newdemo/www/img/logo.png +0 -0
- package/example/newdemo/www/index.html +126 -0
- package/example/newdemo/www/js/index.js +399 -0
- package/package.json +1 -1
- package/plugin.xml +2 -2
|
@@ -58,6 +58,7 @@ body:
|
|
|
58
58
|
label: Your Pushwoosh Cordova plugin version
|
|
59
59
|
description: Your version of the Cordova plugin integrated into the application. You may find it on the [releases page](https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/releases)
|
|
60
60
|
options:
|
|
61
|
+
- 8.3.36
|
|
61
62
|
- 8.3.35
|
|
62
63
|
- 8.3.34
|
|
63
64
|
- 8.3.33
|
package/README.md
CHANGED
|
@@ -14,13 +14,13 @@ Cross-Platform push notifications by Pushwoosh for Cordova / PhoneGap
|
|
|
14
14
|
Using npm:
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
cordova plugin add pushwoosh-cordova-plugin@8.3.
|
|
17
|
+
cordova plugin add pushwoosh-cordova-plugin@8.3.36
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Using git:
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.3.
|
|
23
|
+
cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.3.36
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Guide
|
package/example/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Pushwoosh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# CORDOVA SAMPLE
|
|
2
|
+
|
|
3
|
+
## To launch and utilize a sample with Pushwoosh SDK integration, clone or download the repository archive.
|
|
4
|
+
|
|
5
|
+
### iOS, Android
|
|
6
|
+
<img src="https://github.com/Pushwoosh/pushwoosh-cordova-sample/blob/main/Screenshots/iOS.png" alt="Alt text" width="300"> <img src="https://github.com/Pushwoosh/pushwoosh-cordova-sample/blob/main/Screenshots/Android.png" alt="Alt text" width="350">
|
|
7
|
+
|
|
8
|
+
### 1. Go to 'newdemo' folder and install the package from the command line:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
cordova plugin add pushwoosh-cordova-plugin
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### 2. Navigate to the js folder within the www directory and open the file named index.js. Add your App ID and FCM Sender ID
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
/**
|
|
18
|
+
* Function: onDeviceReady
|
|
19
|
+
* [android, ios, wp8, windows] Initialize Pushwoosh plugin and trigger a start push message
|
|
20
|
+
* Should be called on every app launch
|
|
21
|
+
* Parameters:
|
|
22
|
+
* "config.appid" - Pushwoosh application code
|
|
23
|
+
* "config.projectid" - GCM project number for android platform
|
|
24
|
+
* "config.serviceName" - MPNS service name for wp8 platform
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
function initPushwoosh() {
|
|
28
|
+
var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
|
|
29
|
+
|
|
30
|
+
//Should be called before pushwoosh.onDeviceReady
|
|
31
|
+
document.addEventListener('push-notification', function(event) {
|
|
32
|
+
var notification = event.notification;
|
|
33
|
+
// handle push open here
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
pushwoosh.onDeviceReady({
|
|
37
|
+
appid: "XXXXX-XXXXX",
|
|
38
|
+
projectid: "XXXXXXXXXXXXXXX",
|
|
39
|
+
serviceName: "XXXX"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. [Android] Add the 'google-services.json' file to the app folder in Android
|
|
45
|
+
|
|
46
|
+
### 4. [Android] Add the following section to your config.xml:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
<platform name="android">
|
|
50
|
+
<resource-file src="google-services.json" target="app/google-services.json" />
|
|
51
|
+
...
|
|
52
|
+
</platform>
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 5. [iOS] Badges
|
|
57
|
+
|
|
58
|
+
### a. Open the Xcode project, navigate to the TARGETS tab, and add your App Group name in the App Group section for both targets (newdemo and NotificationService).
|
|
59
|
+
|
|
60
|
+
<img src="https://github.com/Pushwoosh/pushwoosh-cordova-sample/blob/main/Screenshots/xcode_1.png" alt="Alt text" width="500">
|
|
61
|
+
|
|
62
|
+
### b. Add the App Groups ID to your info.plist for each target of your application:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
<key>PW_APP_GROUPS_NAME</key>
|
|
66
|
+
<string>group.com.example.demo</string>
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## The guide for SDK integration is available on the Pushwoosh [website](https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/cordova/integrating-cordova-plugin)
|
|
71
|
+
|
|
72
|
+
Documentation:
|
|
73
|
+
https://github.com/Pushwoosh/pushwoosh-ios-sdk/tree/master/Documentation
|
|
74
|
+
|
|
75
|
+
Pushwoosh team
|
|
76
|
+
http://www.pushwoosh.com
|
|
77
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
+
<widget id="com.pushwoosh.newdemo" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
3
|
+
<name>newdemo</name>
|
|
4
|
+
<description>Sample Apache Cordova App</description>
|
|
5
|
+
<author email="dev@cordova.apache.org" href="https://cordova.apache.org">
|
|
6
|
+
Apache Cordova Team
|
|
7
|
+
</author>
|
|
8
|
+
<content src="index.html" />
|
|
9
|
+
<allow-intent href="http://*/*" />
|
|
10
|
+
<allow-intent href="https://*/*" />
|
|
11
|
+
|
|
12
|
+
<!-- Local Pushwoosh Cordova Plugin -->
|
|
13
|
+
<plugin name="pushwoosh-cordova-plugin" spec="../../">
|
|
14
|
+
<variable name="LOG_LEVEL" value="DEBUG" />
|
|
15
|
+
<variable name="IOS_FOREGROUND_ALERT_TYPE" value="NONE" />
|
|
16
|
+
<variable name="ANDROID_FOREGROUND_PUSH" value="false" />
|
|
17
|
+
</plugin>
|
|
18
|
+
</widget>
|
|
19
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "com.pushwoosh.newdemo",
|
|
3
|
+
"displayName": "newdemo",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "A sample Apache Cordova application that responds to the deviceready event.",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"ecosystem:cordova"
|
|
12
|
+
],
|
|
13
|
+
"author": "Apache Cordova Team",
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"cordova-android": "^12.0.1",
|
|
17
|
+
"cordova-ios": "^7.1.0",
|
|
18
|
+
"pushwoosh-cordova-plugin": "file:../.."
|
|
19
|
+
},
|
|
20
|
+
"cordova": {
|
|
21
|
+
"platforms": [
|
|
22
|
+
"ios",
|
|
23
|
+
"android"
|
|
24
|
+
],
|
|
25
|
+
"plugins": {
|
|
26
|
+
"pushwoosh-cordova-plugin": {
|
|
27
|
+
"LOG_LEVEL": "DEBUG",
|
|
28
|
+
"IOS_FOREGROUND_ALERT_TYPE": "NONE",
|
|
29
|
+
"ANDROID_FOREGROUND_PUSH": "false"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
.scroll-view {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
overflow: auto;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.scroll-content {
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 0px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.container {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
margin-top: 150px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.container_enabled {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.container_lang {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.container_userId {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.container_postEvent {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.container_btns {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.input-gap {
|
|
44
|
+
width: 5px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.input-container {
|
|
48
|
+
flex: 1;
|
|
49
|
+
margin-right: 18px;
|
|
50
|
+
margin-left: 18px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#textField1 {
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 23px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#textField2 {
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 23px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#textField3 {
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 23px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#textField4 {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: 23px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#textField5 {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 23px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.btn {
|
|
79
|
+
width: 120px;
|
|
80
|
+
height: 35px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.btn_get {
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 35px;
|
|
86
|
+
background-color: #003175;
|
|
87
|
+
border-radius: 14px;
|
|
88
|
+
font-weight: bold;
|
|
89
|
+
color: white;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.container_setTags {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.container_setTags input[type="text"] {
|
|
98
|
+
width: auto;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.label {
|
|
102
|
+
margin-right: 10px;
|
|
103
|
+
font-weight: bold;
|
|
104
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.container_setLanguage {
|
|
108
|
+
margin-top: 0px;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.gap {
|
|
114
|
+
margin-bottom: 20px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.top-image {
|
|
118
|
+
width: 70px;
|
|
119
|
+
height: 70px;
|
|
120
|
+
position: absolute;
|
|
121
|
+
top: 0;
|
|
122
|
+
left: 50%;
|
|
123
|
+
transform: translateX(-50%);
|
|
124
|
+
margin-top: 70px;
|
|
125
|
+
border-radius: 14px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.ios-switch {
|
|
129
|
+
position: relative;
|
|
130
|
+
width: 50px;
|
|
131
|
+
height: 28px;
|
|
132
|
+
border-radius: 14px;
|
|
133
|
+
background-color: #c0c0c0;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
vertical-align: middle;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ios-switch input[type="checkbox"] {
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.ios-switch label {
|
|
143
|
+
position: absolute;
|
|
144
|
+
top: 0;
|
|
145
|
+
left: 0;
|
|
146
|
+
width: 50%;
|
|
147
|
+
height: 100%;
|
|
148
|
+
background-color: #363636;
|
|
149
|
+
border-radius: 14px;
|
|
150
|
+
transition: left 0.3s ease;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ios-switch input[type="checkbox"]:checked + label {
|
|
154
|
+
left: 50%;
|
|
155
|
+
background-color: #4CAF50;
|
|
156
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta http-equiv="Content-Security-Policy"
|
|
7
|
+
content="default-src 'self' data: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
|
|
8
|
+
<meta name="format-detection" content="telephone=no">
|
|
9
|
+
<meta name="msapplication-tap-highlight" content="no">
|
|
10
|
+
<meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
|
|
11
|
+
<meta name="color-scheme" content="light dark">
|
|
12
|
+
<link rel="stylesheet" href="css/index.css">
|
|
13
|
+
<style>
|
|
14
|
+
.container {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.label {
|
|
21
|
+
flex-grow: 1;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
|
|
26
|
+
<body>
|
|
27
|
+
<div class="app">
|
|
28
|
+
<div id="deviceready" class="blink">
|
|
29
|
+
<div class="scroll-view">
|
|
30
|
+
<div class="scroll-content" id="scroll-content">
|
|
31
|
+
<img src="img/logo.png" alt="Your Image" class="top-image">
|
|
32
|
+
|
|
33
|
+
<div class="container">
|
|
34
|
+
<label class="label" for="switcher">REGISTER FOR NOTIFICATIONS:</label>
|
|
35
|
+
<div class="ios-switch">
|
|
36
|
+
<input type="checkbox" id="switcher">
|
|
37
|
+
<label for="switcher"></label>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="gap"></div>
|
|
42
|
+
|
|
43
|
+
<div class="container_enabled">
|
|
44
|
+
<input type="text" id="textField1" placeholder="KEY">
|
|
45
|
+
<div class="input-gap"></div>
|
|
46
|
+
<input type="text" id="textField2" placeholder="VALUE">
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="gap"></div>
|
|
50
|
+
|
|
51
|
+
<div class="container_setTags">
|
|
52
|
+
<button class="btn_get" id="setTags">SET TAGS</button>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div class="gap"></div>
|
|
56
|
+
|
|
57
|
+
<div class="container_lang">
|
|
58
|
+
<button class="btn" id="setLangBtn">SET LANGUAGE</button>
|
|
59
|
+
<div class="input-container">
|
|
60
|
+
<input type="text" id="textField3" placeholder="'en'">
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="gap"></div>
|
|
65
|
+
|
|
66
|
+
<div class="container_userId">
|
|
67
|
+
<button class="btn" id="setUserBtn">SET USER ID</button>
|
|
68
|
+
<div class="input-container">
|
|
69
|
+
<input type="text" id="textField4" placeholder="USER ID">
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="gap"></div>
|
|
74
|
+
|
|
75
|
+
<div class="container_postEvent">
|
|
76
|
+
<button class="btn" id="setPostEventBtn">POST EVENT</button>
|
|
77
|
+
<div class="input-container">
|
|
78
|
+
<input type="text" id="textField5" placeholder="EVENT NAME">
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div class="gap"></div>
|
|
83
|
+
|
|
84
|
+
<div class="container_btns">
|
|
85
|
+
<button class="btn_get" id="getTags">GET TAGS</button>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div class="gap"></div>
|
|
89
|
+
|
|
90
|
+
<div class="container_btns">
|
|
91
|
+
<button class="btn_get" id="getPushToken">GET PUSH TOKEN</button>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div class="gap"></div>
|
|
95
|
+
|
|
96
|
+
<div class="container_btns">
|
|
97
|
+
<button class="btn_get" id="getHwid">GET HWID</button>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="gap"></div>
|
|
101
|
+
|
|
102
|
+
<div class="container_btns">
|
|
103
|
+
<button class="btn_get" id="resetBadges">RESET BADGES</button>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div class="gap"></div>
|
|
107
|
+
|
|
108
|
+
<div class="container_btns">
|
|
109
|
+
<button class="btn_get" id="localNotification">SEND LOCAL NOTIFICATION</button>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="gap"></div>
|
|
113
|
+
|
|
114
|
+
<div class="container_btns">
|
|
115
|
+
<button class="btn_get" id="clearNotificationCenter">CLEAR NOTIFICATION CENTER</button>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
<script src="cordova.js"></script>
|
|
123
|
+
<script src="js/index.js"></script>
|
|
124
|
+
</body>
|
|
125
|
+
|
|
126
|
+
</html>
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Wait for the deviceready event before using any of Cordova's device APIs.
|
|
21
|
+
// See https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready
|
|
22
|
+
document.addEventListener('deviceready', onDeviceReady, false);
|
|
23
|
+
|
|
24
|
+
function onDeviceReady() {
|
|
25
|
+
var pushwoosh = cordova.require("pushwoosh-cordova-plugin.PushNotification");
|
|
26
|
+
|
|
27
|
+
console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
|
|
28
|
+
document.getElementById('deviceready').classList.add('ready');
|
|
29
|
+
|
|
30
|
+
pushwooshInitialize(pushwoosh);
|
|
31
|
+
|
|
32
|
+
registerForPushNotificationAction(pushwoosh);
|
|
33
|
+
|
|
34
|
+
setTagsAction(pushwoosh);
|
|
35
|
+
setLanguageAction(pushwoosh);
|
|
36
|
+
setUserIdAction(pushwoosh);
|
|
37
|
+
sendPostEventAction(pushwoosh);
|
|
38
|
+
|
|
39
|
+
getTagsAction(pushwoosh);
|
|
40
|
+
getPushTokenAction(pushwoosh);
|
|
41
|
+
getPushwooshHWIDAction(pushwoosh);
|
|
42
|
+
|
|
43
|
+
sendLocalNotificationAction(pushwoosh);
|
|
44
|
+
clearNotificationCenterAction(pushwoosh);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function setTagsAction(pushwoosh) {
|
|
48
|
+
document.getElementById('setTags').addEventListener('click', function() {
|
|
49
|
+
var key = document.getElementById("textField1").value;
|
|
50
|
+
var value = document.getElementById("textField2").value;
|
|
51
|
+
/**
|
|
52
|
+
* Function: setTags
|
|
53
|
+
* [android, ios, wp8, windows] Set tags for the device
|
|
54
|
+
*
|
|
55
|
+
* Parameters:
|
|
56
|
+
* "config" - object with custom device tags
|
|
57
|
+
* "success" - success callback
|
|
58
|
+
* "fail" - error callback
|
|
59
|
+
*
|
|
60
|
+
* | |
|
|
61
|
+
* | |
|
|
62
|
+
* __| |__
|
|
63
|
+
* \ /
|
|
64
|
+
* \ /
|
|
65
|
+
* \ /
|
|
66
|
+
* \__/
|
|
67
|
+
*/
|
|
68
|
+
pushwoosh.setTags({key: key, value: value},
|
|
69
|
+
function() {
|
|
70
|
+
console.warn('setTags success');
|
|
71
|
+
},
|
|
72
|
+
function(error) {
|
|
73
|
+
console.warn('setTags failed');
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function setLanguageAction(pushwoosh) {
|
|
79
|
+
document.getElementById('setLangBtn').addEventListener('click', function() {
|
|
80
|
+
var language = document.getElementById('textField3').value;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* [android, ios] Set custom application language (as opposed to the default system language).
|
|
84
|
+
* This allows sending localized push messages
|
|
85
|
+
*
|
|
86
|
+
* Parameters:
|
|
87
|
+
* "language" - string containing language code, i.e. "en", "fr"
|
|
88
|
+
* | |
|
|
89
|
+
* | |
|
|
90
|
+
* __| |__
|
|
91
|
+
* \ /
|
|
92
|
+
* \ /
|
|
93
|
+
* \ /
|
|
94
|
+
* \__/
|
|
95
|
+
*/
|
|
96
|
+
pushwoosh.setLanguage(language);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function setUserIdAction(pushwoosh) {
|
|
101
|
+
document.getElementById('setUserBtn').addEventListener('click', function() {
|
|
102
|
+
var userId = document.getElementById('textField4').value;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Function: setUserId
|
|
106
|
+
* [android, ios] Set User indentifier. This could be Facebook ID, username or email, or any other user ID.
|
|
107
|
+
* This allows data and events to be matched across multiple user devices.
|
|
108
|
+
*
|
|
109
|
+
* Parameters:
|
|
110
|
+
* "userId" - user string identifier
|
|
111
|
+
*
|
|
112
|
+
* | |
|
|
113
|
+
* | |
|
|
114
|
+
* __| |__
|
|
115
|
+
* \ /
|
|
116
|
+
* \ /
|
|
117
|
+
* \ /
|
|
118
|
+
* \__/
|
|
119
|
+
*/
|
|
120
|
+
pushwoosh.setUserId(userId);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function sendPostEventAction(pushwoosh) {
|
|
125
|
+
document.getElementById('setPostEventBtn').addEventListener('click', function() {
|
|
126
|
+
var eventName = document.getElementById("textField5").value;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Function: postEvent
|
|
130
|
+
* [android, ios] Post events for In-App Messages. This can trigger In-App message display as specified in Pushwoosh Control Panel.
|
|
131
|
+
*
|
|
132
|
+
* Parameters:
|
|
133
|
+
* "event" - event to trigger
|
|
134
|
+
* "attributes" - object with additional event attributes
|
|
135
|
+
*
|
|
136
|
+
* | |
|
|
137
|
+
* | |
|
|
138
|
+
* __| |__
|
|
139
|
+
* \ /
|
|
140
|
+
* \ /
|
|
141
|
+
* \ /
|
|
142
|
+
* \__/
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
pushwoosh.postEvent(eventName, { "buttonNumber" : 4, "buttonLabel" : "banner" });
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function getTagsAction(pushwoosh) {
|
|
150
|
+
document.getElementById('getTags').addEventListener('click', function() {
|
|
151
|
+
/**
|
|
152
|
+
* Function: getTags
|
|
153
|
+
* [android, ios, wp8, windows] Returns tags for the device including default tags
|
|
154
|
+
*
|
|
155
|
+
* Parameters:
|
|
156
|
+
* "success" - success callback. Receives tags as parameter
|
|
157
|
+
* "fail" - error callback
|
|
158
|
+
* | |
|
|
159
|
+
* | |
|
|
160
|
+
* __| |__
|
|
161
|
+
* \ /
|
|
162
|
+
* \ /
|
|
163
|
+
* \ /
|
|
164
|
+
* \__/
|
|
165
|
+
*/
|
|
166
|
+
pushwoosh.getTags(
|
|
167
|
+
function(tags) {
|
|
168
|
+
console.log('tags for device: ' + JSON.stringify(tags));
|
|
169
|
+
},
|
|
170
|
+
function(error) {
|
|
171
|
+
console.log('get tags error: ' + JSON.stringify(error));
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}, false);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getPushTokenAction(pushwoosh) {
|
|
178
|
+
document.getElementById('getPushToken').addEventListener('click', function() {
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Function: getPushToken
|
|
182
|
+
* [android, ios, wp8, windows] Returns push token if it is available. Note the token also comes in registerDevice function callback.
|
|
183
|
+
*
|
|
184
|
+
* Parameters:
|
|
185
|
+
* "success" - getPushToken callback
|
|
186
|
+
*
|
|
187
|
+
* | |
|
|
188
|
+
* | |
|
|
189
|
+
* __| |__
|
|
190
|
+
* \ /
|
|
191
|
+
* \ /
|
|
192
|
+
* \ /
|
|
193
|
+
* \__/
|
|
194
|
+
*/
|
|
195
|
+
pushwoosh.getPushToken(
|
|
196
|
+
function(token) {
|
|
197
|
+
console.log('push token: ', + token);
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
}, false);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function getPushwooshHWIDAction(pushwoosh) {
|
|
204
|
+
document.getElementById('getHwid').addEventListener('click', function() {
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Function: getPushwooshHWID
|
|
208
|
+
* [android, ios, wp8, windows] Returns Pushwoosh HWID used for communications with Pushwoosh API
|
|
209
|
+
*
|
|
210
|
+
* Parameters:
|
|
211
|
+
* "success" - getPushwooshHWID callback
|
|
212
|
+
*
|
|
213
|
+
* | |
|
|
214
|
+
* | |
|
|
215
|
+
* __| |__
|
|
216
|
+
* \ /
|
|
217
|
+
* \ /
|
|
218
|
+
* \ /
|
|
219
|
+
* \__/
|
|
220
|
+
*/
|
|
221
|
+
pushwoosh.getPushwooshHWID(
|
|
222
|
+
function(token) {
|
|
223
|
+
console.log('Pushwoosh HWID: ' + token);
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function resetBadges(pushwoosh) {
|
|
230
|
+
document.getElementById('resetBadges').addEventListener('click', function() {
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Function: setApplicationIconBadgeNumber
|
|
234
|
+
* [android, ios, wp8, windows] Set the application icon badge number
|
|
235
|
+
*
|
|
236
|
+
* Parameters:
|
|
237
|
+
* "badgeNumber" - icon badge number
|
|
238
|
+
*
|
|
239
|
+
* | |
|
|
240
|
+
* | |
|
|
241
|
+
* __| |__
|
|
242
|
+
* \ /
|
|
243
|
+
* \ /
|
|
244
|
+
* \ /
|
|
245
|
+
* \__/
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
pushwoosh.setApplicationIconBadgeNumber('0');
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function sendLocalNotificationAction(pushwoosh) {
|
|
253
|
+
document.getElementById('localNotification').addEventListener('click', function() {
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Function: createLocalNotification
|
|
257
|
+
* [android, ios] Schedules local notification.
|
|
258
|
+
*
|
|
259
|
+
* Parameters:
|
|
260
|
+
* "config.msg" - notification message
|
|
261
|
+
* "config.seconds" - notification delay in seconds
|
|
262
|
+
* "config.userData" - addition data to pass in notification
|
|
263
|
+
* "success" - success callback
|
|
264
|
+
* "fail" - error callback
|
|
265
|
+
*
|
|
266
|
+
* | |
|
|
267
|
+
* | |
|
|
268
|
+
* __| |__
|
|
269
|
+
* \ /
|
|
270
|
+
* \ /
|
|
271
|
+
* \ /
|
|
272
|
+
* \__/
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
pushwoosh.createLocalNotification({msg: 'Hello, Pushwoosh!', seconds: 5, userData: 'optional'});
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function clearNotificationCenterAction(pushwoosh) {
|
|
280
|
+
document.getElementById('clearNotificationCenter').addEventListener('click', function() {
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Function: cancelAllLocalNotifications
|
|
284
|
+
* [ios] Clears all notifications from the notification center
|
|
285
|
+
*
|
|
286
|
+
* | |
|
|
287
|
+
* | |
|
|
288
|
+
* __| |__
|
|
289
|
+
* \ /
|
|
290
|
+
* \ /
|
|
291
|
+
* \ /
|
|
292
|
+
* \__/
|
|
293
|
+
*/
|
|
294
|
+
|
|
295
|
+
pushwoosh.cancelAllLocalNotifications();
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function registerForPushNotificationAction(pushwoosh) {
|
|
300
|
+
var switcher = document.getElementById("switcher");
|
|
301
|
+
|
|
302
|
+
switcher.addEventListener("change", function () {
|
|
303
|
+
// Register for Push Notifications
|
|
304
|
+
if (this.checked) {
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Function: registerDevice
|
|
308
|
+
* [android, ios, wp8, windows] Register device for push notifications and retreive a push Token
|
|
309
|
+
*
|
|
310
|
+
* Parameters:
|
|
311
|
+
* "success" - success callback. Push token is passed as "status.pushToken" parameter to this callback
|
|
312
|
+
* "fail" - error callback
|
|
313
|
+
*
|
|
314
|
+
* | |
|
|
315
|
+
* | |
|
|
316
|
+
* __| |__
|
|
317
|
+
* \ /
|
|
318
|
+
* \ /
|
|
319
|
+
* \ /
|
|
320
|
+
* \__/
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
pushwoosh.registerDevice(
|
|
324
|
+
function (status) {
|
|
325
|
+
var pushToken = status.pushToken;
|
|
326
|
+
// Handle successful registration here
|
|
327
|
+
console.log('Push token received: ', pushToken);
|
|
328
|
+
},
|
|
329
|
+
function (status) {
|
|
330
|
+
// Handle registration error here
|
|
331
|
+
console.error('Push registration failed: ', status);
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
} else {
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Function: unregisterDevice
|
|
338
|
+
* [android, ios, wp8, windows] Unregister device form receiving push notifications
|
|
339
|
+
*
|
|
340
|
+
* Parameters:
|
|
341
|
+
* "success" - success callback
|
|
342
|
+
* "fail" - error callback
|
|
343
|
+
*
|
|
344
|
+
* | |
|
|
345
|
+
* | |
|
|
346
|
+
* __| |__
|
|
347
|
+
* \ /
|
|
348
|
+
* \ /
|
|
349
|
+
* \ /
|
|
350
|
+
* \__/
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
pushwoosh.unregisterDevice(
|
|
354
|
+
function (status) {
|
|
355
|
+
console.log('Success', status);
|
|
356
|
+
},
|
|
357
|
+
function (status) {
|
|
358
|
+
console.error('Fail', status);
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function pushwooshInitialize(pushwoosh) {
|
|
366
|
+
// Should be called before pushwoosh.onDeviceReady
|
|
367
|
+
document.addEventListener('push-notification', function (event) {
|
|
368
|
+
var notification = event.notification;
|
|
369
|
+
// Handle push open here
|
|
370
|
+
console.log('Received push notification: ', notification);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Function: onDeviceReady
|
|
375
|
+
* [android, ios, wp8, windows] Initialize Pushwoosh plugin and trigger a start push message
|
|
376
|
+
* Should be called on every app launch
|
|
377
|
+
*
|
|
378
|
+
* Parameters:
|
|
379
|
+
* "config.appid" - Pushwoosh application code
|
|
380
|
+
* "config.projectid" - GCM project number for android platform
|
|
381
|
+
* "config.serviceName" - MPNS service name for wp8 platform
|
|
382
|
+
*
|
|
383
|
+
* initialize Pushwoosh with projectid:
|
|
384
|
+
* "GOOGLE_PROJECT_NUMBER", appid : "PUSHWOOSH_APP_ID", serviceName : "WINDOWS_PHONE_SERVICE".
|
|
385
|
+
* This will trigger all pending push notifications on start.
|
|
386
|
+
* | |
|
|
387
|
+
* | |
|
|
388
|
+
* __| |__
|
|
389
|
+
* \ /
|
|
390
|
+
* \ /
|
|
391
|
+
* \ /
|
|
392
|
+
* \__/
|
|
393
|
+
*/
|
|
394
|
+
pushwoosh.onDeviceReady({
|
|
395
|
+
appid: "XXXXX-XXXXX",
|
|
396
|
+
projectid: "XXXXXXXXXXXXXXX",
|
|
397
|
+
serviceName: "XXXX"
|
|
398
|
+
});
|
|
399
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pushwoosh-cordova-plugin",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.36",
|
|
4
4
|
"description": "\n This plugin allows you to send and receive push notifications. Powered by Pushwoosh (www.pushwoosh.com).\n ",
|
|
5
5
|
"main":"www/PushNotification.js",
|
|
6
6
|
"typings":"types/index.d.ts",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="pushwoosh-cordova-plugin" version="8.3.
|
|
2
|
+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="pushwoosh-cordova-plugin" version="8.3.36">
|
|
3
3
|
|
|
4
4
|
<name>Pushwoosh</name>
|
|
5
5
|
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
126
126
|
</config>
|
|
127
127
|
<pods use-frameworks="true">
|
|
128
|
-
<pod name="PushwooshXCFramework" spec="6.7.
|
|
128
|
+
<pod name="PushwooshXCFramework" spec="6.7.13" />
|
|
129
129
|
<pod name="PushwooshInboxUIXCFramework" spec="6.1.2" />
|
|
130
130
|
</pods>
|
|
131
131
|
</podspec>
|