DialPad: clean code

This commit is contained in:
ganfra 2021-06-03 15:57:02 +02:00
parent a95eed7163
commit d520dfe108
5 changed files with 2 additions and 9 deletions

View file

@ -29,7 +29,7 @@ class DialPadLookup @Inject constructor(
private val webRtcCallManager: WebRtcCallManager,
private val directRoomHelper: DirectRoomHelper
) {
sealed class Failure : Throwable(){
sealed class Failure : Throwable() {
object NoResult: Failure()
object NumberIsYours: Failure()
}
@ -46,7 +46,7 @@ class DialPadLookup @Inject constructor(
} else {
thirdPartyUser.userId
}
if(nativeUserId == session.myUserId) throw Failure.NumberIsYours
if (nativeUserId == session.myUserId) throw Failure.NumberIsYours
val roomId = directRoomHelper.ensureDMExists(nativeUserId)
return Result(userId = nativeUserId, roomId = roomId)
}

View file

@ -26,13 +26,11 @@ import dagger.assisted.AssistedInject
import im.vector.app.AppStateHandler
import im.vector.app.RoomGroupingMethod
import im.vector.app.core.di.HasScreenInjector
import im.vector.app.core.platform.EmptyViewEvents
import im.vector.app.core.platform.VectorViewModel
import im.vector.app.features.call.dialpad.DialPadLookup
import im.vector.app.features.call.lookup.CallProtocolsChecker
import im.vector.app.features.call.webrtc.WebRtcCallManager
import im.vector.app.features.createdirect.DirectRoomHelper
import im.vector.app.features.home.room.detail.RoomDetailViewEvents
import im.vector.app.features.ui.UiStateRepository
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.Dispatchers

View file

@ -46,4 +46,3 @@ sealed class HomeTab(@StringRes val titleRes: Int) {
data class RoomList(val displayMode: RoomListDisplayMode) : HomeTab(displayMode.titleRes)
object DialPad : HomeTab(R.string.call_dial_pad_title)
}

View file

@ -39,7 +39,6 @@ import im.vector.app.core.mvrx.runCatchingToAsync
import im.vector.app.core.platform.VectorViewModel
import im.vector.app.core.resources.StringProvider
import im.vector.app.features.call.conference.JitsiService
import im.vector.app.features.call.dialpad.DialPadLookup
import im.vector.app.features.call.lookup.CallProtocolsChecker
import im.vector.app.features.call.webrtc.WebRtcCallManager
import im.vector.app.features.command.CommandParser

View file

@ -16,7 +16,6 @@
package im.vector.app.features.home.room.detail
import android.os.Bundle
import androidx.activity.result.ActivityResultLauncher
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
@ -29,7 +28,6 @@ import im.vector.app.features.call.webrtc.WebRtcCallManager
import im.vector.app.features.settings.VectorPreferences
import org.matrix.android.sdk.api.session.widgets.model.WidgetType
class StartCallActionsHandler(
private val roomId: String,
private val fragment: Fragment,
@ -152,5 +150,4 @@ class StartCallActionsHandler(
}
}
}
}