Skip to content

Commit

Permalink
Merge pull request #34 from webex/sdk-3.1.0-release
Browse files Browse the repository at this point in the history
3.1.0 release
  • Loading branch information
ankibatr authored Aug 16, 2021
2 parents 3e046ab + 8337deb commit d21c343
Show file tree
Hide file tree
Showing 21 changed files with 128 additions and 29 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,20 @@ This demo support Android device with **Android 7.0** or later
```
dependencies {
implementation 'com.ciscowebex:androidsdk:3.0.0@aar'
implementation 'com.ciscowebex:androidsdk:3.1.0@aar'
}
```
## Usage
For example see [README](https://github.com/webex/webex-android-sdk/blob/master/README.md)
## Note
Please update below constants in gradle.properties
```
CLIENT_ID=""
CLIENT_SECRET=""
SCOPE=""
REDIRECT_URI=""
```
24 changes: 21 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ android {
applicationId "com.cisco.sdk_android"
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
versionCode 30001
versionName "3.0.0"
versionCode 30003
versionName "3.1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "CLIENT_ID", "${CLIENT_ID}"
buildConfigField "String", "CLIENT_SECRET", "${CLIENT_SECRET}"
buildConfigField "String", "SCOPE", "${SCOPE}"
buildConfigField "String", "REDIRECT_URI", "${REDIRECT_URI}"
}

Expand All @@ -41,10 +42,27 @@ android {
buildFeatures {
dataBinding true
}
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true

// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
reset()

// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"

// Specifies that we want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
}

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

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation Dependencies.kotlinStdLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ 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.phone.Phone
import org.koin.android.ext.android.inject

class HomeActivity : BaseActivity() {
Expand All @@ -41,6 +42,10 @@ class HomeActivity : BaseActivity() {
webexViewModel.setLogLevel(webexViewModel.logFilter)
webexViewModel.enableConsoleLogger(webexViewModel.isConsoleLoggerEnabled)

Log.d(tag, "Service URls METRICS: ${webexViewModel.getServiceUrl(Phone.ServiceUrlType.METRICS)}" +
"\nCLIENT_LOGS: ${webexViewModel.getServiceUrl(Phone.ServiceUrlType.CLIENT_LOGS)}" +
"\nKMS: ${webexViewModel.getServiceUrl(Phone.ServiceUrlType.KMS)}")

authenticator?.let {
when (it) {
is OAuthWebViewAuthenticator -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ val OAuthWebexModule = module {
single <Authenticator> (named("oAuth")) {
val clientId = BuildConfig.CLIENT_ID
val clientSecret = BuildConfig.CLIENT_SECRET
val additionalScopes = BuildConfig.SCOPE
val redirectUri = BuildConfig.REDIRECT_URI
val email = getEmailPref(androidApplication()).orEmpty()
OAuthWebViewAuthenticator(clientId, clientSecret, redirectUri, email)
OAuthWebViewAuthenticator(clientId, clientSecret, additionalScopes, redirectUri, email)
}

factory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,4 +749,32 @@ class WebexViewModel(val webex: Webex, val repository: WebexRepository) : BaseVi
fun openAuxStream(view: View) {
getCall(currentCallId.orEmpty())?.openAuxStream(view)
}

fun hasAnyoneJoined(): Boolean {
return getCall(currentCallId.orEmpty())?.hasAnyoneJoined() ?: false
}

fun isMeeting(): Boolean {
return getCall(currentCallId.orEmpty())?.isMeeting() ?: false
}

fun isPmr(): Boolean {
return getCall(currentCallId.orEmpty())?.isPmr() ?: false
}

fun isSelfCreator(): Boolean {
return getCall(currentCallId.orEmpty())?.isSelfCreator() ?: false
}

fun isSpaceMeeting(): Boolean {
return getCall(currentCallId.orEmpty())?.isSpaceMeeting() ?: false
}

fun isScheduledMeeting(): Boolean {
return getCall(currentCallId.orEmpty())?.isScheduledMeeting() ?: false
}

fun getServiceUrl(type: Phone.ServiceUrlType): String? {
return webex.phone.getServiceUrl(type)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class JWTLoginActivity : AppCompatActivity() {
}
})

loginViewModel.errorData.observe(this@JWTLoginActivity, Observer { errorMessage ->
progressLayout.visibility = View.GONE
onLoginFailed(errorMessage)
})

loginViewModel.initialize()
}
}
Expand All @@ -75,8 +80,9 @@ class JWTLoginActivity : AppCompatActivity() {
finish()
}

private fun onLoginFailed() {
private fun onLoginFailed(failureMessage: String = getString(R.string.jwt_login_failed)) {
binding.loginButton.visibility = View.VISIBLE
binding.loginFailedTextView.visibility = View.VISIBLE
binding.loginFailedTextView.text = failureMessage
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ciscowebex.androidsdk.kitchensink.auth

import android.util.Log
import android.webkit.WebView
import com.ciscowebex.androidsdk.Webex
import com.ciscowebex.androidsdk.auth.JWTAuthenticator
Expand All @@ -12,6 +13,7 @@ class LoginRepository() {
fun authorizeOAuth(loginWebview: WebView, oAuthAuthenticator: OAuthWebViewAuthenticator): Observable<Boolean> {
return Single.create<Boolean> { emitter ->
oAuthAuthenticator.authorize(loginWebview, CompletionHandler { result ->
Log.d("LoginRepository:authorizeOAuth ", "isAuthorized : ${oAuthAuthenticator.isAuthorized()}")
if (result.error != null) {
emitter.onError(Throwable(result.error?.errorMessage))
} else {
Expand All @@ -24,6 +26,7 @@ class LoginRepository() {
fun initialize(webex: Webex): Observable<Boolean> {
return Single.create<Boolean> { emitter ->
webex.initialize(CompletionHandler { result ->
Log.d("LoginRepository:initialize ", "isAuthorized : ${webex.authenticator?.isAuthorized()}")
if (result.error != null) {
emitter.onError(Throwable(result.error?.errorMessage))
} else {
Expand All @@ -36,6 +39,7 @@ class LoginRepository() {
fun loginWithJWT(token: String, jwtAuthenticator: JWTAuthenticator): Observable<Boolean> {
return Single.create<Boolean> { emitter ->
jwtAuthenticator.authorize(token, CompletionHandler { result ->
Log.d("LoginRepository:loginWithJWT ", "isAuthorized : ${jwtAuthenticator.isAuthorized()}")
if (result.error != null) {
emitter.onError(Throwable(result.error?.errorMessage))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class LoginViewModel(private val webex: Webex, private val loginRepository: Logi
jwtAuthenticator?.let { auth ->
loginRepository.loginWithJWT(token, auth).observeOn(AndroidSchedulers.mainThread()).subscribe({
_isAuthorized.postValue(it)
}, {_isAuthorized.postValue(false)}).autoDispose()
}, {
_errorData.postValue(it.message)
}).autoDispose()
} ?: run {
_isAuthorized.postValue(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ class CallControlsFragment : Fragment(), OnClickListener, CallObserverInterface
}

override fun onConnected(call: Call?) {
Log.d(TAG, "CallObserver onConnected : " + call?.getCallId())
Log.d(TAG, "CallObserver onConnected callId: ${call?.getCallId()}, hasAnyoneJoined: ${webexViewModel.hasAnyoneJoined()}, " +
"isMeeting: ${webexViewModel.isMeeting()}," +
"isPmr: ${webexViewModel.isPmr()}," +
"isSelfCreator: ${webexViewModel.isSelfCreator()}," +
"isSpaceMeeting: ${webexViewModel.isSpaceMeeting()}"+
"isScheduledMeeting: ${webexViewModel.isScheduledMeeting()}")

onCallConnected(call?.getCallId().orEmpty())
ringerManager.stopRinger(if (isIncomingActivity) RingerManager.RingerType.Incoming else RingerManager.RingerType.Outgoing)
webexViewModel.sendDTMF(call?.getCallId().orEmpty(), "2")
Expand Down Expand Up @@ -1507,6 +1513,14 @@ class CallControlsFragment : Fragment(), OnClickListener, CallObserverInterface

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
handleActivityResult(requestCode, resultCode, data)
}

private fun handleActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?
) {
if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) {
val callNumber = data?.getStringExtra(CALLER_ID) ?: ""
//start call association to add new person on call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class ExtrasViewModel(private val extrasRepository: ExtrasRepository) : BaseView
fun getRefreshToken() {
extrasRepository.getRefreshToken().observeOn(AndroidSchedulers.mainThread()).subscribe({
_refreshToken.postValue(it)
}, { _refreshToken.postValue(null) }).autoDispose()
}, {
_refreshToken.postValue(it.message)
}).autoDispose()
}

fun getJwtAccessTokenExpiration(): Date? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ class MessageComposerActivity : AppCompatActivity() {

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
handleActivityResult(requestCode, resultCode, data)
}

private fun handleActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?
) {
if (requestCode == PICKFILE_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
data?.let { intent ->
intent.clipData?.let { data ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.ciscowebex.androidsdk.space.Space
import com.ciscowebex.androidsdk.space.Space.SpaceType
import java.util.*

data class SpaceModel(val id: String, val title: String, val spaceType: SpaceType, val isLocked: Boolean, val lastActivity: Date, val created: Date, val teamId: String, val sipAddress: String) {
data class SpaceModel(val id: String, val title: String, val spaceType: SpaceType?, val isLocked: Boolean, val lastActivity: Date, val created: Date, val teamId: String, val sipAddress: String) {

val createdDateTimeString: String = created.toString()
val lastActivityTimestampString: String = lastActivity.toString()
Expand Down Expand Up @@ -34,8 +34,7 @@ data class SpaceModel(val id: String, val title: String, val spaceType: SpaceTyp

companion object {
fun convertToSpaceModel(space: Space?): SpaceModel {
return SpaceModel(space?.id.orEmpty(), space?.title.orEmpty(), space?.type
?: SpaceType.NONE,
return SpaceModel(space?.id.orEmpty(), space?.title.orEmpty(), space?.type,
space?.isLocked ?: false, space?.lastActivity
?: Date(), space?.created ?: Date(),
space?.teamId.orEmpty(), space?.sipAddress.orEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.ciscowebex.androidsdk.space.SpaceReadStatus
import com.ciscowebex.androidsdk.space.Space.SpaceType
import java.util.*

data class SpaceReadStatusModel(val spaceId: String, val spaceType: SpaceType, val lastActivityDate: Date, val lastSeenDate: Date) {
val spaceTypeString: String = spaceType.name
data class SpaceReadStatusModel(val spaceId: String, val spaceType: SpaceType?, val lastActivityDate: Date, val lastSeenDate: Date) {
val spaceTypeString: String = spaceType?.name.orEmpty()
val lastSeenDateTimeString: String = lastSeenDate.toString()
val lastActivityTimestampString: String = lastActivityDate.toString()
val isSpaceUnread: Boolean = lastActivityDate > lastSeenDate
Expand All @@ -29,8 +29,7 @@ data class SpaceReadStatusModel(val spaceId: String, val spaceType: SpaceType, v

companion object {
fun convertToSpaceReadStatusModel(spaceReadStatus: SpaceReadStatus?): SpaceReadStatusModel {
return SpaceReadStatusModel(spaceReadStatus?.id.orEmpty(),spaceReadStatus?.type
?: SpaceType.NONE, spaceReadStatus?.lastActivityDate ?: Date(),
return SpaceReadStatusModel(spaceReadStatus?.id.orEmpty(), spaceReadStatus?.type, spaceReadStatus?.lastActivityDate ?: Date(),
spaceReadStatus?.lastSeenDate ?: Date())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ class SpacesFragment : Fragment() {

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
handleActivityResult(requestCode, resultCode, data)
}

private fun handleActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?
) {
if (requestCode == requestCodeSearchPersonToAddToSpace && resultCode == Activity.RESULT_OK) {
val person = data?.getParcelableExtra<PersonModel>(Constants.Intent.PERSON)
if (person != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import io.reactivex.Single
class SpacesRepository(private val webex: Webex) : MessagingRepository(webex) {
fun fetchSpacesList(teamId: String?, maxSpaces: Int): Observable<List<SpaceModel>> {
return Single.create<List<SpaceModel>> { emitter ->
webex.spaces.list(teamId, maxSpaces, SpaceType.NONE, SortBy.ID, CompletionHandler { result ->
webex.spaces.list(teamId, maxSpaces, null, SortBy.ID, CompletionHandler { result ->
if (result.isSuccessful) {
emitter.onSuccess(result.data?.map {
SpaceModel.convertToSpaceModel(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ class TeamsFragment : Fragment() {

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
handleActivityResult(requestCode, resultCode, data)
}

private fun handleActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?
) {
if (requestCode == requestCodeSearchPersonToAddToTeam && resultCode == Activity.RESULT_OK) {
val person = data?.getParcelableExtra<PersonModel>(Constants.Intent.PERSON)
if (person != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class TeamMembershipFragment : Fragment() {
lateinit var binding: FragmentMembershipBinding

private val membershipViewModel: TeamMembershipViewModel by inject()
private var teamId: String? = null

companion object {
fun newInstance(teamId: String): TeamMembershipFragment {
Expand All @@ -38,7 +37,7 @@ class TeamMembershipFragment : Fragment() {
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
teamId = arguments?.getString(Constants.Bundle.TEAM_ID)
val teamId = arguments?.getString(Constants.Bundle.TEAM_ID) ?: ""
membershipViewModel.teamId = teamId
return FragmentMembershipBinding.inflate(inflater, container, false)
.also { binding = it }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import io.reactivex.Observable
import io.reactivex.Single

class TeamMembershipRepository(private val webex: Webex) {
fun getTeamMemberships(teamId: String?, max: Int): Observable<List<TeamMembershipModel>> {
fun getTeamMemberships(teamId: String, max: Int): Observable<List<TeamMembershipModel>> {
return Single.create<List<TeamMembershipModel>> { emitter ->
webex.teamMembershipClient.list(teamId, max, CompletionHandler { result ->
Log.d(TeamMembershipRepository::class.java.name, "result: " + result.data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.ciscowebex.androidsdk.kitchensink.BaseViewModel
import io.reactivex.android.schedulers.AndroidSchedulers

class TeamMembershipViewModel(private val membershipRepo: TeamMembershipRepository) : BaseViewModel() {
var teamId: String? = null
var teamId: String = ""
private val _memberships = MutableLiveData<List<TeamMembershipModel>>()
val memberships: LiveData<List<TeamMembershipModel>> = _memberships

Expand Down
8 changes: 2 additions & 6 deletions app/src/main/res/layout/list_item_space_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
android:layout_height="1dp"
android:background="@color/lightGray"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="4dp"
android:visibility="@{message.reply? view.GONE: view.VISIBLE}"/>
android:layout_marginTop="4dp"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/membershipContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@{message.reply? @dimen/padding_2dp:@dimen/padding_8dp}"
android:paddingStart="@{message.reply? @dimen/padding_8dp:@dimen/padding_4dp}"
android:paddingEnd="@{message.reply? @dimen/padding_8dp:@dimen/padding_4dp}"
tools:context="com.ciscowebex.androidsdk.kitchensink.messaging.spaces.members.MembershipActivity">
<ImageView
android:id="@+id/iv_reply"
Expand All @@ -40,7 +36,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:visibility="@{message.reply? view.VISIBLE: view.GONE}"
android:visibility="gone"
app:srcCompat="@drawable/ic_reply" />

<androidx.constraintlayout.widget.Guideline
Expand Down
Loading

0 comments on commit d21c343

Please sign in to comment.