cordova-plugin-appice 2.2.0 → 2.2.2
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/example/package.json +2 -2
- package/example/www/index.html +89 -52
- package/example/www/js/AppInboxMessage.js +58 -0
- package/example/www/js/index.js +580 -99
- package/package.json +1 -1
- package/plugin.xml +6 -5
- package/src/android/AppICEPlugin.java +567 -54
- package/src/ios/AppICEPlugin.h +17 -1
- package/src/ios/AppICEPlugin.m +384 -12
- package/www/AppICE.js +86 -3
package/example/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"cordova-android": "^10.1.2",
|
|
17
17
|
"cordova-ios": "^6.3.0",
|
|
18
|
-
"cordova-plugin-appice": "^2.
|
|
18
|
+
"cordova-plugin-appice": "^2.2.1",
|
|
19
19
|
"cordova-plugin-device": "^2.1.0",
|
|
20
20
|
"cordova-plugin-dialogs": "^2.0.2",
|
|
21
21
|
"cordova-plugin-file": "^7.0.0",
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|
package/example/www/index.html
CHANGED
|
@@ -1,62 +1,99 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<!--
|
|
3
|
-
Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
-
or more contributor license agreements. See the NOTICE file
|
|
5
|
-
distributed with this work for additional information
|
|
6
|
-
regarding copyright ownership. The ASF licenses this file
|
|
7
|
-
to you under the Apache License, Version 2.0 (the
|
|
8
|
-
"License"); you may not use this file except in compliance
|
|
9
|
-
with the License. You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing,
|
|
14
|
-
software distributed under the License is distributed on an
|
|
15
|
-
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
KIND, either express or implied. See the License for the
|
|
17
|
-
specific language governing permissions and limitations
|
|
18
|
-
under the License.
|
|
19
|
-
-->
|
|
2
|
+
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements -->
|
|
20
3
|
<html>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<meta name="color-scheme" content="light dark">
|
|
36
|
-
<link rel="stylesheet" href="css/index.css">
|
|
37
|
-
<title>Hello World</title>
|
|
38
|
-
</head>
|
|
39
|
-
<body>
|
|
40
|
-
<div class="app">
|
|
41
|
-
<div id="deviceready" class="blink">
|
|
42
|
-
<p class="event listening">Connecting to Device</p>
|
|
43
|
-
<p class="event received">Device is Ready</p>
|
|
44
|
-
</div>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
|
|
7
|
+
<meta name="format-detection" content="telephone=no">
|
|
8
|
+
<meta name="msapplication-tap-highlight" content="no">
|
|
9
|
+
<meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
|
|
10
|
+
<meta name="color-scheme" content="light dark">
|
|
11
|
+
<link rel="stylesheet" href="css/index.css">
|
|
12
|
+
<title>Hello World</title>
|
|
13
|
+
<style>
|
|
14
|
+
body {
|
|
15
|
+
margin: 0;
|
|
16
|
+
font-family: Arial, sans-serif;
|
|
17
|
+
}
|
|
45
18
|
|
|
19
|
+
.scroll-container {
|
|
20
|
+
background-color: #262424;
|
|
21
|
+
max-height: 100vh;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
padding: 15px;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.btn2, .btn3 {
|
|
28
|
+
padding: 10px 20px;
|
|
29
|
+
margin: 10px 0;
|
|
30
|
+
display: block;
|
|
31
|
+
width: 100%;
|
|
32
|
+
max-width: 300px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
input {
|
|
36
|
+
margin-bottom: 15px;
|
|
37
|
+
padding: 8px;
|
|
38
|
+
width: calc(100% - 16px);
|
|
39
|
+
max-width: 300px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#inboxMessagesContainer {
|
|
43
|
+
border: 1px solid #262424;
|
|
44
|
+
padding: 10px;
|
|
45
|
+
margin-top: 15px;
|
|
46
|
+
max-height: 500px;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
50
|
+
</head>
|
|
51
|
+
<body>
|
|
52
|
+
<div class="app">
|
|
53
|
+
<div id="deviceready" class="blink">
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div class="scroll-container">
|
|
60
|
+
<div>
|
|
61
|
+
<button id="event1" class="btn2">Send Event</button>
|
|
62
|
+
<button id="userinfo" class="btn2">Set User</button>
|
|
63
|
+
<button id="getUser" class="btn2">Get User</button>
|
|
64
|
+
<button id="userid" class="btn2">Set User ID</button>
|
|
65
|
+
<button id="getUserId" class="btn2">Get User ID</button>
|
|
46
66
|
</div>
|
|
47
|
-
|
|
48
|
-
<div
|
|
49
|
-
<
|
|
67
|
+
|
|
68
|
+
<div>
|
|
69
|
+
<input id="userIdInput" type="text" placeholder="Enter User ID">
|
|
70
|
+
<button id="getInboxMessagesForUserIds" class="btn3">getInboxMessagesForUserIds</button>
|
|
71
|
+
<button id="getInboxMessages" class="btn3">getInboxMessages</button>
|
|
72
|
+
<button id="getMessageCountForUserIds" class="btn3">getMessageCountForUserIds</button>
|
|
73
|
+
<button id="getMessageCount" class="btn3">getMessageCount</button>
|
|
50
74
|
</div>
|
|
51
75
|
|
|
52
|
-
<div
|
|
53
|
-
<
|
|
76
|
+
<div>
|
|
77
|
+
<input id="typeInput" type="text" placeholder="Enter Message Type: Enter 1-FOR ALL MSG">
|
|
78
|
+
<button id="getInboxMessageForIdWithUserId" class="btn3">getInboxMessageForIdWithUserId</button>
|
|
79
|
+
<button id="getInboxMessageForId" class="btn3">getInboxMessageForId</button>
|
|
80
|
+
<button id="updateInboxMessageForUserId" class="btn3">updateInboxMessageForUserId</button>
|
|
81
|
+
<button id="updateInboxMessage" class="btn3">Update Inbox Message</button>
|
|
82
|
+
|
|
83
|
+
<input id="msgId" type="text" placeholder="Enter Inbox Message ID">
|
|
84
|
+
<button id="synInbox" class="btn3">Synchronize Inbox</button>
|
|
85
|
+
|
|
86
|
+
<input id="cmpid" type="text" placeholder="Enter CampID to Schedule Campaign">
|
|
87
|
+
<button id="scheduleCampaign" class="btn3">Schedule Campaign</button>
|
|
54
88
|
</div>
|
|
55
89
|
|
|
56
|
-
<div
|
|
57
|
-
<
|
|
90
|
+
<div id="inboxMessagesContainer">
|
|
91
|
+
<ul id="inboxMessagesList"></ul>
|
|
58
92
|
</div>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<script src="cordova.js"></script>
|
|
96
|
+
<script src="js/index.js"></script>
|
|
97
|
+
<script src="js/AppInboxMessage.js"></script>
|
|
98
|
+
</body>
|
|
62
99
|
</html>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
function AppInboxMessage(data) {
|
|
2
|
+
this.messageId = data.id || data.messageId || "";
|
|
3
|
+
this.messageCampid = data.campId || data.messageCampid || "";
|
|
4
|
+
this.messageImage = data.icon || data.messageImage || "";
|
|
5
|
+
this.messageBody = data.message || data.messageBody || "";
|
|
6
|
+
this.messageTitle = data.title || data.messageTitle || "";
|
|
7
|
+
this.campType = data.campType || "";
|
|
8
|
+
this.messageStatus = data.messageStatus || "";
|
|
9
|
+
this.messageLanguage = data.messageLanguage || "";
|
|
10
|
+
this.customData = data.cData || data.customData || {};
|
|
11
|
+
|
|
12
|
+
this.messageExpiryTime = data.messageExpiryTime || 0;
|
|
13
|
+
this.expandedImage = data.expandedImage || data.messageExpandedImage || "";
|
|
14
|
+
this.expandedDescription = data.expandedDescription || "";
|
|
15
|
+
this.actionType = data.actionType || "";
|
|
16
|
+
this.actionUrl = data.actionUrl || "";
|
|
17
|
+
|
|
18
|
+
this.actions = Array.isArray(data.actions)
|
|
19
|
+
? data.actions.map(function(action) {
|
|
20
|
+
return {
|
|
21
|
+
actionTitle: action.actionTitle || action.abt || "",
|
|
22
|
+
actionType: action.actionType || action.act || "",
|
|
23
|
+
actionUrl: action.actionUrl || action.acu || "",
|
|
24
|
+
replyText: action.replyText || ""
|
|
25
|
+
};
|
|
26
|
+
})
|
|
27
|
+
: [];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This function is used when sending app inbox data to sdk for retrieve media data.
|
|
32
|
+
* The keys are different from the original data structure, as they were customized
|
|
33
|
+
* for the app. This function renames the keys to match the new structure.
|
|
34
|
+
*
|
|
35
|
+
* @param {*} data - The input data containing the original keys that need to be renamed.
|
|
36
|
+
*/
|
|
37
|
+
function AppInboxMediaData(data) {
|
|
38
|
+
this.nt = data.messageTitle || "";
|
|
39
|
+
this.nm = data.messageBody || "";
|
|
40
|
+
this.ni = data.messageImage || "";
|
|
41
|
+
this.nid = data.messageId || "";
|
|
42
|
+
this.mid = data.messageId || "";
|
|
43
|
+
this.st = data.messageStatus || "";
|
|
44
|
+
this.ct = data.campType || "";
|
|
45
|
+
this.et = data.messageExpiryTime || "";
|
|
46
|
+
this.ln = data.messageLanguage || "";
|
|
47
|
+
this.acu = data.actionUrl || "";
|
|
48
|
+
this.act = data.actionType || "";
|
|
49
|
+
this.campid = data.messageCampid || "";
|
|
50
|
+
this.eni = data.expandedImage || "";
|
|
51
|
+
this.end = data.expandedDescription || "";
|
|
52
|
+
this.cdata = data.customData || {};
|
|
53
|
+
this.actions = data.actions || {};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
define('AppInboxMessage', [], function() {
|
|
57
|
+
return AppInboxMessage;
|
|
58
|
+
});
|