@@ -25,7 +25,7 @@ import kotlinx.coroutines.cancel
2525import kotlinx.coroutines.launch
2626
2727class RNDocumentPickerModule (reactContext : ReactApplicationContext ) :
28- NativeDocumentPickerSpec (reactContext), LifecycleEventListener {
28+ NativeDocumentPickerSpec (reactContext) {
2929 private var currentPickOptions: PickOptions ? = null
3030 private var currentUriOfFileBeingExported: Uri ? = null
3131 private val promiseWrapper = PromiseWrapper (NAME )
@@ -70,15 +70,12 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
7070 }
7171
7272 init {
73- reactContext.addActivityEventListener(activityEventListener)
74- reactContext.addLifecycleEventListener(this )
73+ reactApplicationContext.addActivityEventListener(activityEventListener)
7574 }
7675
7776 override fun invalidate () {
7877 fileCopyingCoroutine.cancel(" module invalidated" )
7978 reactApplicationContext.removeActivityEventListener(activityEventListener)
80- // TODO verify this should be done (and order)
81- // reactApplicationContext.removeLifecycleEventListener(this)
8279 super .invalidate()
8380 }
8481
@@ -330,12 +327,4 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
330327 private const val E_OTHER_PRESENTING_ERROR = " OTHER_PRESENTING_ERROR"
331328 private const val E_INVALID_DATA_RETURNED = " INVALID_DATA_RETURNED"
332329 }
333-
334- override fun onHostResume () {}
335-
336- override fun onHostPause () {}
337-
338- override fun onHostDestroy () {
339- fileCopyingCoroutine.cancel(" host destroyed" )
340- }
341330}
0 commit comments