diff --git a/appmock/build.gradle b/appmock/build.gradle index aa65e90..09d56cd 100644 --- a/appmock/build.gradle +++ b/appmock/build.gradle @@ -49,7 +49,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' - implementation 'com.github.functionland:fula-build-aar:v0.7.3' // From jitpack.io + implementation 'com.github.functionland:fula-build-aar:v0.7.4' // From jitpack.io testImplementation 'junit:junit:4.+' testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1' testImplementation "androidx.arch.core:core-testing:2.1.0" diff --git a/appmock/src/androidTest/java/land/fx/app/WNFSTest.kt b/appmock/src/androidTest/java/land/fx/app/WNFSTest.kt index 8cdd576..c09bdfa 100644 --- a/appmock/src/androidTest/java/land/fx/app/WNFSTest.kt +++ b/appmock/src/androidTest/java/land/fx/app/WNFSTest.kt @@ -80,13 +80,13 @@ class WNFSTest { assertNotNull("cid should not be null", config.cid) assertNotNull("private_ref should not be null", config.private_ref) - val fileNames_initial: String = ls( + val fileNames_initial: ByteArray = ls( client , "bafyreieqp253whdfdrky7hxpqezfwbkjhjdbxcq4mcbp6bqf4jdbncbx4y" , "{\"saturated_name_hash\":[229,31,96,28,24,238,207,22,36,150,191,37,235,68,191,144,219,250,5,97,85,208,156,134,137,74,25,209,6,66,250,127],\"content_key\":[172,199,245,151,207,21,26,76,52,109,93,57,118,232,9,230,149,46,37,137,174,42,119,29,102,175,25,149,213,204,45,15],\"revision_key\":[17,5,78,59,8,135,144,240,41,248,135,168,222,186,158,240,100,10,129,4,180,55,126,115,146,239,22,177,207,118,169,51]}" , "root/" ) - Log.d("AppMock", "ls_initial. fileNames_initial="+fileNames_initial) + Log.d("AppMock", "ls_initial. fileNames_initial="+String(fileNames_initial)) val testContent = "Hello, World!".toByteArray() @@ -144,8 +144,8 @@ class WNFSTest { config = mkdir(client, config.cid, config.private_ref, "root/test1") Log.d("AppMock", "config mkdir. cid="+config.cid+" & private_ref="+config.private_ref) - val fileNames: String = ls(client, config.cid, config.private_ref, "root") - Log.d("AppMock", "ls. fileNames="+fileNames) + val fileNames: ByteArray = ls(client, config.cid, config.private_ref, "root") + Log.d("AppMock", "ls. fileNames="+String(fileNames)) //assertEquals(fileNames, "[{\"name\":\"test.txt\",\"creation\":\"2022-12-17 00:36:02 UTC\",\"modification\":\"2022-12-17 00:36:02 UTC\"},{\"name\":\"test1\",\"creation\":\"\",\"modification\":\"]\"}]") @@ -162,7 +162,7 @@ class WNFSTest { Log.d("AppMock", "wnfs12 getPrivateRef. private_ref="+private_ref_reload) assertNotNull("private_ref should not be null", private_ref_reload) - val fileNames_reloaded: String = ls(client, config.cid, private_ref_reload, "root") + val fileNames_reloaded: ByteArray = ls(client, config.cid, private_ref_reload, "root") //assertEquals(fileNames_reloaded, "test.txt\ntest1") diff --git a/jitpack.yml b/jitpack.yml index 6b58413..a974c6e 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -2,4 +2,4 @@ before_install: - git lfs pull install: - FILE="-Dfile=lib/build/outputs/aar/lib-release.aar" - - mvn install:install-file $FILE -DgroupId=com.group.module -DartifactId=wnfs-android -Dversion=1.3.5 -Dpackaging=aar -DgeneratePom=true + - mvn install:install-file $FILE -DgroupId=com.group.module -DartifactId=wnfs-android -Dversion=1.3.9 -Dpackaging=aar -DgeneratePom=true diff --git a/lib/build.gradle b/lib/build.gradle index e0990de..25b639f 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -49,7 +49,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation 'androidx.core:core-ktx:1.7.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.github.functionland:fula-build-aar:v0.7.3' // From jitpack.io + ///implementation 'com.github.functionland:fula-build-aar:v0.7.4' // From jitpack.io } tasks.whenTaskAdded { task -> diff --git a/lib/src/main/java/land/fx/wnfslib/Fs.java b/lib/src/main/java/land/fx/wnfslib/Fs.java index 976a059..de64124 100644 --- a/lib/src/main/java/land/fx/wnfslib/Fs.java +++ b/lib/src/main/java/land/fx/wnfslib/Fs.java @@ -109,12 +109,13 @@ public static Config writeFile(Datastore datastore, String cid, String privateRe } @NonNull - public static String ls(Datastore datastore, String cid, String privateRef, String path) throws Exception { + public static byte[] ls(Datastore datastore, String cid, String privateRef, String path) throws Exception { try { - JSONArray output = new JSONArray(); - Log.d("wnfs", "JSONArray is reached"); + + Log.d("wnfs", "JSONArray is reached2"); byte[] lsResult = lsNative(datastore, cid, privateRef, path); - Log.d("wnfs", "lsResult is reached"); + Log.d("wnfs", "lsResult is reached: "); + /*JSONArray output = new JSONArray(); byte[] rowSeparatorPattern = {33, 33, 33}; //!!! byte[] itemSeparatorPattern = {63, 63, 63}; //??? List rows = split(rowSeparatorPattern, lsResult); @@ -141,11 +142,9 @@ public static String ls(Datastore datastore, String cid, String privateRef, Stri } } - } - - String textOutput = output.toString(); + }*/ - return textOutput; + return lsResult; } catch(Exception e) { throw new Exception(e.getMessage()); diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity new file mode 100644 index 0000000..60ee24b --- /dev/null +++ b/node_modules/.yarn-integrity @@ -0,0 +1,10 @@ +{ + "systemParams": "linux-x64-111", + "modulesFolders": [], + "flags": [], + "linkedModules": [], + "topLevelPatterns": [], + "lockfileEntries": {}, + "files": [], + "artifacts": {} +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 847208a..e39bb5e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,5 +5,5 @@ 4.0.0 com.group.module wnfs-android - 1.3.5 + 1.3.9 diff --git a/wnfslib/src/lib.rs b/wnfslib/src/lib.rs index bc35c63..06568e4 100644 --- a/wnfslib/src/lib.rs +++ b/wnfslib/src/lib.rs @@ -501,38 +501,40 @@ pub mod android { trace!("**********************lsNative finished**************"); if output.is_ok() { let res = output.ok().unwrap(); - return vec_to_jbyte_array(env, res); + return vec_to_jbyte_array( + env, + res + ); } else { trace!("wnfsError occured in Java_land_fx_wnfslib_Fs_lsNative output: {:?}", output.err().unwrap().to_string()); - - let emptyVec: Vec = Vec::new(); + let emptyBytes: Vec = vec![0]; return vec_to_jbyte_array( env, - emptyVec, + emptyBytes ); } } else { trace!("wnfsError occured in Java_land_fx_wnfslib_Fs_lsNative ls_res: {:?}", ls_res.err().unwrap().to_string()); - let emptyVec: Vec = Vec::new(); + let emptyBytes: Vec = vec![0]; return vec_to_jbyte_array( env, - emptyVec, + emptyBytes ); } } else { trace!("wnfsError occured in Java_land_fx_wnfslib_Fs_lsNative root_dir_res: {:?}", root_dir_res.err().unwrap().to_string()); - let emptyVec: Vec = Vec::new(); + let emptyBytes: Vec = vec![0]; return vec_to_jbyte_array( env, - emptyVec, + emptyBytes ); } } else { trace!("wnfsError occured in Java_land_fx_wnfslib_Fs_lsNative forest_res: {:?}", forest_res.err().unwrap().to_string()); - let emptyVec: Vec = Vec::new(); + let emptyBytes: Vec = vec![0]; return vec_to_jbyte_array( env, - emptyVec, + emptyBytes ); } }