Fix favorites move from local to cloud
This commit is contained in:
1 parent
8ac2b027ec
commit
39f76246c8
2 files changed
+13
-9
No files matched your search
@@ -334,7 +334,6 @@ object EhEngine {
|
||||
formBody {
|
||||
add("ddact", catStr)
|
||||
gidArray.forEach { add("modifygids[]", it.toString()) }
|
||||
add("apply", "Apply")
|
||||
}
|
||||
}.executeAndParsingWith(FavoritesParser::parse).apply { fillGalleryList(galleryInfoList, url, false) }
|
||||
}
|
||||
@@ -481,7 +480,7 @@ object EhEngine {
|
||||
if (filter) list.removeAll { EhFilter.filterUploader(it) || EhFilter.filterTag(it) || EhFilter.filterTagNamespace(it) }
|
||||
}
|
||||
|
||||
suspend fun addFavoritesRange(gidTokenArray: Array<Pair<Long, String>>, dstCat: Int) {
|
||||
gidTokenArray.forEach { (gid, token) -> addFavorites(gid, token, dstCat) }
|
||||
suspend fun addFavoritesRange(galleryList: List<Pair<Long, String>>, dstCat: Int) {
|
||||
galleryList.forEach { (gid, token) -> addFavorites(gid, token, dstCat) }
|
||||
}
|
||||
}
|
||||
@@ -495,8 +495,8 @@ class FavoritesScene : SearchBarScene() {
|
||||
val gidArray = info.map { it.gid }.toLongArray()
|
||||
EhDB.removeLocalFavorites(gidArray)
|
||||
} else {
|
||||
val delArray = info.map { it.gid to it.token!! }.toTypedArray()
|
||||
EhEngine.addFavoritesRange(delArray, -1)
|
||||
val delList = info.map { it.gid to it.token!! }
|
||||
EhEngine.addFavoritesRange(delList, -1)
|
||||
}
|
||||
mAdapter?.refresh()
|
||||
}
|
||||
@@ -514,15 +514,20 @@ class FavoritesScene : SearchBarScene() {
|
||||
// Move from local to cloud
|
||||
val gidArray = info.map { it.gid }.toLongArray()
|
||||
EhDB.removeLocalFavorites(gidArray)
|
||||
}
|
||||
if (dstCat == FavListUrlBuilder.FAV_CAT_LOCAL) {
|
||||
val galleryList = info.map { it.gid to it.token!! }
|
||||
runCatching {
|
||||
EhEngine.addFavoritesRange(galleryList, dstCat)
|
||||
}
|
||||
} else if (dstCat == FavListUrlBuilder.FAV_CAT_LOCAL) {
|
||||
// Move from cloud to local
|
||||
EhDB.putLocalFavorites(info)
|
||||
} else {
|
||||
// Move from cloud/local to cloud
|
||||
// Move from cloud to cloud
|
||||
val gidArray = info.map { it.gid }.toLongArray()
|
||||
val url = ehUrl { addPathSegments(EhUrl.FAV_PATH) }.toString()
|
||||
EhEngine.modifyFavorites(url, gidArray, dstCat)
|
||||
runCatching {
|
||||
EhEngine.modifyFavorites(url, gidArray, dstCat)
|
||||
}
|
||||
}
|
||||
mAdapter?.refresh()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user