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.content.Intent
import android.os.Bundle import android.os.Bundle
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.paging.LoadState import androidx.paging.LoadState
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
@ -134,7 +135,13 @@ class ScheduledStatusActivity : BaseActivity(), ScheduledStatusActionListener, I
} }
override fun delete(item: ScheduledStatus) { 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 { companion object {

View file

@ -57,8 +57,7 @@ class ScheduledStatusAdapter(
v.isEnabled = false v.isEnabled = false
listener.edit(item) listener.edit(item)
} }
holder.binding.delete.setOnClickListener { v: View -> holder.binding.delete.setOnClickListener {
v.isEnabled = false
listener.delete(item) 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="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="url_domain_notifier">%s (🔗 %s)</string>
<string name="delete_scheduled_post_warning">Delete this scheduled post?</string>
</resources> </resources>