Sample for ark-core FileStorage JNI bindings usage#110
Sample for ark-core FileStorage JNI bindings usage#110oluiscabral wants to merge 15 commits intomainfrom
ark-core FileStorage JNI bindings usage#110Conversation
sample/src/main/java/dev/arkbuilders/sample/storage/StorageDemoFragment.kt
Show resolved
Hide resolved
| binding.tvMapValues.text = getString(R.string.empty_map) | ||
| return | ||
| } | ||
| storage!!.writeFS() |
There was a problem hiding this comment.
I should check with the crate implementation, but do we really need flushing? That isn't handled by the crate?
There was a problem hiding this comment.
From what I tested, no
There was a problem hiding this comment.
storage.set and storage.remove do not write to fs, only storage.erase deletes file
| maven { | ||
| name = "GitHubPackages" | ||
| name = "arklib-android GitHub Packages" | ||
| url = URI("https://maven.pkg.github.com/ARK-Builders/arklib-android") |
There was a problem hiding this comment.
Let's use ark-android to avoid confusion with the archived repo.
It was just a fat lib when we were prototyping, now we moved to the next level with modular framework 😁
There was a problem hiding this comment.
Yes. I don't know if I understood it correctly. This is indeed a reference to arklib-android archive, it is not a name for the current repo. Should we use another repo instead?
There was a problem hiding this comment.
Oh, I didn't notice the link leads to the archived repo.
We certainly should not use archived repos.
There was a problem hiding this comment.
But what do we use from arklib-android?
There was a problem hiding this comment.
@kirillt It's being used in at least 23 places, just search for dev.arkbuilders.arklib and you'll realize it too. Here's an example on the sample package
There was a problem hiding this comment.
But what do we use from
arklib-android?
TagSelector and ScoreWidget dependent on arklib, they need ResourceIndex, TagStorage, ScoreStorage and so on
There was a problem hiding this comment.
Thanks guys, I wasn't realizing it.. I'll come up with plan for the upgrade later.
|
Doesn't really work on my devices... Tried on Android versions 9 and 11. Steps to test:
|
3b6c3eb to
cc4e896
Compare
Hi! @kirillt Just repeating what we previously discussed: this issue was being caused by the fact that the released APK did not include Now, with the latest updates, it fortunately might be fixed, but let me know if it still persists |
|
@oluiscabral still doesn't work. Nothing is written to disk. |
@kirillt That's unfortunate... But I might know what's happening. I'll try another potential solution and let you know again when it's done |
.github/workflows/build_sample.yml
Outdated
| - name: Download and extract `ark-core` JNI libs | ||
| run: | | ||
| wget https://github.com/ARK-Builders/ark-core/releases/download/v1.0.0/jniLibs.zip | ||
| unzip -d sample/src/main jniLibs.zip | ||
|
|
There was a problem hiding this comment.
Sorry for suddenly jumping into this, but I think implementation(libraries.core) is enough. In theory we don't have to manually download the JNI libs like this because it's already included in the synced dependency of arkcore.
There was a problem hiding this comment.
Just repeating what we later discussed: implementation(libraries.core) is not currently enough, since ark-core/java is a JAR, that means JNI libs are not available for use from it. However, I'm working on transforming ark-core/java into an AAR instead (to make JNI libs available directly from the package)
|
@kirillt Just converted the JAR into an AAR. Let me know if it's still working for you |
mdrlzy
left a comment
There was a problem hiding this comment.
readFS, sync, syncStatus, merge, get not implemented
|
|
Thanks for contributing, @mdrlzy! It's nice that you created a foundation to test each one of the Anyways, I have a few considerations about the points you brought. So all that said, maybe should we disable the buttons related to those methods if the button for About |
I dont know. Kirill asked me to do review/refactor.
Good idea. Done. Can you test it?
Everything works for me. Except for some cases where the storage file is missing but it seems to be justified Let's wait for Kirill's review |
|
@oluiscabral to create better API suited for app developers' needs, we need one of these two static functions in
This way, the app developer will be able to specify the "root" folder and the storage name and simply load or initialize the storage without working with the file path directly. @mdrlzy initially I had the idea of flexible path selection in the sample, to ease testing, but I don't think it's a good idea to expose the path via the API to the app developer. We should prevent incorrect usage of the underlying files of the storage. Could you modify the sample to only allow selection of root and name for the storage? If the storage exists, empty storage is ok to be not persisted, for the rest we have sync status, it sounds ok to have storage in pending state if we have something like "flush" or "sync" operation |
|
@mdrlzy also, would be great to add display for SyncStatus that is returned by fn sync_status It seems to me (although I'm not 100% sure) that usages of @oluiscabral other minor changes to the
|
The problem is that if storage file does not exist then
We already have button that shows toast with sync status. Is this not enough? |
Should be enough. Sorry, I haven't tested the APK yet. |
Sounds great! Do you think it should already be addressed on this PR? |
We can do it in separate PR, too. But if we don't create it before merging this PR, then we should track the issue. |
No description provided.