Skip to content

Commit

Permalink
2.1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nonproto committed Jul 30, 2020
1 parent cef829d commit 6a1bb40
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.getChapterNum
import eu.kanade.tachiyomi.source.model.getVolumeNum
import eu.kanade.tachiyomi.source.model.isMergedChapter
import eu.kanade.tachiyomi.source.online.utils.MdUtil
import java.util.Date
import java.util.TreeSet

Expand All @@ -27,7 +28,6 @@ fun syncChaptersWithSource(

// Chapters from db.
val dbChapters = db.getChapters(manga).executeAsBlocking()
val dbChapterByUrl = dbChapters.groupByTo(destination = HashMap(), keySelector = { it.url }, valueTransform = { it })
var copyOfRawSource = rawSourceChapters.toList()
if (manga.merge_manga_url != null) {
val partition = copyOfRawSource.partition { !it.isMergedChapter() }
Expand Down Expand Up @@ -92,16 +92,24 @@ fun syncChaptersWithSource(
// Chapters whose metadata have changed.
val toChange = mutableListOf<Chapter>()



for (sourceChapter in sourceChapters) {
val dbChapters = dbChapterByUrl.get(sourceChapter.url)
val dbChapter = dbChapters.find {
if (sourceChapter.isMergedChapter() && it.isMergedChapter()) {
it.url == sourceChapter.url
} else if (sourceChapter.isMergedChapter().not() && it.isMergedChapter().not()) {
(it.mangadex_chapter_id.isNotBlank() && it.mangadex_chapter_id == sourceChapter.mangadex_chapter_id) ||
MdUtil.getChapterId(it.url) == sourceChapter.mangadex_chapter_id
} else {
false
}

}

// Add the chapter if not in db already, or update if the metadata changed.
if (dbChapters == null) {
if (dbChapter == null) {
toAdd.add(sourceChapter)
} else {
val dbChapter = dbChapters.first()

ChapterRecognition.parseChapterNumber(sourceChapter, manga)

if (shouldUpdateDbChapter(dbChapter, sourceChapter)) {
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/raw/changelog_release.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog bulletedList="true">
<changelogversion
changeDate=""
versionName="v2.1.1.2">
<changelogtext>Hot fix 2 electric boogaloo</changelogtext>
</changelogversion>
<changelogversion
changeDate=""
versionName="v2.1.1.1">
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ object AndroidVersions {
const val COMPILE_SDK = 29
const val MIN_SDK = 24
const val TARGET_SDK = 29
const val VERSION_CODE = 76
const val VERSION_NAME = "2.1.1.1"
const val VERSION_CODE = 77
const val VERSION_NAME = "2.1.1.2"
}

object BuildPluginsVersion {
Expand Down

0 comments on commit 6a1bb40

Please sign in to comment.