@react-native-documents/picker 11.0.2 → 11.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ import kotlinx.coroutines.cancel
25
25
  import kotlinx.coroutines.launch
26
26
 
27
27
  class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
28
- NativeDocumentPickerSpec(reactContext), LifecycleEventListener {
28
+ NativeDocumentPickerSpec(reactContext) {
29
29
  private var currentPickOptions: PickOptions? = null
30
30
  private var currentUriOfFileBeingExported: Uri? = null
31
31
  private val promiseWrapper = PromiseWrapper(NAME)
@@ -70,15 +70,12 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
70
70
  }
71
71
 
72
72
  init {
73
- reactContext.addActivityEventListener(activityEventListener)
74
- reactContext.addLifecycleEventListener(this)
73
+ reactApplicationContext.addActivityEventListener(activityEventListener)
75
74
  }
76
75
 
77
76
  override fun invalidate() {
78
77
  fileCopyingCoroutine.cancel("module invalidated")
79
78
  reactApplicationContext.removeActivityEventListener(activityEventListener)
80
- // TODO verify this should be done (and order)
81
- // reactApplicationContext.removeLifecycleEventListener(this)
82
79
  super.invalidate()
83
80
  }
84
81
 
@@ -103,11 +100,7 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
103
100
  }
104
101
 
105
102
  override fun saveDocument(options: ReadableMap, promise: Promise) {
106
- val currentActivity = currentActivity
107
- if (currentActivity == null) {
108
- rejectWithNullActivity(promise)
109
- return
110
- }
103
+ val currentActivity = reactApplicationContext.currentActivity ?: return rejectWithNullActivity(promise)
111
104
  if (!promiseWrapper.trySetPromiseRejectingIncoming(promise, "saveDocuments")) {
112
105
  return
113
106
  }
@@ -334,12 +327,4 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
334
327
  private const val E_OTHER_PRESENTING_ERROR = "OTHER_PRESENTING_ERROR"
335
328
  private const val E_INVALID_DATA_RETURNED = "INVALID_DATA_RETURNED"
336
329
  }
337
-
338
- override fun onHostResume() {}
339
-
340
- override fun onHostPause() {}
341
-
342
- override fun onHostDestroy() {
343
- fileCopyingCoroutine.cancel("host destroyed")
344
- }
345
330
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-documents/picker",
3
- "version": "11.0.2",
3
+ "version": "11.0.4",
4
4
  "description": "A react native interface to access documents from dropbox, google drive, iCloud...",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",