Use a common class Wrapper and IterWrapper to wrap native resource.#25
Use a common class Wrapper and IterWrapper to wrap native resource.#25mgautierfr wants to merge 1 commit intomainfrom
Conversation
8ce4ed1 to
929ae6d
Compare
Native resource (pointer to shared_ptr) is stored as a long in the `Wrapper.Resource` class. As Wrapper implements AutoCloseable and we register the (java) resource to be cleaned at object destruction, we now properly delete the native resource. This also adding new macro to avoid writting the class name and so reduce potential typos. # Conflicts: # lib/build.gradle # lib/src/main/java/org/kiwix/libkiwix/Library.java
|
This is ready for review. There is still a open question on the change of min sdk version (https://github.com/kiwix/java-libkiwix/pull/25/files#diff-655a69127303f6948c0b150902436756156ec7f82640e994c1f552cbdec5bbceL29-L33). This is needed to have the |
@mgautierfr , If we change minimum SDK version to 33 then it's only support the android 13 or above devices, we can not use this library below android 13. |
|
FYI Android 13 is latest stable and has only 12% market share (January 2023) |
|
Sounds like a nogo to make that move as such. What do we have as alternative? |
Keep the previous version using deprecated (but probably never removed) functions. |
|
OK, to me it sounds we should keep this PR for a moment and reassess the whole thing after next major release of kiwix-android. For the moment continue with the "old" approach. |
58516a2 to
f4b5d7a
Compare
|
@mgautierfr Would that be wise to keep this PR open longer without merging/finishing it? |
|
This PR should be rebased on |
Native resource (pointer to shared_ptr) is stored as a long in the
Wrapper.Resourceclass.As Wrapper implements AutoCloseable and we register the (java) resource to be cleaned at object destruction, we now properly delete the native resource.
This also adding new macro to avoid writting the class name and so reduce potential typos.