mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-03 04:27:35 +01:00
Fix rebase
This commit is contained in:
parent
cb964c6dcd
commit
b5cdb44642
@ -155,7 +155,6 @@ interface Session :
|
||||
* Returns the identity service associated with the session
|
||||
*/
|
||||
fun identityService(): IdentityService
|
||||
fun callService(): CallSignalingService
|
||||
|
||||
/**
|
||||
* Returns the widget service associated with the session
|
||||
@ -168,9 +167,9 @@ interface Session :
|
||||
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.
|
||||
|
@ -247,7 +247,7 @@ internal class DefaultSession @Inject constructor(
|
||||
|
||||
override fun integrationManagerService() = integrationManagerService
|
||||
|
||||
override fun callService(): CallSignalingService = callSignalingService.get()
|
||||
override fun callSignalingService(): CallSignalingService = callSignalingService.get()
|
||||
|
||||
override fun addListener(listener: Session.Listener) {
|
||||
sessionListeners.addListener(listener)
|
||||
|
@ -41,6 +41,7 @@
|
||||
<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_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_call_candidates">%s sent data to setup the call.</string>
|
||||
<string name="notice_answered_call">%s answered the call.</string>
|
||||
|
@ -125,7 +125,7 @@ class VectorApplication : Application(), HasVectorInjector, MatrixConfiguration.
|
||||
val lastAuthenticatedSession = authenticationService.getLastAuthenticatedSession()!!
|
||||
activeSessionHolder.setActiveSession(lastAuthenticatedSession)
|
||||
lastAuthenticatedSession.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener)
|
||||
lastAuthenticatedSession.callService().addCallListener(webRtcPeerConnectionManager)
|
||||
lastAuthenticatedSession.callSignalingService().addCallListener(webRtcPeerConnectionManager)
|
||||
}
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(object : LifecycleObserver {
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||
|
@ -104,7 +104,7 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||
autoReplyIfNeeded = args.autoAccept
|
||||
|
||||
initialState.callId?.let {
|
||||
session.callService().getCallWithId(it)?.let { mxCall ->
|
||||
session.callSignalingService().getCallWithId(it)?.let { mxCall ->
|
||||
this.call = mxCall
|
||||
mxCall.otherUserId
|
||||
val item: MatrixItem? = session.getUser(mxCall.otherUserId)?.toMatrixItem()
|
||||
|
@ -216,7 +216,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
}
|
||||
|
||||
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?) {
|
||||
callback(data)
|
||||
}
|
||||
@ -441,7 +441,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
|
||||
fun startOutgoingCall(context: Context, signalingRoomId: String, otherUserId: String, isVideoCall: Boolean) {
|
||||
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)
|
||||
currentCall = callContext
|
||||
|
||||
|
@ -479,20 +479,6 @@ class RoomDetailFragment @Inject constructor(
|
||||
}
|
||||
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.video_call -> {
|
||||
roomDetailViewModel.getOtherUserIds()?.firstOrNull()?.let {
|
||||
|
@ -34,7 +34,7 @@ class DisplayableEventFormatter @Inject constructor(
|
||||
private val noticeEventFormatter: NoticeEventFormatter
|
||||
) {
|
||||
|
||||
fun format(timelineEvent: TimelineEvent, prependAuthor: Boolean): CharSequence {
|
||||
fun format(timelineEvent: TimelineEvent, appendAuthor: Boolean): CharSequence {
|
||||
if (timelineEvent.root.isRedacted()) {
|
||||
return noticeEventFormatter.formatRedactedEvent(timelineEvent.root)
|
||||
}
|
||||
@ -53,39 +53,50 @@ class DisplayableEventFormatter @Inject constructor(
|
||||
EventType.MESSAGE -> {
|
||||
timelineEvent.getLastMessageContent()?.let { messageContent ->
|
||||
when (messageContent.msgType) {
|
||||
MessageType.MSGTYPE_VERIFICATION_REQUEST ->
|
||||
simpleFormat(senderName, stringProvider.getString(R.string.verification_request), prependAuthor)
|
||||
MessageType.MSGTYPE_IMAGE ->
|
||||
simpleFormat(senderName, stringProvider.getString(R.string.sent_an_image), prependAuthor)
|
||||
MessageType.MSGTYPE_AUDIO ->
|
||||
simpleFormat(senderName, stringProvider.getString(R.string.sent_an_audio_file), prependAuthor)
|
||||
MessageType.MSGTYPE_VIDEO ->
|
||||
simpleFormat(senderName, stringProvider.getString(R.string.sent_a_video), prependAuthor)
|
||||
MessageType.MSGTYPE_FILE ->
|
||||
simpleFormat(senderName, stringProvider.getString(R.string.sent_a_file), prependAuthor)
|
||||
MessageType.MSGTYPE_TEXT ->
|
||||
MessageType.MSGTYPE_VERIFICATION_REQUEST -> {
|
||||
return simpleFormat(senderName, stringProvider.getString(R.string.verification_request), appendAuthor)
|
||||
}
|
||||
MessageType.MSGTYPE_IMAGE -> {
|
||||
return simpleFormat(senderName, stringProvider.getString(R.string.sent_an_image), appendAuthor)
|
||||
}
|
||||
MessageType.MSGTYPE_AUDIO -> {
|
||||
return simpleFormat(senderName, stringProvider.getString(R.string.sent_an_audio_file), appendAuthor)
|
||||
}
|
||||
MessageType.MSGTYPE_VIDEO -> {
|
||||
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()) {
|
||||
// Skip reply prefix, and show important
|
||||
// TODO add a reply image span ?
|
||||
simpleFormat(senderName, timelineEvent.getTextEditableContent() ?: messageContent.body, prependAuthor)
|
||||
return simpleFormat(senderName, timelineEvent.getTextEditableContent()
|
||||
?: messageContent.body, appendAuthor)
|
||||
} else {
|
||||
simpleFormat(senderName, messageContent.body, prependAuthor)
|
||||
return simpleFormat(senderName, messageContent.body, appendAuthor)
|
||||
}
|
||||
else ->
|
||||
simpleFormat(senderName, messageContent.body, prependAuthor)
|
||||
}
|
||||
else -> {
|
||||
return simpleFormat(senderName, messageContent.body, appendAuthor)
|
||||
}
|
||||
}
|
||||
} ?: span { }
|
||||
}
|
||||
}
|
||||
else ->
|
||||
span {
|
||||
else -> {
|
||||
return span {
|
||||
text = noticeEventFormatter.format(timelineEvent) ?: ""
|
||||
textStyle = "italic"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return span { }
|
||||
}
|
||||
|
||||
private fun simpleFormat(senderName: String, body: CharSequence, prependAuthor: Boolean): CharSequence {
|
||||
return if (prependAuthor) {
|
||||
private fun simpleFormat(senderName: String, body: CharSequence, appendAuthor: Boolean): CharSequence {
|
||||
return if (appendAuthor) {
|
||||
span {
|
||||
text = senderName
|
||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)
|
||||
|
@ -615,7 +615,7 @@ class LoginViewModel @AssistedInject constructor(
|
||||
private fun onSessionCreated(session: Session) {
|
||||
activeSessionHolder.setActiveSession(session)
|
||||
session.configureAndStart(applicationContext, pushRuleTriggerListener, sessionListener)
|
||||
session.callService().addCallListener(webRtcPeerConnectionManager)
|
||||
session.callSignalingService().addCallListener(webRtcPeerConnectionManager)
|
||||
setState {
|
||||
copy(
|
||||
asyncLoginAction = Success(Unit)
|
||||
|
@ -18,7 +18,7 @@
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/voip_call"
|
||||
android:id="@+id/voice_call"
|
||||
android:icon="@drawable/ic_phone"
|
||||
android:title="@string/call"
|
||||
android:visible="false"
|
||||
|
Loading…
x
Reference in New Issue
Block a user