expo-file-system 13.0.3 → 13.1.0
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.
- package/CHANGELOG.md +2 -6
- package/android/build.gradle +6 -2
- package/android/src/main/java/expo/modules/filesystem/CountingRequestBody.kt +1 -1
- package/android/src/main/java/expo/modules/filesystem/FilePermissionModule.kt +48 -0
- package/android/src/main/java/expo/modules/filesystem/FileSystemFileProvider.kt +5 -0
- package/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt +1321 -0
- package/android/src/main/java/expo/modules/filesystem/FileSystemPackage.kt +14 -0
- package/android/src/main/java/expo/modules/filesystem/UploadType.kt +11 -0
- package/ios/EXFileSystem.xcframework/ios-arm64/EXFileSystem.framework/EXFileSystem +0 -0
- package/ios/EXFileSystem.xcframework/ios-arm64/EXFileSystem.framework/Info.plist +0 -0
- package/ios/EXFileSystem.xcframework/ios-arm64_x86_64-simulator/EXFileSystem.framework/EXFileSystem +0 -0
- package/ios/EXFileSystem.xcframework/ios-arm64_x86_64-simulator/EXFileSystem.framework/Info.plist +0 -0
- package/package.json +6 -4
- package/plugin/build/withFileSystem.js +1 -1
- package/android/src/main/java/expo/modules/filesystem/FilePermissionModule.java +0 -69
- package/android/src/main/java/expo/modules/filesystem/FileSystemFileProvider.java +0 -5
- package/android/src/main/java/expo/modules/filesystem/FileSystemModule.java +0 -1489
- package/android/src/main/java/expo/modules/filesystem/FileSystemPackage.java +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -10,16 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
## 13.0
|
|
13
|
+
## 13.1.0 — 2021-11-17
|
|
14
14
|
|
|
15
15
|
### 🐛 Bug fixes
|
|
16
16
|
|
|
17
17
|
- Fixed `uploadAsync` failing to resolve when using `BINARY_CONTENT`. ([#14764](https://github.com/expo/expo/pull/14764) by [@cruzach](https://github.com/cruzach))
|
|
18
|
-
|
|
19
|
-
## 13.0.2 — 2021-10-15
|
|
20
|
-
|
|
21
|
-
### 🐛 Bug fixes
|
|
22
|
-
|
|
23
18
|
- Fix `okio` library build error for `react-native@0.65` or above. ([#14761](https://github.com/expo/expo/pull/14761) by [@kudo](https://github.com/kudo))
|
|
24
19
|
|
|
25
20
|
## 13.0.1 — 2021-10-01
|
|
@@ -40,6 +35,7 @@ _This version does not introduce any user-facing changes._
|
|
|
40
35
|
### 💡 Others
|
|
41
36
|
|
|
42
37
|
- Updated `@expo/config-plugins` ([#14443](https://github.com/expo/expo/pull/14443) by [@EvanBacon](https://github.com/EvanBacon))
|
|
38
|
+
- Rewritten module to Kotlin. ([#14549](https://github.com/expo/expo/pull/14549) by [@mstach60161](https://github.com/mstach60161))
|
|
43
39
|
|
|
44
40
|
## 12.0.0 — 2021-09-08
|
|
45
41
|
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '13.0
|
|
6
|
+
version = '13.1.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
@@ -53,11 +53,15 @@ android {
|
|
|
53
53
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
kotlinOptions {
|
|
57
|
+
jvmTarget = JavaVersion.VERSION_1_8
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
defaultConfig {
|
|
57
61
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
58
62
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
59
63
|
versionCode 30
|
|
60
|
-
versionName "13.0
|
|
64
|
+
versionName "13.1.0"
|
|
61
65
|
}
|
|
62
66
|
lintOptions {
|
|
63
67
|
abortOnError false
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package expo.modules.filesystem
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import expo.modules.interfaces.filesystem.FilePermissionModuleInterface
|
|
5
|
+
import expo.modules.core.interfaces.InternalModule
|
|
6
|
+
import expo.modules.interfaces.filesystem.Permission
|
|
7
|
+
import java.io.File
|
|
8
|
+
import java.io.IOException
|
|
9
|
+
import java.util.*
|
|
10
|
+
|
|
11
|
+
// The class needs to be 'open', because it's inherited in expoview
|
|
12
|
+
open class FilePermissionModule : FilePermissionModuleInterface, InternalModule {
|
|
13
|
+
override fun getExportedInterfaces(): List<Class<*>> =
|
|
14
|
+
listOf(FilePermissionModuleInterface::class.java)
|
|
15
|
+
|
|
16
|
+
override fun getPathPermissions(context: Context, path: String): EnumSet<Permission> =
|
|
17
|
+
getInternalPathPermissions(path, context) ?: getExternalPathPermissions(path)
|
|
18
|
+
|
|
19
|
+
private fun getInternalPathPermissions(path: String, context: Context): EnumSet<Permission>? {
|
|
20
|
+
return try {
|
|
21
|
+
val canonicalPath = File(path).canonicalPath
|
|
22
|
+
getInternalPaths(context)
|
|
23
|
+
.firstOrNull { dir -> canonicalPath.startsWith("$dir/") || dir == canonicalPath }
|
|
24
|
+
?.let { EnumSet.of(Permission.READ, Permission.WRITE) }
|
|
25
|
+
} catch (e: IOException) {
|
|
26
|
+
EnumSet.noneOf(Permission::class.java)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected open fun getExternalPathPermissions(path: String): EnumSet<Permission> {
|
|
31
|
+
val file = File(path)
|
|
32
|
+
return EnumSet.noneOf(Permission::class.java).apply {
|
|
33
|
+
if (file.canRead()) {
|
|
34
|
+
add(Permission.READ)
|
|
35
|
+
}
|
|
36
|
+
if (file.canWrite()) {
|
|
37
|
+
add(Permission.WRITE)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Throws(IOException::class)
|
|
43
|
+
private fun getInternalPaths(context: Context): List<String> =
|
|
44
|
+
listOf(
|
|
45
|
+
context.filesDir.canonicalPath,
|
|
46
|
+
context.cacheDir.canonicalPath
|
|
47
|
+
)
|
|
48
|
+
}
|