Skip to content

Commit

Permalink
Reload library when deleting bookmarks (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna712 authored Oct 28, 2023
1 parent f0ebfa4 commit d542feb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import com.lagradost.cloudstream3.utils.AppUtils.loadResult
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
import com.lagradost.cloudstream3.utils.DOWNLOAD_HEADER_CACHE
import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.DataStoreHelper.deleteAllBookmarkedData
import com.lagradost.cloudstream3.utils.DataStoreHelper.deleteAllResumeStateIds
import com.lagradost.cloudstream3.utils.DataStoreHelper.getAllResumeStateIds
import com.lagradost.cloudstream3.utils.DataStoreHelper.getAllWatchStateIds
Expand Down Expand Up @@ -102,11 +101,6 @@ class HomeViewModel : ViewModel() {
loadStoredData()
}

fun deleteBookmarks() {
deleteAllBookmarkedData()
loadStoredData()
}

var repo: APIRepository? = null

private val _apiName = MutableLiveData<String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,9 @@ object DataStoreHelper {
removeKeys(folder)
}

fun deleteAllBookmarkedData() {
val folder1 = "$currentAccount/$RESULT_WATCH_STATE"
val folder2 = "$currentAccount/$RESULT_WATCH_STATE_DATA"
removeKeys(folder1)
removeKeys(folder2)
}

fun deleteBookmarkedData(id: Int?) {
if (id == null) return
AccountManager.localListApi.requireLibraryRefresh = true
removeKey("$currentAccount/$RESULT_WATCH_STATE", id.toString())
removeKey("$currentAccount/$RESULT_WATCH_STATE_DATA", id.toString())
}
Expand Down

0 comments on commit d542feb

Please sign in to comment.