@developer_tribe/react-native-comnyx 0.11.4 → 0.12.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 +28 -1
- package/android/src/main/java/com/comnyx/ComnyxModule.kt +1 -0
- package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +11 -2
- package/ios/Comnyx.swift +24 -0
- package/lib/commonjs/api/api.js +1 -1
- package/lib/commonjs/notifications/initializeNotifications.js +10 -1
- package/lib/commonjs/notifications/initializeNotifications.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/api/api.js +1 -1
- package/lib/module/notifications/initializeNotifications.js +10 -1
- package/lib/module/notifications/initializeNotifications.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/api.ts +1 -1
- package/src/notifications/initializeNotifications.ts +11 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,34 @@ Add to your `Info.plist`:
|
|
|
90
90
|
- Select target → "Signing & Capabilities"
|
|
91
91
|
- Add "Push Notifications" capability
|
|
92
92
|
|
|
93
|
-
### 4.
|
|
93
|
+
### 4. Platform-Specific Requirements
|
|
94
|
+
|
|
95
|
+
#### Android: Handle New Intents
|
|
96
|
+
|
|
97
|
+
In your `MainActivity.kt`, add the following method to handle notification intents:
|
|
98
|
+
|
|
99
|
+
```kotlin
|
|
100
|
+
override fun onNewIntent(intent: Intent) {
|
|
101
|
+
super.onNewIntent(intent)
|
|
102
|
+
ComnyxModule.handleNewIntent(intent)
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### iOS: Register Device Tokens
|
|
107
|
+
|
|
108
|
+
In your `AppDelegate.swift`, add these methods to handle push notification registration:
|
|
109
|
+
|
|
110
|
+
```swift
|
|
111
|
+
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
112
|
+
Comnyx.registerDeviceToken(deviceToken)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
|
116
|
+
Comnyx.registerDeviceTokenFailed(error)
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 5. Notifications Code Setup
|
|
94
121
|
|
|
95
122
|
```javascript
|
|
96
123
|
// Initialize notifications
|
|
@@ -26,6 +26,7 @@ import android.widget.Toast
|
|
|
26
26
|
import android.content.ClipData
|
|
27
27
|
import android.content.ClipboardManager
|
|
28
28
|
|
|
29
|
+
//TODO: logging (from bridge)
|
|
29
30
|
@ReactModule(name = ComnyxModule.NAME)
|
|
30
31
|
class ComnyxModule(reactContext: ReactApplicationContext) :
|
|
31
32
|
ReactContextBaseJavaModule(reactContext), PermissionListener {
|
|
@@ -7,7 +7,8 @@ import com.google.firebase.messaging.RemoteMessage
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
open class ComnyxFirebaseMessagingService : FirebaseMessagingService() {
|
|
10
|
-
|
|
10
|
+
//TODO: backend should send a metadata key to identify the message as comnyx
|
|
11
|
+
private static val COMNYX_METADATA_KEY = "comnyx"
|
|
11
12
|
private lateinit var notificationsHelper: NotificationsHelper
|
|
12
13
|
|
|
13
14
|
override fun onCreate() {
|
|
@@ -18,7 +19,15 @@ open class ComnyxFirebaseMessagingService : FirebaseMessagingService() {
|
|
|
18
19
|
override fun onMessageReceived(remoteMessage: RemoteMessage) {
|
|
19
20
|
//https://stackoverflow.com/a/40083727
|
|
20
21
|
super.onMessageReceived(remoteMessage)
|
|
21
|
-
|
|
22
|
+
if(isRemoteMessageFromComnyx(remoteMessage)) {
|
|
23
|
+
notificationsHelper.showNotification(remoteMessage)
|
|
24
|
+
}else{
|
|
25
|
+
Log.w("ComnyxFirebaseMessagingService","Message is not from Comnyx")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
internal fun isRemoteMessageFromComnyx(remoteMessage: RemoteMessage): Boolean {
|
|
30
|
+
return remoteMessage.data.containsKey(COMNYX_METADATA_KEY)
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
override fun onNewToken(token: String) {
|
package/ios/Comnyx.swift
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import UserNotifications
|
|
10
10
|
|
|
11
|
+
//TODO: logging (from bridge)
|
|
11
12
|
@objc(Comnyx)
|
|
12
13
|
class Comnyx: RCTEventEmitter {
|
|
13
14
|
private var hasListeners: Bool = false
|
|
@@ -186,6 +187,29 @@ class Comnyx: RCTEventEmitter {
|
|
|
186
187
|
UIApplication.shared.applicationIconBadgeNumber = 0
|
|
187
188
|
}
|
|
188
189
|
|
|
190
|
+
@objc
|
|
191
|
+
static func registerDeviceToken(_ deviceToken: Data) {
|
|
192
|
+
let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
|
|
193
|
+
print("Device Token: \(token)")
|
|
194
|
+
|
|
195
|
+
// Post notification for RCT modules to handle
|
|
196
|
+
NotificationCenter.default.post(
|
|
197
|
+
name: NSNotification.Name("RCTRemoteNotificationRegistered"),
|
|
198
|
+
object: self,
|
|
199
|
+
userInfo: ["deviceToken": token]
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@objc
|
|
204
|
+
static func registerDeviceTokenFailed(_ error: Error) {
|
|
205
|
+
print("Device Token Failed: \(error)")
|
|
206
|
+
// Post notification for RCT modules to handle
|
|
207
|
+
NotificationCenter.default.post(
|
|
208
|
+
name: NSNotification.Name("RCTRemoteNotificationRegistrationFailed"),
|
|
209
|
+
object: self,
|
|
210
|
+
userInfo: ["error": error]
|
|
211
|
+
)
|
|
212
|
+
}
|
|
189
213
|
|
|
190
214
|
}
|
|
191
215
|
|
package/lib/commonjs/api/api.js
CHANGED
|
@@ -17,7 +17,7 @@ const axiosInstance = exports.axiosInstance = _axios.default.create({
|
|
|
17
17
|
headers: {
|
|
18
18
|
'Content-Type': 'application/json'
|
|
19
19
|
},
|
|
20
|
-
timeout:
|
|
20
|
+
timeout: 15_000
|
|
21
21
|
});
|
|
22
22
|
function isInitCalled() {
|
|
23
23
|
return !!axiosInstance.defaults.headers.common['project-id'];
|
|
@@ -15,13 +15,22 @@ let globalSubscriptions = {
|
|
|
15
15
|
subscriptionsForNotification: [],
|
|
16
16
|
subscriptionsForOptIn: null
|
|
17
17
|
};
|
|
18
|
+
let isAlertShowing = false;
|
|
18
19
|
function showAlertDialog() {
|
|
20
|
+
if (_reactNative.Platform.OS === 'ios' && isAlertShowing) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
isAlertShowing = true;
|
|
19
24
|
_reactNative.Alert.alert((0, _useLocalize.localize)('notifications.optIn.title'), (0, _useLocalize.localize)('notifications.optIn.description'), [{
|
|
20
25
|
text: (0, _useLocalize.localize)('notifications.optIn.cancel'),
|
|
21
|
-
style: 'cancel'
|
|
26
|
+
style: 'cancel',
|
|
27
|
+
onPress: () => {
|
|
28
|
+
isAlertShowing = false;
|
|
29
|
+
}
|
|
22
30
|
}, {
|
|
23
31
|
text: (0, _useLocalize.localize)('notifications.optIn.openSettings'),
|
|
24
32
|
onPress: () => {
|
|
33
|
+
isAlertShowing = false;
|
|
25
34
|
_index.ComnyxNotifications.linkToSettings();
|
|
26
35
|
}
|
|
27
36
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_index","_NativeComnyx","_store","_api","_useLocalize","_Accumulator","globalSubscriptions","subscriptionsForNotification","subscriptionsForOptIn","showAlertDialog","Alert","alert","localize","text","style","onPress","ComnyxNotifications","linkToSettings","changePermissionStatus","status","state","useAppStore","getState","NotificationPermissionStatus","GRANTED","permissionGiven","setPermissionGiven","accumulator","add","allow_notifications","initializeNativeNotifications","addEventListener","data","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_index","_NativeComnyx","_store","_api","_useLocalize","_Accumulator","globalSubscriptions","subscriptionsForNotification","subscriptionsForOptIn","isAlertShowing","showAlertDialog","Platform","OS","Alert","alert","localize","text","style","onPress","ComnyxNotifications","linkToSettings","changePermissionStatus","status","state","useAppStore","getState","NotificationPermissionStatus","GRANTED","permissionGiven","setPermissionGiven","accumulator","add","allow_notifications","initializeNativeNotifications","addEventListener","data","apnsToken","token","fcmToken","console","error","nativeComnyx","initialize","then","res","setNotificationInitialized","success","platform","country","language","timezone","initializeNotifications","params","isInitCalled","Error","isLoginCalled","result","length","forEach","subscription","remove","permissionResult","checkOptIn","showOptIn","DENIED","permissionResultAfterDenied","optIn","BLOCKED","AppState","nextAppState","permissionGivenInForeground","notificationInitialized","showOptInOnForeground","permissionResultInner"],"sourceRoot":"../../../src","sources":["notifications/initializeNotifications.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAEA,IAAIO,mBAAmB,GAAG;EACxBC,4BAA4B,EAAE,EAA2B;EACzDC,qBAAqB,EAAE;AACzB,CAAC;AAED,IAAIC,cAAc,GAAG,KAAK;AAQ1B,SAASC,eAAeA,CAAA,EAAG;EACzB,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAIH,cAAc,EAAE;IAC3C;EACF;EAEAA,cAAc,GAAG,IAAI;EACrBI,kBAAK,CAACC,KAAK,CACT,IAAAC,qBAAQ,EAAC,2BAA2B,CAAC,EACrC,IAAAA,qBAAQ,EAAC,iCAAiC,CAAC,EAC3C,CACE;IACEC,IAAI,EAAE,IAAAD,qBAAQ,EAAC,4BAA4B,CAAC;IAC5CE,KAAK,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B,MAAM,CAACoB,qBAAqB,EAAE;UAChCrD,0BAAmB,CAAC+C,KAAK,CAAC,CAAC,CAACvB,IAAI,CAAC,MAAO8B,qBAAqB,IAAK;YAChEpD,sBAAsB,CAACoD,qBAAqB,CAAC;YAC7C,IACEA,qBAAqB,KAAK/C,0CAA4B,CAACC,OAAO,EAC9D;cACA,MAAMM,6BAA6B,CAAC,CAAC;YACvC,CAAC,MAAM,IACLwC,qBAAqB,KAAK/C,0CAA4B,CAACyC,OAAO,EAC9D;cACA,IAAIf,MAAM,CAAChC,cAAc,EAAE;gBACzBV,eAAe,CAAC,CAAC;cACnB;YACF;UACF,CAAC,CAAC;QACJ;MACF;IACF;EACF,CACF,CAAC;EAED,OAAO8C,MAAM;AACf","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/api/api.js
CHANGED
|
@@ -11,13 +11,22 @@ let globalSubscriptions = {
|
|
|
11
11
|
subscriptionsForNotification: [],
|
|
12
12
|
subscriptionsForOptIn: null
|
|
13
13
|
};
|
|
14
|
+
let isAlertShowing = false;
|
|
14
15
|
function showAlertDialog() {
|
|
16
|
+
if (Platform.OS === 'ios' && isAlertShowing) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
isAlertShowing = true;
|
|
15
20
|
Alert.alert(localize('notifications.optIn.title'), localize('notifications.optIn.description'), [{
|
|
16
21
|
text: localize('notifications.optIn.cancel'),
|
|
17
|
-
style: 'cancel'
|
|
22
|
+
style: 'cancel',
|
|
23
|
+
onPress: () => {
|
|
24
|
+
isAlertShowing = false;
|
|
25
|
+
}
|
|
18
26
|
}, {
|
|
19
27
|
text: localize('notifications.optIn.openSettings'),
|
|
20
28
|
onPress: () => {
|
|
29
|
+
isAlertShowing = false;
|
|
21
30
|
ComnyxNotifications.linkToSettings();
|
|
22
31
|
}
|
|
23
32
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Alert","AppState","Platform","ComnyxNotifications","nativeComnyx","NotificationPermissionStatus","useAppStore","isInitCalled","isLoginCalled","localize","accumulator","globalSubscriptions","subscriptionsForNotification","subscriptionsForOptIn","showAlertDialog","alert","text","style","onPress","linkToSettings","changePermissionStatus","status","state","getState","GRANTED","permissionGiven","setPermissionGiven","add","allow_notifications","initializeNativeNotifications","addEventListener","data","
|
|
1
|
+
{"version":3,"names":["Alert","AppState","Platform","ComnyxNotifications","nativeComnyx","NotificationPermissionStatus","useAppStore","isInitCalled","isLoginCalled","localize","accumulator","globalSubscriptions","subscriptionsForNotification","subscriptionsForOptIn","isAlertShowing","showAlertDialog","OS","alert","text","style","onPress","linkToSettings","changePermissionStatus","status","state","getState","GRANTED","permissionGiven","setPermissionGiven","add","allow_notifications","initializeNativeNotifications","addEventListener","data","apnsToken","token","fcmToken","console","error","initialize","then","res","setNotificationInitialized","success","platform","country","language","timezone","initializeNotifications","params","Error","result","length","forEach","subscription","remove","permissionResult","checkOptIn","showOptIn","DENIED","permissionResultAfterDenied","optIn","BLOCKED","nextAppState","permissionGivenInForeground","notificationInitialized","showOptInOnForeground","permissionResultInner"],"sourceRoot":"../../../src","sources":["notifications/initializeNotifications.ts"],"mappings":";;AAAA,SACEA,KAAK,EACLC,QAAQ,EAGRC,QAAQ,QACH,cAAc;AACrB,SAASC,mBAAmB,QAAQ,YAAG;AACvC,SAASC,YAAY,EAAEC,4BAA4B,QAAQ,oBAAiB;AAC5E,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,YAAY,EAAEC,aAAa,QAAQ,eAAY;AACxD,SAASC,QAAQ,QAAQ,yBAAsB;AAC/C,SAASC,WAAW,QAAQ,4BAAyB;AAErD,IAAIC,mBAAmB,GAAG;EACxBC,4BAA4B,EAAE,EAA2B;EACzDC,qBAAqB,EAAE;AACzB,CAAC;AAED,IAAIC,cAAc,GAAG,KAAK;AAQ1B,SAASC,eAAeA,CAAA,EAAG;EACzB,IAAIb,QAAQ,CAACc,EAAE,KAAK,KAAK,IAAIF,cAAc,EAAE;IAC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3D,4BAA4B,CAACqB,OAAO,EACpE;QACA,MAAMF,KAAK,GAAGlB,WAAW,CAACmB,QAAQ,CAAC,CAAC;QACpC,IAAI,CAACD,KAAK,CAACyC,uBAAuB,EAAE;UAClC,MAAMlC,6BAA6B,CAAC,CAAC;QACvC;MACF,CAAC,MAAM;QACL,IAAIkB,MAAM,CAACiB,qBAAqB,EAAE;UAChC/D,mBAAmB,CAAC0D,KAAK,CAAC,CAAC,CAACrB,IAAI,CAAC,MAAO2B,qBAAqB,IAAK;YAChE7C,sBAAsB,CAAC6C,qBAAqB,CAAC;YAC7C,IACEA,qBAAqB,KAAK9D,4BAA4B,CAACqB,OAAO,EAC9D;cACA,MAAMK,6BAA6B,CAAC,CAAC;YACvC,CAAC,MAAM,IACLoC,qBAAqB,KAAK9D,4BAA4B,CAACyD,OAAO,EAC9D;cACA,IAAIb,MAAM,CAAC5B,cAAc,EAAE;gBACzBN,eAAe,CAAC,CAAC;cACnB;YACF;UACF,CAAC,CAAC;QACJ;MACF;IACF;EACF,CACF,CAAC;EAED,OAAOoC,MAAM;AACf","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeNotifications.d.ts","sourceRoot":"","sources":["../../../../src/notifications/initializeNotifications.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initializeNotifications.d.ts","sourceRoot":"","sources":["../../../../src/notifications/initializeNotifications.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,6BAA6B;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAqFD,wBAAsB,uBAAuB,CAC3C,MAAM,GAAE,6BAAkC,oBAmF3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.12.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developer_tribe/react-native-comnyx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
package/src/api/api.ts
CHANGED
|
@@ -17,6 +17,8 @@ let globalSubscriptions = {
|
|
|
17
17
|
subscriptionsForOptIn: null as NativeEventSubscription | null,
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
let isAlertShowing = false;
|
|
21
|
+
|
|
20
22
|
export interface InitializeNotificationsParams {
|
|
21
23
|
showOptIn?: boolean;
|
|
22
24
|
showOptInOnForeground?: boolean;
|
|
@@ -24,6 +26,11 @@ export interface InitializeNotificationsParams {
|
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
function showAlertDialog() {
|
|
29
|
+
if (Platform.OS === 'ios' && isAlertShowing) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
isAlertShowing = true;
|
|
27
34
|
Alert.alert(
|
|
28
35
|
localize('notifications.optIn.title'),
|
|
29
36
|
localize('notifications.optIn.description'),
|
|
@@ -31,10 +38,14 @@ function showAlertDialog() {
|
|
|
31
38
|
{
|
|
32
39
|
text: localize('notifications.optIn.cancel'),
|
|
33
40
|
style: 'cancel',
|
|
41
|
+
onPress: () => {
|
|
42
|
+
isAlertShowing = false;
|
|
43
|
+
},
|
|
34
44
|
},
|
|
35
45
|
{
|
|
36
46
|
text: localize('notifications.optIn.openSettings'),
|
|
37
47
|
onPress: () => {
|
|
48
|
+
isAlertShowing = false;
|
|
38
49
|
ComnyxNotifications.linkToSettings();
|
|
39
50
|
},
|
|
40
51
|
},
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '0.12.0';
|