mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 02:58:45 +00: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(
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.signal.core.util.readToList
|
||||
import org.signal.core.util.requireLong
|
||||
import org.signal.core.util.requireString
|
||||
import org.signal.ringrtc.CallManager
|
||||
import org.signal.storageservice.protos.calls.quality.SubmitCallQualitySurveyRequest
|
||||
import org.thoughtcrime.securesms.BuildConfig
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.calls.quality.CallQualityBottomSheetFragment
|
||||
@@ -59,6 +60,7 @@ import org.thoughtcrime.securesms.payments.DataExportUtil
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
import org.thoughtcrime.securesms.util.BottomSheetUtil
|
||||
import org.thoughtcrime.securesms.util.ConversationUtil
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
@@ -580,11 +582,12 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
}
|
||||
)
|
||||
|
||||
switchPref(
|
||||
title = DSLSettingsText.from("Enable call quality surveys"),
|
||||
isChecked = state.callQualitySurveys,
|
||||
clickPref(
|
||||
title = DSLSettingsText.from("Display call quality survey"),
|
||||
onClick = {
|
||||
viewModel.setEnableCallQualitySurveys(!state.callQualitySurveys)
|
||||
CallQualityBottomSheetFragment
|
||||
.create(SubmitCallQualitySurveyRequest())
|
||||
.show(parentFragmentManager, BottomSheetUtil.STANDARD_BOTTOM_SHEET_FRAGMENT_TAG)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -31,6 +31,5 @@ data class InternalSettingsState(
|
||||
val hasPendingOneTimeDonation: Boolean,
|
||||
val hevcEncoding: Boolean,
|
||||
val newCallingUi: Boolean,
|
||||
val callQualitySurveys: Boolean,
|
||||
val forceSplitPane: Boolean
|
||||
)
|
||||
|
||||
@@ -197,7 +197,6 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
||||
hasPendingOneTimeDonation = SignalStore.inAppPayments.getPendingOneTimeDonation() != null,
|
||||
hevcEncoding = SignalStore.internal.hevcEncoding,
|
||||
newCallingUi = SignalStore.internal.newCallingUi,
|
||||
callQualitySurveys = SignalStore.internal.callQualitySurveys,
|
||||
forceSplitPane = SignalStore.internal.forceSplitPane
|
||||
)
|
||||
|
||||
@@ -214,11 +213,6 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
||||
refresh()
|
||||
}
|
||||
|
||||
fun setEnableCallQualitySurveys(enabled: Boolean) {
|
||||
SignalStore.internal.callQualitySurveys = enabled
|
||||
refresh()
|
||||
}
|
||||
|
||||
fun setForceSplitPane(forceSplitPane: Boolean) {
|
||||
SignalStore.internal.forceSplitPane = forceSplitPane
|
||||
refresh()
|
||||
|
||||
@@ -32,7 +32,6 @@ class InternalValues internal constructor(store: KeyValueStore) : SignalStoreVal
|
||||
const val WEB_SOCKET_SHADOWING_STATS: String = "internal.web_socket_shadowing_stats"
|
||||
const val ENCODE_HEVC: String = "internal.hevc_encoding"
|
||||
const val NEW_CALL_UI: String = "internal.new.call.ui"
|
||||
const val CALL_QUALITY_SURVEYS: String = "internal.call_quality_surveys"
|
||||
const val FORCE_SPLIT_PANE_ON_COMPACT_LANDSCAPE: String = "internal.force.split.pane.on.compact.landscape.ui"
|
||||
const val SHOW_ARCHIVE_STATE_HINT: String = "internal.show_archive_state_hint"
|
||||
const val INCLUDE_DEBUGLOG_IN_BACKUP: String = "internal.include_debuglog_in_backup"
|
||||
@@ -171,8 +170,6 @@ class InternalValues internal constructor(store: KeyValueStore) : SignalStoreVal
|
||||
|
||||
var newCallingUi: Boolean by booleanValue(NEW_CALL_UI, false).defaultForExternalUsers()
|
||||
|
||||
var callQualitySurveys: Boolean by booleanValue(CALL_QUALITY_SURVEYS, false).defaultForExternalUsers()
|
||||
|
||||
var lastScrollPosition: Int by integerValue(LAST_SCROLL_POSITION, 0).defaultForExternalUsers()
|
||||
|
||||
var useConversationItemV2Media by booleanValue(CONVERSATION_ITEM_V2_MEDIA, false).defaultForExternalUsers()
|
||||
|
||||
@@ -1233,7 +1233,7 @@ object RemoteConfig {
|
||||
@JvmStatic
|
||||
@get:JvmName("callQualitySurvey")
|
||||
val callQualitySurvey: Boolean by remoteBoolean(
|
||||
key = "android.callQualitySurvey",
|
||||
key = "android.callQualitySurvey.2",
|
||||
defaultValue = false,
|
||||
hotSwappable = true
|
||||
)
|
||||
|
||||
9
app/src/main/res/drawable/symbol_thumbs_down_24.xml
Normal file
9
app/src/main/res/drawable/symbol_thumbs_down_24.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11.75 23.38c-0.6 0-1.2-0.23-1.58-0.83-0.31-0.51-0.4-1.18-0.4-1.88 0-2.75-0.94-4.12-1.96-5.61L7.8 15.05c-0.26-0.38-0.52-0.76-0.78-1.18h-2c-1.18 0-2.11-0.77-2.7-1.73-0.6-0.97-0.94-2.26-0.94-3.64 0-1.38 0.34-2.67 0.94-3.64 0.59-0.96 1.52-1.74 2.7-1.74h3.21c0.69-0.34 1.5-0.57 2.45-0.72 1.24-0.2 2.75-0.27 4.6-0.27h2.44c1.3 0 2.34 1.04 2.34 2.33 0 0.16-0.02 0.32-0.05 0.46 0.76 0.45 1.27 1.28 1.27 2.23 0 0.33-0.07 0.66-0.19 0.95 0.56 0.48 0.92 1.18 0.92 1.97 0 0.7-0.28 1.35-0.74 1.81 0.16 0.34 0.25 0.72 0.25 1.12 0 1.43-1.15 2.58-2.58 2.58h-2.2c-1.2 0-1.66 0.2-1.83 0.37-0.15 0.14-0.29 0.41-0.29 1.2 0 0.37 0.03 0.55 0.07 0.8 0.06 0.36 0.12 0.76 0.12 1.62 0 0.86-0.2 1.77-0.69 2.5-0.5 0.75-1.3 1.3-2.37 1.3Zm-0.1-1.76h0.1c0.4 0 0.68-0.17 0.91-0.52 0.25-0.37 0.4-0.92 0.4-1.53 0-0.73-0.05-1.05-0.1-1.33v-0.02c-0.04-0.28-0.09-0.57-0.09-1.07 0-0.87 0.12-1.81 0.85-2.48 0.7-0.65 1.74-0.84 3.02-0.84h2.2c0.46 0 0.83-0.37 0.83-0.83 0-0.26-0.12-0.5-0.3-0.65-0.25-0.2-0.37-0.5-0.32-0.82 0.06-0.3 0.27-0.57 0.56-0.68 0.32-0.11 0.55-0.42 0.55-0.78 0-0.39-0.27-0.72-0.63-0.8-0.32-0.08-0.56-0.33-0.64-0.64C18.9 8.3 19 7.98 19.25 7.77c0.17-0.16 0.28-0.38 0.28-0.62 0-0.44-0.35-0.8-0.78-0.83-0.33-0.03-0.63-0.24-0.75-0.55-0.13-0.3-0.07-0.66 0.16-0.91 0.1-0.1 0.15-0.24 0.15-0.4 0-0.32-0.27-0.58-0.59-0.58h-2.44c-1.81 0-3.22 0.07-4.32 0.25C9.86 4.3 9.13 4.57 8.64 4.9 7.75 5.53 7.37 6.57 7.37 8.85c0 2.49 0.88 3.76 1.88 5.21 1.08 1.57 2.27 3.31 2.27 6.6 0 0.63 0.1 0.88 0.14 0.96Zm-7.84-10.4c0.4 0.67 0.86 0.9 1.2 0.9h1.16c-0.33-0.9-0.54-1.95-0.54-3.27 0-1.55 0.15-2.9 0.74-3.97H5.02c-0.35 0-0.8 0.23-1.21 0.9C3.4 6.43 3.12 7.39 3.12 8.5c0 1.1 0.28 2.07 0.69 2.72Z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/symbol_thumbs_up_24.xml
Normal file
9
app/src/main/res/drawable/symbol_thumbs_up_24.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11.75 1.13c-0.6 0-1.2 0.22-1.58 0.82-0.31 0.51-0.4 1.18-0.4 1.88 0 2.75-0.94 4.12-1.96 5.61L7.8 9.45c-0.26 0.38-0.52 0.76-0.78 1.18h-2c-1.18 0-2.11 0.77-2.7 1.73-0.6 0.97-0.94 2.26-0.94 3.64 0 1.38 0.34 2.67 0.94 3.64 0.59 0.96 1.52 1.73 2.7 1.73h3.21c0.69 0.35 1.5 0.58 2.45 0.73 1.24 0.2 2.75 0.27 4.6 0.27h2.44c1.3 0 2.34-1.04 2.34-2.33 0-0.16-0.02-0.32-0.05-0.46 0.76-0.45 1.27-1.28 1.27-2.23 0-0.33-0.07-0.66-0.19-0.95 0.56-0.48 0.92-1.18 0.92-1.97 0-0.7-0.28-1.35-0.74-1.81 0.16-0.34 0.25-0.72 0.25-1.12 0-1.43-1.15-2.58-2.58-2.58h-2.2c-1.2 0-1.66-0.2-1.83-0.37-0.15-0.14-0.29-0.41-0.29-1.2 0-0.37 0.03-0.55 0.07-0.8 0.06-0.36 0.12-0.76 0.12-1.62 0-0.86-0.2-1.77-0.69-2.5-0.5-0.75-1.3-1.3-2.37-1.3Zm-0.1 1.75h0.1c0.4 0 0.68 0.17 0.91 0.52 0.25 0.37 0.4 0.92 0.4 1.53 0 0.73-0.05 1.05-0.1 1.33v0.02c-0.04 0.28-0.09 0.57-0.09 1.07 0 0.87 0.12 1.81 0.85 2.48 0.7 0.65 1.74 0.84 3.02 0.84h2.2c0.46 0 0.83 0.37 0.83 0.83 0 0.26-0.12 0.5-0.3 0.65-0.25 0.2-0.37 0.5-0.32 0.82 0.06 0.3 0.27 0.57 0.56 0.68 0.32 0.11 0.55 0.42 0.55 0.78 0 0.39-0.27 0.72-0.63 0.8-0.32 0.08-0.56 0.33-0.64 0.64-0.08 0.32 0.02 0.65 0.26 0.86 0.17 0.16 0.28 0.38 0.28 0.62 0 0.44-0.35 0.8-0.78 0.83-0.33 0.03-0.63 0.24-0.75 0.55-0.13 0.3-0.07 0.66 0.16 0.91 0.1 0.1 0.15 0.24 0.15 0.4 0 0.32-0.27 0.59-0.59 0.59h-2.44c-1.81 0-3.22-0.08-4.32-0.26-1.1-0.17-1.83-0.44-2.32-0.78-0.89-0.62-1.27-1.66-1.27-3.94 0-2.49 0.88-3.76 1.88-5.21 1.08-1.57 2.27-3.31 2.27-6.6 0-0.63 0.1-0.88 0.14-0.96Zm-7.84 10.4c0.4-0.67 0.86-0.9 1.2-0.9h1.16c-0.33 0.9-0.54 1.95-0.54 3.27 0 1.55 0.15 2.9 0.74 3.97H5.02c-0.35 0-0.8-0.23-1.21-0.9-0.4-0.65-0.69-1.61-0.69-2.72 0-1.1 0.28-2.07 0.69-2.72Z"/>
|
||||
</vector>
|
||||
@@ -9025,6 +9025,10 @@
|
||||
<string name="CallQualitySheet__submit">Submit</string>
|
||||
<!-- Displayed as a snackbar after submitting feedback -->
|
||||
<string name="CallQualitySheet__thanks_for_your_feedback">Thanks for your feedback!</string>
|
||||
<!-- Content description for the thumbs down button indicating user had issues with the call -->
|
||||
<string name="CallQualitySheet__had_issues_content_description">I had issues with the call</string>
|
||||
<!-- Content description for the thumbs up button indicating the call was great -->
|
||||
<string name="CallQualitySheet__great_content_description">The call was great</string>
|
||||
|
||||
<!-- Message body when someone pins a message where %1$s is the name of the person -->
|
||||
<string name="PinnedMessage__s_pinned_a_message">%1$s pinned a message</string>
|
||||
|
||||
Reference in New Issue
Block a user