react-native-nitro-unzip 0.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/LICENSE +21 -0
- package/README.md +107 -0
- package/android/CMakeLists.txt +16 -0
- package/android/build.gradle +70 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/unzip/HybridUnzip.kt +29 -0
- package/android/src/main/java/com/margelo/nitro/unzip/HybridUnzipTask.kt +256 -0
- package/android/src/main/java/com/margelo/nitro/unzip/HybridZipTask.kt +157 -0
- package/ios/HybridUnzip.swift +33 -0
- package/ios/HybridUnzipTask.swift +238 -0
- package/ios/HybridZipTask.swift +266 -0
- package/lib/commonjs/index.js +31 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/specs/Unzip.nitro.js +6 -0
- package/lib/commonjs/specs/Unzip.nitro.js.map +1 -0
- package/lib/module/index.js +27 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/specs/Unzip.nitro.js +4 -0
- package/lib/module/specs/Unzip.nitro.js.map +1 -0
- package/lib/typescript/index.d.ts +24 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/specs/Unzip.nitro.d.ts +170 -0
- package/lib/typescript/specs/Unzip.nitro.d.ts.map +1 -0
- package/nitro.json +26 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroUnzip+autolinking.cmake +85 -0
- package/nitrogen/generated/android/NitroUnzip+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroUnzipOnLoad.cpp +71 -0
- package/nitrogen/generated/android/NitroUnzipOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JFunc_void_UnzipProgress.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_ZipProgress.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridUnzipSpec.cpp +82 -0
- package/nitrogen/generated/android/c++/JHybridUnzipSpec.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridUnzipTaskSpec.cpp +94 -0
- package/nitrogen/generated/android/c++/JHybridUnzipTaskSpec.hpp +68 -0
- package/nitrogen/generated/android/c++/JHybridZipTaskSpec.cpp +94 -0
- package/nitrogen/generated/android/c++/JHybridZipTaskSpec.hpp +68 -0
- package/nitrogen/generated/android/c++/JUnzipProgress.hpp +73 -0
- package/nitrogen/generated/android/c++/JUnzipResult.hpp +73 -0
- package/nitrogen/generated/android/c++/JZipProgress.hpp +69 -0
- package/nitrogen/generated/android/c++/JZipResult.hpp +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/Func_void_UnzipProgress.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/Func_void_ZipProgress.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/HybridUnzipSpec.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/HybridUnzipTaskSpec.kt +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/HybridZipTaskSpec.kt +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/NitroUnzipOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/UnzipProgress.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/UnzipResult.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/ZipProgress.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unzip/ZipResult.kt +50 -0
- package/nitrogen/generated/ios/NitroUnzip+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroUnzip-Swift-Cxx-Bridge.cpp +107 -0
- package/nitrogen/generated/ios/NitroUnzip-Swift-Cxx-Bridge.hpp +270 -0
- package/nitrogen/generated/ios/NitroUnzip-Swift-Cxx-Umbrella.hpp +68 -0
- package/nitrogen/generated/ios/NitroUnzipAutolinking.mm +49 -0
- package/nitrogen/generated/ios/NitroUnzipAutolinking.swift +50 -0
- package/nitrogen/generated/ios/c++/HybridUnzipSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridUnzipSpecSwift.hpp +112 -0
- package/nitrogen/generated/ios/c++/HybridUnzipTaskSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridUnzipTaskSpecSwift.hpp +104 -0
- package/nitrogen/generated/ios/c++/HybridZipTaskSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridZipTaskSpecSwift.hpp +104 -0
- package/nitrogen/generated/ios/swift/Func_void_UnzipProgress.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_UnzipResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ZipProgress.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ZipResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridUnzipSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridUnzipSpec_cxx.swift +186 -0
- package/nitrogen/generated/ios/swift/HybridUnzipTaskSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridUnzipTaskSpec_cxx.swift +177 -0
- package/nitrogen/generated/ios/swift/HybridZipTaskSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridZipTaskSpec_cxx.swift +177 -0
- package/nitrogen/generated/ios/swift/UnzipProgress.swift +49 -0
- package/nitrogen/generated/ios/swift/UnzipResult.swift +49 -0
- package/nitrogen/generated/ios/swift/ZipProgress.swift +44 -0
- package/nitrogen/generated/ios/swift/ZipResult.swift +49 -0
- package/nitrogen/generated/shared/c++/HybridUnzipSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridUnzipSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridUnzipTaskSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridUnzipTaskSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridZipTaskSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridZipTaskSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/UnzipProgress.hpp +99 -0
- package/nitrogen/generated/shared/c++/UnzipResult.hpp +99 -0
- package/nitrogen/generated/shared/c++/ZipProgress.hpp +95 -0
- package/nitrogen/generated/shared/c++/ZipResult.hpp +99 -0
- package/package.json +165 -0
- package/react-native-nitro-unzip.podspec +24 -0
- package/src/index.ts +36 -0
- package/src/specs/Unzip.nitro.ts +193 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_UnzipProgress.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(progress: struct) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_UnzipProgress: (UnzipProgress) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(progress: UnzipProgress): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(progress: struct) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_UnzipProgress_cxx: Func_void_UnzipProgress {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(progress: UnzipProgress): Unit
|
|
60
|
+
= invoke_cxx(progress)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(progress: UnzipProgress): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(progress: struct) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(UnzipProgress) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_UnzipProgress_java(private val function: (UnzipProgress) -> Unit): Func_void_UnzipProgress {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(progress: UnzipProgress): Unit {
|
|
78
|
+
return this.function(progress)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_ZipProgress.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(progress: struct) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_ZipProgress: (ZipProgress) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(progress: ZipProgress): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(progress: struct) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_ZipProgress_cxx: Func_void_ZipProgress {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(progress: ZipProgress): Unit
|
|
60
|
+
= invoke_cxx(progress)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(progress: ZipProgress): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(progress: struct) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(ZipProgress) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_ZipProgress_java(private val function: (ZipProgress) -> Unit): Func_void_ZipProgress {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(progress: ZipProgress): Unit {
|
|
78
|
+
return this.function(progress)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUnzipSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the Unzip HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of Unzip.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridUnzipSpec: HybridObject() {
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
private var mHybridData: HybridData = initHybrid()
|
|
29
|
+
|
|
30
|
+
init {
|
|
31
|
+
super.updateNative(mHybridData)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun updateNative(hybridData: HybridData) {
|
|
35
|
+
mHybridData = hybridData
|
|
36
|
+
super.updateNative(hybridData)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Default implementation of `HybridObject.toString()`
|
|
40
|
+
override fun toString(): String {
|
|
41
|
+
return "[HybridObject Unzip]"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Properties
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// Methods
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
abstract fun extract(zipPath: String, destinationPath: String): HybridUnzipTaskSpec
|
|
51
|
+
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
@Keep
|
|
54
|
+
abstract fun extractWithPassword(zipPath: String, destinationPath: String, password: String): HybridUnzipTaskSpec
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
abstract fun zip(sourcePath: String, destinationZipPath: String): HybridZipTaskSpec
|
|
59
|
+
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
abstract fun zipWithPassword(sourcePath: String, destinationZipPath: String, password: String): HybridZipTaskSpec
|
|
63
|
+
|
|
64
|
+
private external fun initHybrid(): HybridData
|
|
65
|
+
|
|
66
|
+
companion object {
|
|
67
|
+
protected const val TAG = "HybridUnzipSpec"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridUnzipTaskSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
import com.margelo.nitro.core.HybridObject
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A Kotlin class representing the UnzipTask HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of UnzipTask.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
27
|
+
abstract class HybridUnzipTaskSpec: HybridObject() {
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
private var mHybridData: HybridData = initHybrid()
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
super.updateNative(mHybridData)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun updateNative(hybridData: HybridData) {
|
|
36
|
+
mHybridData = hybridData
|
|
37
|
+
super.updateNative(hybridData)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Default implementation of `HybridObject.toString()`
|
|
41
|
+
override fun toString(): String {
|
|
42
|
+
return "[HybridObject UnzipTask]"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Properties
|
|
46
|
+
@get:DoNotStrip
|
|
47
|
+
@get:Keep
|
|
48
|
+
abstract val taskId: String
|
|
49
|
+
|
|
50
|
+
// Methods
|
|
51
|
+
abstract fun onProgress(callback: (progress: UnzipProgress) -> Unit): Unit
|
|
52
|
+
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
private fun onProgress_cxx(callback: Func_void_UnzipProgress): Unit {
|
|
56
|
+
val __result = onProgress(callback)
|
|
57
|
+
return __result
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
abstract fun cancel(): Unit
|
|
63
|
+
|
|
64
|
+
@DoNotStrip
|
|
65
|
+
@Keep
|
|
66
|
+
abstract fun await(): Promise<UnzipResult>
|
|
67
|
+
|
|
68
|
+
private external fun initHybrid(): HybridData
|
|
69
|
+
|
|
70
|
+
companion object {
|
|
71
|
+
protected const val TAG = "HybridUnzipTaskSpec"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridZipTaskSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
import com.margelo.nitro.core.HybridObject
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A Kotlin class representing the ZipTask HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of ZipTask.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
27
|
+
abstract class HybridZipTaskSpec: HybridObject() {
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
private var mHybridData: HybridData = initHybrid()
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
super.updateNative(mHybridData)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun updateNative(hybridData: HybridData) {
|
|
36
|
+
mHybridData = hybridData
|
|
37
|
+
super.updateNative(hybridData)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Default implementation of `HybridObject.toString()`
|
|
41
|
+
override fun toString(): String {
|
|
42
|
+
return "[HybridObject ZipTask]"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Properties
|
|
46
|
+
@get:DoNotStrip
|
|
47
|
+
@get:Keep
|
|
48
|
+
abstract val taskId: String
|
|
49
|
+
|
|
50
|
+
// Methods
|
|
51
|
+
abstract fun onProgress(callback: (progress: ZipProgress) -> Unit): Unit
|
|
52
|
+
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
private fun onProgress_cxx(callback: Func_void_ZipProgress): Unit {
|
|
56
|
+
val __result = onProgress(callback)
|
|
57
|
+
return __result
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
abstract fun cancel(): Unit
|
|
63
|
+
|
|
64
|
+
@DoNotStrip
|
|
65
|
+
@Keep
|
|
66
|
+
abstract fun await(): Promise<ZipResult>
|
|
67
|
+
|
|
68
|
+
private external fun initHybrid(): HybridData
|
|
69
|
+
|
|
70
|
+
companion object {
|
|
71
|
+
protected const val TAG = "HybridZipTaskSpec"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroUnzipOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class NitroUnzipOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "NitroUnzipOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "NitroUnzip".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading NitroUnzip C++ library...")
|
|
25
|
+
System.loadLibrary("NitroUnzip")
|
|
26
|
+
Log.i(TAG, "Successfully loaded NitroUnzip C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load NitroUnzip C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// UnzipProgress.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "UnzipProgress".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class UnzipProgress(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val extractedFiles: Double,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val totalFiles: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val progress: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val speed: Double,
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
val processedBytes: Double
|
|
35
|
+
) {
|
|
36
|
+
/* primary constructor */
|
|
37
|
+
|
|
38
|
+
companion object {
|
|
39
|
+
/**
|
|
40
|
+
* Constructor called from C++
|
|
41
|
+
*/
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
@Suppress("unused")
|
|
45
|
+
@JvmStatic
|
|
46
|
+
private fun fromCpp(extractedFiles: Double, totalFiles: Double, progress: Double, speed: Double, processedBytes: Double): UnzipProgress {
|
|
47
|
+
return UnzipProgress(extractedFiles, totalFiles, progress, speed, processedBytes)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// UnzipResult.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "UnzipResult".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class UnzipResult(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val success: Boolean,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val extractedFiles: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val duration: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val averageSpeed: Double,
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
val totalBytes: Double
|
|
35
|
+
) {
|
|
36
|
+
/* primary constructor */
|
|
37
|
+
|
|
38
|
+
companion object {
|
|
39
|
+
/**
|
|
40
|
+
* Constructor called from C++
|
|
41
|
+
*/
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
@Suppress("unused")
|
|
45
|
+
@JvmStatic
|
|
46
|
+
private fun fromCpp(success: Boolean, extractedFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double): UnzipResult {
|
|
47
|
+
return UnzipResult(success, extractedFiles, duration, averageSpeed, totalBytes)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ZipProgress.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "ZipProgress".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class ZipProgress(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val compressedFiles: Double,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val totalFiles: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val progress: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val speed: Double
|
|
32
|
+
) {
|
|
33
|
+
/* primary constructor */
|
|
34
|
+
|
|
35
|
+
companion object {
|
|
36
|
+
/**
|
|
37
|
+
* Constructor called from C++
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress("unused")
|
|
42
|
+
@JvmStatic
|
|
43
|
+
private fun fromCpp(compressedFiles: Double, totalFiles: Double, progress: Double, speed: Double): ZipProgress {
|
|
44
|
+
return ZipProgress(compressedFiles, totalFiles, progress, speed)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ZipResult.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.unzip
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "ZipResult".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class ZipResult(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val success: Boolean,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val compressedFiles: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val duration: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val averageSpeed: Double,
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
val totalBytes: Double
|
|
35
|
+
) {
|
|
36
|
+
/* primary constructor */
|
|
37
|
+
|
|
38
|
+
companion object {
|
|
39
|
+
/**
|
|
40
|
+
* Constructor called from C++
|
|
41
|
+
*/
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
@Suppress("unused")
|
|
45
|
+
@JvmStatic
|
|
46
|
+
private fun fromCpp(success: Boolean, compressedFiles: Double, duration: Double, averageSpeed: Double, totalBytes: Double): ZipResult {
|
|
47
|
+
return ZipResult(success, compressedFiles, duration, averageSpeed, totalBytes)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroUnzip+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroUnzip+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroUnzip is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroUnzip-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|