Volodymyr Korniienko
02/18/2022, 9:20 AMresponseBased
and operationBased
codegen. responseBased
is claimed to be more performant but generates tons of code that may affect class loading and compilation time. Therefore I’m wondering is there any performance analysis of these two methods based on response size/nested fragments count/any other metric?Jeremie
02/18/2022, 2:16 PMfragment ThreeLayerBreakdown on AbstractBreakdown {
...TokenBreakdownV3Fragment
}
Jeremie
02/21/2022, 12:25 PMplugin [id: 'com.apollographql.apollo3', version: '3.1.0'] was not found in any of the following sourcess
org.gradle.api.UnknownPluginException
Stylianos Gakis
02/23/2022, 9:59 AMtype SomeType {
name: String
}
And it’s crashing since JS doesn’t like it with error: JavaScript name (name) generated for this declaration clashes with another declaration: fun name(): String
.
Is there some way to automatically map those names to something else, maybe like “name_” or something smarter I must think about without annoying literally everyone about this limitation 😂 just like how we can map GraphQL types to Kotlin types?Stylianos Gakis
02/23/2022, 10:32 AMLocale
specified as a type with the specific string values that our backend accepts in the schema, and I want to use that in my local code in order to make sure I am not sending in a wrong string.
The queries themselves accept a String type, but I can use that type
enum Locale {
sv_SE
en_SE
... # more here
}
to use it typed in my code, and then extract the rawValue at the last moment to pass it to the query.
But the thing is, if none of the .graphql
files mention this type, it’s not generated automatically.Stylianos Gakis
02/23/2022, 12:19 PMjcenter()
in the list of repositories, despite having the IDE yell at me for it 😅
Is this something worrisome? And if yes, is the only solution possible to come from JetBrains themselves publishing their library somewhere else as well, or do you have plans to somehow not depend on that one in that artifact anymore at some point?
Also maybe a gotcha for someone who might add the dependency and get confused why it doesn’t work, idk if it’d fit your documentation really, but it’d suck for someone who wouldn’t know how to resolve this.Stylianos Gakis
02/23/2022, 2:13 PMe: error while writing /Users/stylianosgakis/ProjectsKmm/EmbarkX/shared/build/tmp/kotlin-classes/debug/com/hedvig/giraffe/adapter/EmbarkStoryQuery_ResponseAdapter$Data$EmbarkStory$Passage$EmbarkAddressAutocompleteActionAction$AddressAutocompleteActionData$EmbarkApiGraphQLMutationApi$MutationData$EmbarkAPIGraphQLMultiActionVariableVariable$EmbarkAPIGraphQLGeneratedVariableVariable.class (Permission denied)
and I have no idea what this is, just guessing it may have something to do with the name of the file being this big? Does the error ring any bells?Sean Proctor
02/23/2022, 10:43 PMaddHttpInterceptor
doesn't affect WS connections. Is that intentional? Is there an alternative to using an OkHttpClient
with an interceptor for web sockets?Stylianos Gakis
02/23/2022, 11:15 PMStylianos Gakis
02/24/2022, 9:42 AMStylianos Gakis
02/24/2022, 11:35 AMUncompletedCoroutinesError: After waiting for 60000 ms, the test coroutine is not completing
I stumbled upon this by chance and I figured out that there is another runTest
inside apollo-testing? Fortunately this does run now, all tests pass fine by using that runTest instead of the one from Coroutines 1.6.
But that was weeeird, if I didn’t have access to Kotlin slack channel I don’t think I would’ve ever figured this one out. Again, not sure how this could be noted in the docs, but maybe it deserves a spot?
Also if for some reason I also wanted the functionality of the coroutines runTest of passing in a dispatchTimeoutMs
I am now losing that functionality with the apollo version of it right?subham
02/25/2022, 11:12 AMCould not find org.jetbrains.kotlinx:kotlinx-nodejs:0.0.7.
Searched in the following locations:
- <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlinx/kotlinx-nodejs/0.0.7/kotlinx-nodejs-0.0.7.pom>
- <https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-nodejs/0.0.7/kotlinx-nodejs-0.0.7.pom>
- file:/Users/subhamtyagi/.m2/repository/org/jetbrains/kotlinx/kotlinx-nodejs/0.0.7/kotlinx-nodejs-0.0.7.pom
- <https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/kotlinx/kotlinx-nodejs/0.0.7/kotlinx-nodejs-0.0.7.pom>
- <https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven/org/jetbrains/kotlinx/kotlinx-nodejs/0.0.7/kotlinx-nodejs-0.0.7.pom>
Required by:
project :common-test > com.apollographql.apollo3:apollo-mockserver:3.1.0 > com.apollographql.apollo3:apollo-mockserver-js:3.1.0
project :common-test > com.apollographql.apollo3:apollo-testing-support:3.1.0 > com.apollographql.apollo3:apollo-testing-support-js:3.1.0
Possible solution:
- Declare repository providing the artifact, see the documentation at <https://docs.gradle.org/current/userguide/declaring_repositories.html>
Stylianos Gakis
03/03/2022, 11:40 AMJustin
03/11/2022, 5:54 PMmyschema.graphql
schema file as input and output a collection of kotlin files containing kotlin data classes for that schema?
For example, this GraphQL schema:
myschema.graphql
type User {
"""
The unique identifier for the user
"""
id: String!
"""
User first and last name
"""
name: String!
"""
Gender identity of user
"""
gender: Gender
}
enum Gender {
MALE
FEMALE
OTHER
UNKNOWN
}
...would generate:
User.kt
data class User(
val id: String,
val name: String,
val gender: Gender
)
Gender.kt
enum class Gender {
MALE, FEMALE, OTHER, UNKNOWN;
}
Stylianos Gakis
03/11/2022, 6:45 PMsubscriptionManager
here and there, always to call .reconnect() on it.
There is no mention in the migration files about this class. I am wondering if there’s some specific thing I can do to imitate whatever we were doing before, or if somehow this wouldn’t be necessary anymore due to the internals being changed somehow.
I’m trying to see when and why we call this so far (code that predates me) and it seems to be around places where we logout of the app, when we fetch a new token for our backend etc.
And I guess in general the question is how come that class completely was wiped from the internals, was it replaced with something? If not, how is that handled now in 3.0?Stylianos Gakis
03/11/2022, 7:24 PMapolloClient.clearHttpCache()
apolloClient.clearNormalizedCache(
object : ApolloStoreOperation.Callback<Boolean> { ... },
)
And I see that there is an alternative for the normalizedCache with apolloClient.apolloStore.clearAll()
as shown by the annotation, but can’t see something for clearHttpCache
. Is it part of something else? Something else I’m missing?james
03/16/2022, 6:08 AMapolloClient.apolloStore.readFragment
, is there a way to check if the CacheKey exists in the store prior to calling this?Ryli Davis
03/19/2022, 11:19 PMquery Picture($search: String) {
person: Character(search: $search) {
image {
medium
}
}
}
I am still trying to understand how to execute the query and connect my query to the UI. I'm trying to follow the tutorial, but am getting stuck still. Please see my MainActivity.kt code below
package com.example.thisone
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.ArrayAdapter
import android.widget.SearchView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContentProviderCompat.requireContext
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.apollographql.apollo3.ApolloClient
import com.apollographql.apollo3.exception.ApolloException
import com.example.thisone.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
val apolloClient = ApolloClient.Builder()
.serverUrl("<https://graphql.anilist.co>")
.build()
lateinit var binding: ActivityMainBinding
override fun onCreateView(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
val UserAdapter : ArrayAdapter<String> = ArrayAdapter(
this,android.R.layout.simple_list_item_1,
user
)
binding.userList.adapter = userAdapter
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
lifecycleScope.launchWhenResumed {
val response = try {
apolloClient.query(PictureQuery()).execute()
} catch (e: ApolloException) {
Log.d("Anime Character Picture", "Success", e)
null
}
val images = response?.data?.person?.image?.filterNotNull()
if (images != null && !response.hasErrors()) {
val adapter = PictureQuery_ResponseAdapter(image)
binding.image.layoutManager = LinearLayoutManager(requireContext())
binding.launches.adapter = adapter
}
}
binding.searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean {
binding.searchView.clearFocus()
if (user.contains(query)) {
userAdapter.filter.filter(query)
}
return false
}
override fun onQueryTextChange(newText: String?): Boolean {
userAdapter.filter.filter(newText)
return false
}
})
}
}
I also made a PictureAdapter.kt file where I'll show the code below, but I am unsure if everything I'm doing is setting me on the right track or if I'm completely in error.
package com.example.rocketreserver
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.thisone.PictureQuery
import com.example.thisone.databinding.ActivityMainBinding
class PictureAdapter(
private val images: List<PictureQuery.Person>
) : RecyclerView.Adapter<PictureAdapter.ViewHolder>() {
class ViewHolder(val binding: ActivityMainBinding) : RecyclerView.ViewHolder(binding.root)
override fun getItemCount(): Int {
return images.size
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val binding = ActivityMainBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return ViewHolder(binding)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val person = images[position]
holder.binding.userList.textAlignment = person.image ?: ""
}
}
Here is the activity_main.xml code below. Again, thank you in advance for helping a super novice programmer. I am slowly but surely learning my way.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
xmlns:app="<http://schemas.android.com/apk/res-auto>"
xmlns:tools="<http://schemas.android.com/tools>"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:queryHint="Enter Anime Character Name"
android:iconifiedByDefault="false"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="16dp"
android:background="@drawable/searchview_background"
android:queryBackground="@android:color/background_light"/>
<ListView
android:id="@+id/userList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"/>
</LinearLayout>
Sam Michael
03/23/2022, 8:30 AMNick
03/23/2022, 1:47 PMquery Project($id: ID!) {
project(projectId: $id) {
id
name
}
}
And I’m calling it with the following:
val project = apollo.query(ProjectQuery(projectId)).execute()
What would cause this issue in the screenshot where it says I’m missing a field and some other errors?Sam Michael
03/29/2022, 4:42 PMYacov Rosenberg
03/29/2022, 9:24 PMannsofi
04/05/2022, 3:00 PMgenerateTestBuilders.set(true)
(though I tried turning that off, that didn't work either) and I keep on getting errors from a TestBuilder for the queries from my other branch, that the classes don't exist.agrosner
04/05/2022, 7:31 PM__typename
first, the two hashes used will never match upVitaliy Kondratiev
04/07/2022, 7:36 PMAlejandro Rios
04/08/2022, 8:53 PMenqueue
in order to add a Callback that manage either Success/Failure response, but after migration I see that there's no enqueue
option anymore, in the 🧵 there'a a sample code of what we are using.clark
04/12/2022, 6:56 PMNick
04/21/2022, 8:13 PMNick
04/21/2022, 11:12 PM@nonnull
and the server gives me a null value for that field, what will happen?clark
04/23/2022, 7:25 PMCaused by: java.lang.IllegalStateException: Apollo: specify 'packageName':
The bug happens when I add jvmTest
dependenciesclark
04/23/2022, 7:25 PMCaused by: java.lang.IllegalStateException: Apollo: specify 'packageName':
The bug happens when I add jvmTest
dependenciesval jvmTest by getting {
dependencies {
implementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
}
}
mbonnin
04/23/2022, 7:45 PMclark
04/23/2022, 7:46 PMmbonnin
04/23/2022, 7:47 PMclark
04/23/2022, 7:47 PMuseVersion2Compat()
mbonnin
04/23/2022, 7:48 PMclark
04/23/2022, 8:01 PMjvm()
as a target 😅mbonnin
04/23/2022, 8:54 PM