Skip to content

Commit e36a44f

Browse files
authored
feat: Add button for noise suppression in sample apps [APICSA-1684] (#39)
* feat: Add button for noise suppression in sample apps [APICSA-1684] * Add button in iOS * Bump to 1.4.0
1 parent d7bf11a commit e36a44f

File tree

16 files changed

+133
-42
lines changed

16 files changed

+133
-42
lines changed

contact-center/android-chat/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ dependencies {
8282
implementation 'com.google.firebase:firebase-messaging-ktx'
8383

8484
// Vonage Client SDK
85-
implementation("com.vonage:client-sdk-chat:1.3.0")
85+
implementation("com.vonage:client-sdk-chat:1.4.0")
8686

8787
// Dagger - HILT (Dependency Injector)
8888
implementation 'com.google.dagger:hilt-android:2.45'

contact-center/android-voice/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dependencies {
5555
implementation 'com.google.firebase:firebase-messaging-ktx'
5656

5757
// Vonage Client SDK
58-
implementation("com.vonage:client-sdk:1.3.0")
58+
implementation("com.vonage:client-sdk:1.4.0")
5959

6060
// Retrofit + Moshi (HTTP Client)
6161
def retrofit_version = "2.9.0"

contact-center/android-voice/app/src/main/java/com/example/vonage/voicesampleapp/activities/CallActivity.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class CallActivity : AppCompatActivity() {
100100
btnHangup.setOnClickListener { onHangup() }
101101
btnMute.setOnClickListener { onMute() }
102102
btnKeypad.setOnClickListener { onKeypad() }
103+
noiseSuppressionSwitch.setOnCheckedChangeListener { _, isChecked -> onNoiseSuppression(isChecked) }
103104
}
104105

105106
private fun setUserUI() = binding.run{
@@ -116,13 +117,15 @@ class CallActivity : AppCompatActivity() {
116117
btnHangup.visibility = View.GONE
117118
btnMute.visibility = View.GONE
118119
btnKeypad.visibility = View.GONE
120+
noiseSuppressionSwitch.visibility = View.GONE
119121
}
120122
else {
121123
btnAnswer.visibility = View.GONE
122124
btnReject.visibility = View.GONE
123125
btnHangup.visibility = View.VISIBLE
124126
btnMute.visibility = View.VISIBLE
125127
btnKeypad.visibility = View.VISIBLE
128+
noiseSuppressionSwitch.visibility = View.VISIBLE
126129
}
127130
//Background Color and State label
128131
val (backgroundColor, stateLabel) = when(callStateExtra){
@@ -170,6 +173,16 @@ class CallActivity : AppCompatActivity() {
170173
}
171174
}
172175

176+
private fun onNoiseSuppression(isChecked: Boolean){
177+
coreContext.activeCall?.let { call ->
178+
if(isChecked){
179+
clientManager.enableNoiseSuppression(call)
180+
} else {
181+
clientManager.disableNoiseSuppression(call)
182+
}
183+
}
184+
}
185+
173186
private fun onKeypad(){
174187
showDialerFragment()
175188
}

contact-center/android-voice/app/src/main/java/com/example/vonage/voicesampleapp/core/VoiceClientManager.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,26 @@ class VoiceClientManager(private val context: Context) {
333333
}
334334
}
335335

336+
fun enableNoiseSuppression(call: CallConnection){
337+
call.takeIfActive()?.apply {
338+
client.enableNoiseSuppression(callId) { err ->
339+
err?.let {
340+
println("Error enabling noise suppression on Call: $it")
341+
} ?: println("Enabled noise suppression on Call with id: $callId")
342+
}
343+
}
344+
}
345+
346+
fun disableNoiseSuppression(call: CallConnection){
347+
call.takeIfActive()?.apply {
348+
client.disableNoiseSuppression(callId) { err ->
349+
err?.let {
350+
println("Error disabling noise suppression on Call: $it")
351+
} ?: println("Disabled noise suppression on Call with id: $callId")
352+
}
353+
}
354+
}
355+
336356
fun sendDtmf(call: CallConnection, digit: String){
337357
call.takeIfActive()?.apply {
338358
client.sendDTMF(callId, digit){ err ->

contact-center/android-voice/app/src/main/res/layout/activity_call.xml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<layout xmlns:android="http://schemas.android.com/apk/res/android">
2+
<layout xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
33
<ScrollView android:layout_width="match_parent"
44
android:layout_height="match_parent"
5-
xmlns:tools="http://schemas.android.com/tools"
6-
xmlns:app="http://schemas.android.com/apk/res-auto"
75
android:fillViewport="true"
86
tools:context=".activities.MainActivity"
97
>
108
<androidx.constraintlayout.widget.ConstraintLayout
11-
xmlns:tools="http://schemas.android.com/tools"
129
android:layout_width="match_parent"
1310
android:layout_height="wrap_content">
1411
<RelativeLayout
15-
xmlns:app="http://schemas.android.com/apk/res-auto"
16-
xmlns:tools="http://schemas.android.com/tools"
1712
android:layout_width="match_parent"
1813
android:layout_height="match_parent"
1914
tools:context=".activities.CallActivity">
@@ -25,15 +20,15 @@
2520
android:layout_marginRight="-80dp"
2621
android:layout_marginTop="-80dp"
2722
app:cardBackgroundColor="@color/purple_700"
28-
android:layout_height="550dp"/>
23+
android:layout_height="450dp"/>
2924
<ImageView
30-
android:layout_width="250dp"
25+
android:layout_width="150dp"
3126
android:elevation="16dp"
3227
tools:src="@tools:sample/avatars"
3328
android:id="@+id/user_avatar"
3429
android:layout_marginTop="48dp"
3530
android:layout_centerHorizontal="true"
36-
android:layout_height="250dp"
31+
android:layout_height="150dp"
3732
android:contentDescription="@string/user_avatar_description"/>
3833
<TextView
3934
android:id="@+id/user_name"
@@ -60,11 +55,12 @@
6055
android:layout_width="wrap_content"
6156
android:layout_height="wrap_content"/>
6257
<LinearLayout
58+
android:id="@+id/call_actions"
6359
android:layout_below="@+id/card_view"
6460
android:orientation="horizontal"
6561
android:gravity="center"
6662
android:layout_width="match_parent"
67-
android:layout_height="match_parent">
63+
android:layout_height="100dp">
6864
<com.google.android.material.floatingactionbutton.FloatingActionButton
6965
android:layout_width="wrap_content"
7066
android:layout_height="wrap_content"
@@ -117,6 +113,14 @@
117113
app:srcCompat="@drawable/keypad"
118114
android:contentDescription="@string/keypad_button_description"/>
119115
</LinearLayout>
116+
<androidx.appcompat.widget.SwitchCompat
117+
android:id="@+id/noise_suppression_switch"
118+
android:layout_below="@+id/call_actions"
119+
android:layout_centerHorizontal="true"
120+
android:layout_width="wrap_content"
121+
android:layout_height="wrap_content"
122+
app:switchPadding="5dp"
123+
android:text="@string/noise_suppression_switch_label"/>
120124
</RelativeLayout>
121125
<FrameLayout
122126
android:background="?attr/colorOnPrimary"

contact-center/android-voice/app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@
3939
<string name="answer_button_description">Answer</string>
4040
<string name="reject_button_description">Reject</string>
4141
<string name="login_with_token_label">Login with Vonage Token</string>
42+
<string name="noise_suppression_switch_label">Noise Suppression</string>
4243
</resources>

contact-center/ios-chat/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target 'VonageChatSDKExampleApp' do
66
use_frameworks!
77

88
# Pods for VonageChatSDKExampleApp
9-
pod 'VonageClientSDKChat', '1.3.0'
9+
pod 'VonageClientSDKChat', '1.4.0'
1010

1111
target 'VonageChatSDKExampleAppTests' do
1212
inherit! :search_paths

contact-center/ios-chat/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
PODS:
2-
- VonageClientSDKChat (1.3.0)
2+
- VonageClientSDKChat (1.4.0)
33

44
DEPENDENCIES:
5-
- VonageClientSDKChat (= 1.3.0)
5+
- VonageClientSDKChat (= 1.4.0)
66

77
SPEC REPOS:
88
trunk:
99
- VonageClientSDKChat
1010

1111
SPEC CHECKSUMS:
12-
VonageClientSDKChat: b07a5321f40e294801e8de2d7d67601c9876d05e
12+
VonageClientSDKChat: de0b9a4fbef9ae509502cf6dcd9e52b09afcb84c
1313

14-
PODFILE CHECKSUM: 903d7d7f7b3a759b6a6534d64a6f46d6fef69e6d
14+
PODFILE CHECKSUM: ae627a0e90be46d19ef176e09606d163b1d6d57a
1515

1616
COCOAPODS: 1.14.2

contact-center/ios-chat/VonageChatSDKExampleApp.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,6 @@
775775
isa = XCBuildConfiguration;
776776
baseConfigurationReference = F1F14A1361D2150F805A7E26 /* Pods-VonageChatSDKExampleAppTests.debug.xcconfig */;
777777
buildSettings = {
778-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
779778
BUNDLE_LOADER = "$(TEST_HOST)";
780779
CODE_SIGN_STYLE = Automatic;
781780
CURRENT_PROJECT_VERSION = 1;
@@ -796,7 +795,6 @@
796795
isa = XCBuildConfiguration;
797796
baseConfigurationReference = 31E6D6078738B0F40A67B5B4 /* Pods-VonageChatSDKExampleAppTests.release.xcconfig */;
798797
buildSettings = {
799-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
800798
BUNDLE_LOADER = "$(TEST_HOST)";
801799
CODE_SIGN_STYLE = Automatic;
802800
CURRENT_PROJECT_VERSION = 1;
@@ -817,7 +815,6 @@
817815
isa = XCBuildConfiguration;
818816
baseConfigurationReference = FAEF0785EE15550D9A078528 /* Pods-VonageChatSDKExampleApp-VonageChatSDKExampleAppUITests.debug.xcconfig */;
819817
buildSettings = {
820-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
821818
CODE_SIGN_STYLE = Automatic;
822819
CURRENT_PROJECT_VERSION = 1;
823820
DEVELOPMENT_TEAM = 7F2B5ZSP8Q;
@@ -836,7 +833,6 @@
836833
isa = XCBuildConfiguration;
837834
baseConfigurationReference = 74EB7738A0FA5547C95FD369 /* Pods-VonageChatSDKExampleApp-VonageChatSDKExampleAppUITests.release.xcconfig */;
838835
buildSettings = {
839-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
840836
CODE_SIGN_STYLE = Automatic;
841837
CURRENT_PROJECT_VERSION = 1;
842838
DEVELOPMENT_TEAM = 7F2B5ZSP8Q;

contact-center/ios-voice/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ target 'VonageSDKClientVOIPExample' do
55
use_frameworks!
66

77
# Pods for VonageSDKClientVOIPExample
8-
pod 'VonageClientSDKVoice', '1.3.0'
8+
pod 'VonageClientSDKVoice', '1.4.0'
99

1010
end

0 commit comments

Comments
 (0)