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
mvikotlin
  • b

    benkuly

    08/09/2021, 1:15 PM
    The concept of MVI (and especially the TODO example App) seems to be a bit complicated and the difference to decompose is also not clear to me, so I am not sure if it fits to my needs: I have a key value database, which could be very large and not all data in it is needed all the time, so mirroring the database to Stores is not an option. I would need something like functions in a store to receive only specific data, which are loaded from database, but are also observable, when something changes (e. g. due to a server response). Is this doable with MVI or is it the wrong framework for something like that? Thanks 🙂
    a
    7 replies · 2 participants
  • l

    Laurence Muller

    08/11/2021, 1:24 PM
    Hi, I'm trying to see how Labels are used in this example: https://github.com/JetBrains/compose-jb/blob/master/examples/todoapp/common/edit/s[…]/kotlin/example/todo/common/edit/store/TodoEditStoreProvider.kt from what I see, both setText and setDone methods are doing a dispatch to send out the result but they are also publishing labels which don't seem to be consumed by anything in the app? What would be their purpose in the code?
    a
    f
    7 replies · 3 participants
  • l

    Laurence Muller

    08/11/2021, 1:25 PM
    Lol, how did we end up posting a similar question at the same time
    😯 1
    f
    1 reply · 2 participants
  • f

    Francis Mariano

    08/11/2021, 6:31 PM
    Hello again. I need to create a repository for a bluetooth connection. The bluetooth connection depends on a scope, that is, as long as the scope is valid, the connection remains active. I need this connection to be active for multiple screens. I thought about creating a store/component with application scope and sharing it with each screen. It's possible? Do you see another way to do this?
    a
    7 replies · 2 participants
  • n

    Nikola Milovic

    08/13/2021, 10:21 AM
    Hey, I was wondering how
    subscribeScoped
    works (I am used to the Singles having onError/Success) and how to handle errors in my usecase? I am currently making a request to the backend and it returns the status and data, ktor suspend request so I wrap it in
    singleFromCoroutine
    . Am I supposed to wrap the call in try catch? Eg
    return singleFromCoroutine {
                try {     
     val response: HttpResponse =
                   <http://client.post|client.post>("${serverUrl}${apiEndpoint}/account")
     
                    return@singleFromCoroutine CreateAccountResponse(response.status.value)
                } catch (e: Exception) {
                    return@singleFromCoroutine CreateAccountResponse(500, e.message ?: "")
                }
    I feel like I am seriously missing something here, I can't properly handle errors as I have to have a half-assed response network model that has to hold both the data and the potential error. Or is this the way to go?
    a
    2 replies · 2 participants
  • n

    Nikola Milovic

    08/13/2021, 12:12 PM
    Just stumbled unto this, but after publishing a label in ReaktiveExecutor execute action (checking if user session is still valid) it doesn't get propagated to the store. Is this intended behavior? My code
    private inner class ExecutorImpl : ReaktiveExecutor<Intent, Unit, State, Result, Label>() {
            override fun executeAction(action: Unit, getState: () -> State) {
                dispatch(Result.Loading())
                val user = firebaseAuth.currentUser
                if (user != null) {
                    publish(Label.LoggedIn)
                }
            }
    I am binding to the store.label output in the init block of the component
    a
    5 replies · 2 participants
  • y

    Yevhenii Datsenko

    08/20/2021, 10:30 AM
    Hello everyone) First of all, thanks a lot for the greatest MVI library) Could someone recommend a way how to test Bootstrapper or Executor in isolation? I have complex logic there and want to verify that I am dispatching/publishing right events. The dispatch and publish methods are protected so I couldn’t get access to it to verify right argument.
    a
    2 replies · 2 participants
  • l

    Laurence Muller

    08/24/2021, 12:42 PM
    Hi, I'm trying to use the bootstrapper based on the documentation but I'm not really understanding what I'm doing wrong here (using 3.0.0-alpha01 but it also happens on 2.0.4)
    f
    5 replies · 2 participants
  • f

    Francis Mariano

    09/03/2021, 11:39 AM
    Hello everyone, how are you? can anyone help me with a question? In readme of Essenty library we have the following description about StateKeeper
    When writing common code targetting Android, it might be required to preserve some data over Android configuration changes or process death.
    what kind of process death that we must preserve some data??
    a
    2 replies · 2 participants
  • n

    Nikola Milovic

    09/12/2021, 6:58 AM
    Hey guys, using MVIKotlin with KotlinJS and React for web, anyone got a good setup for functional components and handling state/ passing props? I am trying to do something like this
    external interface RootProps : PropsWithChildren {
        var component: Root
    }
    
    val RootC = fc<RootProps> { props ->
        val (routerState, _) = useState(props.component.routerState.value)
    
        val child: Root.Child = routerState.activeChild.instance
    And I'd call this way in my toplevel app component
    override fun RBuilder.render() {
            RootC {
                attrs {
                    this.component = root
                }
            }
        }
    But this doesn't seem to pickup on the state
    val (routerState, _) = useState(props.component.routerState.value)
    and doesn't update the component. No composables, so cannot use the ValueExt from the samples
    a
    4 replies · 2 participants
  • b

    bartosz.malkowski

    09/15/2021, 2:54 PM
    Hello! I hope you can help me with understanding MVI architecture. I'm experimenting with MVIKotlin and I'm trying to create chat application. Lets assume that it will look like Slack client, then we all know what I'm talking about. My problem is what exactly "Component" is. Currently my app should have two screens: ConfigurationScreen and ConversationsScreen. ConversationsScreen contains list of channels on the left and messages history with input panel on the right. I assume that
    ConfigurationScreen
    and
    ConversationsScreen
    should be Component with their own stores, intents and results. For example
    ConversationsScreen
    state will have state containing
    selectedChannel
    . The question is: does
    MessageHistoryWithInput
    should be Component with their own store (containing: loaded message list), own intents (
    SendMessage
    ,
    LoadedMessageList
    ) etc? How to embed this component inside
    ConversationsScreen
    component? Does anyone has any example?
    a
    2 replies · 2 participants
  • b

    benkuly

    09/15/2021, 4:57 PM
    Is there a recommended way, how to use suspending code in Decompose
    componentContext
    ? Should it contain a new CoroutineScope or should it expose suspending functions and the component should handle it (e. g. with
    rememberCoroutineScope
    )?
    a
    f
    6 replies · 3 participants
  • t

    trashcoder

    09/19/2021, 11:30 AM
    hi all, i use Decompose and my app currently has 2 screens. i would like to use a
    Scaffold
    and navigate with the
    Drawer
    (1 item for each screen in the drawer which will then change router state on click). Since the
    Scaffold
    has multiple parameters related to each screen (title, actions, content), i dont know if it should be part of the root content or part of each screen's content..? Let's say, i would use it as root content. Is it ok to check routerState/children for each
    Scaffold
    section and then call composable functions depending on the child for each section: Child1Title(), Child1Actions(), Child1Content()? (Are there any examples for
    Drawer
    navigation with Decompose?)
    ✅ 1
    a
    2 replies · 2 participants
  • a

    Andrew Steinmetz

    09/21/2021, 9:21 PM
    Hey everyone, I was trying to learn how to unit test a store in MVI using the
    SuspendExecutor
    and was wondering if anybody had a sample project where they could get a
    runBlockingTest
    to work? After some research it seems like the
    runBlockingTest
    in the coroutines test library is just supported on the JVM, but there is a workaround to get it to work per this comment. After adding that to my project, I still seem to run into a few issues when trying to run the test.
    import com.arkivanov.mvikotlin.core.store.StoreFactory
    import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
    import com.plusmobileapps.shared.db.Activity
    import com.plusmobileapps.wolfpack.activity.list.ActivityListStoreProvider
    import com.plusmobileapps.wolfpack.di.DEFAULT_DISPATCHER_TAG
    import com.plusmobileapps.wolfpack.di.MAIN_DISPATCHER_TAG
    import com.plusmobileapps.wolfpack.mocks.ActivityRepositoryMock
    import com.plusmobileapps.wolfpack.runBlockingTest
    import kotlinx.coroutines.Dispatchers
    import org.kodein.di.DI
    import org.kodein.di.bind
    import org.kodein.di.singleton
    import kotlin.coroutines.CoroutineContext
    import kotlin.test.Test
    import kotlin.test.assertEquals
    
    class ActivityListStoreTest {
        private val storeFactory = DefaultStoreFactory
        private val repository = ActivityRepositoryMock()
    
        private val di = DI {
            bind<CoroutineContext>(MAIN_DISPATCHER_TAG) { singleton { testCoroutineContext } }
            bind<CoroutineContext>(DEFAULT_DISPATCHER_TAG) { singleton { testCoroutineContext } }
            bind<ActivityRepository> { singleton { repository } }
            bind<StoreFactory> { singleton { storeFactory } }
        }
    
        @Test
        fun foo() = runBlockingTest {
            val activity = Activity(1L, "", true)
            repository.addActivity(activity)
            val store = ActivityListStoreProvider(di).provide()
    
            assertEquals(listOf(activity), store.state.activities)
        }
    }
    • For ios, keep getting an
    InvalidMutabilityException
    which I think is because the DI gets frozen inside the test because once something is retrieved from DI it throws the exception? • Then for android, keep getting
    java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked.
    which am I supposed to import the coroutine test library on jvm tests to get them to work? I'm a little lost in the weeds trying to figure this out and might even consider switching to Reaktive as it seems to have a pretty good testing support from looking at the todo sample tests. Any help is greatly appreciated!
    a
    6 replies · 2 participants
  • n

    Nikola Milovic

    09/28/2021, 12:10 PM
    Related to the question from Reaktive channel, I was wondering how websockets work with stores/ what's the recommended way of working with them? Should I just subscribe to everything inside my Executors executeAction? As that's the only place you'll have access to state and dispatch/ publish
    a
    3 replies · 2 participants
  • a

    Arkadii Ivanov

    09/30/2021, 11:33 AM
    Hello! Mutable state is common source of bugs, specially with declarative UI frameworks. I suggest to always use immutable structures, unless you are really optimizing the performance with a profiler. So yes, copy data classes and it's lists and maps. You can add an entry to an immutable map as follows:
    map = map + (key to value)
    ☝️ 1
    n
    1 reply · 2 participants
  • b

    bartosz.malkowski

    09/30/2021, 4:31 PM
    Hi. I have a component with few TextFields. I have Store and I have Intents like
    SetPassword
    SetUsername
    SetDomain
    etc. Should I for each Intent create corresponding Result (
    SetPassword
    -
    PasswordChanged
    ,
    SetUsername
    -
    UsernameChanged
    ), or there is simplest solution (but compliant with the best practices)?
    a
    2 replies · 2 participants
  • k

    kenkyee

    10/15/2021, 3:09 PM
    quick suggestion for the mvikotlin docs...add a link to the jb compose sample: https://github.com/JetBrains/compose-jb/tree/master/examples/todoapp Also would help a bit to add a "where stuff is defined markdown page w/ links and how it works"...takes a while to figure out where stuff is in common etc.
    a
    1 reply · 2 participants
  • k

    kenkyee

    10/15/2021, 3:11 PM
    Also, is there a simpler example that just uses it for Jetpack Compose on Android?
    a
    9 replies · 2 participants
  • a

    Arkadii Ivanov

    10/15/2021, 4:19 PM
    Both executeAction and executeIntent were suspending functions a while ago, but it was an explicit decision to make them normal. Looks like I forgot to update KDocs as well, thanks for pointing that. There is
    scope
    properly available which you can use to launch coroutines when needed. You can check samples: https://github.com/arkivanov/MVIKotlin/blob/master/sample/todo-coroutines/src/commonMain/kotlin/com/arkivanov/mvikotlin/sample/todo/coroutines/store/TodoListStoreFactory.kt The reason for this change is because now you are able to process intents and actions synchronously in the same call stack as they were dispatched.
    👍 1
    k
    3 replies · 2 participants
  • k

    kenkyee

    10/15/2021, 7:29 PM
    Has anyone ever mentioned that it'd be less confusing if you Swap the naming of Result and Action? 🙂 Having executors send a result to a reducer is confusing because reducers usually take an intent and state to create a new state.
    a
    n
    3 replies · 3 participants
  • b

    bartosz.malkowski

    10/18/2021, 11:47 AM
    Hi! I stuck with one problem. I'm not sure if it is caused by Decompose or Compose Desktop, but I'm not able to reproduce it without router. I have master-detail application. When I click on master menu item, then I replace ruter configuration:
    when (menuItem) {
    	is SideMenu.MenuItem.DirectChatMenuItem -> router.replaceCurrent(Configuration.Conversation(menuItem.chat.openChatId))
    	else -> router.replaceCurrent(Configuration.Nothing)
    }
    Here is child factory:
    private fun createChild(
    	configuration: Configuration, componentContext: ComponentContext,
    ): Child = when (configuration) {
    	is Configuration.Conversation -> Child.Chat(
    		ConversationMainComponent(componentContext, configuration.chatId, storeFactory)
    	)
    	is Configuration.Nothing -> Child.WelcomeScreen
    }
    ConversationMainComponent
    contains
    TextField
    . When I show
    ConversationMainComponent
    first time and I make text field focused, then everything works fine. When I switch to different
    DirectChatMenuItem
    what creates different
    ConversationMainComponent
    and then I try to focus text field, I see exception:
    Exception in thread "AWT-EventQueue-0" kotlin.UninitializedPropertyAccessException: lateinit property relocationRequesterNode has not been initialized
    	at androidx.compose.ui.layout.RelocationRequesterModifier.getRelocationRequesterNode(RelocationRequesterModifier.kt:32)
    	at androidx.compose.ui.layout.RelocationRequester.bringIntoView(RelocationRequester.kt:61)
    	at androidx.compose.ui.layout.RelocationRequester.bringIntoView$default(RelocationRequester.kt:59)
    	at androidx.compose.foundation.FocusableKt$focusable$2$4$1.invokeSuspend(Focusable.kt:108)
    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    	at androidx.compose.ui.platform.FlushCoroutineDispatcher$dispatch$2.invokeSuspend(CoroutineDispatchers.desktop.kt:55)
    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    	at java.base/java.security.AccessController.doPrivileged(Native Method)
    	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Funny is, that when I select one direct chat, make field focused, then I select something else (
    Child.WelcomeScreen
    ) and I select direct chat again, then everything works fine. Any advice? :-)
    a
    8 replies · 2 participants
  • m

    Mike

    10/27/2021, 3:16 AM
    Hi - on iOS I’m seeing lots of MVIKotlin logging in console. Is there a way to disable the default logging? I’m worried about it causing perf issues in production. I’ve tried to comment out mvikotlin-logging from gradle but there’s still lots of logging. Do I need to implement a custom logger that doesn’t log anything? Thanks Example:
    [MVIKotlin]: ListStore (STATE, State):
    a
    3 replies · 2 participants
  • m

    Michael Thiele

    10/27/2021, 6:37 AM
    Hi, I have updated to the 0.4.0 release of Decompose. The
    ComponentContext
    now only exposes a
    BackPressedHandler
    which can be used to register handlers for the back-button. I have several unit tests that verify the correct behaviour of the back button action which I have initiated with
    onBackPressed()
    which is now missing. How can I simulate a back-button pressed in a unit test? Thanks.
    a
    5 replies · 2 participants
  • a

    Arkadii Ivanov

    10/29/2021, 8:33 PM
    Hello everyone! A few times I received feedback that there is some boilerplate when implementing a Store. I have some ideas of how to improve things, but I would like to run a poll first. Could you please vote how do you like the current experience? Thanks! 🙂 - I like the current experience, don't touch! 😐 - Would be good to improve 🙁 - Definitely needs improvement! 🙃 - I don't care
    😐 9
    a
    i
    +2
    11 replies · 5 participants
  • r

    rsktash

    10/31/2021, 9:06 AM
    Is it a good idea to have a component of dynamic on demand feature as nullable child component? https://gist.github.com/rustamsmax/b8768f4546d8a4b1eb256402527f6f8c
    a
    3 replies · 2 participants
  • b

    Benoye

    11/15/2021, 1:25 PM
    Hi, I don’t know if it is the right channel for this: I am exploring MVIKotlin et Decompose to potentially integrate them in my project I am testing the basic Counter with Decompose on iOS and there is a
    Value
    class in
    ObservableValue
    that is not found by XCode (I cloned the sample and I am not able to find with the sample either) Would you guys be able to tell me what I am missing here ? Thanks !
    a
    10 replies · 2 participants
  • n

    Nikola Milovic

    11/30/2021, 10:03 AM
    Hello, a decompose question. I have the following config, (screens are components + stores practically) Screen A has two children, Nothing and Child B (screen B). When Nothing is the child, screen A displays its content, when the child is B then it shows screen B. Practically corresponding (since it's a web app) to
    url/user/
    and
    url/user/profile/
    I am having issues with going back and navigating to screen A again. If I am on screen B, I cannot press back on my mouse and the browser doesn't give me the back option. Also when navigating from some other screen back to screen A, it still contains Configuration B, because I cannot push a new configuration (getting the unique Config error), so I am using the
    pushToFront
    . What would be the approach, besides adding a back button on desktop to go about this? (I think that mobile handles the back button normally, would have to test it). Also, I am not really proficient in web dev, would it be possible to have URLs and have them go back option with Decompose and Web?
    a
    15 replies · 2 participants
  • n

    Nikola Milovic

    12/07/2021, 3:43 PM
    What is the prefered way of sending one time events to the UI from the stores? Example, we have a success and want to notify the user, I'd emit a Label and I'd be able to catch it in the Component, but how can I send it from Component -> UI?
    r
    a
    8 replies · 3 participants
  • a

    Artyom Bambalov

    12/29/2021, 2:51 PM
    Hi, Arkadii, can you provide an example with creating custom lifecycle from essenty lib?
    a
    14 replies · 2 participants
Powered by Linen
Title
a

Artyom Bambalov

12/29/2021, 2:51 PM
Hi, Arkadii, can you provide an example with creating custom lifecycle from essenty lib?
a

Arkadii Ivanov

12/29/2021, 2:52 PM
Hello. Could you please elaborate what is "custom lifecycle"? Do you need to manually control the lifecycle?
a

Artyom Bambalov

12/29/2021, 2:54 PM
I mean something like that: https://badoo.github.io/MVICore/binder/binder/#lifecycle-handling
I want to start my own lifecycle with special event and end it with another one event
a

Arkadii Ivanov

12/29/2021, 2:57 PM
In MVIKotlin the binder works in another way, it accepts the Lifecycle from the Essenty library directly.
a

Artyom Bambalov

12/29/2021, 2:57 PM
So, that means that I can't create it by my own?
a

Arkadii Ivanov

12/29/2021, 3:02 PM
Probably I don't understand the use case. I'm not aware of such an example, but it should be relatively easy. If I understand correctly, you will need to implement the MVICore Lifecycle interface, and pass Essenty's Lifecycle via constructor. Then inside the subscribe method you have to subscribe/unsubscribe from the Essenty Lifecycle.
a

Artyom Bambalov

12/29/2021, 3:10 PM
Nope. Sorry for not being clear enough I want to catch a specific event that will start my essenty lifecycle. Then, when I catch another event, I will end my Essenty lifecycle. As an example, I want to display a specific dialog when the lifecycle starts and hide the dialog when the lifecycle ends. the MVICore reference was just to explain what I want: start and end lifecycle
a

Arkadii Ivanov

12/29/2021, 3:12 PM
Thanks for the clarification, now it is more clear. Do you have a source of the events already?
a

Artyom Bambalov

12/29/2021, 3:13 PM
Yes, I do
a

Arkadii Ivanov

12/29/2021, 3:14 PM
Alright. Then I still don't have any examples. But you should try LifecycleRegistry. Then you can subscribe to the source of events and call lifecycle.resume() and lifecycle.destroy() accordingly.
LifecycleRegistry implements Lifecycle
a

Artyom Bambalov

12/29/2021, 3:17 PM
Oh, thanks. I think that it will be great to mention this moment in documentation
a

Arkadii Ivanov

12/29/2021, 3:17 PM
I believe it is mentioned in Essenty's readme: https://github.com/arkivanov/Essenty#using-the-lifecycleregistry-manually
a

Artyom Bambalov

12/29/2021, 3:18 PM
I have looked at documentation for MVIKotlin. thanks again
👍 1
View count: 4