https://kotlinlang.org logo
Docs
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
  • m

    Marcin Wisniowski

    03/12/2023, 5:38 AM
    Or is that just a matter of using blocking APIs of Retrofit (as opposed to
    suspend
    functions I currently have)?
  • m

    Marcin Wisniowski

    03/12/2023, 5:59 AM
    Thanks, using
    Call
    and
    execute()
    instead of coroutines on my inner request fixed the issue.
  • d

    Davide Giuseppe Farella

    03/12/2023, 8:47 AM
    #Molecule #Paging-compose Hello people, I promised myself to explore Molecule, but never had a chance. I’m integrating Paging in my Compose project, and what I hate most is the fact that your paged items cannot be part of the State, as you need to collect the paged Flow from Compose I was wondering if Molecule can solve this, as I imagine I could do the following:
    class MyViewModel {
    
      val state = launchModulecule {
        val lazyPagingItems = pagedFlow.collectAsLazyPagingItems()
        MyState(
          items = lazyPagingItems,
          stuff = someStuff
        )
      }
    }
    Is this correct?
  • v

    veyndan

    03/13/2023, 1:46 PM
    It's not obvious to me why that doesn't work. Have you got a minimal reproducible example to checkout?
    d
    • 2
    • 3
  • b

    Big Chungus

    03/14/2023, 5:29 PM
    [KotlinPoet] Is it possible to add explicit wildstar imports to a generated file? I'm working with c imports and have no way to distinguish where a known type comes from, but I know that one of the given packages will have it.
    v
    • 2
    • 10
  • c

    Colton Idle

    03/15/2023, 5:34 AM
    I got a requirement to be able to retry a failed 500 network call up to 5 times (with a 5 second delay). I know that a network interceptor will be my friend here, but is the retry count something that I should just try to persist somewhere, or is there someway to know that I'm retrying the same request without having to create some sort of singleton or something? It also seems like okhttp might retry on my behalf anyway. Is there a way to disable that so I can follow my retry specs directly?
    y
    e
    c
    • 4
    • 15
  • d

    David Carr

    03/16/2023, 11:57 PM
    Is there any support in SQLDelight for writing cross-db queries? i.e. ATTACH a second database, and then write a query that references a table there? I've tried to test it but the compilation immediately fails with
    No table found with name
    which would imply this is not supported
  • h

    hfhbd

    03/17/2023, 2:07 AM
    Unfortunately, this is not yet supported, see https://github.com/cashapp/sqldelight/issues/3761 and requires full qualified table names.
  • d

    David Carr

    03/17/2023, 2:39 AM
    I see, thanks! Out of curiosity is support for this planned?
    h
    • 2
    • 1
  • e

    eygraber

    03/17/2023, 3:09 AM
    Is layoutlib updated according to any schedule in Paparazzi, or is it need based? Looks like an updated layoutlib will be needed to support androidx.core 10 (currently in RC) https://github.com/cashapp/paparazzi/issues/706
  • m

    myanmarking

    03/17/2023, 6:09 PM
    Hello. For some time i wanted to migrate from Room to SqlDelight, but unfortunately i cannot do a full migration because the db is too large. Is there any recommended pathway to partial migrations over time?
    p
    • 2
    • 2
  • d

    Davide Giuseppe Farella

    03/17/2023, 6:39 PM
    #SqlDelight #SqlLite3-35 #Type Hello people. I have the following View:
    CREATE VIEW IF NOT EXISTS screenplay AS
        SELECT
            movie.tmdbId AS movieTmdbId,
            NULL AS tvShowTmdbId,
            ...
        FROM movie
        UNION ALL
        SELECT
            NULL AS movieTmdbId,
            tvShow.tmdbId AS tvShowTmdbId,
            ...
        FROM tvShow;
    where
    movieTmdbId
    and
    tvShowTmdbId
    are of types
    sealed interface ScreenplayTmdbId 
    value class MovieTmdbId : ScreenplayTmdbId
    value class TvShowTmdbId: ScreenplayTmdbId
    I would like to query a single row by id. It would be awesome if SqlDelight could infer the super-type
    ScreenplayTmdbId
    , but I see that’s not happening, as the following resolves
    tmdbId
    as String
    WHERE IFNULL(movieTmdbId, tvShowTmdbId) == :tmdbId;
    I tried then to separate into two separate queries, but, somehow, the first of the following queries compiles, while the second one doesn’t
    findByMovieId:
        SELECT
            movieTmdbId,
            tvShowTmdbId,
            ...
        FROM screenplay
        WHERE movieTmdbId == :tmdbId;
    
    findByTvShowId:
        SELECT
            movieTmdbId,
            tvShowTmdbId,
            ...
        FROM screenplay
        WHERE tvShowTmdbId == :tmdbId;
    Caused by: java.lang.IllegalArgumentException: Cannot bind unknown types or null
    I’m pretty sure I’m doing something wrong
    h
    • 2
    • 7
  • s

    spierce7

    03/17/2023, 9:44 PM
    Does the multiplatform okio support encryption at all?
  • j

    jw

    03/17/2023, 9:56 PM
    Okio multiplatform does not support encryption. Things like compression and encryption rely on JDK APIs. The only thing tangentially related that is supported is hashing.
    s
    • 2
    • 1
  • j

    jessewilson

    03/18/2023, 12:10 AM
    I’ve got signing code in Zipline that might be helpful if you’re looking for a sample: https://github.com/cashapp/zipline/blob/trunk/zipline-loader/src/nativeMain/kotlin/app/cash/zipline/loader/internal/EcdsaP256.kt
  • t

    Tim Malseed

    03/18/2023, 2:36 AM
    I’m using cashapp/copper to observe content provider changes. I noticed that it’s taking about ~10 seconds for App B to observe a change occurring in App A. This is a little OT, it’s not a Copper issue, but rather a content provider one - and I think it maybe relates to the API level.. I’ll get stuck with a :not-kotlin: if I ask anywhere else 😓 But I figured someone who wrote Copper might be familiar with the Content Provider APIs
  • j

    jw

    03/18/2023, 2:37 AM
    I assume this is Android throttling wakeups to avoid a thundering herd problem. There have been a lot of changes here in the last 5 years.
  • j

    jw

    03/18/2023, 2:38 AM
    We use it to observe the contact database and the code has basically been unchanged since... like 7 years ago? maybe more?
  • j

    jw

    03/18/2023, 2:38 AM
    We also are not sensitive to latency. We don't know (or care) whether an update is instant or happens a minute later.
  • t

    Tim Malseed

    03/18/2023, 2:39 AM
    Interestingly, a content observer in the same process observes changes immediately. I don’t really have any concept of how content changes are actually passed between processes by the system
  • t

    Tim Malseed

    03/18/2023, 2:39 AM
    And this isn’t a super important issue, latency here isn’t a big deal. Just curious about it. It’s consistently about 10 seconds to notice a change
  • t

    Tim Malseed

    03/18/2023, 2:41 AM
    Oh, and good point! I didn’t realise how long Copper has been around 😅
  • j

    jw

    03/18/2023, 2:42 AM
    It was part of SQLBrite before. It got spun out when we archived the SQLBrite project.
  • t

    Tim Malseed

    03/18/2023, 2:42 AM
    Oh right. Yeah I used to use SqlBrite back in the day. And now SqlDelight
  • j

    jw

    03/18/2023, 2:42 AM
    if you scroll through the developer changes section of the Android releases of the last 5 years I bet you can find something about cross-process notifications being throttled
  • t

    Tim Malseed

    03/18/2023, 2:43 AM
    No worries, thanks!
  • t

    Tim Malseed

    03/18/2023, 2:47 AM
    I quickly got tired of trying to find an answer in the docs, so I asked ChatGPT:
    Content observers, which allow apps to listen for changes in data in a content provider, are also affected by the changes in Android’s background processing restrictions.
    Starting with Android 9 (API level 28), the system limits the frequency at which content observers receive notifications about changes in data. Specifically, content observers are now subject to the same background processing restrictions as other types of services and apps.
  • t

    Tim Malseed

    03/18/2023, 2:50 AM
    I’m just answering my own question here in case anyone else is interested. But, I’m guessing part of the problem, is I’m leaving the observer app (App B), to make a change in the producer app (App A). So the change is made while App B is in the background. Then I return to App B, and it takes ~10 seconds. Maybe if App B was in the foreground when the change occurred, the delay would be smaller. In any case, if I need a more immediate answer, I could just execute the query in
    onResume()
    or something.
  • j

    jw

    03/18/2023, 2:54 AM
    try split screen? at least to test your theory
  • t

    Tim Malseed

    03/18/2023, 5:53 AM
    Yeah, the change is detected almost instantly when the app is in the foreground (via split screen)
Powered by Linen
Title
t

Tim Malseed

03/18/2023, 5:53 AM
Yeah, the change is detected almost instantly when the app is in the foreground (via split screen)
View count: 3