diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index be41b561e..516d6bd2b 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -25,6 +25,7 @@ plugins { sopt("feature") + sopt("compose") } android { diff --git a/core/common/src/main/java/org/sopt/official/common/context/Actvity.kt b/core/common/src/main/java/org/sopt/official/common/context/Actvity.kt new file mode 100644 index 000000000..0e081abb0 --- /dev/null +++ b/core/common/src/main/java/org/sopt/official/common/context/Actvity.kt @@ -0,0 +1,15 @@ +package org.sopt.official.common.context + +import android.content.Context +import android.content.ContextWrapper + +inline fun Context.findActivity(): T? { + var context = this + while (context is ContextWrapper) { + if (context is T) { + return context + } + context = context.baseContext + } + return null +}