Skip to content

Commit

Permalink
Merge pull request #35 from webex/sdk-3.2.0-release
Browse files Browse the repository at this point in the history
Sdk 3.2.0 release
  • Loading branch information
lasharm2 authored Oct 25, 2021
2 parents d21c343 + 3838008 commit 5af47a2
Show file tree
Hide file tree
Showing 61 changed files with 2,612 additions and 194 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ This demo support Android device with **Android 7.0** or later
```
dependencies {
implementation 'com.ciscowebex:androidsdk:3.1.0@aar'
implementation 'com.ciscowebex:androidsdk:3.2.0@aar'
}
```
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId "com.cisco.sdk_android"
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
versionCode 30003
versionName "3.1.0"
versionCode 32000
versionName "3.2.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "CLIENT_ID", "${CLIENT_ID}"
Expand Down Expand Up @@ -62,7 +62,7 @@ android {
}

dependencies {
implementation 'com.ciscowebex:androidsdk:3.1.0@aar'
implementation 'com.ciscowebex:androidsdk:3.2.0@aar'

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation Dependencies.kotlinStdLib
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
<activity
android:name=".auth.JWTLoginActivity"
android:screenOrientation="portrait" />
<activity
android:name=".auth.AccessTokenLoginActivity"
android:screenOrientation="portrait" />
<activity
android:name=".auth.OAuthWebLoginActivity"
android:screenOrientation="portrait" />
Expand Down Expand Up @@ -134,6 +137,9 @@
<activity
android:name=".setup.SetupActivity"
android:screenOrientation="portrait" />
<activity
android:name=".setup.SetupCameraActivity"
android:screenOrientation="portrait" />
<activity
android:name=".calling.DialerActivity"
android:screenOrientation="portrait" />
Expand All @@ -156,6 +162,9 @@
android:name=".webhooks.WebhooksActivity"
android:screenOrientation="portrait" />

<activity android:name=".calling.calendarMeeting.details.CalendarMeetingDetailsActivity"
android:screenOrientation="portrait" />

<service
android:name=".firebase.KitchenSinkFCMService"
android:exported="false">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ciscowebex.androidsdk.kitchensink

import com.ciscowebex.androidsdk.Webex
import com.ciscowebex.androidsdk.auth.JWTAuthenticator
import com.ciscowebex.androidsdk.auth.TokenAuthenticator
import org.koin.android.ext.koin.androidApplication
import org.koin.dsl.module

val AccessTokenWebexModule = module {

factory {
Webex(androidApplication(), TokenAuthenticator())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import android.util.Log
import android.view.View
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Observer
import com.ciscowebex.androidsdk.CompletionHandler
import com.ciscowebex.androidsdk.auth.OAuthWebViewAuthenticator
import com.ciscowebex.androidsdk.auth.TokenAuthenticator
import com.ciscowebex.androidsdk.kitchensink.auth.LoginActivity
import com.ciscowebex.androidsdk.kitchensink.databinding.ActivityHomeBinding
import com.ciscowebex.androidsdk.kitchensink.messaging.MessagingActivity
Expand All @@ -24,6 +26,9 @@ import com.ciscowebex.androidsdk.kitchensink.calling.CallActivity
import com.ciscowebex.androidsdk.kitchensink.extras.ExtrasActivity
import com.ciscowebex.androidsdk.kitchensink.search.SearchActivity
import com.ciscowebex.androidsdk.kitchensink.setup.SetupActivity
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 org.koin.android.ext.android.inject

Expand Down Expand Up @@ -51,6 +56,10 @@ class HomeActivity : BaseActivity() {
is OAuthWebViewAuthenticator -> {
saveLoginTypePref(this, LoginActivity.LoginType.OAuth)
}
is TokenAuthenticator -> {
saveLoginTypePref(this, LoginActivity.LoginType.AccessToken)
webexViewModel.setOnTokenExpiredListener()
}
else -> {
saveLoginTypePref(this, LoginActivity.LoginType.JWT)
}
Expand Down Expand Up @@ -156,6 +165,7 @@ class HomeActivity : BaseActivity() {
webexViewModel.setSpaceObserver()
webexViewModel.setMembershipObserver()
webexViewModel.setMessageObserver()
webexViewModel.setCalendarMeetingObserver()
}

override fun onBackPressed() {
Expand Down Expand Up @@ -188,6 +198,7 @@ class HomeActivity : BaseActivity() {
super.onResume()
updateUCData()
webexViewModel.setGlobalIncomingListener()
addVirtualBackground()
}

private fun updateUCData() {
Expand All @@ -213,4 +224,24 @@ class HomeActivity : BaseActivity() {
}
}
}

private fun addVirtualBackground() {
if (SharedPrefUtils.isVirtualBgAdded(this)) {
Log.d(tag, "Virtual Bg is already added")
} else {

val thumbnailFile = FileUtils.getFileFromResource(this, "nature-thumb")
val file = FileUtils.getFileFromResource(this, "nature")
val thumbnail = LocalFile.Thumbnail(thumbnailFile, null,
resources.getInteger(R.integer.virtual_bg_thumbnail_width),
resources.getInteger(R.integer.virtual_bg_thumbnail_height))

val localFile = LocalFile(file, null, thumbnail, null)
webexViewModel.addVirtualBackground(localFile, CompletionHandler {
if (it.isSuccessful && it.data != null) {
SharedPrefUtils.setVirtualBgAdded(this, true)
}
})
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.lifecycle.ProcessLifecycleOwner
import com.ciscowebex.androidsdk.kitchensink.auth.LoginActivity
import com.ciscowebex.androidsdk.kitchensink.auth.loginModule
import com.ciscowebex.androidsdk.kitchensink.calling.callModule
import com.ciscowebex.androidsdk.kitchensink.calling.calendarMeeting.calendarMeetingsModule
import com.ciscowebex.androidsdk.kitchensink.extras.extrasModule
import com.ciscowebex.androidsdk.kitchensink.messaging.messagingModule
import com.ciscowebex.androidsdk.kitchensink.messaging.search.searchPeopleModule
Expand Down Expand Up @@ -72,15 +73,18 @@ class KitchenSinkApp : Application(), LifecycleObserver {
fun loadKoinModules(type: LoginActivity.LoginType) {
when (type) {
LoginActivity.LoginType.JWT -> {
loadKoinModules(listOf(mainAppModule, webexModule, loginModule, JWTWebexModule, searchModule, callModule, messagingModule, personModule, searchPeopleModule, webhooksModule, extrasModule))
loadKoinModules(listOf(mainAppModule, webexModule, loginModule, JWTWebexModule, searchModule, callModule, messagingModule, personModule, searchPeopleModule, webhooksModule, extrasModule, calendarMeetingsModule))
}
LoginActivity.LoginType.AccessToken -> {
loadKoinModules(listOf(mainAppModule, webexModule, loginModule, AccessTokenWebexModule, searchModule, callModule, messagingModule, personModule, searchPeopleModule, webhooksModule, extrasModule, calendarMeetingsModule))
}
else -> {
loadKoinModules(listOf(mainAppModule, webexModule, loginModule, OAuthWebexModule, searchModule, callModule, messagingModule, personModule, searchPeopleModule, webhooksModule, extrasModule))
loadKoinModules(listOf(mainAppModule, webexModule, loginModule, OAuthWebexModule, searchModule, callModule, messagingModule, personModule, searchPeopleModule, webhooksModule, extrasModule, calendarMeetingsModule))
}
}
}

fun unloadKoinModules() {
unloadKoinModules(listOf(mainAppModule, webexModule, loginModule, JWTWebexModule, OAuthWebexModule, searchModule, callModule, messagingModule, personModule, searchPeopleModule, webhooksModule, extrasModule))
unloadKoinModules(listOf(mainAppModule, webexModule, loginModule, JWTWebexModule, AccessTokenWebexModule, OAuthWebexModule, searchModule, callModule, messagingModule, personModule, searchPeopleModule, webhooksModule, extrasModule, calendarMeetingsModule))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ import com.ciscowebex.androidsdk.CompletionHandler
import com.ciscowebex.androidsdk.auth.PhoneServiceRegistrationFailureReason
import com.ciscowebex.androidsdk.auth.UCLoginServerConnectionStatus
import com.ciscowebex.androidsdk.kitchensink.utils.CallObjectStorage
import com.ciscowebex.androidsdk.calendarMeeting.CalendarMeetingObserver
import com.ciscowebex.androidsdk.membership.Membership
import com.ciscowebex.androidsdk.membership.MembershipObserver
import com.ciscowebex.androidsdk.message.LocalFile
import com.ciscowebex.androidsdk.message.MessageObserver
import com.ciscowebex.androidsdk.phone.CallMembership
import com.ciscowebex.androidsdk.phone.CallObserver
import com.ciscowebex.androidsdk.phone.NotificationCallType
import com.ciscowebex.androidsdk.phone.Call
import com.ciscowebex.androidsdk.phone.MediaOption
import com.ciscowebex.androidsdk.phone.Phone
import com.ciscowebex.androidsdk.phone.VirtualBackground
import com.ciscowebex.androidsdk.space.SpaceObserver

class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
Expand Down Expand Up @@ -79,6 +82,12 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
MeetingPinOrPasswordRequired
}

enum class CalendarMeetingEvent {
Created,
Updated,
Deleted
}

data class CallLiveData(val event: CallEvent,
val call: Call? = null,
val sharingLabel: String? = null,
Expand All @@ -99,6 +108,7 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
var enableBgStreamtoggle = true
var enableBgConnectiontoggle = true
var enablePhoneStatePermission = true
var enableHWAcceltoggle = true
var logFilter = LogLevel.ALL.name
var isConsoleLoggerEnabled = true
var callCapability: CallCap = CallCap.Audio_Video
Expand All @@ -124,6 +134,7 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
var _spaceEventLiveData: MutableLiveData<Pair<SpaceEvent, Any?>>? = null
var _membershipEventLiveData: MutableLiveData<Pair<MembershipEvent, Membership?>>? = null
var _messageEventLiveData: MutableLiveData<Pair<MessageEvent, Any?>>? = null
var _calendarMeetingEventLiveData: MutableLiveData<Pair<CalendarMeetingEvent, Any>>? = null

init {
webex.delegate = this
Expand Down Expand Up @@ -223,6 +234,31 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
})
}

fun setCalendarMeetingObserver() {
webex.calendarMeetings.setObserver(object : CalendarMeetingObserver
{
override fun onEvent(event: CalendarMeetingObserver.CalendarMeetingEvent) {
Log.d(tag, "onCalendarMeetingEvent: $event")
when (event) {
is CalendarMeetingObserver.CalendarMeetingAdded -> {
_calendarMeetingEventLiveData?.postValue(Pair(CalendarMeetingEvent.Created, event.getCalendarMeeting()))
}
is CalendarMeetingObserver.CalendarMeetingUpdated -> {
_calendarMeetingEventLiveData?.postValue(Pair(CalendarMeetingEvent.Updated, event.getCalendarMeeting()))
}
is CalendarMeetingObserver.CalendarMeetingRemoved -> {
_calendarMeetingEventLiveData?.postValue(Pair(CalendarMeetingEvent.Deleted, event.getCalendarMeetingId()))
}
}
}
})
}

fun removeCalendarMeetingObserver() {
_calendarMeetingEventLiveData = null
webex.calendarMeetings.setObserver(null)
}

fun setIncomingListener() {
Log.d(tag, "setIncomingListener")
if (webex.phone.getIncomingCallListener() != null) {
Expand Down Expand Up @@ -264,6 +300,30 @@ class WebexRepository(val webex: Webex) : WebexUCLoginDelegate {
webex.messages.list(spaceId, null, 10000, null, handler)
}

fun getVirtualBackgrounds(handler: CompletionHandler<List<VirtualBackground>> ) {
webex.phone.fetchVirtualBackgrounds(handler)
}

fun addVirtualBackground(imgFile: LocalFile, handler: CompletionHandler<VirtualBackground>) {
webex.phone.addVirtualBackground(imgFile, handler)
}

fun applyVirtualBackground(background: VirtualBackground, mode: Phone.VirtualBackgroundMode, handler: CompletionHandler<Boolean>) {
webex.phone.applyVirtualBackground(background, mode, handler)
}

fun removeVirtualBackground(background: VirtualBackground, handler: CompletionHandler<Boolean>) {
webex.phone.removeVirtualBackground(background, handler)
}

fun setMaxVirtualBackgrounds(limit: Int) {
webex.phone.setMaxVirtualBackgroundItems(limit)
}

fun getMaxVirtualBackgrounds(): Int {
return webex.phone.getMaxVirtualBackgroundItems()
}

// Callbacks
override fun showUCSSOLoginView(ssoUrl: String) {
_cucmLiveData?.postValue(Pair(CucmEvent.ShowSSOLogin, ssoUrl))
Expand Down
Loading

0 comments on commit 5af47a2

Please sign in to comment.