Skip to content

Commit 5b11959

Browse files
Merge pull request #13 from CleverTap/develop
[VC-473] Release Signed Call React Native SDK v0.0.5
2 parents 2c9fb2e + c7a8c70 commit 5b11959

29 files changed

+5443
-647
lines changed

CHANGELOG.md

+70-20
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,97 @@
11
# Change Log
22

3+
### Version 0.0.5 (February 08, 2024 )
4+
5+
---
6+
7+
**What's new**
8+
9+
- **[Android Platform]**
10+
11+
- Supports [Signed Call Android SDK v0.0.5](https://repo1.maven.org/maven2/com/clevertap/android/clevertap-signedcall-sdk/0.0.5) which is compatible with [CleverTap Android SDK v5.2.2](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-522-december-22-2023).
12+
- Introduces new properties `initiatorImage` and `receiverImage` in the `MissedCallActionClickResult` instance provided through the `SignedCall.addListener(SignedCall.SignedCallOnMissedCallActionClicked,(result:MissedCallActionClickResult) => {})` listener.
13+
- Introduces a new public API: `SignedCallOnCallStatusListener.register(applicationContext)`. This API allows your application to receive VoIP call events through the `SignedCall.SignedCallOnCallStatusChanged` listener even when the app is in a killed state.
14+
15+
For detailed integration instructions, please refer to the documentation.
16+
17+
- **[iOS Platform]**
18+
- Supports [Signed Call iOS SDK v0.0.6](https://github.com/CleverTap/clevertap-signedcall-ios-sdk/blob/main/CHANGELOG.md#version-006-january-19-2024) which is compatible with [CleverTap iOS SDK v5.2.2](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-522-november-21-2023).
19+
20+
**Breaking Changes**
21+
22+
- **[Android and iOS Platform]**
23+
- The `SignedCall.SignedCallOnCallStatusChanged` listener will now provide an instance of the `CallEventResult` class instead of the `CallEvent` class. Please refer to the integration documentation for details on usage.
24+
- **[iOS Platform]**
25+
- iOS deployment target version is bumped to iOS 12.
26+
27+
**Behaviour Changes**
28+
29+
- **[Android Platform]**
30+
31+
- Handles UX issues during network loss or switch by invalidating the socket reconnection and establishing an active connection to process the call related actions.
32+
- Modifies the SDK's behavior when the **Notifications Settings** are disabled for the application. Previously, if the app's notifications were disabled, the device rang on incoming calls without displaying the call screen in the background and killed states. In this version, the SDK now declines incoming calls when the notifications are disabled. If the notification settings are later enabled, the SDK resumes processing calls instead of automatically declining them.
33+
34+
- **[Android and iOS Platform]**
35+
- The `SignedCall.addListener(SignedCall.SignedCallOnCallStatusChanged,(result:CallEventResult) => {})` listener will now provide updates in the call state to both the initiator and receiver of the call. Previously, it was exposed only to the initiator of the call.
36+
37+
**Bug Fixes**
38+
39+
- **[Android Platform]**
40+
41+
- Fixes multiple outgoing call requests initiated simultaneously through multiple calls of `SignedCall.call(receiverCuid, callContext, callProperties)`. The SDK now processes only one call at a time while rejecting other requests with a failure exception.
42+
- Addresses an **IllegalStateException** which occurs while prompting the user with the poor/bad network conditions on the call-screen.
43+
44+
- **[Android and iOS Platform]**
45+
- Addresses an infinite **Connecting** state issue on the call screen which was triggered by using CUIDs longer than 15 characters. In this version, the SDK extends support to CUIDs ranging from 5 to 50 characters.
46+
347
### Version 0.0.4 (September 12, 2023)
4-
-------------------------------------------
48+
49+
---
550

651
**What's new**
752

8-
* **[Android Platform]**
9-
* Supports [Signed Call Android SDK v0.0.4](https://repo1.maven.org/maven2/com/clevertap/android/clevertap-signedcall-sdk/0.0.4) which is compatible with [CleverTap Android SDK v5.2.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-520-august-10-2023).
53+
- **[Android Platform]**
1054

11-
* **[iOS Platform]**
12-
* Supports [Signed Call iOS SDK v0.0.5](https://github.com/CleverTap/clevertap-signedcall-ios-sdk/blob/main/CHANGELOG.md#version-005-aug-23-2023) which is compatible with [CleverTap iOS SDK v5.2.0](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-520-august-16-2023).
55+
- Supports [Signed Call Android SDK v0.0.4](https://repo1.maven.org/maven2/com/clevertap/android/clevertap-signedcall-sdk/0.0.4) which is compatible with [CleverTap Android SDK v5.2.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-520-august-10-2023).
1356

14-
* **[Android and iOS Platform]**
15-
* Adds support for hiding the **Powered by Signed Call** label from VoIP call screens. For more information, refer to [Override Dashboard Branding for Call Screen](https://developer.clevertap.com/docs/signed-call-react-native-sdk#overridedefaultbranding-all-platforms).
57+
- **[iOS Platform]**
58+
59+
- Supports [Signed Call iOS SDK v0.0.5](https://github.com/CleverTap/clevertap-signedcall-ios-sdk/blob/main/CHANGELOG.md#version-005-aug-23-2023) which is compatible with [CleverTap iOS SDK v5.2.0](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-520-august-16-2023).
60+
61+
- **[Android and iOS Platform]**
62+
- Adds support for hiding the **Powered by Signed Call** label from VoIP call screens. For more information, refer to [Override Dashboard Branding for Call Screen](https://developer.clevertap.com/docs/signed-call-react-native-sdk#overridedefaultbranding-all-platforms).
1663

1764
**Changes**
1865

19-
* **[Android Platform]**
20-
* The **index.html** file used inside the SDK has been renamed to a unique name to prevent conflicts with the same file name that may exist in the application.
21-
* Captures a missed call system event when a call initiator manually cancels the call, reported under the `SCEnd` system event.
22-
* Adjust the Microphone permission prompt limit to align with the [permissible threshold](https://developer.android.com/about/versions/11/privacy/permissions#dialog-visibility) which is shown when the receiver attends the call. Previously, if the Microphone permission was denied even once, SDK would continue to block all incoming calls at the receiver's end. (***Note***: Starting from Android 11, users have the option to deny the prompt twice before the permission is blocked by system, whereas in earlier versions, users could deny the prompt until selecting the "don't ask again" checkbox.)
66+
- **[Android Platform]**
67+
68+
- The **index.html** file used inside the SDK has been renamed to a unique name to prevent conflicts with the same file name that may exist in the application.
69+
- Captures a missed call system event when a call initiator manually cancels the call, reported under the `SCEnd` system event.
70+
- Adjust the Microphone permission prompt limit to align with the [permissible threshold](https://developer.android.com/about/versions/11/privacy/permissions#dialog-visibility) which is shown when the receiver attends the call. Previously, if the Microphone permission was denied even once, SDK would continue to block all incoming calls at the receiver's end. (**_Note_**: Starting from Android 11, users have the option to deny the prompt twice before the permission is blocked by system, whereas in earlier versions, users could deny the prompt until selecting the "don't ask again" checkbox.)
2371

24-
* **[Android and iOS Platform]**
25-
* Captures a missed call system event when a call initiator manually cancels the call, reported under the `SCEnd` system event.
72+
- **[Android and iOS Platform]**
73+
- Captures a missed call system event when a call initiator manually cancels the call, reported under the `SCEnd` system event.
2674

2775
**Fixes**
2876

29-
* **[Android Platform]**
30-
* Improved Bluetooth handling for a better user experience:
31-
* Voice now goes through Bluetooth when Bluetooth connectivity is established during an ongoing call.
32-
* Voice now goes through the internal speaker when Bluetooth connectivity is disabled from the call screen button.
33-
* Resolved duplicate reporting of `SCIncoming` system events caused by receiving duplicate pushes for the same call, one from the socket and one from FCM.
77+
- **[Android Platform]**
78+
- Improved Bluetooth handling for a better user experience:
79+
- Voice now goes through Bluetooth when Bluetooth connectivity is established during an ongoing call.
80+
- Voice now goes through the internal speaker when Bluetooth connectivity is disabled from the call screen button.
81+
- Resolved duplicate reporting of `SCIncoming` system events caused by receiving duplicate pushes for the same call, one from the socket and one from FCM.
3482

3583
## Version 0.0.2 (April 17, 2023)
36-
-------------------------------------------
84+
85+
---
3786

3887
- Supports [Signed Call Android SDK v0.0.2](https://repo1.maven.org/maven2/com/clevertap/android/clevertap-signedcall-sdk/0.0.2) and [CleverTap Android SDK v4.7.5](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev4.7.5_rmv1.0.3).
3988
- Supports [Signed Call iOS SDK v0.0.2](https://github.com/CleverTap/clevertap-signedcall-ios-sdk/releases/tag/0.0.2) and [CleverTap iOS SDK v4.2.2](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/4.2.2)
4089
- Supports Push Primer for [Android 13 notification runtime permission](https://developer.android.com/develop/ui/views/notifications/notification-permission).
4190
- Adds new public API `disconnectSignallingSocket()` in order to close the Signalling socket connection.
4291

4392
## Version 0.0.1 (March 28, 2023)
44-
-------------------------------------------
93+
94+
---
4595

4696
- Initial Release.
4797
- Supports Signed Call Android SDK v0.0.1 and Signed Call iOS SDK v0.0.2.

android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ dependencies {
7373
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
7474
//Required dependencies for Signed Call Android SDK
7575
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
76-
compileOnly "com.clevertap.android:clevertap-android-sdk:5.2.0"
77-
compileOnly "com.clevertap.android:clevertap-signedcall-sdk:0.0.4"
76+
compileOnly "com.clevertap.android:clevertap-android-sdk:5.2.2"
77+
compileOnly "com.clevertap.android:clevertap-signedcall-sdk:0.0.5"
7878
compileOnly 'androidx.work:work-runtime:2.7.1'
7979
compileOnly('io.socket:socket.io-client:2.1.0') {
8080
exclude group: 'org.json', module: 'json'

android/src/main/java/com/clevertap/rnsignedcallandroid/CleverTapSignedCallModule.kt

+60-74
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ package com.clevertap.rnsignedcallandroid
22

33
import android.annotation.SuppressLint
44
import com.clevertap.android.sdk.CleverTapAPI
5-
import com.clevertap.android.signedcall.enums.VoIPCallStatus
65
import com.clevertap.android.signedcall.exception.CallException
76
import com.clevertap.android.signedcall.exception.InitException
87
import com.clevertap.android.signedcall.init.SignedCallAPI
98
import com.clevertap.android.signedcall.init.SignedCallInitConfiguration
109
import com.clevertap.android.signedcall.interfaces.OutgoingCallResponse
1110
import com.clevertap.android.signedcall.interfaces.SignedCallInitResponse
11+
import com.clevertap.android.signedcall.utils.SignedCallUtils
1212
import com.clevertap.rnsignedcallandroid.internal.Events.ON_CALL_STATUS_CHANGED
1313
import com.clevertap.rnsignedcallandroid.internal.Events.ON_MISSED_CALL_ACTION_CLICKED
1414
import com.clevertap.rnsignedcallandroid.internal.events.EventEmitter
15+
import com.clevertap.rnsignedcallandroid.internal.util.InitConfigSerializer.getInitConfigFromReadableMap
1516
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.signedCallResponseToWritableMap
1617
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.toSignedCallLogLevel
17-
import com.clevertap.rnsignedcallandroid.internal.util.InitConfigSerializer.getInitConfigFromReadableMap
18+
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.toWriteableMap
1819
import com.clevertap.rnsignedcallandroid.internal.util.Utils.log
1920
import com.clevertap.rnsignedcallandroid.internal.util.toJson
2021
import com.facebook.react.bridge.*
2122

2223
class CleverTapSignedCallModule(private val reactContext: ReactApplicationContext) :
23-
ReactContextBaseJavaModule(reactContext) {
24+
ReactContextBaseJavaModule(reactContext) {
2425
private var mSignedCall: SignedCallAPI? = null
2526
private var cleverTapAPI: CleverTapAPI? = null
26-
private var eventEmitter: EventEmitter? = null
2727

2828
init {
29-
eventEmitter = EventEmitter(reactContext)
3029
cleverTapAPI = CleverTapAPI.getDefaultInstance(reactContext)
30+
registerListeners(reactContext)
3131
}
3232

3333
companion object {
@@ -36,8 +36,8 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
3636
}
3737

3838
/**
39-
* Exports the Name of the Android module.
40-
* TypeScript/Javascript part of the package used this name to communicate with this NativeModule class.
39+
* Exports the Name of the Android module. TypeScript/Javascript part of the package used this
40+
* name to communicate with this NativeModule class.
4141
*/
4242
override fun getName(): String {
4343
return NAME
@@ -53,13 +53,12 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
5353
// Keep: Required for RN built in Event Emitter Calls.
5454
}
5555

56-
/**
57-
* Exports constants for Typescript or Javascript part of this package.
58-
*/
59-
override fun getConstants(): MutableMap<String, String> = hashMapOf(
60-
ON_CALL_STATUS_CHANGED to ON_CALL_STATUS_CHANGED,
61-
ON_MISSED_CALL_ACTION_CLICKED to ON_MISSED_CALL_ACTION_CLICKED
62-
)
56+
/** Exports constants for Typescript or Javascript part of this package. */
57+
override fun getConstants(): MutableMap<String, String> =
58+
hashMapOf(
59+
ON_CALL_STATUS_CHANGED to ON_CALL_STATUS_CHANGED,
60+
ON_MISSED_CALL_ACTION_CLICKED to ON_MISSED_CALL_ACTION_CLICKED
61+
)
6362

6463
private fun getSignedCallAPI(): SignedCallAPI {
6564
if (mSignedCall == null) {
@@ -68,14 +67,23 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
6867
return mSignedCall!!
6968
}
7069

70+
@SuppressLint("RestrictedApi")
71+
private fun registerListeners(context: ReactContext) {
72+
if (!SignedCallUtils.isAppInBackground()) {
73+
SignedCallAPI.getInstance().registerVoIPCallStatusListener { data ->
74+
log(message = "SignedCallOnCallStatusListener is invoked in foreground or background: $data")
75+
EventEmitter.emit(context, ON_CALL_STATUS_CHANGED, data.toWriteableMap())
76+
}
77+
}
78+
}
79+
7180
@SuppressLint("RestrictedApi")
7281
@ReactMethod
7382
fun trackSdkVersion(sdkName: String, sdkVersion: Int) {
74-
cleverTapAPI?.let {
75-
cleverTapAPI!!.setCustomSdkVersion(sdkName, sdkVersion)
76-
} ?: run {
77-
log(message = "$ERROR_CLEVERTAP_INSTANCE_NOT_INITIALIZED to track the SDK Version");
78-
}
83+
cleverTapAPI?.let { cleverTapAPI!!.setCustomSdkVersion(sdkName, sdkVersion) }
84+
?: run {
85+
log(message = "$ERROR_CLEVERTAP_INSTANCE_NOT_INITIALIZED to track the SDK Version")
86+
}
7987
}
8088

8189
@ReactMethod
@@ -92,18 +100,20 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
92100
initProperties?.let {
93101
try {
94102
val initConfiguration: SignedCallInitConfiguration? = getInitConfigFromReadableMap(it)
95-
signedCallAPI.init(reactContext,
96-
initConfiguration,
97-
cleverTapAPI,
98-
object : SignedCallInitResponse {
99-
override fun onSuccess() {
100-
promise.resolve(signedCallResponseToWritableMap(exception = null))
101-
}
102-
103-
override fun onFailure(initException: InitException) {
104-
promise.resolve(signedCallResponseToWritableMap(initException))
103+
signedCallAPI.init(
104+
reactContext,
105+
initConfiguration,
106+
cleverTapAPI,
107+
object : SignedCallInitResponse {
108+
override fun onSuccess() {
109+
promise.resolve(signedCallResponseToWritableMap(exception = null))
110+
}
111+
112+
override fun onFailure(initException: InitException) {
113+
promise.resolve(signedCallResponseToWritableMap(initException))
114+
}
105115
}
106-
})
116+
)
107117
} catch (throwable: Throwable) {
108118
val errorMessage = "Exception while initializing the Signed Call native module"
109119
log(message = errorMessage + ": " + throwable.localizedMessage)
@@ -112,78 +122,54 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
112122
}
113123
}
114124

115-
/**
116-
* Sends the call-details to initiate a VoIP call
117-
*/
125+
/** Sends the call-details to initiate a VoIP call */
118126
@ReactMethod
119127
fun call(
120-
receiverCuid: String, callContext: String, callProperties: ReadableMap?, promise: Promise
128+
receiverCuid: String,
129+
callContext: String,
130+
callProperties: ReadableMap?,
131+
promise: Promise
121132
) {
122133
val signedCallAPI: SignedCallAPI = getSignedCallAPI()
123134
try {
124135
val callOptions = callProperties?.toJson()
125136
signedCallAPI.call(
126-
reactContext,
127-
receiverCuid,
128-
callContext,
129-
callOptions,
130-
object : OutgoingCallResponse {
131-
override fun callStatus(callStatus: VoIPCallStatus) {
132-
emitCallEvent(callStatus)
133-
}
134-
135-
override fun onSuccess() {
136-
promise.resolve(signedCallResponseToWritableMap(exception = null))
137-
}
137+
reactContext,
138+
receiverCuid,
139+
callContext,
140+
callOptions,
141+
object : OutgoingCallResponse {
142+
override fun onSuccess() {
143+
promise.resolve(signedCallResponseToWritableMap(exception = null))
144+
}
138145

139-
override fun onFailure(callException: CallException?) {
140-
promise.resolve(signedCallResponseToWritableMap(callException))
146+
override fun onFailure(callException: CallException?) {
147+
promise.resolve(signedCallResponseToWritableMap(callException))
148+
}
141149
}
142-
})
150+
)
143151
} catch (throwable: Throwable) {
144152
val errorMessage = "Exception while initiating the VoIP Call"
145153
log(message = errorMessage + ": " + throwable.localizedMessage)
146154
promise.reject(errorMessage, throwable)
147155
}
148156
}
149157

150-
/**
151-
* Logs out the Signed Call SDK session
152-
*/
158+
/** Logs out the Signed Call SDK session */
153159
@ReactMethod
154160
fun logout() {
155161
getSignedCallAPI().logout(reactContext)
156162
}
157163

158-
/**
159-
* Ends the active call, if any.
160-
*/
164+
/** Ends the active call, if any. */
161165
@ReactMethod
162166
fun hangupCall() {
163167
getSignedCallAPI().callController?.endCall()
164168
}
165169

166-
/**
167-
* Disconnects the signalling socket
168-
*/
170+
/** Disconnects the signalling socket */
169171
@ReactMethod
170172
fun disconnectSignallingSocket() {
171173
getSignedCallAPI().disconnectSignallingSocket(reactContext)
172174
}
173-
174-
/**
175-
* Sends the real-time changes in the call-state to an observable event-stream
176-
*/
177-
private fun emitCallEvent(callStatus: VoIPCallStatus) {
178-
val callEventName = when (callStatus) {
179-
VoIPCallStatus.CALL_CANCELLED -> "Cancelled"
180-
VoIPCallStatus.CALL_DECLINED -> "Declined"
181-
VoIPCallStatus.CALL_MISSED -> "Missed"
182-
VoIPCallStatus.CALL_ANSWERED -> "Answered"
183-
VoIPCallStatus.CALL_IN_PROGRESS -> "CallInProgress"
184-
VoIPCallStatus.CALL_OVER -> "Ended"
185-
VoIPCallStatus.CALLEE_BUSY_ON_ANOTHER_CALL -> "ReceiverBusyOnAnotherCall"
186-
}
187-
eventEmitter?.emit(ON_CALL_STATUS_CHANGED, callEventName)
188-
}
189175
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.clevertap.rnsignedcallandroid
2+
3+
import android.content.Context
4+
import com.clevertap.android.signedcall.init.SignedCallAPI
5+
import com.clevertap.rnsignedcallandroid.internal.Events
6+
import com.clevertap.rnsignedcallandroid.internal.events.EventEmitter
7+
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.toWriteableMap
8+
import com.clevertap.rnsignedcallandroid.internal.util.Utils.log
9+
10+
open class SignedCallOnCallStatusListener {
11+
12+
companion object {
13+
14+
@JvmStatic
15+
fun register(context: Context) {
16+
log(message = "SignedCallOnCallStatusListener is registered!")
17+
18+
SignedCallAPI.getInstance().registerVoIPCallStatusListener { data ->
19+
log(message = "SignedCallOnCallStatusListener is invoked in killed state: $data")
20+
EventEmitter.emit(context, Events.ON_CALL_STATUS_CHANGED, data.toWriteableMap())
21+
}
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)