package com.tapjoy.easyapp.extensions

import android.app.Activity
import android.content.Context
import android.content.ContextWrapper

/**
 * Gets the activity from Jetpack Compose context.
 */
fun Context.findActivity(): Activity? {
    var context = this
    while (context is ContextWrapper) {
        if (context is Activity) return context
        context = context.baseContext
    }
    return null
}
