From 1bd85082c31da907da3a279b5c57915f88536be3 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 2 Jan 2020 18:45:44 +0100 Subject: [PATCH] Auto-review --- .../im/vector/riotx/core/di/FragmentModule.kt | 2 +- .../settings/devices/DevicesController.kt | 3 --- .../features/settings/devices/DevicesViewModel.kt | 4 ++-- .../devices/VectorSettingsDevicesFragment.kt | 15 ++++----------- .../res/xml/vector_settings_developer_mode.xml | 2 +- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt b/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt index 88af219c78..5565369006 100644 --- a/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt +++ b/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt @@ -227,7 +227,7 @@ interface FragmentModule { @Binds @IntoMap @FragmentKey(VectorSettingsIgnoredUsersFragment::class) - fun bindVectorSettingsIgnoredUsersFragment(fragment: VectorSettingsIgnoredUsersFragment): Fragment + fun bindVectorSettingsIgnoredUsersFragment(fragment: VectorSettingsIgnoredUsersFragment): Fragment @Binds @IntoMap diff --git a/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesController.kt b/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesController.kt index db61db429b..e0a379be83 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesController.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesController.kt @@ -61,9 +61,6 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor listener { callback?.retry() } } 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() // sort before display: most recent first .sortByLastSeen() diff --git a/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt b/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt index 1fc56e76fd..b2b015a3f0 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/devices/DevicesViewModel.kt @@ -80,8 +80,8 @@ class DevicesViewModel @AssistedInject constructor(@Assisted initialState: Devic /** * Force the refresh of the devices list. - * The devices list is the list of the devices where the user as logged in. - * It can be any mobile device, as any browser. + * The devices list is the list of the devices where the user is logged in. + * It can be any mobile devices, and any browsers. */ private fun refreshDevicesList() { if (session.isCryptoEnabled() && !session.sessionParams.credentials.deviceId.isNullOrEmpty()) { diff --git a/vector/src/main/java/im/vector/riotx/features/settings/devices/VectorSettingsDevicesFragment.kt b/vector/src/main/java/im/vector/riotx/features/settings/devices/VectorSettingsDevicesFragment.kt index 4168e3eeb7..4d14930fce 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/devices/VectorSettingsDevicesFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/devices/VectorSettingsDevicesFragment.kt @@ -91,13 +91,6 @@ class VectorSettingsDevicesFragment @Inject constructor( .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) { devicesViewModel.handle(DevicesAction.ToggleDevice(deviceInfo)) } @@ -117,14 +110,14 @@ class VectorSettingsDevicesFragment @Inject constructor( /** * 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 layout = inflater.inflate(R.layout.dialog_base_edit_text, null) val input = layout.findViewById(R.id.edit_text) - input.setText(aDeviceInfoToRename.displayName) + input.setText(deviceInfo.displayName) AlertDialog.Builder(requireActivity()) .setTitle(R.string.devices_details_device_name) @@ -132,7 +125,7 @@ class VectorSettingsDevicesFragment @Inject constructor( .setPositiveButton(R.string.ok) { _, _ -> val newName = input.text.toString() - devicesViewModel.handle(DevicesAction.Rename(aDeviceInfoToRename, newName)) + devicesViewModel.handle(DevicesAction.Rename(deviceInfo, newName)) } .setNegativeButton(R.string.cancel, null) .show() diff --git a/vector/src/main/res/xml/vector_settings_developer_mode.xml b/vector/src/main/res/xml/vector_settings_developer_mode.xml index d3f960b31b..b7b800052f 100644 --- a/vector/src/main/res/xml/vector_settings_developer_mode.xml +++ b/vector/src/main/res/xml/vector_settings_developer_mode.xml @@ -10,7 +10,7 @@ android:key="SETTINGS_USE_RAGE_SHAKE_KEY" android:title="@string/send_bug_report_rage_shake" /> -