Skip to content

Commit

Permalink
Is/bug fix/jvm signature (#344)
Browse files Browse the repository at this point in the history
* Update build.gradle

* Fix. SocketObserver onChanged method

* Version Update

* Remove Unused Dep (Volley)

* Update target SDK

* Fix Test Cases
  • Loading branch information
isaacakakpo1 authored May 20, 2024
1 parent 0ac0ef4 commit 3e5116c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 32 deletions.
7 changes: 2 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))

android {
compileSdkVersion 33
compileSdkVersion 34
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.telnyx.webrtc.sdk"
minSdkVersion 23
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -120,9 +120,6 @@ dependencies {
implementation deps.ktor.gson
implementation deps.ktor.websockets

// Volley
implementation deps.volley

// Firebase
implementation platform(deps.firebasebom)
implementation deps.firebase_analytics
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/telnyx/webrtc/sdk/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ class MainActivity : AppCompatActivity() {
Timber.i("Loading...")
}

override fun onChanged(value: SocketResponse<ReceivedMessageBody>) {
super.onChanged(value)
// Do Nothing
}

override fun onError(message: String?) {
Timber.e("onError: %s", message)
Toast.makeText(
Expand Down
15 changes: 6 additions & 9 deletions telnyx_rtc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'maven-publish'
apply plugin: "com.bugsnag.android.gradle"

def getVersionName = { ->
return "1.3.3"
return "1.3.5"
}

def getArtifactId = { ->
Expand Down Expand Up @@ -78,7 +78,7 @@ dokkaHtml.configure {


android {
compileSdkVersion 33
compileSdkVersion 34
buildToolsVersion "30.0.3"

androidExtensions {
Expand All @@ -87,7 +87,7 @@ android {

defaultConfig {
minSdkVersion 23
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -198,7 +198,7 @@ dependencies {
implementation deps.ktor.gson
implementation deps.ktor.websockets
implementation deps.ktor.okhttp
implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
implementation 'androidx.lifecycle:lifecycle-process:2.7.0'
testImplementation deps.ktor.client_test

implementation 'org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.7.10'
Expand All @@ -207,8 +207,6 @@ dependencies {
//BugSnag:
implementation "com.bugsnag:bugsnag-android:5.+"

// Volley
implementation deps.volley

// Firebase
implementation platform(deps.firebasebom)
Expand Down Expand Up @@ -266,7 +264,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:truth:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.work:work-testing:2.7.1'
androidTestImplementation "io.mockk:mockk-android:1.12.5"
androidTestImplementation "io.mockk:mockk-androitd:1.12.5"
debugImplementation 'androidx.fragment:fragment-testing:1.5.2'
debugImplementation 'androidx.test:core-ktx:1.4.0'

Expand All @@ -276,7 +274,6 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

def lifecycle_version = "2.4.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
def lifecycle_version = "2.7.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,6 @@ class TelnyxClient(
SpeakerMode.EARPIECE -> {
audioManager?.isSpeakerphoneOn = false
}

SpeakerMode.UNASSIGNED -> audioManager?.isSpeakerphoneOn = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@ abstract class SocketObserver<T> : Observer<SocketResponse<T>> {
abstract fun onError(message: String?)
abstract fun onSocketDisconnect()

override fun onChanged(t: SocketResponse<T>?) {
if (t == null) {
onError("Socket Error")
} else {
when (t.status) {
SocketStatus.ESTABLISHED -> onConnectionEstablished()
SocketStatus.MESSAGERECEIVED -> onMessageReceived(t.data)
SocketStatus.LOADING -> onLoading()
SocketStatus.ERROR -> onError(t.errorMessage)
SocketStatus.DISCONNECT -> onSocketDisconnect()
}
override fun onChanged(value: SocketResponse<T>) {
when (value.status) {
SocketStatus.ESTABLISHED -> onConnectionEstablished()
SocketStatus.MESSAGERECEIVED -> onMessageReceived(value.data)
SocketStatus.LOADING -> onLoading()
SocketStatus.ERROR -> onError(value.errorMessage)
SocketStatus.DISCONNECT -> onSocketDisconnect()
}
}
}
5 changes: 3 additions & 2 deletions telnyx_rtc/src/test/java/com/telnyx/webrtc/sdk/CallTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,12 @@ fun <T> LiveData<T>.getOrAwaitValue(
var data: T? = null
val latch = CountDownLatch(1)
val observer = object : Observer<T> {
override fun onChanged(o: T?) {
data = o
override fun onChanged(value: T) {
data = value
latch.countDown()
this@getOrAwaitValue.removeObserver(this)
}

}

this.observeForever(observer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,8 @@ class TelnyxClientTest : BaseTest() {
var data: T? = null
val latch = CountDownLatch(1)
val observer = object : Observer<T> {
override fun onChanged(o: T?) {
data = o
override fun onChanged(value: T) {
data = value
latch.countDown()
this@getOrAwaitValue.removeObserver(this)
}
Expand Down
2 changes: 0 additions & 2 deletions versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ versions.ktor = "1.5.3"
versions.timber = "4.5.1"
versions.dexter = "6.2.2"
versions.googleservices = "4.3.8"
versions.volley = "1.1.1"
versions.firebasebom = "28.2.1"
versions.hilt = "2.43.2"
versions.bugsnag = "7.+"
Expand All @@ -37,7 +36,6 @@ deps.androidx_fragment = "androidx.fragment:fragment-ktx:$versions.androidx_frag
deps.appcompat = "androidx.appcompat:appcompat:$versions.androidx_appcompat"
deps.material = "com.google.android.material:material:$versions.material"
deps.constraint_layout = "androidx.constraintlayout:constraintlayout:$versions.androidx_constraint_layout"
deps.volley = "com.android.volley:volley:$versions.volley"
deps.webrtc = "org.webrtc:google-webrtc:$versions.webrtc"
deps.gson = "com.google.code.gson:gson:$versions.gson"
deps.websocket = "org.java-websocket:Java-WebSocket:$versions.websocket"
Expand Down

0 comments on commit 3e5116c

Please sign in to comment.