Auto-review

This commit is contained in:
Benoit Marty 2020-01-02 18:45:44 +01:00
parent de1d79b637
commit 1bd85082c3
5 changed files with 8 additions and 18 deletions

View file

@ -61,9 +61,6 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
listener { callback?.retry() } listener { callback?.retry() }
} }
is Success -> is Success ->
// Build the devices portion of the settings.
// Each row correspond to a device ID and its corresponding device name. Clicking on the row
// display a dialog containing: the device ID, the device name and the "last seen" information.
devices() devices()
// sort before display: most recent first // sort before display: most recent first
.sortByLastSeen() .sortByLastSeen()

View file

@ -80,8 +80,8 @@ class DevicesViewModel @AssistedInject constructor(@Assisted initialState: Devic
/** /**
* Force the refresh of the devices list. * Force the refresh of the devices list.
* The devices list is the list of the devices where the user as logged in. * The devices list is the list of the devices where the user is logged in.
* It can be any mobile device, as any browser. * It can be any mobile devices, and any browsers.
*/ */
private fun refreshDevicesList() { private fun refreshDevicesList() {
if (session.isCryptoEnabled() && !session.sessionParams.credentials.deviceId.isNullOrEmpty()) { if (session.isCryptoEnabled() && !session.sessionParams.credentials.deviceId.isNullOrEmpty()) {

View file

@ -91,13 +91,6 @@ class VectorSettingsDevicesFragment @Inject constructor(
.show() .show()
} }
/**
* Display a dialog containing the device ID, the device name and the "last seen" information.
* This dialog allow to delete the corresponding device (see [.displayDeviceDeletionDialog])
*
* @param deviceInfo the device information
* @param isCurrentDevice true if this is the current device
*/
override fun onDeviceClicked(deviceInfo: DeviceInfo) { override fun onDeviceClicked(deviceInfo: DeviceInfo) {
devicesViewModel.handle(DevicesAction.ToggleDevice(deviceInfo)) devicesViewModel.handle(DevicesAction.ToggleDevice(deviceInfo))
} }
@ -117,14 +110,14 @@ class VectorSettingsDevicesFragment @Inject constructor(
/** /**
* Display an alert dialog to rename a device * Display an alert dialog to rename a device
* *
* @param aDeviceInfoToRename device info * @param deviceInfo device info
*/ */
private fun displayDeviceRenameDialog(aDeviceInfoToRename: DeviceInfo) { private fun displayDeviceRenameDialog(deviceInfo: DeviceInfo) {
val inflater = requireActivity().layoutInflater val inflater = requireActivity().layoutInflater
val layout = inflater.inflate(R.layout.dialog_base_edit_text, null) val layout = inflater.inflate(R.layout.dialog_base_edit_text, null)
val input = layout.findViewById<EditText>(R.id.edit_text) val input = layout.findViewById<EditText>(R.id.edit_text)
input.setText(aDeviceInfoToRename.displayName) input.setText(deviceInfo.displayName)
AlertDialog.Builder(requireActivity()) AlertDialog.Builder(requireActivity())
.setTitle(R.string.devices_details_device_name) .setTitle(R.string.devices_details_device_name)
@ -132,7 +125,7 @@ class VectorSettingsDevicesFragment @Inject constructor(
.setPositiveButton(R.string.ok) { _, _ -> .setPositiveButton(R.string.ok) { _, _ ->
val newName = input.text.toString() val newName = input.text.toString()
devicesViewModel.handle(DevicesAction.Rename(aDeviceInfoToRename, newName)) devicesViewModel.handle(DevicesAction.Rename(deviceInfo, newName))
} }
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show() .show()

View file

@ -10,7 +10,7 @@
android:key="SETTINGS_USE_RAGE_SHAKE_KEY" android:key="SETTINGS_USE_RAGE_SHAKE_KEY"
android:title="@string/send_bug_report_rage_shake" /> android:title="@string/send_bug_report_rage_shake" />
<SeekBarPreference <androidx.preference.SeekBarPreference
android:defaultValue="13" android:defaultValue="13"
android:dependency="SETTINGS_USE_RAGE_SHAKE_KEY" android:dependency="SETTINGS_USE_RAGE_SHAKE_KEY"
android:key="SETTINGS_RAGE_SHAKE_DETECTION_THRESHOLD_KEY" android:key="SETTINGS_RAGE_SHAKE_DETECTION_THRESHOLD_KEY"