@react-native-hero/fs 0.1.0 → 0.1.2
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,12 +6,12 @@
|
|
|
6
6
|
<application>
|
|
7
7
|
<provider
|
|
8
8
|
android:name="androidx.core.content.FileProvider"
|
|
9
|
-
android:authorities="${applicationId}.
|
|
9
|
+
android:authorities="${applicationId}.fsProvider"
|
|
10
10
|
android:exported="false"
|
|
11
11
|
android:grantUriPermissions="true">
|
|
12
12
|
<meta-data
|
|
13
13
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
14
|
-
android:resource="@xml/
|
|
14
|
+
android:resource="@xml/fs_file_provider_paths" />
|
|
15
15
|
</provider>
|
|
16
16
|
</application>
|
|
17
17
|
|
|
@@ -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
|
|
50
|
-
super.
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
File without changes
|