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
  • y

    yschimke

    11/01/2022, 1:56 PM
    I think the rough plan for OkHttp multiplatform JS support would be. omit the streaming data accessors, and only have one providing completed data. String, bytes. But follow okio on this. Not sure how that applies to natural streaming concepts like sockets.
  • y

    yschimke

    11/01/2022, 1:57 PM
    Low confidence on this prediction.
  • a

    Aaron Todd

    11/01/2022, 2:29 PM
    In the one place I use it I buffer the whole body before wrapping
    I think the rough plan for OkHttp multiplatform JS support would be. omit the streaming data accessors, and only have one providing completed data. String, bytes.
    Buffering the entire contents of a large response in memory isn't going to work for large/streaming responses. I'd imagine what I'll have to end up doing is creating an async version of Pipe and then maybe wrapping it in sum type we actually expose like:
    sealed class ByteStream {
         data class Source(val source: okio.Source): ByteStream(), okio.Source by source
         
         data class Streaming(val source: AsyncStream): ByteStream()
    }
    
    // convenience functions for most common operations that deal with the variant differences 
    suspend fun ByteStream.writeToFile(file: File): Unit
    suspend fun ByteStream.toByteArray(): ByteArray
    suspend fun ByteStream.toBuffer(): okio.Buffer
    For JVM/Native it will be relatively simple, just expose the underlying contents of the response as a
    Source
    and have the convenience suspend functions block on
    <http://Dispatchers.IO|Dispatchers.IO>
    . On JS expose an async abstraction that introduces one layer of buffering between the consumer and producer.
  • j

    jessewilson

    11/01/2022, 2:56 PM
    Buffering the entire contents of a large response in memory isn't going to work for large/streaming responses.
    We might choose to not support these on JS.
  • a

    Aaron Todd

    11/01/2022, 3:13 PM
    Interesting. Ok well I appreciate the insights into how you guys are considering supporting (or not supporting) this use case. We haven't gotten to KMP support yet but this question on JS is a big "known unknown" for us as well. We won't be able to not support streaming/large responses though so JS I/O will likely be a different abstraction, time will tell I suppose
  • s

    Stylianos Gakis

    11/04/2022, 4:35 PM
    For KotlinPoet, if I got a
    KSFunctionDeclaration
    which I know I want to call inside of the body of a function I am generating, is there a way for me to do that in a better way that just doing something like this:
    fun FileSpec.Builder.foo() {
      addImport(ksFunctionDeclaration.packageName.asString() + ksFunctionDeclaration.simpleName.asString())
      addFunction(
        FunSpec
          .builder()
          // stuff
          .addStatement("${ksFunctionDeclaration.simpleName}()")
          .build()
      )
    }
    I feel like I must be missing some part of the API that simplifies this. or am I wrong?
  • j

    jw

    11/04/2022, 4:42 PM
    You're looking for a
    MemberName
    which will hold a reference to a function and automatically emit an import when used with
    %M
  • j

    jw

    11/04/2022, 4:42 PM
    https://square.github.io/kotlinpoet/1.x/kotlinpoet/kotlinpoet/com.squareup.kotlinpoet/-member-name/index.html
  • j

    jw

    11/04/2022, 4:43 PM
    details of
    %M
    are documented on
    CodeBlock
    https://square.github.io/kotlinpoet/1.x/kotlinpoet/kotlinpoet/com.squareup.kotlinpoet/-code-block/index.html
  • t

    Tadeas Kriz

    11/07/2022, 10:32 PM
    Hey, is the
    redwood-layout-uiview
    not being published to snapshots yet? I'm unable to find it, but I might be looking wrong
  • j

    jw

    11/07/2022, 10:33 PM
    I have no idea, but I can look later
  • j

    jw

    11/07/2022, 10:33 PM
    We may have just forgot to apply the publish plugin to it
  • t

    Tadeas Kriz

    11/07/2022, 10:34 PM
    Thanks. I just checked and you're right the publish plugin is not being applied. Should I create a github issue for that?
  • j

    jw

    11/07/2022, 10:43 PM
    Sure!
  • t

    Tadeas Kriz

    11/08/2022, 2:26 PM
    Is there a way to get Redwood working without going through the serialize/deserialize route and instead have the Compose code drive the Widget code directly?
    j
    • 2
    • 4
  • j

    jw

    11/08/2022, 2:33 PM
    Not currently, there's a big TODO. There shouldn't be anything really blocking it except some work
  • t

    Tadeas Kriz

    11/08/2022, 2:36 PM
    Cool, thanks. I might dig into that then. Is there some docs/info about how you'd want to implement it? So I don't go and reinvent the wheel?
  • j

    jw

    11/08/2022, 2:48 PM
    It's been a long time since I've thought about it, but the design is such that the Compose code already talks directly to the Widgets. The only thing is that we only support the protocol implementation of widgets because of the applier in use which appends operations directly to the protocol. The change that would have to be made is that the applier would need to talk to the Widget.Children instance on the current widget. Then, for the protocol, we would just use an implementation that appended to the protocol. I can look a bit at it today and maybe write up some of what is needed.
  • t

    Tadeas Kriz

    11/08/2022, 3:32 PM
    I see. No worries, let's not waste your time now. I checked with my team and we should be good with just using the protocol implementation for now.
  • j

    jw

    11/08/2022, 3:39 PM
    This was originally tracked by https://github.com/cashapp/redwood/issues/14 but like 95% of the work has been done
  • m

    Mateu

    11/09/2022, 10:23 AM
    Hi, I'm trying to use molecule in KMP, but I can't build it for ios. I'm stuck with the following error. Has any one faced the same problem and found a solution? Just updated to Molecule 0.6.0.
    > Task :client:linkPodDebugFrameworkIosArm64
    e: Compilation failed: Unbound symbols not allowed
    
    Unbound public symbol IrSimpleFunctionPublicSymbolImpl: presenters/MoleculePresenter.models|4816226463707555740[0]
    
     * Source files: 
     * Compiler version info: Konan: 1.7.20 / Kotlin: 1.7.20
     * Output kind: FRAMEWORK
    
    e: java.lang.AssertionError: Unbound symbols not allowed
    
    Unbound public symbol IrSimpleFunctionPublicSymbolImpl: presenters/MoleculePresenter.models|4816226463707555740[0]
            at org.jetbrains.kotlin.ir.util.SymbolTableKt.noUnboundLeft(SymbolTable.kt:1218)
            at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:96)
            at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment$default(Psi2IrTranslator.kt:75)
            at org.jetbrains.kotlin.backend.konan.PsiToIrKt.psiToIr(PsiToIr.kt:187)
            at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:120)
            at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:118)
            at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:96)
            at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:94)
            at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
            at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:29)
            at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
            at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:43)
            at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:40)
            at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:94)
            at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:37)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:99)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:47)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:79)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:43)
            at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:179)
            at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:412)
            at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:411)
            at org.jetbrains.kotlin.util.UtilKt.profileIf(Util.kt:22)
            (...)
  • j

    jw

    11/09/2022, 12:40 PM
    Can you add https://github.com/cashapp/molecule/blob/trunk/gradle.properties#L37-L39 to your gradle properties and try?
    m
    • 2
    • 2
  • h

    hfhbd

    11/09/2022, 2:53 PM
    Why does molecule do not find the MonotonicFrameClock on Compose web (html dom api)? I playing with molecule and on android this frame sync works nice, but compose web fails with an exception. I thought this frame clock is mandatory for compose runtime. And the dom render uses DefaultMonotonicFrameClock 🤔 https://github.com/JetBrains/compose-jb/blob/685e305c5ee62bfd1c6c004163a2cd80c6017c98/web/internal-web-core-runtime/src/jsMain/kotlin/org/jetbrains/compose/web/renderComposable.kt#L40 Edit: found a workaround, adding the DefaultMonotonicFrameClock manually to the coroutine Scope on JS
  • j

    jw

    11/09/2022, 3:04 PM
    are you using it in a scope whose coroutine context has a clock in it?
  • t

    Troy Perales

    11/09/2022, 5:12 PM
    I’m looking at a pattern shown in the image below from a very helpful talk on Molecule by Ash Davies and Bill Phillips. I understand these snippets aren’t meant to be taken literally, but I’m having difficulty filling in some of the blanks. 1. I get
    A MonotonicFrameClock is not available in this CoroutineContext...
    crash when I use
    viewModelScope
    to launch Molecule as it is bound to
    Dispatchers.Main.immediate
    . My solve was to simply launch with
    AndroidUiDispatcher.Main
    , since having the ViewModel hold the Presenter is enough to make it survive configuration changes. Am I missing something else here? 2. What is the recommendation for emitting events within a Composable screen (or any view, for that matter)? The snippet has
    events
    as a SharedFlow, but it does not successfully emit an event when I call
    events.tryEmit(LoginEvent)
    and calling
    emit
    directly won’t work outside a coroutine.
    a
    j
    d
    • 4
    • 11
  • l

    Landry Norris

    11/09/2022, 10:25 PM
    I’m looking to use paparazzi in an Android project that also has Kotlin/Native code building for androidNative* targets. Because paparazzi uses android unit tests, it’s having trouble finding my .so files (and if it could, they’d be built for android NDK). Do I need to add a macosArm64 target to my ndk module, or is there a way to make this work with the .so files I already build for androidNative*?
    • 1
    • 1
  • r

    Ryan Woodcock

    11/10/2022, 10:33 AM
    Hey, I'm trying to use sqldelight in multiplatform to connect to a cloud database on AWS from android and ios, but can't work out where to put the URL configuration for this when initialising the drivers, does anyone here know how I would go about this or if it is possible?
    a
    • 2
    • 3
  • t

    Tadeas Kriz

    11/10/2022, 11:33 PM
    Is it okay to run multiple ProtocolRedwoodCompositions in parallel (like embedding in different parts of the app)? Or is there a better way to do it?
  • j

    jw

    11/10/2022, 11:35 PM
    Yep, should be fine. No different than running two ComposeViews next to each other on screen with Compose UI. Our composition setup is nearly identical to theirs.
    t
    • 2
    • 3
  • a

    andrew

    11/12/2022, 3:28 AM
    Does molecule have a delay before it fully initializes, enough to where any initial events sent to it could potentially be ignored?
Powered by Linen
Title
a

andrew

11/12/2022, 3:28 AM
Does molecule have a delay before it fully initializes, enough to where any initial events sent to it could potentially be ignored?
View count: 3