expo-file-system 13.0.1 → 13.2.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 +20 -0
- package/README.md +1 -1
- package/android/build.gradle +8 -4
- package/android/src/main/java/expo/modules/filesystem/CountingRequestBody.kt +11 -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/build/FileSystem.js +1 -1
- package/build/FileSystem.js.map +1 -1
- package/ios/EXFileSystem/EXFileSystem.m +4 -2
- package/ios/EXFileSystem.xcframework/Info.plist +5 -5
- 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 +7 -5
- package/plugin/build/withFileSystem.js +1 -1
- package/src/FileSystem.ts +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 -1487
- package/android/src/main/java/expo/modules/filesystem/FileSystemPackage.java +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,25 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 13.2.0 — 2021-12-22
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fixed runtime crash due to `.toUpperCase` not being invoked as a function, it was missing `()`. ([#15615](https://github.com/expo/expo/pull/15615) by [@lukebrandonfarrell](https://github.com/lukebrandonfarrell))
|
|
18
|
+
- Fixed `totalByteSent` in upload progress callback incorrectly sending `bytesSent` on iOS. ([#15615](https://github.com/expo/expo/pull/15615) by [@lukebrandonfarrell](https://github.com/lukebrandonfarrell))
|
|
19
|
+
- Fixed simulator runtime crash on arm64 devices caused by `CFRelease(NULL)`. ([#15496](https://github.com/expo/expo/pull/15496) by [@daxaxelrod](https://github.com/daxaxelrod))
|
|
20
|
+
|
|
21
|
+
### 💡 Others
|
|
22
|
+
|
|
23
|
+
- Updated `@expo/config-plugins` from `4.0.2` to `4.0.14` ([#15621](https://github.com/expo/expo/pull/15621) by [@EvanBacon](https://github.com/EvanBacon))
|
|
24
|
+
|
|
25
|
+
## 13.1.0 — 2021-11-17
|
|
26
|
+
|
|
27
|
+
### 🐛 Bug fixes
|
|
28
|
+
|
|
29
|
+
- Fixed `uploadAsync` failing to resolve when using `BINARY_CONTENT`. ([#14764](https://github.com/expo/expo/pull/14764) by [@cruzach](https://github.com/cruzach))
|
|
30
|
+
- 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))
|
|
31
|
+
|
|
13
32
|
## 13.0.1 — 2021-10-01
|
|
14
33
|
|
|
15
34
|
_This version does not introduce any user-facing changes._
|
|
@@ -28,6 +47,7 @@ _This version does not introduce any user-facing changes._
|
|
|
28
47
|
### 💡 Others
|
|
29
48
|
|
|
30
49
|
- Updated `@expo/config-plugins` ([#14443](https://github.com/expo/expo/pull/14443) by [@EvanBacon](https://github.com/EvanBacon))
|
|
50
|
+
- Rewritten module to Kotlin. ([#14549](https://github.com/expo/expo/pull/14549) by [@mstach60161](https://github.com/mstach60161))
|
|
31
51
|
|
|
32
52
|
## 12.0.0 — 2021-09-08
|
|
33
53
|
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Provides access to the local file system on the device.
|
|
|
9
9
|
|
|
10
10
|
# Installation in managed Expo projects
|
|
11
11
|
|
|
12
|
-
For
|
|
12
|
+
For [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/filesystem/).
|
|
13
13
|
|
|
14
14
|
# Installation in bare React Native projects
|
|
15
15
|
|
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.2.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
@@ -16,7 +16,7 @@ buildscript {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
dependencies {
|
|
19
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.
|
|
19
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.6.10')}")
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -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.2.0"
|
|
61
65
|
}
|
|
62
66
|
lintOptions {
|
|
63
67
|
abortOnError false
|
|
@@ -77,5 +81,5 @@ dependencies {
|
|
|
77
81
|
api 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
|
|
78
82
|
api "androidx.legacy:legacy-support-v4:1.0.0"
|
|
79
83
|
|
|
80
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.
|
|
84
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.6.10')}"
|
|
81
85
|
}
|
|
@@ -9,7 +9,7 @@ import okio.Sink
|
|
|
9
9
|
import java.io.IOException
|
|
10
10
|
|
|
11
11
|
@FunctionalInterface
|
|
12
|
-
interface RequestBodyDecorator {
|
|
12
|
+
fun interface RequestBodyDecorator {
|
|
13
13
|
fun decorate(requestBody: RequestBody): RequestBody
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -44,7 +44,17 @@ class CountingRequestBody(
|
|
|
44
44
|
|
|
45
45
|
override fun writeTo(sink: BufferedSink) {
|
|
46
46
|
val countingSink = CountingSink(sink, this, progressListener)
|
|
47
|
+
|
|
48
|
+
// `Okio.buffer` is deprecated in okio 2.x.
|
|
49
|
+
// To be compatible across react-native versions where
|
|
50
|
+
// react-native < 0.65, okio is 1.x
|
|
51
|
+
// react-native >= 0.65, okio is 2.x
|
|
52
|
+
// We just suppress the error.
|
|
53
|
+
// In okio 2.x, `Okio.buffer` is still an extension method proxied to `countingSink.buffer()`.
|
|
54
|
+
// See: https://github.com/square/okio/blob/b0f78aaa46/okio/src/jvmMain/kotlin/okio/-DeprecatedOkio.kt#L48-L56
|
|
55
|
+
@Suppress("DEPRECATION_ERROR")
|
|
47
56
|
val bufferedSink = Okio.buffer(countingSink)
|
|
57
|
+
|
|
48
58
|
requestBody.writeTo(bufferedSink)
|
|
49
59
|
bufferedSink.flush()
|
|
50
60
|
}
|
|
@@ -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
|
+
}
|