mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Remove return value for toggleSubscriptionStatus as well
This commit is contained in:
parent
623141cbd8
commit
e1141c3a45
1 changed files with 4 additions and 11 deletions
|
@ -907,18 +907,14 @@ class ResultViewModel2 : ViewModel() {
|
||||||
* @param context The context to use for operations.
|
* @param context The context to use for operations.
|
||||||
* @param statusChangedCallback A callback that is invoked when the subscription status changes.
|
* @param statusChangedCallback A callback that is invoked when the subscription status changes.
|
||||||
* It provides the new subscription status (true if subscribed, false if unsubscribed, null if action was canceled).
|
* It provides the new subscription status (true if subscribed, false if unsubscribed, null if action was canceled).
|
||||||
* @return The new subscription status as a Boolean:
|
|
||||||
* - true if subscribed,
|
|
||||||
* - false if unsubscribed,
|
|
||||||
* - null if not possible to subscribe.
|
|
||||||
*/
|
*/
|
||||||
fun toggleSubscriptionStatus(
|
fun toggleSubscriptionStatus(
|
||||||
context: Context?,
|
context: Context?,
|
||||||
statusChangedCallback: ((newStatus: Boolean?) -> Unit)? = null
|
statusChangedCallback: ((newStatus: Boolean?) -> Unit)? = null
|
||||||
): Boolean? {
|
) {
|
||||||
val isSubscribed = _subscribeStatus.value ?: return null
|
val isSubscribed = _subscribeStatus.value ?: return
|
||||||
val response = currentResponse ?: return null
|
val response = currentResponse ?: return
|
||||||
if (response !is EpisodeResponse) return null
|
if (response !is EpisodeResponse) return
|
||||||
|
|
||||||
val currentId = response.getId()
|
val currentId = response.getId()
|
||||||
|
|
||||||
|
@ -926,7 +922,6 @@ class ResultViewModel2 : ViewModel() {
|
||||||
removeSubscribedData(currentId)
|
removeSubscribedData(currentId)
|
||||||
statusChangedCallback?.invoke(false)
|
statusChangedCallback?.invoke(false)
|
||||||
_subscribeStatus.postValue(false)
|
_subscribeStatus.postValue(false)
|
||||||
return false
|
|
||||||
} else {
|
} else {
|
||||||
checkAndWarnDuplicates(
|
checkAndWarnDuplicates(
|
||||||
context,
|
context,
|
||||||
|
@ -972,8 +967,6 @@ class ResultViewModel2 : ViewModel() {
|
||||||
|
|
||||||
statusChangedCallback?.invoke(true)
|
statusChangedCallback?.invoke(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return _subscribeStatus.value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue