Show linked deviceId's for internal users.

This commit is contained in:
Greyson Parrelli
2026-02-09 10:40:13 -05:00
parent 2d29b02cea
commit c9bd81d332
3 changed files with 9 additions and 4 deletions

View File

@@ -448,7 +448,7 @@ fun DeviceListScreen(
) )
} else { } else {
state.devices.forEach { device -> state.devices.forEach { device ->
DeviceRow(device, onDeviceSelectedForRemoval, onEditDevice) DeviceRow(device, state.isInternalUser, onDeviceSelectedForRemoval, onEditDevice)
} }
} }
} }
@@ -492,7 +492,7 @@ fun DeviceListScreen(
} }
@Composable @Composable
fun DeviceRow(device: Device, setDeviceToRemove: (Device) -> Unit, onEditDevice: (Device) -> Unit) { fun DeviceRow(device: Device, isInternalUser: Boolean, setDeviceToRemove: (Device) -> Unit, onEditDevice: (Device) -> Unit) {
val titleString = if (device.name.isNullOrEmpty()) stringResource(R.string.DeviceListItem_unnamed_device) else device.name val titleString = if (device.name.isNullOrEmpty()) stringResource(R.string.DeviceListItem_unnamed_device) else device.name
val linkedDate = device.createdMillis?.let { DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, Locale.getDefault(), device.createdMillis) } val linkedDate = device.createdMillis?.let { DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, Locale.getDefault(), device.createdMillis) }
val lastActive = DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, Locale.getDefault(), device.lastSeenMillis) val lastActive = DateUtils.getDayPrecisionTimeSpanString(LocalContext.current, Locale.getDefault(), device.lastSeenMillis)
@@ -523,6 +523,9 @@ fun DeviceRow(device: Device, setDeviceToRemove: (Device) -> Unit, onEditDevice:
.weight(1f) .weight(1f)
) { ) {
Text(text = titleString, style = MaterialTheme.typography.bodyLarge) Text(text = titleString, style = MaterialTheme.typography.bodyLarge)
if (isInternalUser) {
Text("[Internal] DeviceId: ${device.id}", style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
if (linkedDate != null) { if (linkedDate != null) {
Text(stringResource(R.string.DeviceListItem_linked_s, linkedDate), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant) Text(stringResource(R.string.DeviceListItem_linked_s, linkedDate), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
} }

View File

@@ -21,7 +21,8 @@ data class LinkDeviceSettingsState(
val bottomSheetVisible: Boolean = false, val bottomSheetVisible: Boolean = false,
val deviceToEdit: Device? = null, val deviceToEdit: Device? = null,
val shouldCancelArchiveUpload: Boolean = false, val shouldCancelArchiveUpload: Boolean = false,
val debugLogUrl: String? = null val debugLogUrl: String? = null,
val isInternalUser: Boolean = false
) { ) {
sealed interface DialogState { sealed interface DialogState {
data object None : DialogState data object None : DialogState

View File

@@ -23,6 +23,7 @@ import org.thoughtcrime.securesms.linkdevice.LinkDeviceSettingsState.OneTimeEven
import org.thoughtcrime.securesms.linkdevice.LinkDeviceSettingsState.QrCodeState import org.thoughtcrime.securesms.linkdevice.LinkDeviceSettingsState.QrCodeState
import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogRepository import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogRepository
import org.thoughtcrime.securesms.notifications.NotificationIds import org.thoughtcrime.securesms.notifications.NotificationIds
import org.thoughtcrime.securesms.util.RemoteConfig
import org.thoughtcrime.securesms.util.ServiceUtil import org.thoughtcrime.securesms.util.ServiceUtil
import org.thoughtcrime.securesms.util.Util import org.thoughtcrime.securesms.util.Util
import org.whispersystems.signalservice.api.link.TransferArchiveError import org.whispersystems.signalservice.api.link.TransferArchiveError
@@ -39,7 +40,7 @@ class LinkDeviceViewModel : ViewModel() {
val TAG = Log.tag(LinkDeviceViewModel::class) val TAG = Log.tag(LinkDeviceViewModel::class)
} }
private val _state = MutableStateFlow(LinkDeviceSettingsState()) private val _state = MutableStateFlow(LinkDeviceSettingsState(isInternalUser = RemoteConfig.internalUser))
val state = _state.asStateFlow() val state = _state.asStateFlow()
private val submitDebugLogRepository: SubmitDebugLogRepository = SubmitDebugLogRepository() private val submitDebugLogRepository: SubmitDebugLogRepository = SubmitDebugLogRepository()