mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Update Voyager and improve dependency addition
This commit is contained in:
@@ -6,6 +6,7 @@ plugins {
|
||||
id(libs.plugins.ksp.get().pluginId)
|
||||
id(libs.plugins.buildkonfig.get().pluginId)
|
||||
id(libs.plugins.kotlinter.get().pluginId)
|
||||
id(libs.plugins.ktorfit.get().pluginId)
|
||||
id(libs.plugins.apollo.get().pluginId)
|
||||
}
|
||||
|
||||
@@ -128,5 +129,9 @@ apollo {
|
||||
packageName.set("ca.gosyer.jui.data.graphql")
|
||||
generateMethods.set(listOf("equalsHashCode"))
|
||||
mapScalar("LongString","kotlin.Long", "ca.gosyer.jui.data.scalars.LongStringScalar")
|
||||
introspection {
|
||||
endpointUrl.set("http://localhost:4567/api/graphql")
|
||||
schemaFile.set(file("src/main/graphql/schema.graphqls"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,11 @@ import ca.gosyer.jui.domain.settings.service.SettingsRepository
|
||||
import ca.gosyer.jui.domain.source.service.SourceRepository
|
||||
import ca.gosyer.jui.domain.updates.service.UpdatesRepository
|
||||
import com.apollographql.apollo3.ApolloClient
|
||||
import com.apollographql.apollo3.annotations.ApolloExperimental
|
||||
import com.apollographql.apollo3.network.ktorClient
|
||||
import de.jensklingenberg.ktorfit.Ktorfit
|
||||
import io.ktor.http.URLBuilder
|
||||
import io.ktor.http.appendPathSegments
|
||||
import me.tatarka.inject.annotations.Provides
|
||||
|
||||
interface DataComponent {
|
||||
@@ -37,12 +40,17 @@ interface DataComponent {
|
||||
.baseUrl(serverPreferences.serverUrl().get().toString().addSuffix('/'))
|
||||
.build()
|
||||
|
||||
@OptIn(ApolloExperimental::class)
|
||||
@Provides
|
||||
fun apolloClient(
|
||||
http: Http,
|
||||
serverPreferences: ServerPreferences,
|
||||
) = ApolloClient.Builder()
|
||||
.serverUrl(serverPreferences.serverUrl().get().toString())
|
||||
.serverUrl(
|
||||
URLBuilder(serverPreferences.serverUrl().get())
|
||||
.appendPathSegments("api", "graphql")
|
||||
.buildString()
|
||||
)
|
||||
.ktorClient(http)
|
||||
.build()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user