Skip to content

Commit 968488e

Browse files
Merge pull request #53 from CleverTap/develop
Release v0.8.0
2 parents 94b9369 + 05439e1 commit 968488e

File tree

78 files changed

+9493
-5742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+9493
-5742
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ android/keystores/debug.keystore
6969
.turbo/
7070

7171
# generated by bob
72-
lib/
72+
lib/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.18.1
1+
18.20.5

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Change Log
22

3+
### Version 0.8.0 (March 07, 2025)
4+
5+
---
6+
**What's new**
7+
* **[Android Platform]**
8+
* Supports Signed Call Android SDK [v0.0.7.7](https://repo1.maven.org/maven2/com/clevertap/android/clevertap-signedcall-sdk/0.0.7.7/) which is compatible with CleverTap Android SDK [v7.0.2](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-702-october-10-2024).
9+
* Adds new public API `SignedCall.isInitialized()` to retrieve the initialization status.
10+
* Adds new public API `SignedCall.dismissMissedCallNotification()` to dismiss the missed call notification.
11+
12+
* **[iOS Platform]**
13+
* Supports [Signed Call iOS SDK v0.0.9](https://github.com/CleverTap/clevertap-signedcall-ios-sdk/blob/main/CHANGELOG.md#version-009-november-19-2024) which is compatible with [CleverTap iOS SDK v7.0.2](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-702-october-10-2024) and higher.
14+
15+
* **[Android and iOS Platform]**
16+
* Migrates the bridge to a backwards-compatible New Architecture Turbo Module.
17+
* The CleverTap SignedCall ReactNative SDK continues to be compatible with both the Old and the New Architecture.
18+
19+
**Bug Fixes**
20+
* **[Android Platform]**
21+
* Addresses the [Notification trampoline restrictions](https://developer.android.com/about/versions/12/behavior-changes-12#notification-trampolines), introduced in Android 12 and above, which blocks the activity launches from the `SignedCall.SignedCallOnMissedCallActionClicked` callback triggered upon clicking the missed call CTA.
22+
* Fixes an issue where the call notification would disappear upon pressing the back button on certain devices.
23+
24+
**Enhancements**
25+
* **[Android Platform]**
26+
* Addresses limitations related to microphone access during ongoing calls when user moves the app to the background.The Google Play Console will prompt you to declare the usage of this permission, for which you need to provide a demo video link. Please refer to the SDK documentation for guidance on how to address this.
27+
* Enforces the network quality checks during call initiation and reception, and capturing the network latency.
28+
329
### Version 0.7.6 (June 06, 2025)
430

531
---

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# CleverTap Signed Call React Native SDK
22

3-
[![npm version](https://badge.fury.io/js/clevertap-signed-call-react-native.svg)](https://badge.fury.io/js/clevertap-signed-call-react-native)
3+
[![npm version](https://badge.fury.io/js/@clevertap%2Fclevertap-signed-call-react-native.svg)](https://badge.fury.io/js/@clevertap%2Fclevertap-signed-call-react-native)
44
<a href="https://github.com/CleverTap/clevertap-signed-call-react-native-sdk/releases">
55
<img src="https://img.shields.io/github/release/CleverTap/clevertap-signed-call-react-native-sdk.svg" />
66
</a>
7-
[![npm downloads](https://img.shields.io/npm/dm/clevertap-signed-call-react-native-sdk.svg)](https://www.npmjs.com/package/clevertap-signed-call-react-native-sdk)
7+
[![npm downloads](https://img.shields.io/npm/dm/@clevertap%2Fclevertap-signed-call-react-native.svg)](https://www.npmjs.com/package/@clevertap/clevertap-signed-call-react-native)
88

99
## 👋 Introduction
1010

@@ -44,4 +44,4 @@ Refer to the [Signed Call React Native SDK Change Log](./CHANGELOG.md).
4444

4545
## ❓Questions
4646

47-
If you have questions or concerns, you can reach out to the CleverTap support team from the CleverTap Dashboard.
47+
If you have questions or concerns, you can reach out to the CleverTap support team from the CleverTap Dashboard.

android/build.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ android {
5656
targetCompatibility JavaVersion.VERSION_1_8
5757
}
5858

59+
sourceSets {
60+
main {
61+
if (isNewArchitectureEnabled()) {
62+
java.srcDirs += [
63+
"src/newarch",
64+
]
65+
} else {
66+
java.srcDirs += ["src/oldarch"]
67+
}
68+
}
69+
}
5970
}
6071

6172
repositories {
@@ -73,8 +84,8 @@ dependencies {
7384
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
7485
//Required dependencies for Signed Call Android SDK
7586
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
76-
compileOnly "com.clevertap.android:clevertap-android-sdk:6.2.1"
77-
compileOnly "com.clevertap.android:clevertap-signedcall-sdk:0.0.7.6"
87+
compileOnly "com.clevertap.android:clevertap-android-sdk:7.0.2"
88+
compileOnly "com.clevertap.android:clevertap-signedcall-sdk:0.0.7.7"
7889
compileOnly 'androidx.work:work-runtime:2.7.1'
7990
compileOnly('io.socket:socket.io-client:2.1.0') {
8091
exclude group: 'org.json', module: 'json'

android/src/main/java/com/clevertap/rnsignedcallandroid/CleverTapSignedCallModule.kt renamed to android/src/main/java/com/clevertap/rnsignedcallandroid/CleverTapSignedCallModuleImpl.kt

Lines changed: 99 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,38 @@ import com.clevertap.rnsignedcallandroid.internal.util.toJson
2222
import com.facebook.react.bridge.Promise
2323
import com.facebook.react.bridge.ReactApplicationContext
2424
import com.facebook.react.bridge.ReactContext
25-
import com.facebook.react.bridge.ReactContextBaseJavaModule
26-
import com.facebook.react.bridge.ReactMethod
2725
import com.facebook.react.bridge.ReadableMap
2826

29-
class CleverTapSignedCallModule(private val reactContext: ReactApplicationContext) :
30-
ReactContextBaseJavaModule(reactContext) {
27+
28+
class CleverTapSignedCallModuleImpl(private val reactContext: ReactApplicationContext) {
29+
3130
private var mSignedCall: SignedCallAPI? = null
3231
private var cleverTapAPI: CleverTapAPI? = null
3332
private lateinit var outgoingCallResponse: OutgoingCallResponse
3433

35-
init {
36-
cleverTapAPI = CleverTapAPI.getDefaultInstance(reactContext)
37-
registerListeners(reactContext)
38-
}
39-
4034
companion object {
35+
/**
36+
* Exports the Name of the Android module. TypeScript/Javascript part of the package used this
37+
* name to communicate with this NativeModule class.
38+
*/
4139
const val NAME = "CleverTapSignedCall"
4240
const val ERROR_CLEVERTAP_INSTANCE_NOT_INITIALIZED = "CleverTap Instance is not initialized"
4341
}
4442

45-
/**
46-
* Exports the Name of the Android module. TypeScript/Javascript part of the package used this
47-
* name to communicate with this NativeModule class.
48-
*/
49-
override fun getName(): String {
50-
return NAME
43+
init {
44+
cleverTapAPI = CleverTapAPI.getDefaultInstance(reactContext)
45+
registerListeners(reactContext)
5146
}
5247

53-
@ReactMethod
48+
5449
fun addListener(eventName: String?) {
5550
// Keep: Required for RN built in Event Emitter Calls.
5651
}
5752

58-
@ReactMethod
5953
fun removeListeners(count: Int?) {
6054
// Keep: Required for RN built in Event Emitter Calls.
6155
}
6256

63-
/** Exports constants for Typescript or Javascript part of this package. */
64-
override fun getConstants(): MutableMap<String, String> =
65-
hashMapOf(
66-
ON_CALL_STATUS_CHANGED to ON_CALL_STATUS_CHANGED,
67-
ON_MISSED_CALL_ACTION_CLICKED to ON_MISSED_CALL_ACTION_CLICKED
68-
)
69-
7057
private fun getSignedCallAPI(): SignedCallAPI {
7158
if (mSignedCall == null) {
7259
mSignedCall = SignedCallAPI.getInstance()
@@ -75,7 +62,7 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
7562
}
7663

7764
@SuppressLint("RestrictedApi")
78-
private fun registerListeners(context: ReactContext) {
65+
fun registerListeners(context: ReactContext) {
7966
if (!SignedCallUtils.isAppInBackground()) {
8067
SignedCallAPI.getInstance().registerVoIPCallStatusListener { data ->
8168
log(message = "SignedCallOnCallStatusListener is invoked in foreground or background: $data")
@@ -90,41 +77,43 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
9077
}
9178

9279
@SuppressLint("RestrictedApi")
93-
@ReactMethod
94-
fun trackSdkVersion(sdkName: String, sdkVersion: Int) {
95-
cleverTapAPI?.let { cleverTapAPI!!.setCustomSdkVersion(sdkName, sdkVersion) }
96-
?: run {
97-
log(message = "$ERROR_CLEVERTAP_INSTANCE_NOT_INITIALIZED to track the SDK Version")
98-
}
80+
fun trackSdkVersion(sdkName: String, sdkVersion: Int, promise: Promise) {
81+
cleverTapAPI?.let {
82+
cleverTapAPI!!.setCustomSdkVersion(sdkName, sdkVersion)
83+
promise.resolve(null)
84+
}
85+
?: run {
86+
log(message = "$ERROR_CLEVERTAP_INSTANCE_NOT_INITIALIZED to track the SDK Version")
87+
promise.reject("$ERROR_CLEVERTAP_INSTANCE_NOT_INITIALIZED to track the SDK Version")
88+
}
9989
}
10090

101-
@ReactMethod
10291
fun setDebugLevel(logLevel: Int) {
10392
SignedCallAPI.setDebugLevel(logLevel.toSignedCallLogLevel())
10493
}
10594

10695
/**
10796
* Retrieves the init-properties from the readableMap and initializes the Signed Call Android SDK
10897
*/
109-
@ReactMethod
11098
fun initialize(initProperties: ReadableMap?, promise: Promise) {
11199
val signedCallAPI: SignedCallAPI = getSignedCallAPI()
112100
initProperties?.let {
113101
try {
114-
val initConfiguration: SignedCallInitConfiguration? = getInitConfigFromReadableMap(it, reactContext.applicationContext)
102+
val initConfiguration: SignedCallInitConfiguration? =
103+
getInitConfigFromReadableMap(it, reactContext.applicationContext)
115104
signedCallAPI.init(
116-
reactContext.applicationContext,
117-
initConfiguration,
118-
cleverTapAPI,
119-
object : SignedCallInitResponse {
120-
override fun onSuccess() {
121-
promise.resolve(signedCallResponseToWritableMap(exception = null))
122-
}
123-
124-
override fun onFailure(initException: InitException) {
125-
promise.resolve(signedCallResponseToWritableMap(initException))
126-
}
105+
reactContext.applicationContext,
106+
initConfiguration,
107+
cleverTapAPI,
108+
object : SignedCallInitResponse {
109+
override fun onSuccess() {
110+
promise.resolve(signedCallResponseToWritableMap(exception = null))
127111
}
112+
113+
override fun onFailure(initException: InitException) {
114+
promise.resolve(signedCallResponseToWritableMap(initException))
115+
}
116+
}
128117
)
129118
} catch (throwable: Throwable) {
130119
val errorMessage = "Exception while initializing the Signed Call native module"
@@ -135,18 +124,17 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
135124
}
136125

137126
/** Sends the call-details to initiate a VoIP call */
138-
@ReactMethod
139127
fun call(
140-
receiverCuid: String,
141-
callContext: String,
142-
callProperties: ReadableMap?,
143-
promise: Promise
128+
receiverCuid: String,
129+
callContext: String,
130+
callProperties: ReadableMap?,
131+
promise: Promise
144132
) {
145133
val signedCallAPI: SignedCallAPI = getSignedCallAPI()
146134
try {
147135
val callOptions = callProperties?.toJson()
148136

149-
outgoingCallResponse = object: OutgoingCallResponse {
137+
outgoingCallResponse = object : OutgoingCallResponse {
150138
override fun onSuccess() {
151139
promise.resolve(signedCallResponseToWritableMap(exception = null))
152140
}
@@ -157,11 +145,11 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
157145
}
158146

159147
signedCallAPI.call(
160-
reactContext,
161-
receiverCuid,
162-
callContext,
163-
callOptions,
164-
outgoingCallResponse
148+
reactContext,
149+
receiverCuid,
150+
callContext,
151+
callOptions,
152+
outgoingCallResponse
165153
)
166154
} catch (throwable: Throwable) {
167155
val errorMessage = "Exception while initiating the VoIP Call"
@@ -176,35 +164,77 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
176164
* This method checks if there is an active call and if the client is on VoIP call.
177165
* If both conditions are met, it starts the call screen activity.
178166
*/
179-
@ReactMethod
180167
fun getBackToCall(promise: Promise) {
181-
promise.resolve(getSignedCallAPI().callController?.getBackToCall(reactContext))
168+
promiseHandler(getSignedCallAPI().callController?.getBackToCall(reactContext), promise)
182169
}
183170

184171
/**
185172
* Retrieves the current call state.
186173
* @return The current call state.
187174
*/
188-
@ReactMethod
189175
fun getCallState(promise: Promise) {
190-
promise.resolve(getSignedCallAPI().callController?.callState?.formattedCallState())
176+
promiseHandler(getSignedCallAPI().callController?.callState?.formattedCallState(), promise)
191177
}
192178

193179
/** Logs out the Signed Call SDK session */
194-
@ReactMethod
195-
fun logout() {
196-
getSignedCallAPI().logout(reactContext)
180+
fun logout(promise: Promise) {
181+
getSignedCallAPI().logout(reactContext.applicationContext)
182+
promiseHandler(true, promise)
197183
}
198184

199185
/** Ends the active call, if any. */
200-
@ReactMethod
201-
fun hangupCall() {
202-
getSignedCallAPI().callController?.endCall()
186+
fun hangupCall(promise: Promise) {
187+
promiseHandler(getSignedCallAPI().callController?.endCall(), promise)
203188
}
204189

205190
/** Disconnects the signalling socket */
206-
@ReactMethod
207-
fun disconnectSignallingSocket() {
208-
getSignedCallAPI().disconnectSignallingSocket(reactContext)
191+
fun disconnectSignallingSocket(promise: Promise) {
192+
promiseHandler(
193+
getSignedCallAPI().disconnectSignallingSocket(reactContext.applicationContext),
194+
promise
195+
)
209196
}
197+
198+
/** Exports constants for Typescript or Javascript part of this package. */
199+
fun getConstants(): MutableMap<String, String> {
200+
return mutableMapOf(
201+
ON_CALL_STATUS_CHANGED to ON_CALL_STATUS_CHANGED,
202+
ON_MISSED_CALL_ACTION_CLICKED to ON_MISSED_CALL_ACTION_CLICKED
203+
)
204+
}
205+
206+
/**
207+
* Checks if the Signed Call SDK is initialized.
208+
*
209+
*/
210+
fun isInitialized(promise: Promise) {
211+
promiseHandler(getSignedCallAPI().isInitialized(reactContext.applicationContext), promise)
212+
}
213+
214+
/**
215+
* Dismisses the missed call notification.
216+
*
217+
* This method is intended to be called after a VoIP call use case is completed
218+
*
219+
*/
220+
fun dismissMissedCallNotification(promise: Promise) {
221+
promiseHandler(
222+
getSignedCallAPI().dismissMissedCallNotification(reactContext.applicationContext),
223+
promise
224+
)
225+
}
226+
227+
228+
private fun promiseHandler(promiseFunction: Any?, promise: Promise) {
229+
try {
230+
when (promiseFunction) {
231+
is Unit -> promise.resolve(null)
232+
else -> promise.resolve(promiseFunction)
233+
}
234+
235+
} catch (e: Throwable) {
236+
promise.reject(e)
237+
}
238+
}
239+
210240
}

0 commit comments

Comments
 (0)