Fix rebase

This commit is contained in:
Valere 2020-06-11 15:44:14 +02:00
parent cb964c6dcd
commit b5cdb44642
10 changed files with 42 additions and 45 deletions

View File

@ -155,7 +155,6 @@ interface Session :
* Returns the identity service associated with the session * Returns the identity service associated with the session
*/ */
fun identityService(): IdentityService fun identityService(): IdentityService
fun callService(): CallSignalingService
/** /**
* Returns the widget service associated with the session * Returns the widget service associated with the session
@ -168,9 +167,9 @@ interface Session :
fun integrationManagerService(): IntegrationManagerService fun integrationManagerService(): IntegrationManagerService
/** /**
* Returns the cryptoService associated with the session * Returns the call signaling service associated with the session
*/ */
fun callService(): CallService fun callSignalingService(): CallSignalingService
/** /**
* Add a listener to the session. * Add a listener to the session.

View File

@ -247,7 +247,7 @@ internal class DefaultSession @Inject constructor(
override fun integrationManagerService() = integrationManagerService override fun integrationManagerService() = integrationManagerService
override fun callService(): CallSignalingService = callSignalingService.get() override fun callSignalingService(): CallSignalingService = callSignalingService.get()
override fun addListener(listener: Session.Listener) { override fun addListener(listener: Session.Listener) {
sessionListeners.addListener(listener) sessionListeners.addListener(listener)

View File

@ -41,6 +41,7 @@
<string name="notice_room_name_changed_by_you">You changed the room name to: %1$s</string> <string name="notice_room_name_changed_by_you">You changed the room name to: %1$s</string>
<string name="notice_placed_video_call">%s placed a video call.</string> <string name="notice_placed_video_call">%s placed a video call.</string>
<string name="notice_placed_video_call_by_you">You placed a video call.</string> <string name="notice_placed_video_call_by_you">You placed a video call.</string>
<string name="notice_placed_voice_call_by_you">You placed a voice call.</string>
<string name="notice_placed_voice_call">%s placed a voice call.</string> <string name="notice_placed_voice_call">%s placed a voice call.</string>
<string name="notice_call_candidates">%s sent data to setup the call.</string> <string name="notice_call_candidates">%s sent data to setup the call.</string>
<string name="notice_answered_call">%s answered the call.</string> <string name="notice_answered_call">%s answered the call.</string>

View File

@ -125,7 +125,7 @@ class VectorApplication : Application(), HasVectorInjector, MatrixConfiguration.
val lastAuthenticatedSession = authenticationService.getLastAuthenticatedSession()!! val lastAuthenticatedSession = authenticationService.getLastAuthenticatedSession()!!
activeSessionHolder.setActiveSession(lastAuthenticatedSession) activeSessionHolder.setActiveSession(lastAuthenticatedSession)
lastAuthenticatedSession.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener) lastAuthenticatedSession.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener)
lastAuthenticatedSession.callService().addCallListener(webRtcPeerConnectionManager) lastAuthenticatedSession.callSignalingService().addCallListener(webRtcPeerConnectionManager)
} }
ProcessLifecycleOwner.get().lifecycle.addObserver(object : LifecycleObserver { ProcessLifecycleOwner.get().lifecycle.addObserver(object : LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME) @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)

View File

@ -104,7 +104,7 @@ class VectorCallViewModel @AssistedInject constructor(
autoReplyIfNeeded = args.autoAccept autoReplyIfNeeded = args.autoAccept
initialState.callId?.let { initialState.callId?.let {
session.callService().getCallWithId(it)?.let { mxCall -> session.callSignalingService().getCallWithId(it)?.let { mxCall ->
this.call = mxCall this.call = mxCall
mxCall.otherUserId mxCall.otherUserId
val item: MatrixItem? = session.getUser(mxCall.otherUserId)?.toMatrixItem() val item: MatrixItem? = session.getUser(mxCall.otherUserId)?.toMatrixItem()

View File

@ -216,7 +216,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
} }
private fun getTurnServer(callback: ((TurnServer?) -> Unit)) { private fun getTurnServer(callback: ((TurnServer?) -> Unit)) {
sessionHolder.getActiveSession().callService().getTurnServer(object : MatrixCallback<TurnServer?> { sessionHolder.getActiveSession().callSignalingService().getTurnServer(object : MatrixCallback<TurnServer?> {
override fun onSuccess(data: TurnServer?) { override fun onSuccess(data: TurnServer?) {
callback(data) callback(data)
} }
@ -441,7 +441,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
fun startOutgoingCall(context: Context, signalingRoomId: String, otherUserId: String, isVideoCall: Boolean) { fun startOutgoingCall(context: Context, signalingRoomId: String, otherUserId: String, isVideoCall: Boolean) {
Timber.v("## VOIP startOutgoingCall in room $signalingRoomId to $otherUserId isVideo $isVideoCall") Timber.v("## VOIP startOutgoingCall in room $signalingRoomId to $otherUserId isVideo $isVideoCall")
val createdCall = sessionHolder.getSafeActiveSession()?.callService()?.createOutgoingCall(signalingRoomId, otherUserId, isVideoCall) ?: return val createdCall = sessionHolder.getSafeActiveSession()?.callSignalingService()?.createOutgoingCall(signalingRoomId, otherUserId, isVideoCall) ?: return
val callContext = CallContext(createdCall) val callContext = CallContext(createdCall)
currentCall = callContext currentCall = callContext

View File

@ -479,20 +479,6 @@ class RoomDetailFragment @Inject constructor(
} }
true true
} }
else -> super.onOptionsItemSelected(item)
}
if (item.itemId == R.id.resend_all) {
roomDetailViewModel.handle(RoomDetailAction.ResendAll)
return true
}
if (item.itemId == R.id.voice_call || item.itemId == R.id.video_call) {
roomDetailViewModel.getOtherUserIds()?.firstOrNull()?.let {
webRtcPeerConnectionManager.startOutgoingCall(requireContext(), roomDetailArgs.roomId, it, item.itemId == R.id.video_call)
}
R.id.resend_all -> {
roomDetailViewModel.handle(RoomDetailAction.ResendAll)
true
}
R.id.voice_call, R.id.voice_call,
R.id.video_call -> { R.id.video_call -> {
roomDetailViewModel.getOtherUserIds()?.firstOrNull()?.let { roomDetailViewModel.getOtherUserIds()?.firstOrNull()?.let {

View File

@ -34,7 +34,7 @@ class DisplayableEventFormatter @Inject constructor(
private val noticeEventFormatter: NoticeEventFormatter private val noticeEventFormatter: NoticeEventFormatter
) { ) {
fun format(timelineEvent: TimelineEvent, prependAuthor: Boolean): CharSequence { fun format(timelineEvent: TimelineEvent, appendAuthor: Boolean): CharSequence {
if (timelineEvent.root.isRedacted()) { if (timelineEvent.root.isRedacted()) {
return noticeEventFormatter.formatRedactedEvent(timelineEvent.root) return noticeEventFormatter.formatRedactedEvent(timelineEvent.root)
} }
@ -53,39 +53,50 @@ class DisplayableEventFormatter @Inject constructor(
EventType.MESSAGE -> { EventType.MESSAGE -> {
timelineEvent.getLastMessageContent()?.let { messageContent -> timelineEvent.getLastMessageContent()?.let { messageContent ->
when (messageContent.msgType) { when (messageContent.msgType) {
MessageType.MSGTYPE_VERIFICATION_REQUEST -> MessageType.MSGTYPE_VERIFICATION_REQUEST -> {
simpleFormat(senderName, stringProvider.getString(R.string.verification_request), prependAuthor) return simpleFormat(senderName, stringProvider.getString(R.string.verification_request), appendAuthor)
MessageType.MSGTYPE_IMAGE -> }
simpleFormat(senderName, stringProvider.getString(R.string.sent_an_image), prependAuthor) MessageType.MSGTYPE_IMAGE -> {
MessageType.MSGTYPE_AUDIO -> return simpleFormat(senderName, stringProvider.getString(R.string.sent_an_image), appendAuthor)
simpleFormat(senderName, stringProvider.getString(R.string.sent_an_audio_file), prependAuthor) }
MessageType.MSGTYPE_VIDEO -> MessageType.MSGTYPE_AUDIO -> {
simpleFormat(senderName, stringProvider.getString(R.string.sent_a_video), prependAuthor) return simpleFormat(senderName, stringProvider.getString(R.string.sent_an_audio_file), appendAuthor)
MessageType.MSGTYPE_FILE -> }
simpleFormat(senderName, stringProvider.getString(R.string.sent_a_file), prependAuthor) MessageType.MSGTYPE_VIDEO -> {
MessageType.MSGTYPE_TEXT -> return simpleFormat(senderName, stringProvider.getString(R.string.sent_a_video), appendAuthor)
}
MessageType.MSGTYPE_FILE -> {
return simpleFormat(senderName, stringProvider.getString(R.string.sent_a_file), appendAuthor)
}
MessageType.MSGTYPE_TEXT -> {
if (messageContent.isReply()) { if (messageContent.isReply()) {
// Skip reply prefix, and show important // Skip reply prefix, and show important
// TODO add a reply image span ? // TODO add a reply image span ?
simpleFormat(senderName, timelineEvent.getTextEditableContent() ?: messageContent.body, prependAuthor) return simpleFormat(senderName, timelineEvent.getTextEditableContent()
?: messageContent.body, appendAuthor)
} else { } else {
simpleFormat(senderName, messageContent.body, prependAuthor) return simpleFormat(senderName, messageContent.body, appendAuthor)
} }
else ->
simpleFormat(senderName, messageContent.body, prependAuthor)
} }
} ?: span { } else -> {
return simpleFormat(senderName, messageContent.body, appendAuthor)
} }
else -> }
span { }
}
else -> {
return span {
text = noticeEventFormatter.format(timelineEvent) ?: "" text = noticeEventFormatter.format(timelineEvent) ?: ""
textStyle = "italic" textStyle = "italic"
} }
} }
} }
private fun simpleFormat(senderName: String, body: CharSequence, prependAuthor: Boolean): CharSequence { return span { }
return if (prependAuthor) { }
private fun simpleFormat(senderName: String, body: CharSequence, appendAuthor: Boolean): CharSequence {
return if (appendAuthor) {
span { span {
text = senderName text = senderName
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_primary) textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)

View File

@ -615,7 +615,7 @@ class LoginViewModel @AssistedInject constructor(
private fun onSessionCreated(session: Session) { private fun onSessionCreated(session: Session) {
activeSessionHolder.setActiveSession(session) activeSessionHolder.setActiveSession(session)
session.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener) session.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener)
session.callService().addCallListener(webRtcPeerConnectionManager) session.callSignalingService().addCallListener(webRtcPeerConnectionManager)
setState { setState {
copy( copy(
asyncLoginAction = Success(Unit) asyncLoginAction = Success(Unit)

View File

@ -18,7 +18,7 @@
app:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/voip_call" android:id="@+id/voice_call"
android:icon="@drawable/ic_phone" android:icon="@drawable/ic_phone"
android:title="@string/call" android:title="@string/call"
android:visible="false" android:visible="false"