expo-file-system 13.0.2 → 13.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.
- package/CHANGELOG.md +17 -1
- package/android/build.gradle +26 -2
- package/android/src/main/java/expo/modules/filesystem/CountingRequestBody.kt +1 -10
- 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,10 +10,25 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
## 13.
|
|
13
|
+
## 13.1.2 — 2022-01-22
|
|
14
14
|
|
|
15
15
|
### 🐛 Bug fixes
|
|
16
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
|
+
## 13.1.1 — 2022-01-20
|
|
22
|
+
|
|
23
|
+
### 🐛 Bug fixes
|
|
24
|
+
|
|
25
|
+
- Fix build errors on React Native 0.66 caused by `okio` and `okhttp`. ([#15632](https://github.com/expo/expo/pull/15632) by [@kudo](https://github.com/kudo))
|
|
26
|
+
|
|
27
|
+
## 13.1.0 — 2021-11-17
|
|
28
|
+
|
|
29
|
+
### 🐛 Bug fixes
|
|
30
|
+
|
|
31
|
+
- Fixed `uploadAsync` failing to resolve when using `BINARY_CONTENT`. ([#14764](https://github.com/expo/expo/pull/14764) by [@cruzach](https://github.com/cruzach))
|
|
17
32
|
- 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))
|
|
18
33
|
|
|
19
34
|
## 13.0.1 — 2021-10-01
|
|
@@ -34,6 +49,7 @@ _This version does not introduce any user-facing changes._
|
|
|
34
49
|
### 💡 Others
|
|
35
50
|
|
|
36
51
|
- Updated `@expo/config-plugins` ([#14443](https://github.com/expo/expo/pull/14443) by [@EvanBacon](https://github.com/EvanBacon))
|
|
52
|
+
- Rewritten module to Kotlin. ([#14549](https://github.com/expo/expo/pull/14549) by [@mstach60161](https://github.com/mstach60161))
|
|
37
53
|
|
|
38
54
|
## 12.0.0 — 2021-09-08
|
|
39
55
|
|
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.
|
|
6
|
+
version = '13.1.2'
|
|
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.
|
|
64
|
+
versionName "13.1.2"
|
|
61
65
|
}
|
|
62
66
|
lintOptions {
|
|
63
67
|
abortOnError false
|
|
@@ -75,7 +79,27 @@ dependencies {
|
|
|
75
79
|
api 'commons-io:commons-io:1.4'
|
|
76
80
|
api 'com.squareup.okhttp3:okhttp:3.10.0'
|
|
77
81
|
api 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
|
|
82
|
+
api 'com.squareup.okio:okio:1.17.5'
|
|
78
83
|
api "androidx.legacy:legacy-support-v4:1.0.0"
|
|
79
84
|
|
|
80
85
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
|
|
81
86
|
}
|
|
87
|
+
|
|
88
|
+
// [BEGIN] Workaround okhttp/okio compatibility issue
|
|
89
|
+
// Remove when we drop support for SDK 44
|
|
90
|
+
def okhttpPinnedArtifacts = []
|
|
91
|
+
configurations.api.getDependencies().removeIf { it ->
|
|
92
|
+
if (['com.squareup.okhttp3', 'com.squareup.okio'].contains(it.group)) {
|
|
93
|
+
okhttpPinnedArtifacts.add("${it.group}:${it.name}:${it.version}")
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
96
|
+
return false
|
|
97
|
+
}
|
|
98
|
+
okhttpPinnedArtifacts.each { artifact ->
|
|
99
|
+
dependencies.add('compileOnly', artifact)
|
|
100
|
+
dependencies.add('testApi', artifact)
|
|
101
|
+
configurations.all {
|
|
102
|
+
resolutionStrategy.force(artifact)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// [END] Workaround okhttp/okio compatibility issue
|
|
@@ -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
|
|
|
@@ -45,16 +45,7 @@ class CountingRequestBody(
|
|
|
45
45
|
override fun writeTo(sink: BufferedSink) {
|
|
46
46
|
val countingSink = CountingSink(sink, this, progressListener)
|
|
47
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")
|
|
56
48
|
val bufferedSink = Okio.buffer(countingSink)
|
|
57
|
-
|
|
58
49
|
requestBody.writeTo(bufferedSink)
|
|
59
50
|
bufferedSink.flush()
|
|
60
51
|
}
|
|
@@ -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
|
+
}
|