mirror of
https://github.com/mihonapp/mihon.git
synced 2025-02-12 18:18:55 +01:00
Compare commits
No commits in common. "cb068984303f811692531bf6f14902ae118d8ac7" and "a024218410953a389b8af4880fa7ae6cc30124a2" have entirely different histories.
cb06898430
...
a024218410
@ -163,7 +163,7 @@ class SyncChaptersWithSource(
|
||||
var updatedToAdd = newChapters.map { toAddItem ->
|
||||
var chapter = toAddItem.copy(dateFetch = nowMillis + itemCount--)
|
||||
|
||||
if (!chapter.isRecognizedNumber || chapter.chapterNumber !in deletedChapterNumbers) return@map chapter
|
||||
if (chapter.isRecognizedNumber.not() || chapter.chapterNumber !in deletedChapterNumbers) return@map chapter
|
||||
|
||||
chapter = chapter.copy(
|
||||
read = chapter.chapterNumber in deletedReadChapterNumbers,
|
||||
|
@ -23,7 +23,7 @@ class GetExtensionSources(
|
||||
ExtensionSourceItem(
|
||||
source = source,
|
||||
enabled = source.isEnabled(),
|
||||
labelAsName = isMultiSource && !isMultiLangSingleSource,
|
||||
labelAsName = isMultiSource && isMultiLangSingleSource.not(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ class GetExtensionsByType(
|
||||
extensionManager.availableExtensionsFlow,
|
||||
) { _activeLanguages, _installed, _untrusted, _available ->
|
||||
val (updates, installed) = _installed
|
||||
.filter { (showNsfwSources || !it.isNsfw) }
|
||||
.filter { (showNsfwSources || it.isNsfw.not()) }
|
||||
.sortedWith(
|
||||
compareBy<Extension.Installed> { !it.isObsolete }
|
||||
compareBy<Extension.Installed> { it.isObsolete.not() }
|
||||
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
|
||||
)
|
||||
.partition { it.hasUpdate }
|
||||
@ -36,7 +36,7 @@ class GetExtensionsByType(
|
||||
.filter { extension ->
|
||||
_installed.none { it.pkgName == extension.pkgName } &&
|
||||
_untrusted.none { it.pkgName == extension.pkgName } &&
|
||||
(showNsfwSources || !extension.isNsfw)
|
||||
(showNsfwSources || extension.isNsfw.not())
|
||||
}
|
||||
.flatMap { ext ->
|
||||
if (ext.sources.isEmpty()) {
|
||||
|
@ -34,15 +34,15 @@ class GetSourcesWithFavoriteCount(
|
||||
when (sorting) {
|
||||
SetMigrateSorting.Mode.ALPHABETICAL -> {
|
||||
when {
|
||||
a.first.isStub && !b.first.isStub -> -1
|
||||
b.first.isStub && !a.first.isStub -> 1
|
||||
a.first.isStub && b.first.isStub.not() -> -1
|
||||
b.first.isStub && a.first.isStub.not() -> 1
|
||||
else -> a.first.name.lowercase().compareToWithCollator(b.first.name.lowercase())
|
||||
}
|
||||
}
|
||||
SetMigrateSorting.Mode.TOTAL -> {
|
||||
when {
|
||||
a.first.isStub && !b.first.isStub -> -1
|
||||
b.first.isStub && !a.first.isStub -> 1
|
||||
a.first.isStub && b.first.isStub.not() -> -1
|
||||
b.first.isStub && a.first.isStub.not() -> 1
|
||||
else -> a.second.compareTo(b.second)
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ fun Track.toDbTrack(): DbTrack = DbTrack.create(trackerId).also {
|
||||
}
|
||||
|
||||
fun DbTrack.toDomainTrack(idRequired: Boolean = true): Track? {
|
||||
val trackId = id ?: if (!idRequired) -1 else return null
|
||||
val trackId = id ?: if (idRequired.not()) -1 else return null
|
||||
return Track(
|
||||
id = trackId,
|
||||
mangaId = manga_id,
|
||||
|
@ -203,13 +203,7 @@ private fun ExtensionContent(
|
||||
items(
|
||||
items = items,
|
||||
contentType = { "item" },
|
||||
key = { item ->
|
||||
when (item.extension) {
|
||||
is Extension.Untrusted -> "extension-untrusted-${item.hashCode()}"
|
||||
is Extension.Installed -> "extension-installed-${item.hashCode()}"
|
||||
is Extension.Available -> "extension-available-${item.hashCode()}"
|
||||
}
|
||||
},
|
||||
key = { "extension-${it.hashCode()}" },
|
||||
) { item ->
|
||||
ExtensionItem(
|
||||
modifier = Modifier.animateItemPlacement(),
|
||||
|
@ -315,13 +315,13 @@ class DownloadManager(
|
||||
val capitalizationChanged = oldFolder.name.equals(newName, ignoreCase = true)
|
||||
if (capitalizationChanged) {
|
||||
val tempName = newName + Downloader.TMP_DIR_SUFFIX
|
||||
if (!oldFolder.renameTo(tempName)) {
|
||||
if (oldFolder.renameTo(tempName).not()) {
|
||||
logcat(LogPriority.ERROR) { "Failed to rename source download folder: ${oldFolder.name}" }
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (!oldFolder.renameTo(newName)) {
|
||||
if (oldFolder.renameTo(newName).not()) {
|
||||
logcat(LogPriority.ERROR) { "Failed to rename source download folder: ${oldFolder.name}" }
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class DownloadProvider(
|
||||
val newChapterName = sanitizeChapterName(chapterName)
|
||||
return DiskUtil.buildValidFilename(
|
||||
when {
|
||||
!chapterScanlator.isNullOrBlank() -> "${chapterScanlator}_$newChapterName"
|
||||
chapterScanlator.isNullOrBlank().not() -> "${chapterScanlator}_$newChapterName"
|
||||
else -> newChapterName
|
||||
},
|
||||
)
|
||||
|
@ -185,7 +185,7 @@ class Anilist(id: Long) : BaseTracker(id, "AniList"), DeletableTracker {
|
||||
|
||||
if (track.status != COMPLETED) {
|
||||
val isRereading = track.status == REREADING
|
||||
track.status = if (!isRereading && hasReadChapters) READING else track.status
|
||||
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
|
||||
}
|
||||
|
||||
update(track)
|
||||
|
@ -104,7 +104,7 @@ class MyAnimeList(id: Long) : BaseTracker(id, "MyAnimeList"), DeletableTracker {
|
||||
|
||||
if (track.status != COMPLETED) {
|
||||
val isRereading = track.status == REREADING
|
||||
track.status = if (!isRereading && hasReadChapters) READING else track.status
|
||||
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
|
||||
}
|
||||
|
||||
update(track)
|
||||
|
@ -72,7 +72,7 @@ class Shikimori(id: Long) : BaseTracker(id, "Shikimori"), DeletableTracker {
|
||||
|
||||
if (track.status != COMPLETED) {
|
||||
val isRereading = track.status == REREADING
|
||||
track.status = if (!isRereading && hasReadChapters) READING else track.status
|
||||
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
|
||||
}
|
||||
|
||||
update(track)
|
||||
|
@ -338,10 +338,6 @@ class ExtensionManager(
|
||||
}
|
||||
|
||||
override fun onExtensionUntrusted(extension: Extension.Untrusted) {
|
||||
val installedExtension = _installedExtensionsFlow.value
|
||||
.find { it.pkgName == extension.pkgName }
|
||||
?: return
|
||||
_installedExtensionsFlow.value -= installedExtension
|
||||
_untrustedExtensionsFlow.value += extension
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,8 @@ internal class ExtensionInstallReceiver(private val listener: Listener) :
|
||||
launchNow {
|
||||
when (val result = getExtensionFromIntent(context, intent)) {
|
||||
is LoadResult.Success -> listener.onExtensionUpdated(result.extension)
|
||||
is LoadResult.Untrusted -> listener.onExtensionUntrusted(result.extension)
|
||||
// Not needed as a package can't be upgraded if the signature is different
|
||||
// is LoadResult.Untrusted -> {}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer {
|
||||
pager.addOnPageChangeListener(
|
||||
object : ViewPager.SimpleOnPageChangeListener() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
if (!activity.isScrollingThroughPages) {
|
||||
if (activity.isScrollingThroughPages.not()) {
|
||||
activity.hideMenu()
|
||||
}
|
||||
onPageChange(position)
|
||||
|
@ -89,7 +89,7 @@ internal class RateLimitInterceptor(
|
||||
while (requestQueue.size >= permits) { // queue is full, remove expired entries
|
||||
val periodStart = SystemClock.elapsedRealtime() - rateLimitMillis
|
||||
var hasRemovedExpired = false
|
||||
while (!requestQueue.isEmpty() && requestQueue.first <= periodStart) {
|
||||
while (requestQueue.isEmpty().not() && requestQueue.first <= periodStart) {
|
||||
requestQueue.removeFirst()
|
||||
hasRemovedExpired = true
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class GetApplicationRelease(
|
||||
val now = Instant.now()
|
||||
|
||||
// Limit checks to once every 3 days at most
|
||||
if (!arguments.forceCheck && now.isBefore(
|
||||
if (arguments.forceCheck.not() && now.isBefore(
|
||||
Instant.ofEpochMilli(lastChecked.get()).plus(3, ChronoUnit.DAYS),
|
||||
)
|
||||
) {
|
||||
|
@ -22,7 +22,7 @@ class StubSource(
|
||||
throw SourceNotInstalledException()
|
||||
|
||||
override fun toString(): String =
|
||||
if (!isInvalid) "$name (${lang.uppercase()})" else id.toString()
|
||||
if (isInvalid.not()) "$name (${lang.uppercase()})" else id.toString()
|
||||
|
||||
companion object {
|
||||
fun from(source: Source): StubSource {
|
||||
|
Loading…
x
Reference in New Issue
Block a user