From 30a6effc50f8c91292aa9a8963defc8958b07d4e Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 2 Sep 2023 22:18:11 -0400 Subject: [PATCH] Add replacement suspend functions in Source interface --- .jitpack.yml | 2 +- build.gradle | 2 +- library/build.gradle | 9 +++++ .../java/eu/kanade/tachiyomi/source/Source.kt | 36 +++++++++++++++---- settings.gradle | 1 - settings.gradle.kts | 1 + 6 files changed, 42 insertions(+), 9 deletions(-) delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/.jitpack.yml b/.jitpack.yml index 4f4d58a..b3fce73 100644 --- a/.jitpack.yml +++ b/.jitpack.yml @@ -1,4 +1,4 @@ jdk: - - openjdk11 + - openjdk17 install: - ./gradlew build :library:publishToMavenLocal diff --git a/build.gradle b/build.gradle index c3b9582..4c1c4f9 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/library/build.gradle b/library/build.gradle index 81b3cb7..36222a0 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -17,6 +17,15 @@ android { minifyEnabled false } } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } } dependencies { diff --git a/library/src/main/java/eu/kanade/tachiyomi/source/Source.kt b/library/src/main/java/eu/kanade/tachiyomi/source/Source.kt index 4e00356..a61df58 100644 --- a/library/src/main/java/eu/kanade/tachiyomi/source/Source.kt +++ b/library/src/main/java/eu/kanade/tachiyomi/source/Source.kt @@ -22,24 +22,48 @@ interface Source { val name: String /** - * Returns an observable with the updated details for a manga. + * Get the updated details for a manga. * + * @since extensions-lib 1.4 * @param manga the manga to update. + * @return the updated manga. */ - fun fetchMangaDetails(manga: SManga): Observable + suspend fun getMangaDetails(manga: SManga): SManga = throw Exception("Stub!") /** - * Returns an observable with all the available chapters for a manga. + * Get all the available chapters for a manga. * + * @since extensions-lib 1.4 * @param manga the manga to update. + * @return the chapters for the manga. */ - fun fetchChapterList(manga: SManga): Observable> + suspend fun getChapterList(manga: SManga): List = throw Exception("Stub!") /** - * Returns an observable with the list of pages a chapter has. + * Get the list of pages a chapter has. Pages should be returned + * in the expected order; the index is ignored. * + * @since extensions-lib 1.4 * @param chapter the chapter. + * @return the pages for the chapter. */ - fun fetchPageList(chapter: SChapter): Observable> + suspend fun getPageList(chapter: SChapter): List = throw Exception("Stub!") + @Deprecated( + "Use the non-RxJava API instead", + ReplaceWith("getMangaDetails"), + ) + fun fetchMangaDetails(manga: SManga): Observable = throw Exception("Stub!") + + @Deprecated( + "Use the non-RxJava API instead", + ReplaceWith("getChapterList"), + ) + fun fetchChapterList(manga: SManga): Observable> = throw Exception("Stub!") + + @Deprecated( + "Use the non-RxJava API instead", + ReplaceWith("getPageList"), + ) + fun fetchPageList(chapter: SChapter): Observable> = throw Exception("Stub!") } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index d8f14a1..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':library' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..be2dccf --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +include(":library")