Marc Knaup
04/20/2020, 2:00 PMJob
to launch
as it breaks parent/child-relationship 😅
We’ve got to take the Job
returned by launch
instead.wasyl
04/20/2020, 2:04 PMstreetsofboston
04/20/2020, 2:07 PMcancel
method as well, for a common MyTask. Cancelling the CourotineScope should suffice.
Instead, a special MyCancellableTask should offer this extra cancel
functionality, to indicate that this (calling cancel
) should be used with some care.Marc Knaup
04/20/2020, 2:07 PMcancel()
on a coroutine scope does is to call cancel()
on the Job
of the coroutine scope’s context.streetsofboston
04/20/2020, 2:11 PMMarc Knaup
04/20/2020, 2:12 PMcancel()
is just for canceling the task if the parent is still alive.streetsofboston
04/20/2020, 2:13 PMMarc Knaup
04/20/2020, 2:14 PMstreetsofboston
04/20/2020, 2:14 PMMarc Knaup
04/20/2020, 2:15 PMstreetsofboston
04/20/2020, 2:15 PMMarc Knaup
04/20/2020, 2:16 PMstreetsofboston
04/20/2020, 2:17 PMMarc Knaup
04/20/2020, 2:18 PMUser
, Message
, Post
- whatever business model I have - should have a CoroutineScope
? 😮streetsofboston
04/20/2020, 2:18 PMMarc Knaup
04/20/2020, 2:18 PMstreetsofboston
04/20/2020, 2:19 PMMarc Knaup
04/20/2020, 2:19 PMAuthticationManager
which has app-lifetime.streetsofboston
04/20/2020, 2:22 PMMarc Knaup
04/20/2020, 2:22 PMstreetsofboston
04/20/2020, 2:24 PMMarc Knaup
04/20/2020, 2:25 PMstreetsofboston
04/20/2020, 2:25 PMMarc Knaup
04/20/2020, 2:25 PMstreetsofboston
04/20/2020, 2:26 PMMarc Knaup
04/20/2020, 2:26 PMstreetsofboston
04/20/2020, 2:28 PMMarc Knaup
04/20/2020, 2:28 PMstreetsofboston
04/20/2020, 2:31 PMMarc Knaup
04/20/2020, 2:32 PMstreetsofboston
04/20/2020, 2:33 PMMarc Knaup
04/20/2020, 2:34 PMFlow
is a good step forward though!streetsofboston
04/20/2020, 2:35 PMsuspend
function, with respect to Structure Concurrency, but it can produce multiple values instead of just one 🙂Marc Knaup
04/20/2020, 2:39 PMstreetsofboston
04/20/2020, 2:41 PMMarc Knaup
04/20/2020, 2:41 PMstreetsofboston
04/20/2020, 2:43 PMMarc Knaup
04/20/2020, 2:43 PMstreetsofboston
04/20/2020, 2:44 PMMarc Knaup
04/20/2020, 2:45 PMonStart
?
Also, my code would have to know that whatever has been set up in onCreate
that’s bound to the scope has to be set up again in onStart
, which doesn’t seem right.streetsofboston
04/20/2020, 2:46 PMMarc Knaup
04/20/2020, 2:46 PMstreetsofboston
04/20/2020, 2:47 PMMarc Knaup
04/20/2020, 2:47 PMstreetsofboston
04/20/2020, 2:49 PMMarc Knaup
04/20/2020, 2:50 PMstreetsofboston
04/20/2020, 2:50 PMMarc Knaup
04/20/2020, 2:51 PMstreetsofboston
04/20/2020, 2:53 PMMarc Knaup
04/20/2020, 2:53 PMstreetsofboston
04/20/2020, 2:57 PMMarc Knaup
04/20/2020, 2:57 PMval reader: Flow<Nothing>
which causes new messages in a chat conversation to be marked as read automatically while the Flow has any consumers.
I subscribe to it in the related Activity in the resume…pause lifecycle.Flow<Nothing>
works 😅streetsofboston
04/20/2020, 3:01 PMMarc Knaup
04/20/2020, 3:03 PMstreetsofboston
04/20/2020, 3:04 PMMarc Knaup
04/20/2020, 3:04 PMI mean, you keep the Flow alive, ie. it remains active in what it is doing (mark incoming messages as read) while the collector is not interested in the Flow’s emissions.Exactly
conversationCoordinator.markAsReadWhileScopeIsAlive(this)
streetsofboston
04/20/2020, 3:06 PMMarc Knaup
04/20/2020, 3:06 PM