OpenSubtitles: prevent re-sending invalid credentials

This commit is contained in:
Nicolas Pomepuy 2024-11-06 08:55:03 +01:00 committed by Duncan McNamara
parent f9550f9ec9
commit ba2d715222

View File

@ -57,6 +57,8 @@ class SubtitleDownloaderDialogFragment : VLCBottomSheetDialogFragment() {
private lateinit var names: String
private lateinit var viewModel: SubtitlesModel
private lateinit var toast: Toast
private var lastUsername: String = ""
private var lastPassword: String = ""
private var state: SubDownloadDialogState = SubDownloadDialogState.Download
set(value) {
@ -143,6 +145,11 @@ class SubtitleDownloaderDialogFragment : VLCBottomSheetDialogFragment() {
if (viewModel.observableUser.get()?.logged == true) {
viewModel.logout(settings)
} else {
if (lastPassword == binding.password.text.toString() && lastUsername == binding.username.text.toString()) {
return@setOnClickListener
}
lastPassword = binding.password.text.toString()
lastUsername = binding.username.text.toString()
viewModel.login(
settings,
binding.username.text.toString(),