mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
VoIP: clean after PR's review
This commit is contained in:
parent
1ef9ed5202
commit
191cef6fff
10 changed files with 34 additions and 15 deletions
|
@ -73,8 +73,7 @@ interface Session :
|
|||
HomeServerCapabilitiesService,
|
||||
SecureStorageService,
|
||||
AccountDataService,
|
||||
AccountService,
|
||||
ThirdPartyService {
|
||||
AccountService {
|
||||
|
||||
/**
|
||||
* The params associated to the session
|
||||
|
@ -214,6 +213,11 @@ interface Session :
|
|||
*/
|
||||
fun searchService(): SearchService
|
||||
|
||||
/**
|
||||
* Returns the third party service associated with the session
|
||||
*/
|
||||
fun thirdPartyService(): ThirdPartyService
|
||||
|
||||
/**
|
||||
* Add a listener to the session.
|
||||
* @param listener the listener to add.
|
||||
|
|
|
@ -19,6 +19,9 @@ package org.matrix.android.sdk.api.session.thirdparty
|
|||
import org.matrix.android.sdk.api.session.room.model.thirdparty.ThirdPartyProtocol
|
||||
import org.matrix.android.sdk.api.session.thirdparty.model.ThirdPartyUser
|
||||
|
||||
/**
|
||||
* See https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-thirdparty-protocols
|
||||
*/
|
||||
interface ThirdPartyService {
|
||||
|
||||
/**
|
||||
|
|
|
@ -114,7 +114,7 @@ internal class DefaultSession @Inject constructor(
|
|||
private val accountService: Lazy<AccountService>,
|
||||
private val defaultIdentityService: DefaultIdentityService,
|
||||
private val integrationManagerService: IntegrationManagerService,
|
||||
private val thirdPartyService: ThirdPartyService,
|
||||
private val thirdPartyService: Lazy<ThirdPartyService>,
|
||||
private val callSignalingService: Lazy<CallSignalingService>,
|
||||
@UnauthenticatedWithCertificate
|
||||
private val unauthenticatedWithCertificateOkHttpClient: Lazy<OkHttpClient>,
|
||||
|
@ -135,7 +135,6 @@ internal class DefaultSession @Inject constructor(
|
|||
ProfileService by profileService.get(),
|
||||
AccountDataService by accountDataService.get(),
|
||||
AccountService by accountService.get(),
|
||||
ThirdPartyService by thirdPartyService,
|
||||
GlobalErrorHandler.Listener {
|
||||
|
||||
override val sharedSecretStorageService: SharedSecretStorageService
|
||||
|
@ -260,6 +259,8 @@ internal class DefaultSession @Inject constructor(
|
|||
|
||||
override fun searchService(): SearchService = searchService.get()
|
||||
|
||||
override fun thirdPartyService(): ThirdPartyService = thirdPartyService.get()
|
||||
|
||||
override fun getOkHttpClient(): OkHttpClient {
|
||||
return unauthenticatedWithCertificateOkHttpClient.get()
|
||||
}
|
||||
|
|
|
@ -385,6 +385,11 @@ SOFTWARE.
|
|||
<br/>
|
||||
Copyright 2016 JetRadar
|
||||
</li>
|
||||
<li>
|
||||
<b>dialogs / android-dialer</b>
|
||||
<br/>
|
||||
Copyright (c) 2017-present, dialog LLC <info@dlg.im>
|
||||
</li>
|
||||
</ul>
|
||||
<pre>
|
||||
Apache License
|
||||
|
|
|
@ -33,7 +33,7 @@ class DialPadLookup @Inject constructor(val session: Session,
|
|||
suspend fun lookupPhoneNumber(phoneNumber: String): Result {
|
||||
val supportedProtocolKey = callManager.supportedPSTNProtocol ?: throw Failure()
|
||||
val thirdPartyUser = tryOrNull {
|
||||
session.getThirdPartyUser(supportedProtocolKey, fields = mapOf(
|
||||
session.thirdPartyService().getThirdPartyUser(supportedProtocolKey, fields = mapOf(
|
||||
"m.id.phone" to phoneNumber
|
||||
)).firstOrNull()
|
||||
} ?: throw Failure()
|
||||
|
|
|
@ -80,9 +80,9 @@ class CallTransferActivity : VectorBaseActivity<ActivityCallTransferBinding>(),
|
|||
waitingView = views.waitingView.waitingView
|
||||
|
||||
callTransferViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is CallTransferViewEvents.Dismiss -> finish()
|
||||
CallTransferViewEvents.Loading -> showWaitingView()
|
||||
when (it) {
|
||||
is CallTransferViewEvents.Dismiss -> finish()
|
||||
CallTransferViewEvents.Loading -> showWaitingView()
|
||||
is CallTransferViewEvents.FailToTransfer -> showSnackbar(getString(R.string.call_transfer_failure))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ private const val PSTN_MATRIX_KEY = "m.protocol.pstn"
|
|||
|
||||
suspend fun Session.getSupportedPSTN(maxTries: Int): String? {
|
||||
val thirdPartyProtocols: Map<String, ThirdPartyProtocol> = try {
|
||||
getThirdPartyProtocols()
|
||||
thirdPartyService().getThirdPartyProtocols()
|
||||
} catch (failure: Throwable) {
|
||||
if (maxTries == 1) {
|
||||
return null
|
||||
|
|
|
@ -118,7 +118,9 @@ class WebRtcCallManager @Inject constructor(
|
|||
GlobalScope.launch {
|
||||
supportedPSTNProtocol = currentSession?.getSupportedPSTN(3)
|
||||
if (supportedPSTNProtocol != null) {
|
||||
pstnSupportListeners.forEach { it.onPSTNSupportUpdated() }
|
||||
pstnSupportListeners.forEach {
|
||||
tryOrNull { it.onPSTNSupportUpdated() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,8 +75,8 @@ class MatrixToBottomSheetViewModel @AssistedInject constructor(
|
|||
return
|
||||
}
|
||||
|
||||
when (permalinkData) {
|
||||
is PermalinkData.UserLink -> {
|
||||
when (permalinkData) {
|
||||
is PermalinkData.UserLink -> {
|
||||
val user = resolveUser(permalinkData.userId)
|
||||
setState {
|
||||
copy(
|
||||
|
@ -85,11 +85,11 @@ class MatrixToBottomSheetViewModel @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
is PermalinkData.RoomLink -> {
|
||||
is PermalinkData.RoomLink -> {
|
||||
// not yet supported
|
||||
_viewEvents.post(MatrixToViewEvents.Dismiss)
|
||||
}
|
||||
is PermalinkData.GroupLink -> {
|
||||
is PermalinkData.GroupLink -> {
|
||||
// not yet supported
|
||||
_viewEvents.post(MatrixToViewEvents.Dismiss)
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package im.vector.app.features.roomdirectory.picker
|
|||
import androidx.lifecycle.viewModelScope
|
||||
import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.FragmentViewModelContext
|
||||
import com.airbnb.mvrx.Loading
|
||||
import com.airbnb.mvrx.MvRxViewModelFactory
|
||||
import com.airbnb.mvrx.Success
|
||||
import com.airbnb.mvrx.ViewModelContext
|
||||
|
@ -53,8 +54,11 @@ class RoomDirectoryPickerViewModel @AssistedInject constructor(@Assisted initial
|
|||
|
||||
private fun load() {
|
||||
viewModelScope.launch {
|
||||
setState {
|
||||
copy(asyncThirdPartyRequest = Loading())
|
||||
}
|
||||
try {
|
||||
val thirdPartyProtocols = session.getThirdPartyProtocols()
|
||||
val thirdPartyProtocols = session.thirdPartyService().getThirdPartyProtocols()
|
||||
setState {
|
||||
copy(asyncThirdPartyRequest = Success(thirdPartyProtocols))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue