Joaquim Ley
12/31/2020, 1:22 PM// This isLoggedInUseCase is a Kotlin suspend fun
isLoggedInUseCase.invoke { task, error in
switch task {
case let task as TaskResultSuccess<KotlinBoolean>:
// Callback style result here with true|false
break;
case _ as TaskResultError<KotlinBoolean>:
// Handle error
break;
default: break;
}
}
// What I wanted is to await the result of the usecase exec and
// Only then continue execution of the 'main' func
John O'Reilly
12/31/2020, 1:36 PMJoaquim Ley
12/31/2020, 1:39 PMJoaquim Ley
01/02/2021, 12:00 PMrusshwolf
01/02/2021, 2:52 PMJohn O'Reilly
01/02/2021, 4:54 PMJohn O'Reilly
01/02/2021, 4:59 PMJohn O'Reilly
01/02/2021, 7:48 PMJohn O'Reilly
01/02/2021, 7:50 PMJohn O'Reilly
01/02/2021, 7:51 PMJoaquim Ley
01/02/2021, 7:51 PMJoaquim Ley
01/02/2021, 7:52 PMrusshwolf
01/02/2021, 7:55 PMJohn O'Reilly
01/02/2021, 8:00 PMrusshwolf
01/02/2021, 8:01 PMJoaquim Ley
01/02/2021, 8:05 PMrusshwolf
01/02/2021, 8:07 PMJoaquim Ley
01/02/2021, 8:12 PMUncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared
John O'Reilly
01/03/2021, 10:19 AMPubllisher
now that maps to the Kotlin flow. Not directly related to that but re.
val scope: CoroutineScope = object : CoroutineScope {
override val coroutineContext: CoroutineContext
get() = SupervisorJob() + Dispatchers.Default
}
@russhwolf I'm using Dispatchers.Main
here right now as I'm making main-safe ktor
calls in my flow
....that won't always be case but at least in this example that seems to mean that those various freeze()
calls aren't needed?John O'Reilly
01/03/2021, 11:36 AMrusshwolf
01/03/2021, 2:18 PMJohn O'Reilly
01/03/2021, 4:47 PMrusshwolf
01/03/2021, 4:48 PMJohn O'Reilly
01/03/2021, 4:48 PMrusshwolf
01/03/2021, 4:48 PMJohn O'Reilly
01/03/2021, 4:51 PMrusshwolf
01/03/2021, 4:51 PMJohn O'Reilly
01/03/2021, 4:51 PMrusshwolf
01/03/2021, 4:52 PMJohn O'Reilly
01/03/2021, 5:43 PM