@react-native-hero/fs 0.1.1 → 0.1.3

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.
@@ -6,7 +6,7 @@
6
6
  <application>
7
7
  <provider
8
8
  android:name="androidx.core.content.FileProvider"
9
- android:authorities="${applicationId}.fsProvider"
9
+ android:authorities="${applicationId}.provider"
10
10
  android:exported="false"
11
11
  android:grantUriPermissions="true">
12
12
  <meta-data
@@ -4,7 +4,6 @@ import android.content.Intent
4
4
  import android.content.pm.PackageManager
5
5
  import android.media.MediaScannerConnection
6
6
  import android.net.Uri
7
- import android.os.Build
8
7
  import android.os.Environment
9
8
  import androidx.core.content.FileProvider
10
9
  import com.facebook.react.bridge.*
@@ -46,8 +45,8 @@ class RNTFSModule(private val reactContext: ReactApplicationContext) : ReactCont
46
45
  scanner.connect()
47
46
  }
48
47
 
49
- override fun onCatalystInstanceDestroy() {
50
- super.onCatalystInstanceDestroy()
48
+ override fun invalidate() {
49
+ super.invalidate()
51
50
  scanner.disconnect()
52
51
  }
53
52
 
@@ -189,7 +188,7 @@ class RNTFSModule(private val reactContext: ReactApplicationContext) : ReactCont
189
188
  val path = options.getString("path")
190
189
  val mimeType = options.getString("mimeType")
191
190
 
192
- val file = File(path)
191
+ val file = File(path!!)
193
192
  if (!checkFileExisted(file, promise)) {
194
193
  return
195
194
  }
@@ -197,16 +196,9 @@ class RNTFSModule(private val reactContext: ReactApplicationContext) : ReactCont
197
196
  val intent = Intent(Intent.ACTION_VIEW)
198
197
  intent.addCategory(Intent.CATEGORY_DEFAULT)
199
198
 
200
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
201
- val uri = FileProvider.getUriForFile(activity, reactApplicationContext.packageName + ".provider", file)
202
- intent.setDataAndType(uri, mimeType)
203
- intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
204
- }
205
- else {
206
- val uri = Uri.fromFile(file)
207
- intent.setDataAndType(uri, mimeType)
208
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
209
- }
199
+ val uri = FileProvider.getUriForFile(activity, reactApplicationContext.packageName + ".provider", file)
200
+ intent.setDataAndType(uri, mimeType)
201
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
210
202
 
211
203
  val list = reactContext.packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
212
204
  if (list.size > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-hero/fs",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "react native fs",
5
5
  "main": "index.js",
6
6
  "scripts": {