warn before deleting a scheduled post (#2721)

This commit is contained in:
Konrad Pozniak 2022-10-28 16:46:38 +02:00 committed by GitHub
parent 2481bc0523
commit 532afaad2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.lifecycleScope
import androidx.paging.LoadState
import androidx.recyclerview.widget.DividerItemDecoration
@ -134,7 +135,13 @@ class ScheduledStatusActivity : BaseActivity(), ScheduledStatusActionListener, I
}
override fun delete(item: ScheduledStatus) {
viewModel.deleteScheduledStatus(item)
AlertDialog.Builder(this)
.setMessage(R.string.delete_scheduled_post_warning)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok) { _, _ ->
viewModel.deleteScheduledStatus(item)
}
.show()
}
companion object {

View File

@ -57,8 +57,7 @@ class ScheduledStatusAdapter(
v.isEnabled = false
listener.edit(item)
}
holder.binding.delete.setOnClickListener { v: View ->
v.isEnabled = false
holder.binding.delete.setOnClickListener {
listener.delete(item)
}
}

View File

@ -668,5 +668,6 @@
<string name="dialog_push_notification_migration_other_accounts">You have re-logged into your current account to grant push subscription permission to Tusky. However, you still have other accounts that have not been migrated this way. Switch to them and re-login one by one in order to enable UnifiedPush notifications support.</string>
<string name="url_domain_notifier">%s (🔗 %s)</string>
<string name="delete_scheduled_post_warning">Delete this scheduled post?</string>
</resources>