expo-tiddlywiki-filesystem-android-external-storage 2.1.1 → 2.2.1
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.
|
@@ -590,6 +590,8 @@ class ExternalStorageModule : Module() {
|
|
|
590
590
|
val changes = JSONArray()
|
|
591
591
|
val indexPaths = mutableSetOf<String>()
|
|
592
592
|
|
|
593
|
+
var modifiedCount = 0
|
|
594
|
+
var deletedCount = 0
|
|
593
595
|
for (entry in indexEntries) {
|
|
594
596
|
indexPaths.add(entry.path)
|
|
595
597
|
val workFile = File(root, entry.path)
|
|
@@ -599,6 +601,7 @@ class ExternalStorageModule : Module() {
|
|
|
599
601
|
obj.put("path", entry.path)
|
|
600
602
|
obj.put("type", "delete")
|
|
601
603
|
changes.put(obj)
|
|
604
|
+
deletedCount++
|
|
602
605
|
} else {
|
|
603
606
|
// Check stat cache: size and mtime
|
|
604
607
|
val diskSize = workFile.length()
|
|
@@ -608,20 +611,30 @@ class ExternalStorageModule : Module() {
|
|
|
608
611
|
obj.put("path", entry.path)
|
|
609
612
|
obj.put("type", "modify")
|
|
610
613
|
changes.put(obj)
|
|
614
|
+
modifiedCount++
|
|
615
|
+
if (modifiedCount <= 3) {
|
|
616
|
+
android.util.Log.i("GitStatus", " modify: ${entry.path} disk(size=$diskSize,mtime=$diskMtime) vs index(size=${entry.size},mtime=${entry.mtimeSeconds})")
|
|
617
|
+
}
|
|
611
618
|
}
|
|
612
619
|
}
|
|
613
620
|
}
|
|
614
621
|
|
|
615
622
|
// 4. Files on disk but not in index → added
|
|
623
|
+
var addedCount = 0
|
|
616
624
|
for (path in workdirFiles) {
|
|
617
625
|
if (path !in indexPaths) {
|
|
618
626
|
val obj = JSONObject()
|
|
619
627
|
obj.put("path", path)
|
|
620
628
|
obj.put("type", "add")
|
|
621
629
|
changes.put(obj)
|
|
630
|
+
addedCount++
|
|
631
|
+
if (addedCount <= 5) {
|
|
632
|
+
android.util.Log.i("GitStatus", " add: $path")
|
|
633
|
+
}
|
|
622
634
|
}
|
|
623
635
|
}
|
|
624
636
|
|
|
637
|
+
android.util.Log.i("GitStatus", "Result: ${changes.length()} changes (add=$addedCount, modify=$modifiedCount, delete=$deletedCount), indexEntries=${indexEntries.size}, workdirFiles=${workdirFiles.size}")
|
|
625
638
|
changes.toString()
|
|
626
639
|
}
|
|
627
640
|
|
|
@@ -832,27 +845,46 @@ class ExternalStorageModule : Module() {
|
|
|
832
845
|
val companionFile = File(companionPath)
|
|
833
846
|
|
|
834
847
|
if (companionFile.exists()) {
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
848
|
+
val tiddlerType = json.optString("type", "text/vnd.tiddlywiki")
|
|
849
|
+
val hasModuleType = json.has("module-type")
|
|
850
|
+
val hasPluginType = json.has("plugin-type")
|
|
851
|
+
|
|
852
|
+
// Determine whether this companion is a text file whose content
|
|
853
|
+
// should be loaded as the tiddler's "text" field.
|
|
854
|
+
// JS modules, CSS, JSON, and other text-based companions need their content.
|
|
855
|
+
// Binary companions (images, pdfs, etc.) should NOT have their content loaded;
|
|
856
|
+
// they use _canonical_uri instead (handled later by JS).
|
|
857
|
+
val isTextCompanion = companionPath.endsWith(".json") ||
|
|
858
|
+
companionPath.endsWith(".js") ||
|
|
859
|
+
companionPath.endsWith(".css") ||
|
|
860
|
+
companionPath.endsWith(".svg") ||
|
|
861
|
+
companionPath.endsWith(".txt") ||
|
|
862
|
+
companionPath.endsWith(".html") ||
|
|
863
|
+
companionPath.endsWith(".htm") ||
|
|
864
|
+
tiddlerType.startsWith("text/") ||
|
|
865
|
+
tiddlerType == "application/javascript" ||
|
|
866
|
+
tiddlerType == "application/json" ||
|
|
867
|
+
tiddlerType == "application/x-tiddler-dictionary"
|
|
868
|
+
|
|
869
|
+
if (isTextCompanion) {
|
|
838
870
|
val shouldIncludeText = if (quickLoadMode) {
|
|
839
871
|
shouldPreserveFullTextInQuickLoad(
|
|
840
872
|
json.optString("title", ""),
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
873
|
+
tiddlerType,
|
|
874
|
+
hasModuleType,
|
|
875
|
+
hasPluginType,
|
|
844
876
|
)
|
|
845
877
|
} else {
|
|
846
878
|
true
|
|
847
879
|
}
|
|
848
880
|
if (shouldIncludeText) {
|
|
849
|
-
val
|
|
850
|
-
json.put("text",
|
|
881
|
+
val textContent = companionFile.readText(Charsets.UTF_8)
|
|
882
|
+
json.put("text", textContent)
|
|
851
883
|
} else {
|
|
852
884
|
json.put("_is_skinny", "yes")
|
|
853
885
|
}
|
|
854
886
|
}
|
|
855
|
-
// For
|
|
887
|
+
// For binary companions (images, etc.), we don't set _canonical_uri here —
|
|
856
888
|
// that requires knowing the workspace base path. JS side handles it.
|
|
857
889
|
}
|
|
858
890
|
|
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.2.1",
|
|
4
4
|
"description": "Expo native module for TidGi-Mobile: external storage I/O + TiddlyWiki .tid/.meta/.json batch parsing in Kotlin",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|