Fix synthetic accessor lint error.

This commit is contained in:
Martin Marconcini 2023-08-22 12:05:11 +02:00
parent 634f020ffa
commit 06239bb8a1
No known key found for this signature in database
1 changed files with 10 additions and 9 deletions

View File

@ -207,7 +207,7 @@ class EditProfileActivity : BaseActivity(), Injectable {
val onBackCallback = object : OnBackPressedCallback(enabled = true) { val onBackCallback = object : OnBackPressedCallback(enabled = true) {
override fun handleOnBackPressed() { override fun handleOnBackPressed() {
if (!viewModel.hasUnsavedChanges(gatherProfileData())) finish() if (!viewModel.hasUnsavedChanges(profileData)) finish()
lifecycleScope.launch { lifecycleScope.launch {
when (showConfirmationDialog()) { when (showConfirmationDialog()) {
@ -224,16 +224,17 @@ class EditProfileActivity : BaseActivity(), Injectable {
override fun onStop() { override fun onStop() {
super.onStop() super.onStop()
if (!isFinishing) { if (!isFinishing) {
viewModel.updateProfile(gatherProfileData()) viewModel.updateProfile(profileData)
} }
} }
private fun gatherProfileData() = ProfileData( private val profileData
get() = ProfileData(
displayName = binding.displayNameEditText.text.toString(), displayName = binding.displayNameEditText.text.toString(),
note = binding.noteEditText.text.toString(), note = binding.noteEditText.text.toString(),
locked = binding.lockedCheckBox.isChecked, locked = binding.lockedCheckBox.isChecked,
fields = accountFieldEditAdapter.getFieldData() fields = accountFieldEditAdapter.getFieldData())
)
private fun observeImage( private fun observeImage(
liveData: LiveData<Uri>, liveData: LiveData<Uri>,
@ -308,7 +309,7 @@ class EditProfileActivity : BaseActivity(), Injectable {
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
private fun save() = viewModel.save(gatherProfileData()) private fun save() = viewModel.save(profileData)
private fun onSaveFailure(msg: String?) { private fun onSaveFailure(msg: String?) {
val errorMsg = msg ?: getString(R.string.error_media_upload_sending) val errorMsg = msg ?: getString(R.string.error_media_upload_sending)