13 lines
397 B
Kotlin
13 lines
397 B
Kotlin
@file:Suppress("ktlint:filename")
|
|
|
|
package cash.z.ecc.android.sdk.demoapp.ext
|
|
|
|
import android.content.Context
|
|
import androidx.fragment.app.Fragment
|
|
|
|
/**
|
|
* A safer alternative to [Fragment.requireContext], as it avoids leaking Fragment or Activity context
|
|
* when Application context is often sufficient.
|
|
*/
|
|
fun Fragment.requireApplicationContext(): Context = requireContext().applicationContext
|