Fix/qa fixes (#1024)

* SES-3512 - Different strings for call baner based on state

* SES-3513 - Missed calls case on remote hangup

* updated readme for BrowserStack
pull/1712/head
ThomasSession 7 months ago committed by GitHub
parent 1bca395711
commit b6e6b68554
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -63,6 +63,11 @@ sha256sum session-$SESSION_VERSION-universal.apk
grep universal.apk signature.asc grep universal.apk signature.asc
``` ```
## Testing
### BrowserStack
This project is tested with BrowserStack.
## License ## License
Copyright 2011 Whisper Systems Copyright 2011 Whisper Systems

@ -1030,10 +1030,13 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
lifecycleScope.launch { lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) { repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.callInProgress.collect { callInProgress -> viewModel.callBanner.collect { callBanner ->
when (callInProgress) { when (callBanner) {
true -> binding.conversationHeader.callInProgress.fadeIn() null -> binding.conversationHeader.callInProgress.fadeOut()
false -> binding.conversationHeader.callInProgress.fadeOut() else -> {
binding.conversationHeader.callInProgress.text = callBanner
binding.conversationHeader.callInProgress.fadeIn()
}
} }
} }
} }

@ -77,6 +77,7 @@ import java.util.UUID
class ConversationViewModel( class ConversationViewModel(
val threadId: Long, val threadId: Long,
val edKeyPair: KeyPair?, val edKeyPair: KeyPair?,
private val context: Context,
private val application: Application, private val application: Application,
private val repository: ConversationRepository, private val repository: ConversationRepository,
private val storage: StorageProtocol, private val storage: StorageProtocol,
@ -267,10 +268,14 @@ class ConversationViewModel(
scope = viewModelScope, scope = viewModelScope,
) )
val callInProgress: StateFlow<Boolean> = callManager.currentConnectionStateFlow.map { val callBanner: StateFlow<String?> = callManager.currentConnectionStateFlow.map {
// a call is in progress if it isn't idle nor disconnected and the recipient is the person on the call // a call is in progress if it isn't idle nor disconnected and the recipient is the person on the call
it !is State.Idle && it !is State.Disconnected && callManager.recipient?.address == recipient?.address if(it !is State.Idle && it !is State.Disconnected && callManager.recipient?.address == recipient?.address){
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), false) // call is started, we need to differentiate between in progress vs incoming
if(it is State.Connected) context.getString(R.string.callsInProgress)
else context.getString(R.string.callsIncomingUnknown)
} else null // null when the call isn't in progress / incoming
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), null)
init { init {
viewModelScope.launch(Dispatchers.Default) { viewModelScope.launch(Dispatchers.Default) {
@ -1114,11 +1119,12 @@ class ConversationViewModel(
private val callManager: CallManager, private val callManager: CallManager,
private val legacyGroupDeprecationManager: LegacyGroupDeprecationManager, private val legacyGroupDeprecationManager: LegacyGroupDeprecationManager,
private val expiredGroupManager: ExpiredGroupManager, private val expiredGroupManager: ExpiredGroupManager,
private val usernameUtils: UsernameUtils private val usernameUtils: UsernameUtils,
) : ViewModelProvider.Factory { ) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T { override fun <T : ViewModel> create(modelClass: Class<T>): T {
return ConversationViewModel( return ConversationViewModel(
context = context,
threadId = threadId, threadId = threadId,
edKeyPair = edKeyPair, edKeyPair = edKeyPair,
application = application, application = application,

@ -297,10 +297,13 @@ class HomeActivity : ScreenLockActionBarActivity(),
lifecycleScope.launch { lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) { repeatOnLifecycle(Lifecycle.State.STARTED) {
homeViewModel.callInProgress.collect { callInProgress -> homeViewModel.callBanner.collect { callBanner ->
when (callInProgress) { when (callBanner) {
true -> binding.callInProgress.fadeIn() null -> binding.callInProgress.fadeOut()
false -> binding.callInProgress.fadeOut() else -> {
binding.callInProgress.text = callBanner
binding.callInProgress.fadeIn()
}
} }
} }
} }

@ -1,11 +1,13 @@
package org.thoughtcrime.securesms.home package org.thoughtcrime.securesms.home
import android.content.ContentResolver import android.content.ContentResolver
import android.content.Context
import androidx.annotation.AttrRes import androidx.annotation.AttrRes
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.asFlow import androidx.lifecycle.asFlow
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.channels.BufferOverflow
@ -24,6 +26,7 @@ import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import network.loki.messenger.R
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_HIDDEN import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_HIDDEN
import org.session.libsession.utilities.ConfigUpdateNotification import org.session.libsession.utilities.ConfigUpdateNotification
import org.session.libsession.utilities.TextSecurePreferences import org.session.libsession.utilities.TextSecurePreferences
@ -40,6 +43,8 @@ import javax.inject.Inject
@HiltViewModel @HiltViewModel
class HomeViewModel @Inject constructor( class HomeViewModel @Inject constructor(
@ApplicationContext
private val context: Context,
private val threadDb: ThreadDatabase, private val threadDb: ThreadDatabase,
private val contentResolver: ContentResolver, private val contentResolver: ContentResolver,
private val prefs: TextSecurePreferences, private val prefs: TextSecurePreferences,
@ -54,9 +59,14 @@ class HomeViewModel @Inject constructor(
onBufferOverflow = BufferOverflow.DROP_OLDEST onBufferOverflow = BufferOverflow.DROP_OLDEST
) )
val callInProgress: StateFlow<Boolean> = callManager.currentConnectionStateFlow.map { val callBanner: StateFlow<String?> = callManager.currentConnectionStateFlow.map {
it !is State.Idle && it !is State.Disconnected // a call is in progress if it isn't idle nor disconnected // a call is in progress if it isn't idle nor disconnected
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), initialValue = false) if(it !is State.Idle && it !is State.Disconnected){
// call is started, we need to differentiate between in progress vs incoming
if(it is State.Connected) context.getString(R.string.callsInProgress)
else context.getString(R.string.callsIncomingUnknown)
} else null // null when the call isn't in progress / incoming
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), initialValue = null)
/** /**
* A [StateFlow] that emits the list of threads and the typing status of each thread. * A [StateFlow] that emits the list of threads and the typing status of each thread.

@ -133,7 +133,7 @@ class WebRtcCallBridge @Inject constructor(
serviceExecutor.execute { serviceExecutor.execute {
callManager.handleRemoteHangup() callManager.handleRemoteHangup()
if (callManager.currentConnectionState in CallState.CAN_DECLINE_STATES) { if (!hasAcceptedCall.value) {
callManager.recipient?.let { recipient -> callManager.recipient?.let { recipient ->
insertMissedCall(recipient, true) insertMissedCall(recipient, true)
} }

Loading…
Cancel
Save