expo-tiddlywiki-filesystem-android-external-storage 2.11.0 → 2.12.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/README.md +10 -0
- package/android/build.gradle +3 -1
- package/android/src/main/java/expo/modules/externalstorage/GitNetwork.kt +0 -4
- package/app.plugin.js +36 -2
- package/package.json +3 -2
- package/plugin.js +36 -2
- package/tsconfig.json +8 -0
package/README.md
CHANGED
|
@@ -118,6 +118,16 @@ Deletes a directory recursively.
|
|
|
118
118
|
### `isExternalStorageManager(): Promise<boolean>`
|
|
119
119
|
Checks if the `MANAGE_EXTERNAL_STORAGE` permission is granted (Android 11+).
|
|
120
120
|
|
|
121
|
+
## JGit Version Note
|
|
122
|
+
|
|
123
|
+
This module bundles **JGit 6.2.x** (not the latest 6.10.x) for Android compatibility.
|
|
124
|
+
|
|
125
|
+
Newer JGit versions (6.3+) call Java 9+ APIs (`InputStream.readNBytes`, `InputStream.transferTo`) that are **not available on Android at any API level** — Android's `desugar_jdk_libs` only backfills Java 8 language APIs, not these Java 9 I/O methods. This has been confirmed on Android 12 (API 31) and is expected to affect all current Android versions.
|
|
126
|
+
|
|
127
|
+
JGit 6.2.x is the latest release that avoids these Java 9+ API calls while still providing all the Git primitives needed by this module (clone, fetch, push, status, diff, log, etc.). One API trade-off: `CloneCommand.setDepth()` (shallow clone) was introduced in JGit 6.3, so this module does not support `--depth` on clone.
|
|
128
|
+
|
|
129
|
+
If you need a newer JGit, ensure your app's `minSdkVersion` and desugaring configuration are verified on all target devices.
|
|
130
|
+
|
|
121
131
|
## License
|
|
122
132
|
|
|
123
133
|
MIT
|
package/android/build.gradle
CHANGED
|
@@ -14,12 +14,14 @@ android {
|
|
|
14
14
|
}
|
|
15
15
|
// JGit needs Java 11+
|
|
16
16
|
compileOptions {
|
|
17
|
+
coreLibraryDesugaringEnabled true
|
|
17
18
|
sourceCompatibility JavaVersion.VERSION_11
|
|
18
19
|
targetCompatibility JavaVersion.VERSION_11
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
dependencies {
|
|
23
|
-
|
|
24
|
+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
|
25
|
+
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.2.0.202206071550-r'
|
|
24
26
|
implementation "com.squareup.okhttp3:okhttp:4.12.0"
|
|
25
27
|
}
|
package/app.plugin.js
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
const { withAndroidManifest } = require('@expo/config-plugins');
|
|
1
|
+
const { withAndroidManifest, withAppBuildGradle } = require('@expo/config-plugins');
|
|
2
|
+
|
|
3
|
+
const DESUGAR_DEPENDENCY = "coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'";
|
|
4
|
+
|
|
5
|
+
function applyCoreLibraryDesugaring(contents) {
|
|
6
|
+
if (!contents.includes('coreLibraryDesugaringEnabled')) {
|
|
7
|
+
if (contents.includes('compileOptions {')) {
|
|
8
|
+
contents = contents.replace(
|
|
9
|
+
/(compileOptions\s*\{)/,
|
|
10
|
+
'$1\n coreLibraryDesugaringEnabled true',
|
|
11
|
+
);
|
|
12
|
+
} else {
|
|
13
|
+
contents = contents.replace(
|
|
14
|
+
/^(android\s*\{)/m,
|
|
15
|
+
'$1\n compileOptions {\n coreLibraryDesugaringEnabled true\n }',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!contents.includes('desugar_jdk_libs')) {
|
|
21
|
+
contents = contents.replace(
|
|
22
|
+
/^(dependencies\s*\{)/m,
|
|
23
|
+
`$1\n ${DESUGAR_DEPENDENCY}`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return contents;
|
|
28
|
+
}
|
|
2
29
|
|
|
3
30
|
const withExternalStoragePermission = (config) => {
|
|
4
|
-
|
|
31
|
+
config = withAndroidManifest(config, async (config) => {
|
|
5
32
|
const androidManifest = config.modResults;
|
|
6
33
|
|
|
7
34
|
if (!androidManifest.manifest['uses-permission']) {
|
|
@@ -20,6 +47,13 @@ const withExternalStoragePermission = (config) => {
|
|
|
20
47
|
|
|
21
48
|
return config;
|
|
22
49
|
});
|
|
50
|
+
|
|
51
|
+
config = withAppBuildGradle(config, (config) => {
|
|
52
|
+
config.modResults.contents = applyCoreLibraryDesugaring(config.modResults.contents);
|
|
53
|
+
return config;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return config;
|
|
23
57
|
};
|
|
24
58
|
|
|
25
59
|
module.exports = withExternalStoragePermission;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-tiddlywiki-filesystem-android-external-storage",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Expo native module for TidGi-Mobile: filesystem I/O + TiddlyWiki .tid/.meta/.json batch parsing + git status in Kotlin (Android) and Swift (iOS)",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"clean": "expo-module clean",
|
|
11
11
|
"lint": "expo-module lint",
|
|
12
12
|
"test": "expo-module test",
|
|
13
|
-
"
|
|
13
|
+
"prepack": "tsc -p tsconfig.json"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"react-native",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"ios",
|
|
43
43
|
"expo-module.config.json",
|
|
44
44
|
"src",
|
|
45
|
+
"tsconfig.json",
|
|
45
46
|
"plugin.js",
|
|
46
47
|
"app.plugin.js"
|
|
47
48
|
],
|
package/plugin.js
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
const { withAndroidManifest } = require('@expo/config-plugins');
|
|
1
|
+
const { withAndroidManifest, withAppBuildGradle } = require('@expo/config-plugins');
|
|
2
|
+
|
|
3
|
+
const DESUGAR_DEPENDENCY = "coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'";
|
|
4
|
+
|
|
5
|
+
function applyCoreLibraryDesugaring(contents) {
|
|
6
|
+
if (!contents.includes('coreLibraryDesugaringEnabled')) {
|
|
7
|
+
if (contents.includes('compileOptions {')) {
|
|
8
|
+
contents = contents.replace(
|
|
9
|
+
/(compileOptions\s*\{)/,
|
|
10
|
+
'$1\n coreLibraryDesugaringEnabled true',
|
|
11
|
+
);
|
|
12
|
+
} else {
|
|
13
|
+
contents = contents.replace(
|
|
14
|
+
/^(android\s*\{)/m,
|
|
15
|
+
'$1\n compileOptions {\n coreLibraryDesugaringEnabled true\n }',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!contents.includes('desugar_jdk_libs')) {
|
|
21
|
+
contents = contents.replace(
|
|
22
|
+
/^(dependencies\s*\{)/m,
|
|
23
|
+
`$1\n ${DESUGAR_DEPENDENCY}`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return contents;
|
|
28
|
+
}
|
|
2
29
|
|
|
3
30
|
const withExternalStoragePermission = (config) => {
|
|
4
|
-
|
|
31
|
+
config = withAndroidManifest(config, async (config) => {
|
|
5
32
|
const androidManifest = config.modResults;
|
|
6
33
|
|
|
7
34
|
if (!androidManifest.manifest['uses-permission']) {
|
|
@@ -20,6 +47,13 @@ const withExternalStoragePermission = (config) => {
|
|
|
20
47
|
|
|
21
48
|
return config;
|
|
22
49
|
});
|
|
50
|
+
|
|
51
|
+
config = withAppBuildGradle(config, (config) => {
|
|
52
|
+
config.modResults.contents = applyCoreLibraryDesugaring(config.modResults.contents);
|
|
53
|
+
return config;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return config;
|
|
23
57
|
};
|
|
24
58
|
|
|
25
59
|
module.exports = withExternalStoragePermission;
|