https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
squarelibraries
  • t

    Trevor Stone

    04/11/2022, 1:55 AM
    Has anyone gotten sqldelight to be accessible for jsBrowserTest? I have been messing with karma.config files and haven't been able to crack it. I can see the wasm file in the correct tmp folder but it isn't able to be accessed by the tests
    d
    • 2
    • 13
  • d

    Dorit Rein

    04/11/2022, 8:40 PM
    Hi -- i have a question about how code generators work. What all does
    projectFiles
    encompass? Is it divided up by gradle target?
    r
    • 2
    • 3
  • s

    spierce7

    04/12/2022, 4:35 AM
    Does sqldelight sanitize the sql it runs??
    e
    • 2
    • 5
  • a

    Andrew O Hart

    04/12/2022, 10:52 AM
    Is it possible to return a max value from a table in SQLDelight? I'm trying
    retrieveMostRecentLastModificationDate:
    SELECT MAX(Information.lastModificationDate) FROM Information LIMIT 1;
    And it is returning Query<RetrieveMostRecentLastModificationDate> I just need to return the most recent date from the table, so I would expect it to return as an Int or a Long as we are storing it using toEpochMilliseconds
    e
    a
    • 3
    • 7
  • l

    Lilly

    04/12/2022, 11:30 PM
    It's more a general question than specific to okhttp, but when Android only provides
    HttpURLConnection
    as http client, every 3rd party has to be based on
    HttpURLConnection
    and so okhttp too or not? But since Android 4.4
    HttpURLConnection
    uses okhttp as http engine. This confuses me a bit. Does that mean okhttp is not based on any other API and is written from scratch? Can someone enlighten me please?
    j
    e
    y
    • 4
    • 21
  • d

    David Nedrow

    04/20/2022, 4:08 PM
    I've been trying to integrate SQLDelight for a couple of days now, and have failed. See the thread for more info.
    n
    • 2
    • 10
  • r

    r

    04/22/2022, 11:25 PM
    Hello! I'm using SQLDelight for my project and I'm trying to understand what's the "correct" way of doing a query returning a Flow. My goal is to make sure the DB access happens on
    IO
    and the transformation of data happens on
    Default
    . I have something like this:
    fun someQuery(): Flow<List<SomeItem>> = database.transactionWithResult {
      database.someQueries.someItems(someMapper)
        .asFlow()
        .flowOn(IO)
        .mapToList()
        .distinctUntilChanged()
        .map { someTransformation(it) }
        .flowOn(Default)
    }
    Is the
    flowOn(IO)
    required?. What about this:
    ...
      database.someQueries.someItems(someMapper)
        .asFlow()
        .mapToList(IO)
        .distinctUntilChanged()
        .map { someTransformation(it) }
        .flowOn(Default)
    ...
    Would that make any difference? From my understanding,
    mapToList()
    will use
    Default
    if we don't pass a context but I want to make sure
    IO
    is used during the DB access and
    Default
    during the transforming the data. Thanks in advance!
    b
    • 2
    • 18
  • c

    charleskorn

    04/24/2022, 2:42 AM
    I’ve just published https://github.com/charleskorn/okhttp-system-keystore/, a small library that makes it easy to use trusted certificates from the operating system keystore (Keychain on macOS, Certificate Store on Windows) with OkHttp. Feedback, suggestions and ideas welcome 🙂
    :mind-blown: 1
    :nice: 2
    e
    y
    • 3
    • 4
  • c

    Colton Idle

    04/25/2022, 2:40 AM
    My app has a typical OAuth flow in terms of, 401 comes into the app, the app (via an interceptor) detects this 401, and tries to exchange the refresh token for a new set of auth and refresh tokens. This works great with okhttp interceptors... but I've noticed in cases where the user comes back to the app and 2 network calls are made at the same, I will get two 401s, and therefore (unfortunately) my interceptor will trigger twice. Anyone have any guidance/experience around this. My initial reaction is to write some sort of state to my user
    isAuthRefreshInProgress
    and short-circuit the interceptor if it's already in progress, but then I'm not sure how I'd wait for the auth refresh to be complete, so I can make that second call again. Here's a gist of my current interceptor.
    e
    p
    • 3
    • 6
  • j

    jw

    04/27/2022, 3:22 AM
    With any luck, in a year or two we'll have a Kotlin-first Retrofit where it won't matter
    :kotlin-intensifies: 7
    e
    e
    • 3
    • 3
  • d

    Derek Ellis

    04/29/2022, 4:49 AM
    When implementing a new driver, is there any mechanism in sqldelight to translate the
    ?
    placeholders (like
    INSERT INTO a VALUES (?, ?)
    ) to something else, e.g.
    ($1, $2)
    , if the underlying driver doesn't like the question marks?
    h
    • 2
    • 1
  • j

    jw

    04/29/2022, 4:04 PM
    if you want to wait on wall-clock time you can do
    withContext(Default) { delay(2.seconds) }
    and then assert no events were received
    👍 1
    m
    • 2
    • 1
  • d

    Dragos Rachieru

    05/02/2022, 9:22 AM
    Hello, about
    okio
    , is there a way to read a path using
    ByteReadChannel
    ? I am trying to create a multiplatform image loading library and I want to create something like this: https://github.com/alialbaali/Kamel/blob/main/kamel-core/src/jvmMain/kotlin/io/kamel/core/fetcher/JvmFileFetcher.kt
    j
    • 2
    • 4
  • p

    Paul Woitaschek

    05/03/2022, 6:30 AM
    With the latest release of turbine I’m seeing a behavior change I can’t make sense of. Basically it boils down to this test case failing:
    private fun contentFlow(): Flow<Int> {
        return combine(
          flowOf(Unit),
          flowOf(2).onStart { emit(1) }
        ) { _, b ->
          b
        }.onEach { println(it) }
      }
    
      @Test
      fun turbineCollect() = runTest {
        contentFlow()
          .test {
            check(awaitItem() == 1)
            cancelAndIgnoreRemainingEvents()
          }
      }
    
      @Test
      fun regularCollect() = runTest {
        check(contentFlow().toList() == listOf(1, 2))
      }
    https://github.com/cashapp/turbine/issues/112
    t
    • 2
    • 1
  • j

    jw

    05/03/2022, 6:28 PM
    generally seems like people point to this wiki to answer those questions https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
    b
    • 2
    • 3
  • b

    brabo-hi

    05/04/2022, 4:57 PM
    hi all, i am using issue integrating sqldelight with KMM with ``app.cash.sqldelight😒qlite-3-38-dialect:2.0.0-alpha02``, it is working for android, but not for the ios
    • 1
    • 1
  • l

    Laurence Muller

    05/09/2022, 4:05 PM
    I am trying to use SQLDelight 2.0.0-alpha02 but it seems like I'm missing something with the setup. Using the guide ( https://cashapp.github.io/sqldelight/android_sqlite/ ) but then replacing it with the new namespace
    app.cash.sqldelight
    and version
    2.0.0-alpha02
    gradle seems to be a bit unhappy. I'm using AS Dolphin Canary 9.
    j
    a
    e
    • 4
    • 21
  • l

    Laurence Muller

    05/09/2022, 7:04 PM
    While it's not explicitly mentioned in the docs, but is sqlite-android from Requery the preferred method to get a json1 compatible sqlite version in SQLDelight (on Android)? Looks like using:
    dialect = "app.cash.sqldelight:sqlite-3-35-dialect:2.0.0-alpha02"
    With:
    implementation 'com.github.requery:sqlite-android:3.36.0'
    and this is working quite well:
    val driver = AndroidSqliteDriver(
                schema = MyDatabase.Schema,
                context = this,
                name = "test.db", 
                factory = RequerySQLiteOpenHelperFactory()
            )
    a
    • 2
    • 6
  • p

    Philip Dukhov

    05/13/2022, 6:22 AM
    I'm using Retrofit with Gson, and and when some field is incorrect, I'm not receiving an exception until try to read the value - only then I'm getting a
    NullPointerException
    Is there a way to enable exceptions for non null fields when deserialization fails?
    y
    k
    • 3
    • 2
  • h

    hfhbd

    05/13/2022, 9:55 AM
    SQLdelight and gradle magic: How can you add a dependency to a local dialect? I hoped, simple setting
    dialect = ":native-dialect
    would work.
    a
    • 2
    • 9
  • m

    mbonnin

    05/13/2022, 11:11 AM
    Can I make the SQLDelight generated classes
    internal
    ?
    🇳🇴 3
    k
    • 2
    • 2
  • j

    jw

    05/21/2022, 1:00 AM
    We've had samples running on Android, iOS, and the browser for a year, we're rolling it out in projection in the next few weeks, and it's entirely built as a standalone tool so it can be open sourced once we finish polishing it as an offering
    👍 2
    🎉 14
    👀 1
    • 1
    • 1
  • d

    dimsuz

    05/21/2022, 12:25 PM
    When using
    sqlDelight
    how do you usually combine relations to keep everything reactively observable? Let's say I have a
    User
    and
    Comment
    tables, each user has many comments. And now I build a list of users with comments:
    val users: List<User> = database.userQueries.select_all { userId, userName ->
      val comments = database.commentQueries.find_by_user_id(userId).executeAsList()
      User(userId = userId, name = userName, comments = comments)
    }.executeAsList()
    But now I want to create a
    Flow<List<User>>
    . I have no problem doing
    val usersFlow = database.userQueries.select_all(...).asFlow()
    But this won't emit if individual comment changes, won't it? So I need to do
    asFlow
    on each individual user's "comment"-query and then flatMap them, this gets complicated suddenly. Is there a nicer way?
    m
    k
    a
    • 4
    • 6
  • s

    saket

    05/24/2022, 2:39 PM
    yep, here's an example: https://github.com/saket/press/blob/trunk/shared/src/macosTest/kotlin/me/saket/press/shared/db/BaseDatabaeTest.kt
    r
    k
    • 3
    • 4
  • j

    jw

    05/24/2022, 10:47 PM
    Probably https://github.com/touchlab/SQLiter/issues/7 and https://github.com/cashapp/sqldelight/issues/3241
    👍 1
    ❤️ 1
    k
    • 2
    • 1
  • a

    Anastasia Rozovskaya

    05/26/2022, 2:26 PM
    Hi, all! Does anyone know how to use JavaNetCookieJar to collect cookies from multiple redirects? I’ll post more info in a thread below.
    j
    • 2
    • 8
  • d

    Dorit Rein

    05/31/2022, 8:46 PM
    Hi team -- I have some questions about Anvil. I am trying to autogenerate both a
    MergeModules
    and a
    MergeComponent
    that depends on that
    MergeModules
    . It looks something like this:
    @MergeModules(scope = MyScope::class)
    public interface MyModule
    
    @MergeComponent(
      scope = AnvilScope::class,
      dependencies = [],
      modules = [MyModule::class]
    )
    public interface MyComponent
    However, Anvil complains that it can't resolve
    MyModule
    even though they are defined in the same generated file. Any thoughts?
    r
    • 2
    • 6
  • p

    Paul Woitaschek

    06/01/2022, 9:05 PM
    Duplicated the files for now 😕
    p
    • 2
    • 1
  • p

    Paul Woitaschek

    06/04/2022, 12:06 PM
    Is it possible to let paparazzi only do a screenshot of the actual composable? For example here I’d like to have the composable without the statusbar and with the whole screen height.
    c
    • 2
    • 8
  • z

    Zac Sweers

    06/11/2022, 10:30 PM
    @rkeazor can you elaborate?
    r
    • 2
    • 11
Powered by Linen
Title
z

Zac Sweers

06/11/2022, 10:30 PM
@rkeazor can you elaborate?
r

rkeazor

06/11/2022, 10:34 PM
@Zac Sweers
Caused by: java.lang.IllegalStateException: Could not parse metadata! Try bumping kotlinpoet and/or kotlinx-metadata version.
	at com.squareup.kotlinpoet.metadata.KotlinPoetMetadata.readKotlinClassMetadata(KotlinPoetMetadata.kt:90)
	at com.squareup.kotlinpoet.metadata.KotlinPoetMetadata.toKmClass(KotlinPoetMetadata.kt:119)
	at dev.zacsweers.moshix.sealed.codegen.MoshiSealedProcessor.process(MoshiSealedProcessor.kt:177)
	at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt:90)
	at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:197)
	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:985)
z

Zac Sweers

06/11/2022, 10:35 PM
Can you please paste the entire trace
r

rkeazor

06/11/2022, 10:36 PM
Untitled.txt
z

Zac Sweers

06/11/2022, 10:49 PM
What version of Moshi?
1.13.0 uses kotlinx-metadata 0.4.0, which supports kotlin 1.7.0
if you’re using 1.13.0, can you create a minimally reproducing repro case?
r

rkeazor

06/11/2022, 11:00 PM
Yea moshi 1.13.0
Sure
Actually nevermind, we had a old version MoshiX that was causing the problem
incrementing to 0.18.1 fixed it
🚀 1
👍 1
Thanks @Zac Sweers appreciate it
👍 1
View count: 11