7115 Commits

Author SHA1 Message Date
MohitMali
8c466467c9 Upgrading libkiwix to 1.0.1 2023-11-16 12:54:56 +05:30
MohitMali
35830aa49c Storing bookmarks/library inside our app-specific directory 2023-11-16 12:47:05 +05:30
MohitMali
4b55bc3245 Removed unnecessary comments 2023-11-16 12:46:59 +05:30
MohitMali
ad6e0435c7 Instead of creating an archive object for every book and retrieving the favicon from it, we are now speeding up the process by directly taking the favicon from the book, as the issue at https://github.com/kiwix/java-libkiwix/issues/73 has been resolved. 2023-11-16 12:46:51 +05:30
MohitMali
31ece90ed7 Fixed path and improved the logs 2023-11-16 12:46:41 +05:30
MohitMali
f8ddf68aa5 Added logs while reading reading the bookmarks/library data, and added logs before writing the library in file. 2023-11-16 12:46:35 +05:30
MohitMali
831d91df78 The writing of the library to a file when retrieving bookmarks for the current book has been removed because adding the book to the library is unnecessary, as we have not saved any bookmarks yet.
* We now write bookmarks and the library on the main thread instead of saving them in the background thread to prevent any data loss.
2023-11-16 12:46:25 +05:30
MohitMali
1ccdd76159 Fixed, compilation error 2023-11-16 12:46:17 +05:30
MohitMali
b1d4d8b13d Resolved bookmark saving issue, which causes the bug when we try to retrieve the saved bookmarks.
* Enhanced the `isBookMarkExist` method, addressing a bug that prevented the addition of new bookmarks for the same file. The method has been refactored for improved functionality.
* In the debug version, added informative logs to provide developers with insights into the bookmark-saving functionality.
2023-11-16 12:46:07 +05:30
MohitMali
edbdeff7d7 Removed the unnecessary wrapper classes of libkiwix from the codebase since we don't need these classes as saving/deleting functionality will be tested in java-libkiwix.
* Added instrumentation test case for testing the UI part with libkiwix bookmark functionality.
2023-11-16 12:45:56 +05:30
MohitMaliFtechiz
967e2df093 Introducing the writeFile method of the Library class allows us to save the library, which contains information about books, their file paths, and favicons, into a file.
* We now save this library information into a file named `library.txt` and subsequently read from it to retrieve file paths and favicons.
* The test cases have been refactored to accommodate this new functionality.
* The `ObjectBoxToLibkiwiMigrator` code has also been enhanced. With this change, we now save books in the library for their favicon and zimFilePath, resulting in a refactor and improvement of this class's functionality and its associated test cases.
* The process of writing bookmarks and library data to file has been enhanced. Now, this is performed asynchronously in a background thread to mitigate potential data loss.
* Additionally, several other improvements have been made throughout the codebase.
2023-11-16 12:45:43 +05:30
MohitMali
f43a6a835e Improved LibkiwixBookTest and added new ObjectBoxToLibkiwixMigratorTest cases 2023-11-16 12:45:31 +05:30
MohitMali
331081b2bd Fixed application crash while running application on the emulators. 2023-11-16 12:45:21 +05:30
MohitMali
c0d28ce0fa Refactored unit coverage test cases for testing bookmarks with LibkiwixBookmarks. 2023-11-16 12:45:12 +05:30
MohitMali
8f65df0c6c Fixed after delete/save bookmark list is not updating.
* We introduced a Flowable list in LibkiwixBookmarks to observe live changes on the UI. Previously, the UI was not updating after deleting bookmarks on the BookmarkScreen, and toggling bookmarks in the reader screen was also not reflecting the changes. To address this, we created a Flowable list and are now observing it whenever bookmarks are added or removed in the library.
2023-11-16 12:45:03 +05:30
MohitMali
38bc849ed3 Fixed detekt errors 2023-11-16 12:44:54 +05:30
MohitMali
ca80d0ed1c Improved seleted items method for avoid duplicacy 2023-11-16 12:43:27 +05:30
MohitMali
177d1f82a3 Migrating bookmarks from objectbox to libkiwix 2023-11-16 12:43:20 +05:30
MohitMali
f0aebc1eaa Fixed all bookmarks automatically selected if we select only one bookmark 2023-11-16 12:43:12 +05:30
MohitMali
a7c4faddcb Improved saving bookmark, add book to the libkiwix library if not already added 2023-11-16 12:43:04 +05:30
MohitMali
81c056afc8 Fixed bookmark not redable from file if there is no book added to the library 2023-11-16 12:42:57 +05:30
MohitMali
8f6e916494 Improved url loading for current book 2023-11-16 12:42:34 +05:30
MohitMali
cfd9b82dd1 Save bookmark when it does not exist in the file since bookmarks is now written in a file with libkiwix 2023-11-16 12:42:26 +05:30
MohitMali
4e6f4ebc30 Refactored the code to display saved bookmarks in the bookmarks screen, improved the delete functionality in the bookmark screen, and also refactored the add/delete bookmark functionality in the reader fragment. 2023-11-16 12:42:18 +05:30
MohitMali
11e254f21d Implemented Save/Delete functionality with libkiwix 2023-11-16 12:42:09 +05:30
MohitMali
ea422b5059 Fixed ObjectBoxToLibkiwixMigrator implementation not found 2023-11-16 12:40:33 +05:30
MohitMali
7f82ed63be Created saved deleted feature and implemented the functionality, created flowables to perform bookmarks operation on background thread for better user experience. 2023-11-16 12:35:09 +05:30
MohitMali
67601d3e62 Storing Bookmarks via libkiwix instead of Objectbox 2023-11-16 12:25:02 +05:30
MohitMali
7bc769a0e0 Created LibkiwixBooks to store and retrieve bookmarks 2023-11-16 12:24:53 +05:30
MohitMali
d02b202802 Created ObjectBox to libkiwix migrator for Bookmarks 2023-11-16 12:24:43 +05:30
Kelson
3716b72fc0
Merge pull request #3516 from kiwix/Issue#56
Fixed, Reduce mass-storage consumption with Android custom apps with embedded ZIM
2023-11-12 18:06:29 +01:00
MohitMali
8b1cb8bc7e We are temporary hiding the kiwixServer feature from Custom Apps.
* Since we are now using fd (FileDescriptor) to read the zim file from the asset folder. Currently, 'KiwixServer' is unable to host zim files via fd. This feature is temporarily hidden for custom apps. We will re-enable it for custom apps once the issue is resolved.
2023-11-12 18:06:05 +01:00
MohitMali
bdb00d7aae Fixed the issue where the Zim File was not displaying in the ZimHostFragment for custom apps.
* In `ZimHostFragment`, we show Zim files that are saved in the database. These files are typically saved when downloading Zim files. In a custom app, where Zim files are already included within the app and not downloaded separately that's why they are not showing on the `ZimHostFragment`, we have addressed this issue by saving the Zim files in the database to ensure they appear in the `ZimHostFragment`.
* Regarding the `FileDescriptor`, there are no file objects available because we read Zim files using `FileDescriptor`. To address this, we have created a `demo.zim` file to save it in the database so that it will be displayed in the `ZimHostFragment`. We handle this file within the `KiwixServer`. When the current Zim file is `demo.zim`, we create an `Archive` object with the `FileDescriptor` to host the Zim file on the `KiwixServer`.
2023-11-12 18:06:05 +01:00
MohitMali
845f19eab6 Fixed #3519.
* The problem was that we were saving the note name combined with `zimFileTitle` and `articleTitle`. When opening the saved note from `NotesFragment`, it retrieved the `noteTitle` from the database, which already contained the combined name. Subsequently, when saving the note again, it redundantly combined the name. To resolve this issue, we now extract the `articleName` when updating notes in `NotesFragment`, ensuring that it updates existing notes instead of creating new ones.
2023-11-12 18:06:05 +01:00
MohitMali
b6d718f287 Fixed note saving with FileDescriptor.
* Now we are using fileDescriptor for custom apps to read zim file from asset folder, so we have improved our notes saving functionality according to this change.
2023-11-12 18:06:05 +01:00
MohitMali
f31535966b Using AssetFileDescriptor instead of ParcelFileDescriptor. 2023-11-12 18:06:05 +01:00
MohitMali
ae0893095c Fixed MimeTypeTest compilation error 2023-11-12 18:06:05 +01:00
MohitMali
c8b98cc504 Using ParcelFileDescriptor instead of FileDescriptor.
* Telling android to not compress the `.zim` files in asset folder while building the apk/bundle.
2023-11-12 18:06:05 +01:00
MohitMali
99614ed88f Introducing reading zim file content through fileDescriptor instead of creating a file to avoid using storage twice for same zim file. 2023-11-12 18:06:05 +01:00
Kelson
ae413559fe
Merge pull request #3525 from kiwix/Issue#3523
Fixed the redundancy of the 'All-Books-Mode' option for Bookmarks, Notes, and History in custom apps.
2023-11-12 18:04:52 +01:00
MohitMali
4c8f7cb02c Fixed the redundancy of the 'All-Books-Mode' option for Bookmarks, Notes, and History in custom apps.
* Since custom apps only have a single zim file, there is no need to display these switches, which can potentially confuse users. Therefore, we have hidden these switches in custom apps.
2023-11-12 18:04:22 +01:00
Kelson
a8eb53f837
Merge pull request #3518 from kiwix/Issue#3515
Fixed, can not open ZIM files from phone storage via the file picker in Android 13.
2023-11-12 18:02:21 +01:00
MohitMali
4baff853fa Fixed, can not open ZIM files from phone storage via the file picker in Android 13.
* Improved the permission request scenario for 'MANAGE_EXTERNAL_STORAGE' in Android 13. In the non-play store variant, we were not prompting users to grant this permission, and they were unaware that it was necessary to access the ZIM files in their storage. To resolve this issue, we now request this permission.
2023-11-12 18:01:28 +01:00
Kelson
f53809abc2
Merge pull request #3218 from kiwix/Issue#2537
Fixed Hosted Books don't update on Application
2023-11-12 18:00:20 +01:00
MohitMali
969ad0d4b1 Increase timeout to check views are displayed or not. 2023-11-11 08:48:22 +01:00
MohitMali
a7b5a7730f Fixed test failure on API level 33.
* In the `ZimHostFragment`, there were occasional test failures due to specific conditions. When reattempting the test, it failed to detect the 'WiFi connection detected' dialog because the server was already running. To resolve this issue, we have improved our test case. Now, we first check if the server is already running. If it is, we close the server before running the test case.
* In previous test failures within the `ZimHostFragment`, there were instances where the zim file was unselected, causing our test case to fail to locate the required views. To mitigate this, we now check whether the zim file is selected. If it's not selected, we first select the zim file before running the test case.
* n the `LocalLibraryFragment` test, there were cases where it was unable to locate the 'file_management_no_files' view due to variations in the order of test cases. This occurred because a zim file was sometimes present in the `LocalLibrary`. To address this, we now check for the presence of any zim files in the `LocalLibrary` and delete them before running our test case.
2023-11-11 08:48:22 +01:00
MohitMali
96b1b195d5 Fixed ZimHostFragment failing on API level 33 (Android 13) because it has the SYSTEM_ALERT_WINDOW permission which is not grantable through code on Android 13, so we have removed this permission from our ZimHostFragment test as well as from our other test cases since we had added this to fix the test cases because without this permission test cases were not launching on API level 21, and now our minimum SDK version is 24 so this permission is no longer needed. 2023-11-11 08:48:22 +01:00
MohitMali
8a4056592e Improved ZimHostFragmentTest.
* We have made improvements to `ZimHostFragmentTest`. We added the `ACCESS_FINE_LOCATION` permission, which is required for running this test case on real devices. Additionally, we have enhanced the permission array and removed unnecessary permissions from the test case.
2023-11-11 08:48:22 +01:00
MohitMali
c3049a6a59 Fixed memory leak on API level 24.
*  When the application goes in the background from `ZimHostFragment`, `KiwixReaderFragment/ZimHostFragment` without starting the Service then the `ReadAloudService`, and `HotspotService` variables are not used and GC try to clear those objects but we are not clearing those objects, that's why memory leak is happening. So now we have free those objects if they are not in use.
2023-11-11 08:48:22 +01:00
MohitMali
3432b32431 Improved ZimHostFragmentTest to properly test the server functionality.
* Created a new class to match the how many checkbox is checked in the recyclerview, it will also help to test this type of functionality in future.
2023-11-11 08:48:22 +01:00