package com.nate.posedetection

import android.app.Activity
import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext

private const val TAG = "ExperimentAuto"

private class AndroidExperimentAutoBridge(private val activity: Activity?) : ExperimentAutoBridge {
    override fun log(msg: String) {
        Log.i(TAG, msg)
    }

    override fun finishActivity() {
        activity?.finish()
    }
}

@Composable
actual fun rememberExperimentAutoBridge(): ExperimentAutoBridge {
    val context = LocalContext.current
    return remember(context) {
        AndroidExperimentAutoBridge(context as? Activity)
    }
}
