mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Call quality icons and config rotation.
This commit is contained in:
committed by
jeffrey-signal
parent
c6de4c7650
commit
6594b8532e
@@ -125,7 +125,7 @@ object CallQuality {
|
||||
}
|
||||
|
||||
private fun isFeatureEnabled(): Boolean {
|
||||
return (RemoteConfig.callQualitySurvey || SignalStore.internal.callQualitySurveys) && SignalStore.callQuality.isQualitySurveyEnabled
|
||||
return RemoteConfig.callQualitySurvey && SignalStore.callQuality.isQualitySurveyEnabled
|
||||
}
|
||||
|
||||
private enum class CallType(val code: String) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.lifecycle.ViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.storageservice.protos.calls.quality.SubmitCallQualitySurveyRequest
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.jobs.CallQualitySurveySubmissionJob
|
||||
@@ -17,6 +18,10 @@ class CallQualityScreenViewModel(
|
||||
val initialRequest: SubmitCallQualitySurveyRequest
|
||||
) : ViewModel() {
|
||||
|
||||
companion object {
|
||||
private val TAG = Log.tag(CallQualityScreenViewModel::class)
|
||||
}
|
||||
|
||||
private val internalState = MutableStateFlow(CallQualitySheetState())
|
||||
val state: StateFlow<CallQualitySheetState> = internalState
|
||||
|
||||
@@ -37,6 +42,11 @@ class CallQualityScreenViewModel(
|
||||
}
|
||||
|
||||
fun submit() {
|
||||
if (initialRequest.call_type.isEmpty()) {
|
||||
Log.i(TAG, "Ignoring survey submission for blank call_type.")
|
||||
return
|
||||
}
|
||||
|
||||
val stateSnapshot = state.value
|
||||
val somethingElseDescription: String? = if (stateSnapshot.selectedQualityIssues.contains(CallQualityIssue.SOMETHING_ELSE)) {
|
||||
stateSnapshot.somethingElseDescription.takeIf { it.isNotEmpty() }
|
||||
|
||||
@@ -27,6 +27,7 @@ import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
@@ -556,7 +557,9 @@ private fun HadIssuesButton(
|
||||
text = stringResource(R.string.CallQualitySheet__had_issues),
|
||||
containerColor = MaterialTheme.colorScheme.errorContainer,
|
||||
contentColor = MaterialTheme.colorScheme.error,
|
||||
onClick = onClick
|
||||
onClick = onClick,
|
||||
contentDescription = stringResource(R.string.CallQualitySheet__had_issues_content_description),
|
||||
imageVector = ImageVector.vectorResource(R.drawable.symbol_thumbs_down_24)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -568,7 +571,9 @@ private fun GreatButton(
|
||||
text = stringResource(R.string.CallQualitySheet__great),
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||
contentColor = MaterialTheme.colorScheme.primary,
|
||||
onClick = onClick
|
||||
onClick = onClick,
|
||||
contentDescription = stringResource(R.string.CallQualitySheet__great_content_description),
|
||||
imageVector = ImageVector.vectorResource(R.drawable.symbol_thumbs_up_24)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -577,8 +582,9 @@ private fun FeedbackButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
containerColor: Color,
|
||||
contentColor: Color
|
||||
// imageVector icon
|
||||
contentColor: Color,
|
||||
imageVector: ImageVector,
|
||||
contentDescription: String
|
||||
) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
@@ -591,7 +597,12 @@ private fun FeedbackButton(
|
||||
.clip(CircleShape)
|
||||
.background(color = containerColor)
|
||||
) {
|
||||
// TODO - icon with contentcolor tint
|
||||
Icon(
|
||||
imageVector = imageVector,
|
||||
contentDescription = contentDescription,
|
||||
tint = contentColor,
|
||||
modifier = Modifier.size(36.dp)
|
||||
)
|
||||
}
|
||||
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user