Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant dependencies #336

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {

}

apply plugin: "com.bugsnag.android.gradle"

def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))

Expand All @@ -25,6 +27,7 @@ android {
multiDexEnabled true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "java.util.concurrent.atomic.AtomicBoolean", "IS_TESTING", "new java.util.concurrent.atomic.AtomicBoolean(false)"
}

buildTypes {
Expand Down Expand Up @@ -100,6 +103,10 @@ dependencies {
// SDK:
implementation project(':telnyx_rtc')


//BugSnag:
implementation "com.bugsnag:bugsnag-android:5.+"

implementation deps.dialpad

implementation "io.getstream:stream-webrtc-android:1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.rule.ActivityTestRule
import com.telnyx.webrtc.sdk.BuildConfig
import com.telnyx.webrtc.sdk.R
import com.telnyx.webrtc.sdk.manager.UserManager
import com.telnyx.webrtc.sdk.testhelpers.BaseUITest
Expand Down Expand Up @@ -50,6 +51,7 @@ class MainActivityTest : BaseUITest() {

@Before
fun setUp() {
BuildConfig.IS_TESTING.set(true)
context = getInstrumentation().targetContext.applicationContext
clearSharedPrefs()
Intents.init()
Expand All @@ -58,6 +60,7 @@ class MainActivityTest : BaseUITest() {

@After
fun tearDown() {
BuildConfig.IS_TESTING.set(false)
Intents.release()
clearSharedPrefs()
setAnimations(true)
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,18 @@
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="telnyx_channel" />

<meta-data
android:name="com.bugsnag.android.APP_TYPE"
android:value="telnyx_rtc" />
<meta-data
android:name="com.bugsnag.android.PROJECT_PACKAGES"
android:value="com.telnyx.webrtc.sdk.telnyx_rtc" />
<meta-data
android:name="com.bugsnag.android.SEND_THREADS"
android:value="ALWAYS" />
<meta-data
android:name="com.bugsnag.android.API_KEY"
android:value="8deb3e73bbe5d352ef442c42b129314c" />

</application>
</manifest>
5 changes: 5 additions & 0 deletions app/src/main/java/com/telnyx/webrtc/sdk/ui/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ package com.telnyx.webrtc.sdk.ui
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.bugsnag.android.Bugsnag
import com.google.gson.JsonObject
import com.telnyx.webrtc.sdk.BuildConfig
import com.telnyx.webrtc.sdk.Call
import com.telnyx.webrtc.sdk.CredentialConfig
import com.telnyx.webrtc.sdk.TelnyxClient
Expand Down Expand Up @@ -40,6 +42,9 @@ class MainViewModel @Inject constructor(
providedServerConfig: TxServerConfiguration?,
txPushMetaData: String?
) {
if (!BuildConfig.IS_TESTING.get()) {
Bugsnag.start(context)
}
telnyxClient = TelnyxClient(context)
providedServerConfig?.let {
telnyxClient?.connect(it, txPushMetaData)
Expand Down
44 changes: 7 additions & 37 deletions telnyx_rtc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'org.jetbrains.dokka'
id 'maven-publish'
id 'kotlin-android-extensions'
id 'io.gitlab.arturbosch.detekt'
}

apply plugin: 'maven-publish'
apply plugin: "com.bugsnag.android.gradle"

def getVersionName = { ->
return "1.3.0"
Expand Down Expand Up @@ -173,16 +170,10 @@ tasks.koverXmlReport {
dependencies {

implementation deps.kotlin.stdlib
implementation deps.androidx_core
implementation deps.appcompat
implementation deps.material
implementation deps.constraint_layout

implementation "io.getstream:stream-webrtc-android:1.0.4"

implementation deps.gson
implementation deps.retrofit.runtime
implementation deps.retrofit.gson


implementation deps.coroutines.core
Expand All @@ -193,36 +184,18 @@ dependencies {
implementation deps.okhttp
implementation deps.interceptor

implementation deps.ktor.android
implementation deps.ktor.cio
implementation deps.ktor.gson
implementation deps.ktor.websockets
implementation deps.ktor.okhttp
implementation 'androidx.lifecycle:lifecycle-process:2.5.1'
testImplementation deps.ktor.android
testImplementation deps.ktor.cio
testImplementation deps.ktor.gson
testImplementation deps.ktor.websockets
testImplementation deps.ktor.okhttp
testImplementation deps.ktor.client_test

implementation 'org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.7.10'


//BugSnag:
implementation "com.bugsnag:bugsnag-android:5.+"

// Volley
implementation deps.volley

// Firebase
implementation platform(deps.firebasebom)
implementation deps.firebase_analytics
implementation deps.firebase_messaging

// Timber
implementation deps.timber

//permissions
implementation deps.dexter

implementation deps.hilt.android
kapt deps.hilt.compiler
def lifecycle_version = "2.5.1"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"

//Testing:
testImplementation "androidx.arch.core:core-testing:2.1.0"
Expand Down Expand Up @@ -276,7 +249,4 @@ 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"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
}
11 changes: 0 additions & 11 deletions telnyx_rtc/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,4 @@
package="com.telnyx.webrtc.sdk.telnyx_rtc">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<application>
<meta-data android:name="com.bugsnag.android.APP_TYPE"
android:value="telnyx_rtc"/>
<meta-data android:name="com.bugsnag.android.PROJECT_PACKAGES"
android:value="com.telnyx.webrtc.sdk.telnyx_rtc"/>
<meta-data android:name="com.bugsnag.android.SEND_THREADS"
android:value="ALWAYS"/>
<meta-data
android:name="com.bugsnag.android.API_KEY"
android:value="8deb3e73bbe5d352ef442c42b129314c"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

package com.telnyx.webrtc.sdk

import android.app.Activity
import android.content.Context
import android.media.AudioManager
import android.media.MediaPlayer
import android.net.ConnectivityManager
import android.net.Uri
import android.os.PowerManager
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.*
import com.bugsnag.android.Bugsnag
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.telnyx.webrtc.sdk.model.*
Expand Down Expand Up @@ -77,7 +76,7 @@ class TelnyxClient(
val wsMessagesResponseLiveDate = MutableLiveData<JsonObject>()

private val audioManager =
context.getSystemService(AppCompatActivity.AUDIO_SERVICE) as? AudioManager
context.getSystemService(Activity.AUDIO_SERVICE) as? AudioManager

// Keeps track of all the created calls by theirs UUIDs
internal val calls: MutableMap<UUID, Call> = mutableMapOf()
Expand Down Expand Up @@ -200,10 +199,6 @@ class TelnyxClient(
}

init {
if (!BuildConfig.IS_TESTING.get()) {
Bugsnag.start(context)
}

// Generate random UUID for sessid param, convert it to string and set globally
sessid = UUID.randomUUID().toString()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import com.bugsnag.android.Bugsnag
import com.telnyx.webrtc.sdk.telnyx_rtc.BuildConfig
import timber.log.Timber

Expand All @@ -33,9 +32,6 @@ object ConnectivityHelper {
manager.unregisterNetworkCallback(callback)
} catch (e: Exception) {
Timber.e(e, "unregisterNetworkCallback [%s]", [email protected])
if (!BuildConfig.IS_TESTING.get()) {
Bugsnag.notify(e)
}
}
}

Expand All @@ -60,9 +56,6 @@ object ConnectivityHelper {
manager.registerNetworkCallback(request, callback)
} catch (e: Exception) {
Timber.e(e, "registerNetworkStatusCallback [%s]", [email protected])
if (!BuildConfig.IS_TESTING.get()) {
Bugsnag.notify(e)
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions telnyx_rtc/src/test/java/com/telnyx/webrtc/sdk/CallTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.telnyx.webrtc.sdk

import android.app.Activity
import android.content.Context
import android.media.AudioManager
import androidx.appcompat.app.AppCompatActivity
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
Expand Down Expand Up @@ -66,7 +66,7 @@ class CallTest : BaseTest() {

BuildConfig.IS_TESTING.set(true)

every { mockContext.getSystemService(AppCompatActivity.AUDIO_SERVICE) } returns audioManager
every { mockContext.getSystemService(Activity.AUDIO_SERVICE) } returns audioManager
every { audioManager.isMicrophoneMute = true } just Runs
every { audioManager.isSpeakerphoneOn = true } just Runs
every { audioManager.isSpeakerphoneOn } returns false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.telnyx.webrtc.sdk

import android.app.Activity
import android.content.Context
import android.media.AudioManager
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import androidx.appcompat.app.AppCompatActivity
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
Expand Down Expand Up @@ -86,7 +86,7 @@ class TelnyxClientTest : BaseTest() {
audioManager = Mockito.spy(AudioManager::class.java)

every { mockContext.getSystemService(Context.CONNECTIVITY_SERVICE) } returns connectivityManager
every { mockContext.getSystemService(AppCompatActivity.AUDIO_SERVICE) } returns audioManager
every { mockContext.getSystemService(Activity.AUDIO_SERVICE) } returns audioManager

client = TelnyxClient(mockContext)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.telnyx.webrtc.sdk.socket

import android.app.Activity
import android.content.Context
import android.media.AudioManager
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import androidx.appcompat.app.AppCompatActivity
import com.google.gson.JsonObject
import com.telnyx.webrtc.sdk.TelnyxClient
import com.telnyx.webrtc.sdk.telnyx_rtc.BuildConfig
Expand Down Expand Up @@ -74,7 +74,7 @@ class TxSocketTest : BaseTest() {
fun setup() {
MockKAnnotations.init(this, true)
BuildConfig.IS_TESTING.set(true)
every { mockContext.getSystemService(AppCompatActivity.AUDIO_SERVICE) } returns audioManager
every { mockContext.getSystemService(Activity.AUDIO_SERVICE) } returns audioManager

networkCallbackSetup()
}
Expand Down