@capacitor/filesystem 8.2.0-next.3 → 8.2.0-next.4

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.
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '16.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'IONFilesystemLib', spec='~> 1.1.1'
16
+ s.dependency 'IONFilesystemLib', spec='~> 2.0.0'
17
17
  s.swift_version = '5.1'
18
18
  end
package/Package.swift CHANGED
@@ -11,7 +11,7 @@ let package = Package(
11
11
  ],
12
12
  dependencies: [
13
13
  .package(url: "https://github.com/ionic-team/capacitor.git", from: "9.0.0-alpha.7"),
14
- .package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", from: "1.1.1")
14
+ .package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", from: "2.0.0")
15
15
  ],
16
16
  targets: [
17
17
  .target(
@@ -76,7 +76,7 @@ dependencies {
76
76
  implementation project(':capacitor-android')
77
77
  }
78
78
 
79
- implementation "io.ionic.libs:ionfilesystem-android:1.1.0"
79
+ implementation "io.ionic.libs:ionfilesystem-android:1.1.1"
80
80
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
81
81
 
82
82
  implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
@@ -332,10 +332,15 @@ class FilesystemPlugin : Plugin() {
332
332
  "readdir" -> readdir(call)
333
333
  "getUri" -> getUri(call)
334
334
  "stat" -> stat(call)
335
- "downloadFile" -> downloadFile(call)
335
+ "downloadFile" -> callDeprecatedDownloadFile(call)
336
336
  }
337
337
  }
338
338
 
339
+ @Suppress("DEPRECATION")
340
+ private fun callDeprecatedDownloadFile(call: PluginCall) {
341
+ downloadFile(call)
342
+ }
343
+
339
344
  /**
340
345
  * Runs a suspend code if the app has permission to access the uri
341
346
  *
@@ -1,7 +1,6 @@
1
1
  package com.capacitorjs.plugins.filesystem
2
2
 
3
3
  import android.content.Context
4
- import android.net.Uri
5
4
  import android.os.Environment
6
5
  import android.os.Handler
7
6
  import android.os.Looper
@@ -17,6 +16,7 @@ import java.io.IOException
17
16
  import java.net.URISyntaxException
18
17
  import java.net.URL
19
18
  import kotlin.concurrent.thread
19
+ import androidx.core.net.toUri
20
20
 
21
21
  class LegacyFilesystemImplementation internal constructor(private val context: Context) {
22
22
  fun downloadFile(
@@ -61,9 +61,9 @@ class LegacyFilesystemImplementation internal constructor(private val context: C
61
61
 
62
62
  private fun getFileObject(path: String, directory: String?): File? {
63
63
  if (directory == null) {
64
- val u = Uri.parse(path)
64
+ val u = path.toUri()
65
65
  if (u.scheme == null || u.scheme == "file") {
66
- return File(u.path)
66
+ return File(u.path ?: "")
67
67
  }
68
68
  }
69
69
 
@@ -125,7 +125,7 @@ class LegacyFilesystemImplementation internal constructor(private val context: C
125
125
 
126
126
  try {
127
127
  maxBytes = contentLength?.toInt() ?: 0
128
- } catch (ignored: NumberFormatException) {
128
+ } catch (_: NumberFormatException) {
129
129
  }
130
130
 
131
131
  val buffer = ByteArray(1024)
@@ -140,7 +140,7 @@ class LegacyFilesystemImplementation internal constructor(private val context: C
140
140
 
141
141
  bytes += len
142
142
 
143
- if (progress!! && null != emitter) {
143
+ if (progress && null != emitter) {
144
144
  val currentTime = System.currentTimeMillis()
145
145
  if (currentTime - lastEmitTime > minEmitIntervalMillis) {
146
146
  emitter.emit(bytes, maxBytes)
@@ -149,7 +149,7 @@ class LegacyFilesystemImplementation internal constructor(private val context: C
149
149
  }
150
150
  }
151
151
 
152
- if (progress!! && null != emitter) {
152
+ if (progress && null != emitter) {
153
153
  emitter.emit(bytes, maxBytes)
154
154
  }
155
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/filesystem",
3
- "version": "8.2.0-next.3",
3
+ "version": "8.2.0-next.4",
4
4
  "description": "The Filesystem API provides a NodeJS-like API for working with files on the device.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",