Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Upgrade realm version
Browse files Browse the repository at this point in the history
  • Loading branch information
NerdNumber9 committed Apr 16, 2018
1 parent 8cc6c01 commit 4d3b469
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ class Hitomi(private val context: Context)
val pages = defRealm { realm ->
val rres = realm.where(HitomiPage::class.java)
.equalTo(HitomiPage::gallery.name, hlId)
.findAllSorted(HitomiPage::index.name)
.sort(HitomiPage::index.name)
.findAll()

if (rres.isNotEmpty())
rres.map(HitomiPage::url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ class LibraryCategoryAdapter(val view: LibraryCategoryView) :
searchEngine.filterResults(it.value.where(),
parsedQuery,
it.value.first()!!.titleFields)
.findAllSorted(SearchableGalleryMetadata::mangaId.name).apply {
.sort(SearchableGalleryMetadata::mangaId.name)
.findAll().apply {
totalFilteredSize += size
}
else
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/exh/metadata/MetadataHelper.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package exh.metadata

import eu.kanade.tachiyomi.R.string.name
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.source.online.LewdSource
Expand All @@ -18,7 +19,7 @@ fun Realm.loadAllMetadata(): Map<KClass<out SearchableGalleryMetadata>, RealmRes
Injekt.get<SourceManager>().getOnlineSources().filterIsInstance<LewdSource<*, *>>().map {
it.queryAll()
}.associate {
it.clazz to it.query(this@loadAllMetadata).findAllSorted(SearchableGalleryMetadata::mangaId.name)
it.clazz to it.query(this@loadAllMetadata).sort(SearchableGalleryMetadata::mangaId.name).findAll()
}.toMap()

fun Realm.queryMetadataFromManga(manga: Manga,
Expand Down
44 changes: 0 additions & 44 deletions app/src/main/java/exh/util/LoggingRealmQuery.kt
Original file line number Diff line number Diff line change
Expand Up @@ -460,18 +460,6 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
return query.isNotEmpty(fieldName)
}

fun distinct(fieldName: String): RealmResults<E> {
return query.distinct(fieldName)
}

fun distinctAsync(fieldName: String): RealmResults<E> {
return query.distinctAsync(fieldName)
}

fun distinct(firstFieldName: String, vararg remainingFieldNames: String): RealmResults<E> {
return query.distinct(firstFieldName, *remainingFieldNames)
}

fun sum(fieldName: String): Number {
return query.sum(fieldName)
}
Expand Down Expand Up @@ -508,38 +496,6 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
return query.findAllAsync()
}

fun findAllSorted(fieldName: String, sortOrder: Sort): RealmResults<E> {
return query.findAllSorted(fieldName, sortOrder)
}

fun findAllSortedAsync(fieldName: String, sortOrder: Sort): RealmResults<E> {
return query.findAllSortedAsync(fieldName, sortOrder)
}

fun findAllSorted(fieldName: String): RealmResults<E> {
return query.findAllSorted(fieldName)
}

fun findAllSortedAsync(fieldName: String): RealmResults<E> {
return query.findAllSortedAsync(fieldName)
}

fun findAllSorted(fieldNames: Array<String>, sortOrders: Array<Sort>): RealmResults<E> {
return query.findAllSorted(fieldNames, sortOrders)
}

fun findAllSortedAsync(fieldNames: Array<String>, sortOrders: Array<Sort>): RealmResults<E> {
return query.findAllSortedAsync(fieldNames, sortOrders)
}

fun findAllSorted(fieldName1: String, sortOrder1: Sort, fieldName2: String, sortOrder2: Sort): RealmResults<E> {
return query.findAllSorted(fieldName1, sortOrder1, fieldName2, sortOrder2)
}

fun findAllSortedAsync(fieldName1: String, sortOrder1: Sort, fieldName2: String, sortOrder2: Sort): RealmResults<E> {
return query.findAllSortedAsync(fieldName1, sortOrder1, fieldName2, sortOrder2)
}

fun findFirst(): E? {
return query.findFirst()
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
//Firebase (EH)
classpath 'com.google.gms:google-services:3.0.0'
//Realm (EH)
classpath "io.realm:realm-gradle-plugin:4.2.0"
classpath "io.realm:realm-gradle-plugin:5.0.1"
}
}

Expand Down

0 comments on commit 4d3b469

Please sign in to comment.