Skip to content

Commit cb223b9

Browse files
Merge pull request #16 from CleverTap/develop
Develop[VC-473] Release Signed Call React Native SDK v0.0.5.5
2 parents 5b11959 + c8d606f commit cb223b9

28 files changed

+644
-72
lines changed

CHANGELOG.md

+45-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
11
# Change Log
22

3-
### Version 0.0.5 (February 08, 2024 )
3+
### Version 0.0.6 (June 21, 2024)
4+
5+
---
6+
7+
**What's new**
8+
9+
- **[Android Platform]**
10+
11+
- Supports [Signed Call Android SDK v0.0.5.5](https://repo1.maven.org/maven2/com/clevertap/android/clevertap-signedcall-sdk/0.0.5.5) which is compatible with [CleverTap Android SDK v6.2.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-620-april-3-2024).
12+
- Enables back button functionality across call screens (incoming, outgoing, and ongoing) to allow users to navigate to other parts of the application while staying on a call.
13+
- Adds new public API `SignedCall.getBackToCall()` to navigate the user to the active call.
14+
- Adds new public API `SignedCall.getCallState()` to retrieve the current call state.
15+
- Supports following new properties to the `initProperties` object which gets passed to the `SignedCall.initialize(initProperties)` method:
16+
- The `notificationPermissionRequired` of `boolean` type to make notification permission as optional during the Signed Call initialization on Android 13 and onwards.
17+
- The `swipeOffBehaviourInForegroundService` property of custom `SCSwipeOffBehaviour` enum type to define the swipe off behavior for an active call within the foreground service managed by host application.
18+
Please ensure to check the SDK documentation for detailed information on usage of initProperties listed above.
19+
- Introduces the following events to the `SignedCall.SignedCallOnCallStatusChanged` listener:
20+
- The `CancelledDueToRingTimeout` event which allows to handle the SDK-initiated cancellations due to ring-timeout. This event is reported when the SDK fails to establish communication with the receiver, often due to an offline device or a device with low bandwidth.
21+
- The `DeclinedDueToBusyOnVoIP` and `DeclinedDueToBusyOnPSTN`, to differentiate calls declined due to another Signed Call(VoIP) or declined due to a PSTN call respectively.
22+
- Exposes `callId` (call-specific identifier) parameter via `CallDetails` object provided in the result of the `SignedCall.SignedCallOnCallStatusChanged` listener.
23+
24+
- **[iOS Platform]**
25+
26+
- Supports [Signed Call iOS SDK v0.0.7](https://github.com/CleverTap/clevertap-signedcall-ios-sdk/blob/main/CHANGELOG.md#version-007-march-15-2024) which is compatible with [CleverTap iOS SDK v6.1.0](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-610-february-22-2024).
27+
- Supports [Socket.io v16.1.0](https://github.com/socketio/socket.io-client-swift/releases/tag/v16.1.0) and [Starscream v4.0.8](https://github.com/daltoniam/Starscream/releases/tag/4.0.8) dependency.
28+
- Adds privacy manifest.
29+
- Expose socket usage logging for debugging purpose.
30+
31+
**Behaviour Changes**
32+
33+
- **[Android Platform]**
34+
35+
- Adds heads up behaviour to the call-notifications to prompt the user every time the call-screen goes invisible, triggered by either a back button press or putting the app in the background. The heads up notifications allow users to return to the call interface by tapping on the notification.
36+
- Improved Bluetooth audio experience during calls. Dial tone of an outgoing call will now play through the connected Bluetooth headset instead of the internal speaker.
37+
Note: The SDK requires the runtime [BLUETOOTH_CONNECT](https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_CONNECT) permission for Android 12 and onwards to enable the Bluetooth management during calls.
38+
39+
**Bug Fixes**
40+
41+
- **[Android Platform]**
42+
43+
- Resolves an intermittent issue where the dialing tone at the initiator's side of the call plays on the loudspeaker instead of the internal speaker.
44+
- Resolves NPE crash occurring when calls are simultaneously initiated to each other, which disrupts the order of signals exchanged between participants.
45+
46+
### Version 0.0.5 (February 08, 2024)
447

548
---
649

@@ -10,9 +53,7 @@
1053

1154
- 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).
1255
- 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.
56+
- 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. For detailed integration instructions, please refer to the documentation.
1657

1758
- **[iOS Platform]**
1859
- 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).

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.2"
77-
compileOnly "com.clevertap.android:clevertap-signedcall-sdk:0.0.5"
76+
compileOnly "com.clevertap.android:clevertap-android-sdk:6.2.0"
77+
compileOnly "com.clevertap.android:clevertap-signedcall-sdk:0.0.5.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

+22-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ 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
1515
import com.clevertap.rnsignedcallandroid.internal.util.InitConfigSerializer.getInitConfigFromReadableMap
16+
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.formattedCallState
1617
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.signedCallResponseToWritableMap
1718
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.toSignedCallLogLevel
1819
import com.clevertap.rnsignedcallandroid.internal.util.PayloadConverter.toWriteableMap
@@ -101,7 +102,7 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
101102
try {
102103
val initConfiguration: SignedCallInitConfiguration? = getInitConfigFromReadableMap(it)
103104
signedCallAPI.init(
104-
reactContext,
105+
reactContext.applicationContext,
105106
initConfiguration,
106107
cleverTapAPI,
107108
object : SignedCallInitResponse {
@@ -155,6 +156,26 @@ class CleverTapSignedCallModule(private val reactContext: ReactApplicationContex
155156
}
156157
}
157158

159+
/**
160+
* Attempts to return to the active call screen.
161+
*
162+
* This method checks if there is an active call and if the client is on VoIP call.
163+
* If both conditions are met, it starts the call screen activity.
164+
*/
165+
@ReactMethod
166+
fun getBackToCall(promise: Promise) {
167+
promise.resolve(getSignedCallAPI().callController?.getBackToCall(reactContext))
168+
}
169+
170+
/**
171+
* Retrieves the current call state.
172+
* @return The current call state.
173+
*/
174+
@ReactMethod
175+
fun getCallState(promise: Promise) {
176+
promise.resolve(getSignedCallAPI().callController?.callState?.formattedCallState())
177+
}
178+
158179
/** Logs out the Signed Call SDK session */
159180
@ReactMethod
160181
fun logout() {

android/src/main/java/com/clevertap/rnsignedcallandroid/internal/util/Constants.kt

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ object Constants {
1212
const val KEY_PROMPT_PUSH_PRIMER = "promptPushPrimer"
1313
const val KEY_PROMPT_RECEIVER_READ_PHONE_STATE_PERMISSION =
1414
"promptReceiverReadPhoneStatePermission"
15+
const val KEY_NOTIFICATION_PERMISSION_REQUIRED =
16+
"notificationPermissionRequired"
17+
const val KEY_SWIPE_OFF_BEHAVIOUR_IN_FOREGROUND_SERVICE =
18+
"swipeOffBehaviourInForegroundService"
1519
const val KEY_OVERRIDE_DEFAULT_BRANDING = "overrideDefaultBranding"
1620
const val KEY_MISSED_CALL_ACTIONS = "missedCallActions"
1721
const val KEY_BG_COLOR = "bgColor"
@@ -31,6 +35,7 @@ object Constants {
3135
const val KEY_ACTION_ID = "actionId"
3236
const val KEY_ACTION_LABEL = "actionLabel"
3337
const val KEY_CALL_DETAILS = "callDetails"
38+
const val KEY_CALL_ID = "callId"
3439
const val KEY_CALLER_CUID = "callerCuid"
3540
const val KEY_CALLEE_CUID = "calleeCuid"
3641
const val KEY_IS_SUCCESSFUL = "isSuccessful"

android/src/main/java/com/clevertap/rnsignedcallandroid/internal/util/InitConfigSerializer.kt

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.clevertap.rnsignedcallandroid.internal.util
22

33
import com.clevertap.android.signedcall.init.SignedCallInitConfiguration
4+
import com.clevertap.android.signedcall.init.SignedCallInitConfiguration.SCSwipeOffBehaviour
45
import com.clevertap.android.signedcall.models.MissedCallAction
56
import com.clevertap.android.signedcall.models.SignedCallScreenBranding
67
import com.clevertap.rnsignedcallandroid.internal.handlers.MissedCallActionClickHandler
@@ -101,6 +102,24 @@ object InitConfigSerializer {
101102
}
102103
}
103104

105+
/**
106+
* Retrieves the swipeOffBehaviour from the given initProperties object and parses to the instance of [SCSwipeOffBehaviour]
107+
*/
108+
@JvmStatic
109+
@Throws(Exception::class)
110+
fun getSwipeOffBehaviourFromReadableConfig(readableMap: ReadableMap): SCSwipeOffBehaviour {
111+
val swipeOffBehaviour: String? = readableMap.getValue(Constants.KEY_SWIPE_OFF_BEHAVIOUR_IN_FOREGROUND_SERVICE)
112+
swipeOffBehaviour?.let {
113+
return if (it == "EndCall") {
114+
SCSwipeOffBehaviour.END_CALL
115+
} else {
116+
SCSwipeOffBehaviour.PERSIST_CALL
117+
}
118+
} ?: run {
119+
return SCSwipeOffBehaviour.END_CALL
120+
}
121+
}
122+
104123
/**
105124
* Retrieves the initConfiguration from the input initProperties object and
106125
* parses into the [SignedCallInitConfiguration] object.
@@ -134,12 +153,19 @@ object InitConfigSerializer {
134153
parsePushPrimerConfigFromInitOptions(pushPrimerReadableConfig)
135154
}
136155

156+
val notificationPermissionRequired: Boolean = getValue(Constants.KEY_NOTIFICATION_PERMISSION_REQUIRED) ?: true
157+
158+
val swipeOffBehaviour: SCSwipeOffBehaviour = getSwipeOffBehaviourFromReadableConfig(readableMap)
159+
137160
initConfiguration =
138161
SignedCallInitConfiguration.Builder(initOptions, allowPersistSocketConnection)
139162
.promptPushPrimer(pushPrimerJson)
140163
.promptReceiverReadPhoneStatePermission(promptReceiverReadPhoneStatePermission)
164+
.setNotificationPermissionRequired(notificationPermissionRequired)
141165
.overrideDefaultBranding(callScreenBranding)
142-
.setMissedCallActions(missedCallActionsList, missedCallActionClickHandlerPath).build()
166+
.setMissedCallActions(missedCallActionsList, missedCallActionClickHandlerPath)
167+
.setSwipeOffBehaviourInForegroundService(swipeOffBehaviour)
168+
.build()
143169
} catch (throwable: Throwable) {
144170
log(message = "issue occurs while de-serializing the initProperties: ${throwable.localizedMessage}")
145171
throwable.printStackTrace()

android/src/main/java/com/clevertap/rnsignedcallandroid/internal/util/PayloadConverter.kt

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.clevertap.rnsignedcallandroid.internal.util
22

3+
import com.clevertap.android.signedcall.enums.SCCallState
34
import com.clevertap.android.signedcall.enums.VoIPCallStatus
45
import com.clevertap.android.signedcall.exception.BaseException
56
import com.clevertap.android.signedcall.init.SignedCallAPI
@@ -81,7 +82,7 @@ internal object PayloadConverter {
8182
*
8283
* @return A formatted call event string.
8384
*/
84-
private fun VoIPCallStatus.formattedCallEvent(): String {
85+
private fun VoIPCallStatus.formattedCallEvent(): String? {
8586
return when (this) {
8687
VoIPCallStatus.CALL_IS_PLACED -> "CallIsPlaced"
8788
VoIPCallStatus.CALL_CANCELLED -> "Cancelled"
@@ -94,6 +95,25 @@ internal object PayloadConverter {
9495
VoIPCallStatus.CALL_DECLINED_DUE_TO_LOGGED_OUT_CUID -> "DeclinedDueToLoggedOutCuid"
9596
VoIPCallStatus.CALL_DECLINED_DUE_TO_NOTIFICATIONS_DISABLED -> "DeclinedDueToNotificationsDisabled"
9697
VoIPCallStatus.CALLEE_MICROPHONE_PERMISSION_NOT_GRANTED -> "DeclinedDueToMicrophonePermissionsNotGranted"
98+
VoIPCallStatus.CALL_DECLINED_DUE_TO_BUSY_ON_VOIP -> "DeclinedDueToBusyOnVoIP"
99+
VoIPCallStatus.CALL_DECLINED_DUE_TO_BUSY_ON_PSTN -> "DeclinedDueToBusyOnPSTN"
100+
VoIPCallStatus.CALL_CANCELLED_DUE_TO_RING_TIMEOUT -> "CancelledDueToRingTimeout"
101+
else -> null
102+
}
103+
}
104+
105+
/**
106+
* Converts [SCCallState] to a formatted string.
107+
*
108+
* @return A formatted call state string.
109+
*/
110+
fun SCCallState.formattedCallState(): String? {
111+
return when (this) {
112+
SCCallState.OUTGOING_CALL -> "OutgoingCall"
113+
SCCallState.INCOMING_CALL -> "IncomingCall"
114+
SCCallState.ONGOING_CALL -> "OngoingCall"
115+
SCCallState.NO_CALL -> "NoCall"
116+
else -> null
97117
}
98118
}
99119

@@ -104,6 +124,7 @@ internal object PayloadConverter {
104124
*/
105125
fun CallDetails.toWriteableMap(): WritableMap {
106126
return Arguments.createMap().apply {
127+
putString(Constants.KEY_CALL_ID, (callId))
107128
putString(Constants.KEY_CALLER_CUID, (callerCuid ?: ""))
108129
putString(Constants.KEY_CALLEE_CUID, (calleeCuid ?: ""))
109130
putString(Constants.KEY_CALL_CONTEXT, (callContext ?: ""))

clevertap-signed-call-react-native.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
1010
s.homepage = package["homepage"]
1111
s.license = package["license"]
1212
s.authors = package["author"]
13-
13+
c
1414
s.platforms = { :ios => "10.0" }
1515
s.source = { :git => "https://github.com/CleverTap/clevertap-signed-call-react-native-sdk.git", :tag => "#{s.version}" }
1616

@@ -22,7 +22,7 @@ Pod::Spec.new do |s|
2222
s.requires_arc = true
2323

2424
s.dependency 'React', '>= 0.13.0', '< 1.0.0'
25-
s.dependency 'CleverTap-SignedCall-SDK', '0.0.6'
25+
s.dependency 'CleverTap-SignedCall-SDK', '0.0.7'
2626

2727
# Don't install the dependencies when we run `pod install` in the old architecture.
2828
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then

example/android/app/build.gradle

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apply plugin: "com.android.application"
22
apply plugin: 'com.google.gms.google-services'
3+
apply plugin: 'com.google.firebase.crashlytics'
34

45
import com.android.build.OutputFile
56

@@ -254,9 +255,10 @@ dependencies {
254255
//noinspection GradleDynamicVersion
255256
implementation "com.facebook.react:react-native:+" // From node_modules
256257

257-
implementation "com.clevertap.android:clevertap-android-sdk:5.2.2"
258-
259-
implementation "com.clevertap.android:clevertap-signedcall-sdk:0.0.5"
258+
implementation "com.clevertap.android:clevertap-android-sdk:6.2.0"
259+
implementation 'com.google.firebase:firebase-crashlytics'
260+
implementation "com.clevertap.android:clevertap-signedcall-sdk:0.0.5.5"
261+
// implementation project (":clevertap-signedcall")
260262
implementation('io.socket:socket.io-client:2.1.0') {
261263
exclude group: 'org.json', module: 'json'
262264
}

example/android/app/src/main/AndroidManifest.xml

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package="com.example.rnsignedcall">
33

44
<uses-permission android:name="android.permission.INTERNET" />
5+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
56

67
<application
78
android:name=".MainApplication"
@@ -15,7 +16,7 @@
1516
android:label="@string/app_name"
1617
android:icon="@mipmap/app_logo"
1718
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18-
android:launchMode="singleTask"
19+
android:launchMode="standard"
1920
android:windowSoftInputMode="adjustResize"
2021
android:exported="true">
2122
<intent-filter>
@@ -36,12 +37,14 @@
3637
<!-- CleverTap Account Credentials -->
3738
<meta-data
3839
android:name="CLEVERTAP_ACCOUNT_ID"
39-
android:value="679-8Z7-W66Z"/>
40+
android:value="CLEVERTAP_ACCOUNT_ID"/>
4041
<meta-data
4142
android:name="CLEVERTAP_TOKEN"
42-
android:value="a1b-ca6"/>
43+
android:value="CLEVERTAP_TOKEN"/>
4344
<meta-data
4445
android:name="CLEVERTAP_REGION"
45-
android:value="sk1"/>
46+
android:value="CLEVERTAP_REGION"/>
47+
48+
<service android:name="com.voximplant.foregroundservice.VIForegroundService"> </service>
4649
</application>
4750
</manifest>

example/android/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ buildscript {
2424
classpath("com.facebook.react:react-native-gradle-plugin")
2525
classpath("de.undercouch:gradle-download-task:5.0.1")
2626
classpath 'com.google.gms:google-services:4.3.3'
27+
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
2728
// NOTE: Do not place your application dependencies here; they belong
2829
// in the individual module build.gradle files
2930
}

example/android/settings.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
rootProject.name = 'ClevertapSignedCallReactNativeExample'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3-
include ':app'
3+
include ':app', ':clevertap-signedcall'
44
includeBuild('../node_modules/react-native-gradle-plugin')
55

66
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
@@ -9,3 +9,5 @@ if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true")
99
include(":ReactAndroid:hermes-engine")
1010
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
1111
}
12+
13+
project(':clevertap-signedcall').projectDir = new File('<path>')

example/firebase.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"react-native": {
3+
"crashlytics_auto_collection_enabled": true,
4+
"crashlytics_debug_enabled": true
5+
}
6+
}

0 commit comments

Comments
 (0)