fun updateContext()

in ConfidenceDemoApp/src/main/java/com/example/confidencedemoapp/MainVm.kt [84:105]


    fun updateContext() {
        val start = System.currentTimeMillis()
        val ctx = mapOf(
            "user_id" to ConfidenceValue.String(UUID.randomUUID().toString()),
            "picture" to ConfidenceValue.String("hej"),
            "region" to ConfidenceValue.String("eu")
        )
        viewModelScope.launch {
            Log.d(TAG, "set new EvaluationContext")
            // or confidence.awaitPutContext(ctx)
            confidence.putContext(ctx)
            confidence.awaitReconciliation()
        }.runCatching {
            invokeOnCompletion {
                Log.d(
                    TAG,
                    "set new EvaluationContext took ${System.currentTimeMillis() - start} ms"
                )
                refreshUi()
            }
        }
    }