vibes-react-native 1.1.5 → 1.1.6
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 +2 -392
- package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.8/gc.properties +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/nb-cache/trust/0FE3017D1D91C06BBB23B2D967E1CF942770CADF1DE28563D6C5A7D96E872CFD +1 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +51 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +30 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/PushEvtEmitter.java +65 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesAppHelper.java +186 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesModule.java +490 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesPackage.java +28 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/Fms.java +132 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/PayloadWrapper.java +23 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/VibesPushReceiver.java +62 -0
- package/ios/Configuration.swift +68 -0
- package/ios/Notifications.swift +72 -0
- package/ios/Vibes-Bridging-Header.h +2 -0
- package/ios/Vibes.m +56 -0
- package/ios/Vibes.swift +378 -0
- package/ios/Vibes.xcodeproj/project.pbxproj +293 -0
- package/ios/Vibes.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Vibes.xcodeproj/project.xcworkspace/xcuserdata/ed.lafoy.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Vibes.xcodeproj/xcuserdata/ed.lafoy.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/VibesClient.swift +35 -0
- package/ios/VibesPluginLogger.swift +160 -0
- package/lib/commonjs/index.js +163 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +143 -0
- package/lib/module/index.js.map +1 -0
- package/package.json +10 -11
- package/src/index.tsx +182 -0
- /package/{ib → lib}/typescript/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,393 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Vibes React Native SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install vibes-react-native
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
```js
|
|
14
|
-
import Vibes from 'vibes-react-native';
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Setup
|
|
19
|
-
|
|
20
|
-
### Android
|
|
21
|
-
In the `android/build.gradle` file of your react-native project, make the following entry in the `allprojects`> `repositories` section.
|
|
22
|
-
|
|
23
|
-
```js
|
|
24
|
-
allprojects {
|
|
25
|
-
repositories {
|
|
26
|
-
....
|
|
27
|
-
maven { url "https://raw.githubusercontent.com/vibes/android-sdk-repository/releases/"}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
You will need values for `vibesAppId` and `vibesApiUrl` in the `android/app/build.gradle` file of your react-native project as shown below.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
defaultConfig {
|
|
37
|
-
...
|
|
38
|
-
manifestPlaceholders = [vibesAppId: "YOUR_VIBES_APPID"),
|
|
39
|
-
vibesApiUrl: "VIBES_API_URL"]
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### iOS
|
|
45
|
-
|
|
46
|
-
In the `Info.plist` file of your react-native project, make the following entries: `VibesAppId` and `VibesApiURL`.
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
<key>VibesAppId</key>
|
|
50
|
-
<string><your vibes app id></string>
|
|
51
|
-
<key>VibesApiURL</key>
|
|
52
|
-
<string><your vibes api url></string>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
The `vibesAppId` is Vibes AppID supplied to you by the Vibes Team. For the value of `vibesApiUrl`, choose one of the following.
|
|
56
|
-
|
|
57
|
-
* Default Vibes Push endpoint (US): https://public-api.vibescm.com/mobile_apps
|
|
58
|
-
* Vibes Push Europe endpoint (UE): https://public-api.vibescmeurope.com/mobile_apps
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## Push Notifications Usage
|
|
62
|
-
With the supplied credentials, the plugin initializes itself and calls `Vibes.registerDevice` and `Vibes.registerPush` when a Firebase token or APNS token is available within the app. This should be enough to start receiving push notifications. However, these additional functions can be called within your application's own lifecycle after the initialization process.
|
|
63
|
-
|
|
64
|
-
### registerDevice
|
|
65
|
-
This call registers the device with the Vibes environment, returning a promise that either contains a unique `device_id` that stays with the app until it is uninstalled, or an error message if registration fails. **This is invoked automatically at startup, and is not required unless you desire to do so. Calling it multiple times has no negative effect.**
|
|
66
|
-
|
|
67
|
-
### unregisterDevice
|
|
68
|
-
This call unregisters the device with the Vibes environment, as well as stops a device from receiving a push notification. It also disables any data collection or reporting functionality on this device. This call returns a promise, which on success contains no data and on failure contains an error message. To recover from this you need to invoke both `Vibes.registerDevice` and `Vibes.registerPush`.
|
|
69
|
-
|
|
70
|
-
### registerPush
|
|
71
|
-
This call fetches the platform specific token for the device and submits it to the Vibes environment, which it can then use to target this device. This call returns a promise, which on success contains no data and on failure contains an error message.
|
|
72
|
-
|
|
73
|
-
> For Android, this is invoked automatically at startup of application, and is not required unless you desire to do so.
|
|
74
|
-
|
|
75
|
-
> For iOS, you will need to manually call `Vibes.registerPush()` from the lifecycle point of entry of your landing page inside your react-native project. This should show push notifications permissions alert dialog, which once granted, will trigger registerPush call on the Vibes SDK with the APNS push token.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
### unregisterPush
|
|
79
|
-
This call notifies the Vibes environment not to send any more push notifications to this device. This call returns a promise, which on success contains no data and on failure contains an error message.
|
|
80
|
-
|
|
81
|
-
### getVibesDeviceInfo
|
|
82
|
-
This call returns a json payload containing the `device_id` and `push_token` which identifies an installed instance of the app. This call returns a promise with the json payload on success and on failure contains an error message. The payload looks like below.
|
|
83
|
-
|
|
84
|
-
```json
|
|
85
|
-
{
|
|
86
|
-
'device_id': 'vXJ6f67XfnH/OYWskzUakSczrQ8=',
|
|
87
|
-
'push_token': 'eAY6g9q3raJ4P03wNdSWC5MOW1EfxoomWNXsPhi7T6Q9yAqmxqn0sLEUjLL1Ib0LCH3nKQWBXdxapQ5LgbHu+g==',
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
### Push notification callbacks
|
|
93
|
-
Your react-native application can register to be notified of the json payload associated with 2 types of events.
|
|
94
|
-
|
|
95
|
-
* **pushReceived** - this is raised immediately a push notification is received.
|
|
96
|
-
* **pushOpened** - this is raised when a user of your app interacts with the received notification by tapping on it.
|
|
97
|
-
|
|
98
|
-
An example of how to subscribe to these 2 events is shown below.
|
|
99
|
-
|
|
100
|
-
```js
|
|
101
|
-
|
|
102
|
-
const onPushReceived = (event: { payload: string }) => {
|
|
103
|
-
alert('Push received. Payload -> ' + JSON.stringify(event.payload));
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const onPushOpened = async (event: { payload: string }) => {
|
|
107
|
-
// eslint-disable-next-line no-alert
|
|
108
|
-
alert('Push opened. Payload -> ' + JSON.stringify(event.payload));
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const eventEmitter =
|
|
112
|
-
Platform.OS === 'ios'
|
|
113
|
-
? new NativeEventEmitter(NativeModules.PushEventEmitter)
|
|
114
|
-
: DeviceEventEmitter;
|
|
115
|
-
|
|
116
|
-
eventEmitter.addListener('pushReceived', onPushReceived);
|
|
117
|
-
eventEmitter.addListener('pushOpened', onPushOpened);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const App = (): React.ReactElement => {
|
|
121
|
-
...
|
|
122
|
-
}
|
|
123
|
-
...
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
**The json payload may look like below for an Android app**
|
|
127
|
-
|
|
128
|
-
```json
|
|
129
|
-
{
|
|
130
|
-
"message_uid":"d4799f7e-442e-45e6-a2d7-e7a82785333a",
|
|
131
|
-
"body":"Test Message",
|
|
132
|
-
"title":"Test Message",
|
|
133
|
-
...
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**The json payload may look like below for an iOS app**
|
|
138
|
-
|
|
139
|
-
```json
|
|
140
|
-
{
|
|
141
|
-
"aps":{
|
|
142
|
-
"alert":{
|
|
143
|
-
"title":"Test Message",
|
|
144
|
-
"body":"Test Message",
|
|
145
|
-
},
|
|
146
|
-
"badge":1,
|
|
147
|
-
"content-available":1,
|
|
148
|
-
"mutable-content":1
|
|
149
|
-
}
|
|
150
|
-
...
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### associatePerson
|
|
155
|
-
To link a device to a user, perhaps by their username/email or any other unique identifier, you can use the `associatePerson` bridge function.
|
|
156
|
-
|
|
157
|
-
```js
|
|
158
|
-
|
|
159
|
-
const onPress = () => {
|
|
160
|
-
try {
|
|
161
|
-
const result = await Vibes.associatePerson('me@vibes.com');
|
|
162
|
-
console.log(result)
|
|
163
|
-
} catch (error) {
|
|
164
|
-
console.error(error);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### getPerson
|
|
170
|
-
To fetch details of a person associated with a device, use `getPerson` bridge function.
|
|
171
|
-
|
|
172
|
-
```js
|
|
173
|
-
|
|
174
|
-
const onPress = () => {
|
|
175
|
-
try {
|
|
176
|
-
const result = await Vibes.getPerson();
|
|
177
|
-
console.log(result.person_key())
|
|
178
|
-
console.log(result.external_person_id())
|
|
179
|
-
} catch (error) {
|
|
180
|
-
console.error(error);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### updateDevice
|
|
186
|
-
This call updates client device information with Vibes. It returns a promise, which on success contains no data and on failure contains an error message. The method requires key parameters i.e.
|
|
187
|
-
> updateCredential of type boolean which indicates whether an update is a token update otherwise false
|
|
188
|
-
> latitude and longitude of type Double
|
|
189
|
-
|
|
190
|
-
## Rich Push Display
|
|
191
|
-
|
|
192
|
-
### Android
|
|
193
|
-
* **Push notification icon** - The plugin looks for a drawable named `ic_stat_vibes_notif_icon.png` in the resources section of your project, and uses that to display an icon when push is received.
|
|
194
|
-
* **Sound** - The plugin looks for sound files in `raw` folder of the Android resources, and plays them when instructed to do so based on the payload contained in the notification. Note that sound will only play if you pass along a **Notification Channel** in the push payload else the default **VIBES** notification channel will be used, which doesn't play sound.
|
|
195
|
-
|
|
196
|
-
Refer to the sample app included in the `sample-app` folder in this project to see how these 2 are configured.
|
|
197
|
-
|
|
198
|
-
> Further documentation on customizing the notification icon, notification channels, sound, displaying images in notification and other extras can be found in the Android SDK documentation [here](https://developer.vibes.com/display/APIs/Integrating+the+Android+Push+Notifications+SDK)
|
|
199
|
-
|
|
200
|
-
### Adding Rich Push for iOS
|
|
201
|
-
To Add Rich Push to iOS, you need to add a Service Extenstion to the project. The service extension sits between the APNS server and the final content of the push and gets a limited execution time to perform some logic on the incoming push payload. This allows you to intercept the push content coming in from the APNS, modify it and then deliver the modified payload to the user.
|
|
202
|
-
|
|
203
|
-
Steps to add:
|
|
204
|
-
1. Go to the iOS project under `<your_rn_project>/ios` and open the `.xcworkspace` on XCode.
|
|
205
|
-
2. On XCode create a new target by clicking `File ▸ New ▸ Target…`.
|
|
206
|
-
3. Filter for the `Notification Service` Extension and click Next:
|
|
207
|
-

|
|
208
|
-
4. Give it a name say `RichPush`, select Team, Bundle ID and language to use (you mostly want to stick with Swift here) and should be set to `Embeded in Application`(this is your main application project).Then click Finish.
|
|
209
|
-
5. If you wish to expose some of the helper classes to the new services extension you created, select the file you wish to expose, go to `File Inspector` and add a check to your service extension target.
|
|
210
|
-

|
|
211
|
-
6. Next go to your Apple Developer Page and create a `Siging Certificate and Provisioning Profile` for the `Bundle ID` you selected above. Make sure these are selected under `Signing & Capabilities` tab on your XCode project setting. You may also just use `Automatic Signing` if this suits your needs.
|
|
212
|
-

|
|
213
|
-
7. You new RichPush target will have a `NotificationService.swift` file created wich should allow you to intercept and modify the notification.
|
|
214
|
-
```swift
|
|
215
|
-
import UserNotifications
|
|
216
|
-
import MobileCoreServices
|
|
217
|
-
|
|
218
|
-
@available(iOS 10.0, *)
|
|
219
|
-
class NotificationService: UNNotificationServiceExtension {
|
|
220
|
-
let parse = RichPushNotificationParsing()
|
|
221
|
-
|
|
222
|
-
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
223
|
-
// you may add your notification Parser here e.g to intercept and maybe dowload a media as in our case
|
|
224
|
-
parse.didReceive(request, withContentHandler: contentHandler)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
override func serviceExtensionTimeWillExpire() {
|
|
228
|
-
parse.serviceExtensionTimeWillExpire()
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
8. This is how the notification Parser may loook like if you are looking to download image with url specified in `client_app_data` using the key `media_url` when posted from the Campaign Manager.
|
|
233
|
-
|
|
234
|
-
```swift
|
|
235
|
-
import UIKit
|
|
236
|
-
import UserNotifications
|
|
237
|
-
|
|
238
|
-
class RichPushNotificationParsing: NSObject {
|
|
239
|
-
var contentHandler: ((UNNotificationContent) -> Void)?
|
|
240
|
-
var bestAttemptContent: UNMutableNotificationContent?
|
|
241
|
-
fileprivate let kClientDataKey = "client_app_data"
|
|
242
|
-
fileprivate let kMediaUrlKey = "media_url"
|
|
243
|
-
fileprivate let kRichContentIdentifier = "richContent"
|
|
244
|
-
|
|
245
|
-
func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
246
|
-
self.contentHandler = contentHandler
|
|
247
|
-
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
|
248
|
-
|
|
249
|
-
if let bestAttemptContent = bestAttemptContent {
|
|
250
|
-
if let clientData = bestAttemptContent.userInfo[kClientDataKey] as? [String: Any] {
|
|
251
|
-
|
|
252
|
-
guard let attachmentString = clientData[kMediaUrlKey] as? String else {
|
|
253
|
-
return
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if let attachmentUrl = URL(string: attachmentString) {
|
|
257
|
-
let session = URLSession(configuration: URLSessionConfiguration.default)
|
|
258
|
-
let attachmentDownloadTask = session.downloadTask(with: attachmentUrl, completionHandler: { (location, response, error) in
|
|
259
|
-
if let location = location {
|
|
260
|
-
let tmpDirectory = NSTemporaryDirectory()
|
|
261
|
-
let tmpFile = "file://".appending(tmpDirectory).appending(attachmentUrl.lastPathComponent)
|
|
262
|
-
let tmpUrl = URL(string: tmpFile)!
|
|
263
|
-
do {
|
|
264
|
-
try FileManager.default.moveItem(at: location, to: tmpUrl)
|
|
265
|
-
if let attachment = try? UNNotificationAttachment(identifier: self.kRichContentIdentifier, url: tmpUrl) {
|
|
266
|
-
self.bestAttemptContent?.attachments = [attachment]
|
|
267
|
-
}
|
|
268
|
-
} catch {
|
|
269
|
-
print("An exception was caught while downloading the rich content!")
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
// Serve the notification content
|
|
273
|
-
self.contentHandler!(self.bestAttemptContent!)
|
|
274
|
-
})
|
|
275
|
-
attachmentDownloadTask.resume()
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
func serviceExtensionTimeWillExpire() {
|
|
282
|
-
// Called just before the extension will be terminated by the system.
|
|
283
|
-
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
|
284
|
-
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
|
285
|
-
contentHandler(bestAttemptContent)
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
```
|
|
290
|
-
9. Compile and Build your project to a device capable of receiving Push notifications on the APNs certificate used for your application project.
|
|
291
|
-
10. You should end up with Rich Push notification, when you send a broadcast that has a media attachment from the Campaign Manager.
|
|
292
|
-
|
|
293
|
-
> More information about setting up your iOS app for Rich Push notifications can be found [here](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ModifyingNotifications.html#//apple_ref/doc/uid/TP40008194-CH16-SW1)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
## Inbox Support
|
|
297
|
-
This SDK also supports interaction with inbox messages. The following actions are available for inbox message support.
|
|
298
|
-
|
|
299
|
-
### fetchInboxMessages
|
|
300
|
-
This call returns a JSON array of inbox messages that have been received for this person. The promise returns on success with the array of inbox messages, or an error message when there's a failure. The array of fetched inbox messages should look like below.
|
|
301
|
-
|
|
302
|
-
```
|
|
303
|
-
[
|
|
304
|
-
{
|
|
305
|
-
|
|
306
|
-
"content": "Content here",
|
|
307
|
-
"created_at": "Jun 16, 2020 6:26:52 PM",
|
|
308
|
-
"expires_at": "Sep 14, 2020 12:00:00 AM",
|
|
309
|
-
"message_uid": "a62b9c70-3b50-40c0-aaf5-9d55c0149e7c",
|
|
310
|
-
"read": false,
|
|
311
|
-
"subject": "Subject here",
|
|
312
|
-
"collapse_key": "vibes-acee3b99-10c1-4dd5-b0e5-1589296ba3a2",
|
|
313
|
-
"detail": "https://publiclyhostedurl.com/image.png",
|
|
314
|
-
"images": {
|
|
315
|
-
"icon": "https://publiclyhostedurl.com/icon.jpg",
|
|
316
|
-
"main": "https://publiclyhostedurl.com/main.jpg"
|
|
317
|
-
},
|
|
318
|
-
"apprefdata": {
|
|
319
|
-
"personUid": "83497970-280e-4cc8-92c3-e699c3db0738",
|
|
320
|
-
"activityUid": "acee3b99-10c1-4dd5-b0e5-1589296ba3a2",
|
|
321
|
-
"vibesDeviceId": "32515f9b-f722-4914-9afc-c734790e5789",
|
|
322
|
-
"flightUid": "f76cd0c9-6245-4ea1-ae36-0b5a13b8fba5",
|
|
323
|
-
"deviceUid": "7e0d100e-c549-4d0d-a28f-3f7336c04f3e",
|
|
324
|
-
"activityType": "Broadcast",
|
|
325
|
-
"last_opened_at": "2020-06-16T18:25:55Z"
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
|
|
330
|
-
"content": "This is the content",
|
|
331
|
-
"created_at": "Jun 16, 2020 6:26:20 PM",
|
|
332
|
-
"expires_at": "Sep 14, 2020 12:00:00 AM",
|
|
333
|
-
"message_uid": "3407658c-85d2-439c-9c6d-2b642ef78761",
|
|
334
|
-
"read": false,
|
|
335
|
-
"subject": "This is the message",
|
|
336
|
-
"collapse_key": "vibes-c9ae6ba9-8041-437d-9521-c3db803c19ce",
|
|
337
|
-
"detail": "https://publiclyhostedurl.com/image.png",
|
|
338
|
-
"images": {
|
|
339
|
-
"icon": "https://publiclyhostedurl.com/icon.jpg",
|
|
340
|
-
"main": "https://publiclyhostedurl.com/main.jpg"
|
|
341
|
-
},
|
|
342
|
-
"apprefdata": {
|
|
343
|
-
"personUid": "83497970-280e-4cc8-92c3-e699c3db0738",
|
|
344
|
-
"activityUid": "c9ae6ba9-8041-437d-9521-c3db803c19ce",
|
|
345
|
-
"vibesDeviceId": "32515f9b-f722-4914-9afc-c734790e5789",
|
|
346
|
-
"flightUid": "bcfe6100-516a-484f-84cb-60686e216041",
|
|
347
|
-
"deviceUid": "7e0d100e-c549-4d0d-a28f-3f7336c04f3e",
|
|
348
|
-
"activityType": "Broadcast",
|
|
349
|
-
"last_opened_at": "2020-06-16T18:25:55Z"
|
|
350
|
-
},
|
|
351
|
-
}
|
|
352
|
-
]
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### fetchInboxMessage
|
|
356
|
-
This call fetches a single inbox message based on the `message_uid` supplied. This is ideal for cases when a push message is linked to an inbox message. It returns a promise, which contains the inbox message on success, or an error message on failure. Note that the `message_uid` is required to invoke this call.
|
|
357
|
-
|
|
358
|
-
```
|
|
359
|
-
{
|
|
360
|
-
"collapse_key": "vibes-acee3b99-10c1-4dd5-b0e5-1589296ba3a2",
|
|
361
|
-
"content": "Content here",
|
|
362
|
-
"created_at": "Jun 16, 2020 6:26:52 PM",
|
|
363
|
-
"expires_at": "Sep 14, 2020 12:00:00 AM",
|
|
364
|
-
"message_uid": "a62b9c70-3b50-40c0-aaf5-9d55c0149e7c",
|
|
365
|
-
"read": false,
|
|
366
|
-
"subject": "Subject here"
|
|
367
|
-
"apprefdata": {
|
|
368
|
-
"personUid": "83497970-280e-4cc8-92c3-e699c3db0738",
|
|
369
|
-
"activityUid": "acee3b99-10c1-4dd5-b0e5-1589296ba3a2",
|
|
370
|
-
"vibesDeviceId": "32515f9b-f722-4914-9afc-c734790e5789",
|
|
371
|
-
"flightUid": "f76cd0c9-6245-4ea1-ae36-0b5a13b8fba5",
|
|
372
|
-
"deviceUid": "7e0d100e-c549-4d0d-a28f-3f7336c04f3e",
|
|
373
|
-
"activityType": "Broadcast",
|
|
374
|
-
"last_opened_at": "2020-06-16T18:25:55Z"
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
### expireInboxMessage
|
|
380
|
-
This call is used to mark a message for expiry. The call requires a `message_uid`. It marks the message as expired immediately. The promise returns with the updated json payload of the expired message, or an error message if there's a failure. Note that the `message_uid` is required to invoke this call.
|
|
381
|
-
|
|
382
|
-
### markInboxMessageAsRead
|
|
383
|
-
This call is used to mark a message as read. The call requires a `message_uid`. The promise returns with the updated json payload with the `read` field set to true, or an error message if there's a failure. Note that the `message_uid` is required to invoke this call.
|
|
384
|
-
|
|
385
|
-
### onInboxMessageOpen
|
|
386
|
-
This call generates an event showing that a single inbox message has been opened. The call requires the full message that has been viewed to be passed as JSON. The promise returns with no data on success, or an error message on failure.
|
|
387
|
-
|
|
388
|
-
### onInboxFetched
|
|
389
|
-
This call generates an event for tracking the usage of inbox functionality by recording the most recent time when inbox messages were fetched for the person on this device. It should typically be called after the `fetchInboxMessages` call above. The promise returns with no data on success, or an error message on failure.
|
|
390
|
-
|
|
391
|
-
## License
|
|
392
|
-
|
|
393
|
-
MIT
|
|
3
|
+
For installation and integration instructions, see the [React Native SDK documentation](https://developer-platform.vibes.com/docs/react-native)
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
61C79B06CD533399D1E28DE57C95268CA2764F2F1B5E0EFE56779638FB58E6F5
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
apply plugin: "com.android.library"
|
|
2
|
+
|
|
3
|
+
def safeExtGet(prop, fallback) {
|
|
4
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
android {
|
|
8
|
+
namespace "com.vibes.push.rn.plugin"
|
|
9
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
10
|
+
defaultConfig {
|
|
11
|
+
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
12
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
13
|
+
}
|
|
14
|
+
buildTypes {
|
|
15
|
+
release {
|
|
16
|
+
minifyEnabled false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
lintOptions {
|
|
20
|
+
disable "GradleCompatible"
|
|
21
|
+
}
|
|
22
|
+
compileOptions {
|
|
23
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
24
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
repositories {
|
|
29
|
+
mavenLocal()
|
|
30
|
+
google()
|
|
31
|
+
mavenCentral()
|
|
32
|
+
maven {
|
|
33
|
+
url "https://raw.githubusercontent.com/vibes/android-sdk-repository/releases/"
|
|
34
|
+
}
|
|
35
|
+
maven {
|
|
36
|
+
url "https://maven.pkg.github.com/vibes/android-sdk-repository"
|
|
37
|
+
credentials {
|
|
38
|
+
username = System.getenv("VIBES_GITHUB_USERNAME") ?: ""
|
|
39
|
+
password = System.getenv("VIBES_GITHUB_PASSWORD") ?: ""
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
dependencies {
|
|
45
|
+
implementation "com.facebook.react:react-android"
|
|
46
|
+
// Exposed to the sample app (MainActivity uses com.vibes.vibes.*); use implementation if app does not import SDK directly.
|
|
47
|
+
api "com.vibes.vibes:vibes:4.10.0"
|
|
48
|
+
implementation "com.google.firebase:firebase-iid:21.1.0"
|
|
49
|
+
implementation "com.google.firebase:firebase-messaging:23.0.8"
|
|
50
|
+
implementation "com.google.code.gson:gson:2.9.0"
|
|
51
|
+
}
|
|
Binary file
|
package/android/gradlew
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2015 the original author or authors.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
##############################################################################
|
|
20
|
+
##
|
|
21
|
+
## Gradle start up script for UN*X
|
|
22
|
+
##
|
|
23
|
+
##############################################################################
|
|
24
|
+
|
|
25
|
+
# Attempt to set APP_HOME
|
|
26
|
+
# Resolve links: $0 may be a link
|
|
27
|
+
PRG="$0"
|
|
28
|
+
# Need this for relative symlinks.
|
|
29
|
+
while [ -h "$PRG" ] ; do
|
|
30
|
+
ls=`ls -ld "$PRG"`
|
|
31
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
32
|
+
if expr "$link" : '/.*' > /dev/null; then
|
|
33
|
+
PRG="$link"
|
|
34
|
+
else
|
|
35
|
+
PRG=`dirname "$PRG"`"/$link"
|
|
36
|
+
fi
|
|
37
|
+
done
|
|
38
|
+
SAVED="`pwd`"
|
|
39
|
+
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
40
|
+
APP_HOME="`pwd -P`"
|
|
41
|
+
cd "$SAVED" >/dev/null
|
|
42
|
+
|
|
43
|
+
APP_NAME="Gradle"
|
|
44
|
+
APP_BASE_NAME=`basename "$0"`
|
|
45
|
+
|
|
46
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
47
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
48
|
+
|
|
49
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
50
|
+
MAX_FD="maximum"
|
|
51
|
+
|
|
52
|
+
warn () {
|
|
53
|
+
echo "$*"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
die () {
|
|
57
|
+
echo
|
|
58
|
+
echo "$*"
|
|
59
|
+
echo
|
|
60
|
+
exit 1
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# OS specific support (must be 'true' or 'false').
|
|
64
|
+
cygwin=false
|
|
65
|
+
msys=false
|
|
66
|
+
darwin=false
|
|
67
|
+
nonstop=false
|
|
68
|
+
case "`uname`" in
|
|
69
|
+
CYGWIN* )
|
|
70
|
+
cygwin=true
|
|
71
|
+
;;
|
|
72
|
+
Darwin* )
|
|
73
|
+
darwin=true
|
|
74
|
+
;;
|
|
75
|
+
MINGW* )
|
|
76
|
+
msys=true
|
|
77
|
+
;;
|
|
78
|
+
NONSTOP* )
|
|
79
|
+
nonstop=true
|
|
80
|
+
;;
|
|
81
|
+
esac
|
|
82
|
+
|
|
83
|
+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Determine the Java command to use to start the JVM.
|
|
87
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
88
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
89
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
90
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
91
|
+
else
|
|
92
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
|
93
|
+
fi
|
|
94
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
95
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
96
|
+
|
|
97
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
98
|
+
location of your Java installation."
|
|
99
|
+
fi
|
|
100
|
+
else
|
|
101
|
+
JAVACMD="java"
|
|
102
|
+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
103
|
+
|
|
104
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
105
|
+
location of your Java installation."
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
# Increase the maximum file descriptors if we can.
|
|
109
|
+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
110
|
+
MAX_FD_LIMIT=`ulimit -H -n`
|
|
111
|
+
if [ $? -eq 0 ] ; then
|
|
112
|
+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
113
|
+
MAX_FD="$MAX_FD_LIMIT"
|
|
114
|
+
fi
|
|
115
|
+
ulimit -n $MAX_FD
|
|
116
|
+
if [ $? -ne 0 ] ; then
|
|
117
|
+
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
118
|
+
fi
|
|
119
|
+
else
|
|
120
|
+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
121
|
+
fi
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# For Darwin, add options to specify how the application appears in the dock
|
|
125
|
+
if $darwin; then
|
|
126
|
+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
130
|
+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
131
|
+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
132
|
+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
133
|
+
|
|
134
|
+
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
135
|
+
|
|
136
|
+
# We build the pattern for arguments to be converted via cygpath
|
|
137
|
+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
138
|
+
SEP=""
|
|
139
|
+
for dir in $ROOTDIRSRAW ; do
|
|
140
|
+
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
141
|
+
SEP="|"
|
|
142
|
+
done
|
|
143
|
+
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
144
|
+
# Add a user-defined pattern to the cygpath arguments
|
|
145
|
+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
146
|
+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
147
|
+
fi
|
|
148
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
149
|
+
i=0
|
|
150
|
+
for arg in "$@" ; do
|
|
151
|
+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
152
|
+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
153
|
+
|
|
154
|
+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
155
|
+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
156
|
+
else
|
|
157
|
+
eval `echo args$i`="\"$arg\""
|
|
158
|
+
fi
|
|
159
|
+
i=`expr $i + 1`
|
|
160
|
+
done
|
|
161
|
+
case $i in
|
|
162
|
+
0) set -- ;;
|
|
163
|
+
1) set -- "$args0" ;;
|
|
164
|
+
2) set -- "$args0" "$args1" ;;
|
|
165
|
+
3) set -- "$args0" "$args1" "$args2" ;;
|
|
166
|
+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
167
|
+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
168
|
+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
169
|
+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
170
|
+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
171
|
+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
172
|
+
esac
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
# Escape application args
|
|
176
|
+
save () {
|
|
177
|
+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
178
|
+
echo " "
|
|
179
|
+
}
|
|
180
|
+
APP_ARGS=`save "$@"`
|
|
181
|
+
|
|
182
|
+
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
183
|
+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
184
|
+
|
|
185
|
+
exec "$JAVACMD" "$@"
|