Skip to content

Commit

Permalink
3.8.0-GA
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscoRankush committed Jan 24, 2023
1 parent 63678d3 commit b291f9e
Show file tree
Hide file tree
Showing 29 changed files with 1,042 additions and 136 deletions.
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ This demo support Android device with **Android 7.0** or later
}
```
3. Add the following dependency in module level Gradle file and press sync-now
```
implementation files('libs/WebexSDK.aar')
```
- For Full SDK
```
implementation files('libs/WebexSDK.aar')
```
- For Meeting SDK
```
implementation files('libs/WebexSDK-Meeting.aar')
```
### Option 2
1. Add the following repository to your top-level `build.gradle` file:
Expand All @@ -64,13 +70,20 @@ This demo support Android device with **Android 7.0** or later
}
}
```
2. Add the `webex-android-sdk` library as a dependency for your app in the `build.gradle` file:
```
dependencies {
implementation 'com.ciscowebex:androidsdk:3.7.0'
}
```
2. Add the `webex-android-sdk` library as a dependency for your app in the `build.gradle` file:
- For Full SDK
```
dependencies {
implementation 'com.ciscowebex:webexsdk:3.8.0'
}
```
- For Meeting SDK
```
dependencies {
implementation 'com.ciscowebex:webexsdk-meeting:3.8.0'
}
```
## Usage
Expand Down
10 changes: 7 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
applicationId "com.cisco.sdk_android"
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
versionCode 37000
versionName "3.7.0"
versionCode 38000
versionName "3.8.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "CLIENT_ID", "${CLIENT_ID}"
Expand All @@ -39,6 +39,10 @@ android {
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
debug {
minifyEnabled false
debuggable true
}
}
buildFeatures {
dataBinding true
Expand All @@ -63,7 +67,7 @@ android {
}

dependencies {
implementation 'com.ciscowebex:androidsdk:3.7.0'
implementation 'com.ciscowebex:webexsdk:3.8.0'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation Dependencies.kotlinStdLib
implementation Dependencies.coreKtx
Expand Down
15 changes: 12 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

<uses-feature
android:name="android.hardware.telephony"
Expand All @@ -71,6 +72,17 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".calling.LockScreenActivity"
android:showOnLockScreen="true"
android:showWhenLocked="true"
android:turnScreenOn="true"
/>

<service
android:name=".CallRejectService"
android:enabled="true"
android:exported="true" />

<provider
android:name="androidx.core.content.FileProvider"
Expand Down Expand Up @@ -132,7 +144,6 @@
android:supportsPictureInPicture="true"
android:turnScreenOn="true"
tools:ignore="UnusedAttribute" />

<activity
android:name=".search.SearchActivity"
android:screenOrientation="portrait" />
Expand Down Expand Up @@ -166,7 +177,6 @@
<activity
android:name=".calling.calendarMeeting.details.CalendarMeetingDetailsActivity"
android:screenOrientation="portrait" />

<activity
android:name=".calling.CucmCallActivity"
android:screenOrientation="portrait" />
Expand All @@ -191,7 +201,6 @@
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.ciscowebex.androidsdk.kitchensink

import android.app.NotificationManager
import android.app.Service
import android.content.Context
import android.content.Intent
import android.os.IBinder
import android.util.Log
import com.ciscowebex.androidsdk.kitchensink.utils.Constants
import org.koin.android.ext.android.inject

class CallRejectService : Service() {

private val repository: WebexRepository by inject()
val tag = "CallRejectService"

companion object {
fun getCallRejectIntent(context: Context, callId: String? = null, accept : Boolean = true): Intent {
val intent = Intent(context, CallRejectService::class.java)
intent.action = Constants.Action.WEBEX_CALL_REJECT_ACTION
intent.putExtra(Constants.Intent.CALLING_ACTIVITY_ID, 1)
intent.putExtra(Constants.Intent.CALL_ID, callId)
return intent
}

}

override fun onBind(intent: Intent): IBinder? {
return null
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if(intent != null){
if(intent.action == Constants.Action.WEBEX_CALL_REJECT_ACTION){
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager?
notificationManager?.cancel(Constants.Notification.WEBEX_CALLING)
val callId = intent.getStringExtra(Constants.Intent.CALL_ID)
if(!callId.isNullOrBlank()) {
val call = repository.getCall(callId)
call?.let {
call.reject { result ->
if (result.isSuccessful) {
Log.d(tag, "rejectCall successful")
} else {
Log.d(tag, "rejectCall error: ${result.error?.errorMessage}")
}
}
}
}
}
}
return super.onStartCommand(intent, flags, startId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import com.ciscowebex.androidsdk.kitchensink.utils.FileUtils
import com.ciscowebex.androidsdk.kitchensink.utils.SharedPrefUtils
import com.ciscowebex.androidsdk.message.LocalFile
import com.ciscowebex.androidsdk.phone.Phone
import com.google.android.material.snackbar.Snackbar
import org.koin.android.ext.android.inject

class HomeActivity : BaseActivity() {
Expand Down Expand Up @@ -86,10 +87,10 @@ class HomeActivity : BaseActivity() {
})


webexViewModel.cucmLiveData.observe(this@HomeActivity, Observer {
webexViewModel.ucLiveData.observe(this@HomeActivity, Observer {
if (it != null) {
when (WebexRepository.CucmEvent.valueOf(it.first.name)) {
WebexRepository.CucmEvent.OnUCServerConnectionStateChanged -> {
when (WebexRepository.UCCallEvent.valueOf(it.first.name)) {
WebexRepository.UCCallEvent.OnUCServerConnectionStateChanged -> {
updateUCData()
}
else -> {}
Expand All @@ -106,10 +107,16 @@ class HomeActivity : BaseActivity() {
}
})

webexViewModel.initialSpacesSyncCompletedLiveData.observe(this@HomeActivity) {
Log.d(tag, getString(R.string.initial_spaces_sync_completed))
}

DataBindingUtil.setContentView<ActivityHomeBinding>(this, R.layout.activity_home)
.also { binding = it }
.apply {

binding.version.text = "Version : "+BuildConfig.VERSION_NAME

ivStartCall.setOnClickListener {
startActivity(Intent(this@HomeActivity, SearchActivity::class.java))
}
Expand Down Expand Up @@ -184,20 +191,20 @@ class HomeActivity : BaseActivity() {
}

private fun observeUCLoginData() {
webexViewModel.cucmLiveData.observe(this@HomeActivity, Observer {
webexViewModel.ucLiveData.observe(this@HomeActivity, Observer {
Log.d(tag, "uc login observer called : ${it.first.name}")
if (it != null) {
when (WebexRepository.CucmEvent.valueOf(it.first.name)) {
WebexRepository.CucmEvent.OnUCLoggedIn, WebexRepository.CucmEvent.OnUCServerConnectionStateChanged -> {
when (WebexRepository.UCCallEvent.valueOf(it.first.name)) {
WebexRepository.UCCallEvent.OnUCLoggedIn, WebexRepository.UCCallEvent.OnUCServerConnectionStateChanged -> {
updateUCData()
}
WebexRepository.CucmEvent.ShowSSOLogin -> {
WebexRepository.UCCallEvent.ShowSSOLogin -> {
startActivity(UCLoginActivity.getIntent(this@HomeActivity,
UCLoginActivity.Companion.OnActivityStartAction.ShowSSOLogin.name,
it.second))
}

WebexRepository.CucmEvent.ShowNonSSOLogin -> {
WebexRepository.UCCallEvent.ShowNonSSOLogin -> {
startActivity(UCLoginActivity.getIntent(this@HomeActivity, UCLoginActivity.Companion.OnActivityStartAction.ShowNonSSOLogin.name))
}
else -> {
Expand Down Expand Up @@ -234,12 +241,27 @@ class HomeActivity : BaseActivity() {
updateUCData()
webexViewModel.setIncomingListener()
addVirtualBackground()
checkForInitialSpacesSync()
}

private fun checkForInitialSpacesSync() {
if (!webexViewModel.isSpacesSyncCompleted()) {
Snackbar.make(binding.root, getString(R.string.syncing_spaces), Snackbar.LENGTH_SHORT).show()
}
}


private fun updateUCData() {
Log.d(tag, "updateUCData isCUCMServerLoggedIn: ${webexViewModel.repository.isCUCMServerLoggedIn} ucServerConnectionStatus: ${webexViewModel.repository.ucServerConnectionStatus}")
if (webexViewModel.isCUCMServerLoggedIn) {
Log.d(tag, "updateUCData isUCServerLoggedIn: ${webexViewModel.repository.isUCServerLoggedIn} ucServerConnectionStatus: ${webexViewModel.repository.ucServerConnectionStatus}")
if (webexViewModel.isUCServerLoggedIn) {
binding.ucLoginStatusTextView.visibility = View.VISIBLE
if(webexViewModel.getCallingType() == Phone.CallingType.WebexCalling) {
binding.ucLoginStatusTextView.text = getString(R.string.wxc_loggedIn)
} else if(webexViewModel.getCallingType() == Phone.CallingType.WebexForBroadworks) {
binding.ucLoginStatusTextView.text = getString(R.string.webexforbroadworks_loggedIn)
} else if (webexViewModel.getCallingType() == Phone.CallingType.CUCM){
binding.ucLoginStatusTextView.text = getString(R.string.uc_loggedIn)
}
} else {
binding.ucLoginStatusTextView.visibility = View.GONE
}
Expand All @@ -250,7 +272,7 @@ class HomeActivity : BaseActivity() {
binding.ucServerConnectionStatusTextView.text = text
binding.ucServerConnectionStatusTextView.visibility = View.VISIBLE
}
UCLoginServerConnectionStatus.Connected, UCLoginServerConnectionStatus.Connecting -> {
UCLoginServerConnectionStatus.Connected, UCLoginServerConnectionStatus.Connecting, UCLoginServerConnectionStatus.Disconnected -> {
val text = resources.getString(R.string.phone_services_connection_status) + webexViewModel.ucServerConnectionStatus.name
binding.ucServerConnectionStatusTextView.text = text
binding.ucServerConnectionStatusTextView.visibility = View.VISIBLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.ciscowebex.androidsdk.people.Person
import com.ciscowebex.androidsdk.space.Space
import com.ciscowebex.androidsdk.CompletionHandler
import com.ciscowebex.androidsdk.auth.PhoneServiceRegistrationFailureReason
import com.ciscowebex.androidsdk.auth.UCLoginFailureReason
import com.ciscowebex.androidsdk.auth.UCLoginServerConnectionStatus
import com.ciscowebex.androidsdk.auth.UCSSOFailureReason
import com.ciscowebex.androidsdk.kitchensink.utils.CallObjectStorage
Expand All @@ -35,7 +36,7 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
Audio_Video
}

enum class CucmEvent {
enum class UCCallEvent {
ShowSSOLogin,
ShowNonSSOLogin,
OnUCLoginFailed,
Expand Down Expand Up @@ -96,7 +97,9 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
MeetingPinOrPasswordRequired,
CaptchaRequired,
InCorrectPassword,
InCorrectPasswordWithCaptcha
InCorrectPasswordWithCaptcha,
InCorrectPasswordOrHostKey,
InCorrectPasswordOrHostKeyWithCaptcha
}

enum class CalendarMeetingEvent {
Expand Down Expand Up @@ -139,13 +142,13 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
var spaceCallId:String? = null

val participantMuteMap = hashMapOf<String, Boolean>()
var isCUCMServerLoggedIn = false
var isUCServerLoggedIn = false
var ucServerConnectionStatus: UCLoginServerConnectionStatus = UCLoginServerConnectionStatus.Idle
var ucServerConnectionFailureReason: PhoneServiceRegistrationFailureReason = PhoneServiceRegistrationFailureReason.Unknown

var _callMembershipsLiveData: MutableLiveData<List<CallMembership>>? = null
var _muteAllLiveData: MutableLiveData<Boolean>? = null
var _cucmLiveData: MutableLiveData<Pair<CucmEvent, String>>? = null
var _ucLiveData: MutableLiveData<Pair<UCCallEvent, String>>? = null
var _callingLiveData: MutableLiveData<CallLiveData>? = null
var _startAssociationLiveData: MutableLiveData<CallLiveData>? = null
var _startShareLiveData: MutableLiveData<Boolean>? = null
Expand Down Expand Up @@ -348,48 +351,52 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
return webex.phone.getMaxVirtualBackgroundItems()
}

fun setOnInitialSpacesSyncCompletedListener(handler: CompletionHandler<Void>) {
webex.spaces.setOnInitialSpacesSyncCompletedListener(handler)
}

// Callbacks
override fun loadUCSSOViewInBackground(ssoUrl: String) {
_cucmLiveData?.postValue(Pair(CucmEvent.ShowSSOLogin, ssoUrl))
_ucLiveData?.postValue(Pair(UCCallEvent.ShowSSOLogin, ssoUrl))
Log.d(tag, "showUCSSOLoginView")
}

override fun showUCNonSSOLoginView() {
_cucmLiveData?.postValue(Pair(CucmEvent.ShowNonSSOLogin, ""))
_ucLiveData?.postValue(Pair(UCCallEvent.ShowNonSSOLogin, ""))
Log.d(tag, "showUCNonSSOLoginView")
}

override fun onUCLoginFailed() {
_cucmLiveData?.postValue(Pair(CucmEvent.OnUCLoginFailed, ""))
Log.d(tag, "onUCLoginFailed")
isCUCMServerLoggedIn = false
override fun onUCLoginFailed(failureReason: UCLoginFailureReason) {
isUCServerLoggedIn = false
_ucLiveData?.postValue(Pair(UCCallEvent.OnUCLoginFailed, failureReason.name))
Log.d(tag, "onUCLoginFailed with reason: $failureReason")
}

override fun onUCLoggedIn() {
_cucmLiveData?.postValue(Pair(CucmEvent.OnUCLoggedIn, ""))
isUCServerLoggedIn = true
_ucLiveData?.postValue(Pair(UCCallEvent.OnUCLoggedIn, ""))
Log.d(tag, "onUCLoggedIn")
isCUCMServerLoggedIn = true
}

override fun onUCServerConnectionStateChanged(status: UCLoginServerConnectionStatus, failureReason: PhoneServiceRegistrationFailureReason) {
Log.d(tag, "onUCServerConnectionStateChanged status: $status failureReason: $failureReason")
ucServerConnectionStatus = status
ucServerConnectionFailureReason = failureReason
_cucmLiveData?.postValue(Pair(CucmEvent.OnUCServerConnectionStateChanged, ""))
_ucLiveData?.postValue(Pair(UCCallEvent.OnUCServerConnectionStateChanged, ""))
}

override fun showUCSSOBrowser() {
_cucmLiveData?.postValue(Pair(CucmEvent.ShowUCSSOBrowser, ""))
_ucLiveData?.postValue(Pair(UCCallEvent.ShowUCSSOBrowser, ""))
Log.d(tag, "showUCSSOBrowser")
}

override fun hideUCSSOBrowser() {
_cucmLiveData?.postValue(Pair(CucmEvent.HideUCSSOBrowser, ""))
_ucLiveData?.postValue(Pair(UCCallEvent.HideUCSSOBrowser, ""))
Log.d(tag, "hideUCSSOBrowser")
}

override fun onUCSSOLoginFailed(failureReason: UCSSOFailureReason) {
_cucmLiveData?.postValue(Pair(CucmEvent.OnSSOLoginFailed, failureReason.name))
_ucLiveData?.postValue(Pair(UCCallEvent.OnSSOLoginFailed, failureReason.name))
Log.d(tag, "onUCSSOLoginFailed : reason = ${failureReason.name}")
}
}
Loading

0 comments on commit b291f9e

Please sign in to comment.