mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 22:09:16 +01:00
Add ability to explicitly remove tracking from track search dialog (closes #2532)
This commit is contained in:
parent
a288c0f280
commit
f966187ea4
@ -91,10 +91,14 @@ class TrackPresenter(
|
||||
.subscribe({ },
|
||||
{ error -> context.toast(error.message) }))
|
||||
} else {
|
||||
db.deleteTrackForManga(manga, service).executeAsBlocking()
|
||||
unregisterTracking(service)
|
||||
}
|
||||
}
|
||||
|
||||
fun unregisterTracking(service: TrackService) {
|
||||
db.deleteTrackForManga(manga, service).executeAsBlocking()
|
||||
}
|
||||
|
||||
private fun updateRemote(track: Track, service: TrackService) {
|
||||
service.update(track)
|
||||
.flatMap { db.insertTrack(track).asRxObservable() }
|
||||
|
@ -54,8 +54,10 @@ class TrackSearchDialog : DialogController {
|
||||
val dialog = MaterialDialog.Builder(activity!!)
|
||||
.customView(R.layout.track_search_dialog, false)
|
||||
.positiveText(android.R.string.ok)
|
||||
.negativeText(android.R.string.cancel)
|
||||
.onPositive { _, _ -> onPositiveButtonClick() }
|
||||
.negativeText(android.R.string.cancel)
|
||||
.neutralText(R.string.action_remove)
|
||||
.onNeutral { _, _ -> onRemoveButtonClick() }
|
||||
.build()
|
||||
|
||||
if (subscriptions.isUnsubscribed) {
|
||||
@ -137,6 +139,10 @@ class TrackSearchDialog : DialogController {
|
||||
trackController.presenter.registerTracking(selectedItem, service)
|
||||
}
|
||||
|
||||
private fun onRemoveButtonClick() {
|
||||
trackController.presenter.unregisterTracking(service)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val KEY_SERVICE = "service_id"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user