jw
08/05/2022, 7:21 PMwiktor
08/16/2022, 5:20 AMjean
08/16/2022, 6:19 AMfun interface
but the generated code is using a`:` instead of a =
like so :
public fun <AsyncDataType, LoadEvent> loadAsyncData(
key: TransitionKey,
loader: (LoadEvent) -> AsyncDataType
): ReusableTransition<LoadEvent> { updater, event ->
...
}
I use the following code to generate it
FunSpec.builder("loadAsyncData")
.addTypeVariable(asyncDataType)
.addTypeVariable(loadEvent)
.addParameter("key", TransitionKeyGenerator.className)
.addParameter("loader", loader)
.returns(reusableTransition)
.addCode(
CodeBlock.builder()
.add(...)
.build()
).build()
itnoles
08/16/2022, 11:36 PMjw
08/16/2022, 11:51 PMitnoles
08/16/2022, 11:53 PMJemo
08/17/2022, 9:41 AMJavier
08/18/2022, 12:42 PMColton Idle
08/20/2022, 7:55 AMjava.lang.IllegalArgumentException: Unexpected char 0x41c at 74 in Content-Disposition value: inline; filename="7326f70a-1b88-4ff8-afc8-5f52190c7052b7179b07fcb968827a_Мала.jpg"
I wrote this interceptor and I set it as a network interceptor, but I still get the same crash (as if the interceptor doesn't even get applied). Can anyone point me in the right direction?
private val REMOVE_HEADER_INTERCEPTOR = Interceptor { chain ->
val originalResponse = chain.proceed(chain.request())
originalResponse.newBuilder()
.removeHeader("Content-Disposition")
.build()
}
ribesg
08/22/2022, 3:48 PMWilliam Reed
08/22/2022, 8:06 PMjw
08/22/2022, 8:16 PMPiotr Prus
08/22/2022, 9:33 PMsqldelight
and release version of android app. I have the file favourites.sq and CREATE TABLE
statement into it. On debug version of the app it works, but on release it is not creating the table and app crash with error:
no such table: favourite
. I found somewhere on slack that I can put CREATE TABLE
also in 1.sqm. I did that and surprisingly it works. Unfortunatelly, on debug version I go t the error now:
table favourite already exists
How can I get rid of it and why the release version of the app needs the migration file if I actually do not migrate anything ? 😕Lukasz Kalnik
08/23/2022, 1:56 PMsynchronized(lock)
doesn't seem to prevent the second call to try to refresh the token as well.
val okHttpClient = OkHttpClient.Builder()
.addInterceptor(AccessTokenInterceptor(oAuthRepository))
.authenticator(RefreshTokenAuthenticator(oAuthRepository))
.build()
val lock = Any()
private class AccessTokenInterceptor(
private val oAuthRepository: OAuthRepository
) : Interceptor {
override fun intercept(chain: Chain): Response {
synchronized(lock) {
val token = oAuthRepository.accessToken
val request = chain.request().newBuilder().apply {
if (token != null) header("Authorization", "Bearer $token")
}.build()
return chain.proceed(request)
}
}
}
private class RefreshTokenAuthenticator(
private val oAuthRepository: OAuthRepository
) : Authenticator {
override fun authenticate(route: Route?, response: Response): Request? {
if (response.responseCount >= 2) return null
synchronized(lock) {
return runBlocking {
oAuthRepository.refreshTokens().map {
oAuthRepository.accessToken
}
}.fold(
ifLeft = { null },
ifRight = {
it?.let { token ->
response.request.newBuilder()
.header("Authorization", "Bearer $token")
.build()
}
}
)
}
}
}
William Reed
08/24/2022, 3:45 PMsqldelight {
database("MyDb") {
packageName = "com.foo.bar"
dialect = "mysql"
sourceFolders = listOf("sqldelight")
migrationOutputDirectory = file("$buildDir/resources/main/migrations")
migrationOutputFileFormat = ".sql"
}
}
the generateMainDatabaseMigrations
task is not being created. is there something else I’m missing? I have my initial CREATE TABLE
statement & queries in src/main/sqldelight/com/foo/bar/…
and I have my .sqm
file in src/main/sqldelight/…
KamilH
08/24/2022, 8:22 PMmoduleA
that contains a table definitions. I would like to write some queries for those tables in a separate moduleB
. Is it possible? I had found dependency(project(":path"))
option and I tried to use it, however when I try to reference a table in a .sq
file it fails to resolve it. Is there anything I’m missing?Michal Klimczak
08/26/2022, 6:00 AMAsad Mukhtar
08/30/2022, 5:28 AMColton Idle
08/30/2022, 7:56 AMTransfer-Encoding: chunked
header. If I replay that request, omitting that header via charles, then the upload succeeds. If I try to remove the header programatically, it still appears in the request (according to charles). Any idea whats up with that? Am I taking the wrong path here?
val resolver = getApplication<Application>().contentResolver
val doc = DocumentFile.fromSingleUri(getApplication(), content)!!
val type = (doc.type ?: DEFAULT_TYPE).toMediaType()
val contentPart = InputStreamRequestBody(type, resolver, content)
val request = Request.Builder().url(url).addHeader("DOES", "THIS WORK").put(contentPart).removeHeader("Transfer-Encoding").build()
grahamborland
08/31/2022, 12:57 PMINSERT
or UPDATE
, or does it do something lower-level like watching the filesystem for changes to the database?jw
08/31/2022, 1:01 PMBenoit Quenaudon
08/31/2022, 6:14 PMJohn Aoussou
09/04/2022, 5:05 AMbuild.gradle.kts
file looks like this
group "com.example"
version "1.0-SNAPSHOT"
allprojects {
repositories {
google()
mavenCentral()
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
}
}
plugins {
kotlin("multiplatform") apply false
kotlin("android") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
}
I'm trying to follow the info here https://cashapp.github.io/sqldelight/multiplatform_sqlite/ but I'm unable to make the parallel. Where am I supposed to insert
'com.squareup.sqldelight:gradle-plugin:1.5.3'
and
'com.squareup.sqldelight'
?hfhbd
09/04/2022, 12:10 PMgroup "com.example"
version "1.0-SNAPSHOT"
allprojects {
repositories {
google()
mavenCentral()
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>")
}
}
plugins {
kotlin("multiplatform") apply false
kotlin("android") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
id("com.squareup.sqldelight) version "1.5.3" apply false // or define the version in other places like the kotlin version
}
And apply the plugin in the sub project, eg app:
plugins {
kotlin("multiplatform")
kotlin("android")
id("com.android.application")
id("com.android.library")
id("org.jetbrains.compose")
id("com.squareup.sqldelight)
}
Philip Dukhov
09/06/2022, 9:22 AMdata class PingResponse(
@Json(name = "needs_update") val shouldUpdate: Boolean,
)
And it works fine in debug, but with release minification it crashes with the following:
IllegalArgumentException: No property for required constructor parameter #0 shouldUpdate of fun `<init>`(kotlin.Boolean): not.minimized.package.PingResponse
It works fine if I apply @JsonClass(generateAdapter = true)
to class.
As per documentation it sounds like I only need to apply @JsonClass(generateAdapter = false)
to enums, and the rest should work out of the box.
I find it very tricky that it works in debug without this annotation but fails in release.
This comment suggests not minimizing all the models, but I don't find it much useful in my case, as I don't store all the models in one package.
I can apply @JsonClass(generateAdapter = true)
to all my models, the biggest issue is that if I forget to do that I won't know there's a problem until I run release version.
Am I missing some other way to set it up, or is there a way to make app crash in debug(or build time check?), same as it does in release, in case when model has no JsonClass
annotation?hfhbd
09/07/2022, 4:29 AMprintln("Hello ${Foo.bar}")
but I get println("Hello $Foo.bar")
which is wrong.Ivan Đorđević
09/07/2022, 7:58 AMQuery<...>.asFlow().mapToList()
to be cached somehow when the related tables haven't changed? Right now this uses a cold flow and reads from the DB on each collect. Is something like this on the roadmap currently?xxfast
09/09/2022, 5:29 AMFileSystem
? Always get
Caused by: android.system.ErrnoException: open failed: EROFS (Read-only file system)
when I do this on androidMain
FileSystem.SYSTEM.sink("test.json".toPath)
xxfast
09/13/2022, 11:41 AMJson.decodeFromBufferedSource()
does this halt whatever thread you call it from?jw
09/13/2022, 11:47 AMjw
09/13/2022, 11:47 AM