7778 Commits

Author SHA1 Message Date
MohitMaliFtechiz
0d5a330d3f Improved logging for exceptions that do not have a stack trace. 2024-06-27 15:52:16 +05:30
MohitMaliFtechiz
a2ac6429a7 Fixed: A NotSerializableException was attached to the crash logs instead of the actual crash logs when there was an error in the coroutine.
* The serialization issue was fixed in coroutine version `1.7.0`, so we have upgraded the coroutine dependency to `1.7.0` to address this issue.
* In the new version of coroutines, `ConflatedBroadcastChannel` is replaced with `StateFlow`, so we have refactored our code to use `StateFlow`.
* Fixed some detekt issues which occurs after upgrading this dependency.
2024-06-27 14:50:23 +05:30
Kelson
e4c3d1a6e8
Merge pull request #3900 from kiwix/Fixes#3899
Fixed: `SQLiteConstraintException` when inserting the same id item of hisotry/notes in room database.
2024-06-27 08:33:48 +02:00
MohitMaliFtechiz
91eacae0f4 Improved DeletePageItemsTest test. 2024-06-26 22:35:24 +05:30
MohitMaliFtechiz
13233e0dcc Fixed: SQLiteConstraintException when inserting the same id item of hisotry/notes in room database.
* id is the primary key for notes/history and when there is an already id available in the room database, and if there is the same id present in the objectbox database and we try to put that entity in the room it gives the SQLiteConstraintException. To fix this we have modified our saving functions of history and notes. If there is already an ID that exists in the room database that we are trying to put in the database it will set the ID to 0 so that the room will automatically assign the ID to that entity and our history/notes will prevent to be lost.
* Added the test cases to properly test these scenarios.
2024-06-26 22:25:18 +05:30
Kelson
2dd933e7ba
Merge pull request #3898 from kiwix/Fixes#3897
Fixed: `getDirectAccessInformation()` method throw the `InvocationTargetException` and crash the application.
2024-06-26 13:13:49 +02:00
MohitMaliFtechiz
352c4038d3 Improved the exception handling. 2024-06-26 15:29:31 +05:30
MohitMaliFtechiz
a902f15480 Fixed: getDirectAccessInformation() method throw the InvocationTargetException and crash the application. 2024-06-26 15:29:24 +05:30
Kelson
4a30af5462
Merge pull request #3893 from kiwix/Fixes#3889
Fixed: Sometimes not all Bookmarks are showing.
2024-06-25 21:44:45 +02:00
MohitMaliFtechiz
f209aa6c6a Fixed BookmarkStateTest, BookmarkViewModelTest, and ShowDeleteBookmarksDialogTest. 2024-06-25 23:22:15 +05:30
MohitMaliFtechiz
38e4fe41cb Fixed DownloadTest, initialDownload. The Library order and zim file name is changed so these test cases are failing so we have implemented a generic approach to not dependent on zim file name. 2024-06-25 23:22:08 +05:30
MohitMaliFtechiz
b0c5db4ad3 Added test cases for testing all the saved bookmarks should show on the bookmarks screen. 2024-06-25 23:22:02 +05:30
MohitMaliFtechiz
17e630c40b Fixed: Sometimes not all Bookmarks are showing.
* We have implemented `setHasStableIds(true)` in our RecyclerView, which handles data updates efficiently and enhances view recycling. It also provides smooth animations when data is refreshed. However, it requires unique IDs to perform these operations effectively. Since our bookmarks are stored in libkiwix and do not have unique IDs (database IDs), this sometimes results in duplicate data being displayed in the list instead of the actual data, as the lack of unique IDs causes the same data to be repeated when recycling non-visible items.
* To fix this, we have explicitly provided unique IDs by combining a UUID with the maximum value of a long. This ensures that RecyclerView can efficiently handle large data sets.
2024-06-25 23:21:55 +05:30
Kelson
4a6fecd2d6
Merge pull request #3887 from kiwix/Fixes#3884
Fixed outdated text showing when a zim file could not open.
2024-06-20 09:53:42 +02:00
MohitMaliFtechiz
a1f33ca18f Fixed outdated text showing when a zim file could not open.
* Outdated text was showing when a zim file could not open in the kiwix, this text was for the older UI, and now we have removed the "Device Tab" from the "Library" screen so this text is outdated and misleading the users. so we have changed this text according to the new UI.
2024-06-20 12:13:53 +05:30
Kelson
99fe8982fb
Merge pull request #3885 from kiwix/Fixes#3877
Fixed: Xapian crash scenarios.
2024-06-20 06:48:50 +02:00
MohitMaliFtechiz
193c0d1de4 Re-enabled the retry logic in test case. 2024-06-20 01:13:58 +05:30
MohitMaliFtechiz
1fcbe67e20 Added instrumentation test cases to test the search functionality.
* Testing the render method with different scenarios to ensure that libzim do not crash due to broken call stack.
2024-06-20 00:03:25 +05:30
MohitMaliFtechiz
eb95bddf6c Added unit test cases for testing the previous job is cancelled properly. 2024-06-19 19:05:49 +05:30
MohitMaliFtechiz
e9934376bb Fixed test cases are not running. 2024-06-19 18:04:59 +05:30
MohitMaliFtechiz
1dfac37559 Fixed SearchViewModelTest and SearchStateTest. 2024-06-19 17:24:29 +05:30
MohitMaliFtechiz
9875ad57eb Moved the global mutex to the SearchResultsWithTerm class to prevent concurrency issues.
* Applied mutex locking in the SearchState class to ensure safe access to search results when users search for different terms.
2024-06-19 15:27:16 +05:30
MohitMaliFtechiz
c405025232 Improved the getVisibleResults method to check if the current job is cancelled before requesting suggestion results from libzim.
* Enhanced the loadMoreSearchResults method to accommodate this modification.
* Refined the render method to effectively cancel any previously running tasks upon its subsequent execution.
2024-06-19 14:37:39 +05:30
MohitMaliFtechiz
8865aac1ba Fixed: Xapian crash scenarios.
* Enhanced retrieval of suggestion lists from libzim.
* Implemented task cancellation if the fragment is not visible.
* Refactored getVisibleResults into a suspend method to ensure efficient job cancellation.
* Handled exceptions thrown by coroutines.
* Transitioned to Kotlin Flow instead of Flowable after making getVisibleResults suspend.
* Employed lifecycleScope for coroutine launch to prevent unnecessary calls when the fragment is hidden.
2024-06-18 20:52:56 +05:30
Kelson
9f949652f2
Merge pull request #3880 from kiwix/Fixes#3878
Fixed ServiceWorker Initialization Issue
2024-06-15 13:15:50 +02:00
MohitMaliFtechiz
4c3af12427 Initlizing the ServiceWorker in onCreate method of CoreApp class so that all necessary application setup is complete before the service worker is initialized and provides better control over the initialization sequence. 2024-06-15 12:46:10 +02:00
MohitMaliFtechiz
824aa96d20 Fixed ServiceWorker Initialization Issue
* ServiceWorker was being initialized every time the `CoreApp` instance was created. When the application crashed, `ErrorActivity` was invoked to send a crash report, running in a separate process. In this new process, the ServiceWorker was also being initialized.
* Upon user interaction (e.g., clicking "No Thanks" to relaunch the app), the application returned to the main process, leading to a second initialization of the ServiceWorker with the same data directory, causing a crash.
* Since `ErrorActivity` does not require any WebView-related functionality, it is unnecessary to initialize the ServiceWorker in this process.
* The fix involves modifying the initialization code to ensure the ServiceWorker is only initialized in the main process of the application.
2024-06-15 12:46:10 +02:00
Kelson
ab5fb35085
Merge pull request #3801 from kiwix/Fix#3511
Fixed: Not able to upload 512MB+ custom apps anymore.
2024-06-15 12:44:59 +02:00
MohitMaliFtechiz
14b782a084 Fixed search result leads to HomePage everytime. 2024-06-14 16:20:37 +05:30
MohitMaliFtechiz
53a259f2bb Improved the Zim file writing for APK(OBB files). 2024-06-14 12:22:03 +05:30
MohitMaliFtechiz
63849c6aab Fixed ZimFileReaderWithSplittedZimFileTest test case. 2024-06-13 18:29:13 +05:30
MohitMaliFtechiz
10f4f2431d Fixed the MimeTypeTest and EncodedUrlTest. 2024-06-13 17:40:05 +05:30
MohitMaliFtechiz
e3be755717 Improved the article loading while using the list of fds.
* It was not showing the article when fresh application is installed on device with list of fds, and after the first install it works normally(It starts loading the article). So we have placed a fix for this.
2024-06-13 17:39:55 +05:30
MohitMaliFtechiz
69a7099bc6 Fixed: Not able to upload 512MB+ custom apps anymore.
* Introduced the splitting zim file with 500MB for custom apps. Since the bundle has a limit for a file to upload it uses the play asset delivery mode, and for new custom apps, playStore does not allow to upload the apk (with apk we can upload more than 1GB file). So to address this issue we have introduced a feature in libzim where we can load the zim files via the fd list.

* We have modified our code to upload the files with 500MB chunks in the asset folder, and later we are accessing these files from the asset folder and creating the archive object with the help of the new libzim feature.
2024-06-13 17:36:15 +05:30
Kelson
d09987612e
Merge pull request #3879 from kiwix/Fixes#3860
Fixed: Zimit2 Youtube video still doesn't play on Android reader.
2024-06-13 10:15:16 +02:00
MohitMaliFtechiz
36afec63ca Fixed: Zimit2 Youtube video still doesn't play on Android reader.
* YouTube videos were not playing in the Android reader because the response code for the video URL was 206 (Partial Content). The `Content-Range` header of the incoming data was being set incorrectly. This happened because the `data` had a size of 0, as the content was being written on the IO thread (to avoid blocking the UI thread) when loading in the WebView. Due to this, the `Content-Range` was set incorrectly, preventing the YouTube video from playing.
* To fix this, the correct content length is now passed to the `Content-Range` header, ensuring that the video plays correctly.
2024-06-12 18:12:16 +05:30
Kelson
8e08acea4e
Merge pull request #3870 from kiwix/Fixes#3869
Fixed: Long clicking on Download button in epub ZIM files shows the `Open in new tab` dialog which leads to a blank page.
3.11.0
2024-06-07 14:23:50 +02:00
MohitMaliFtechiz
630966d469 Fixed: Long clicking on Download button in epub ZIM files shows the Open in new tab dialog which leads to a blank page.
* We didn't account for the scenario where a user long-clicks on an image that contains an anchor tag with a URL. For now, we only check when a link is loading(when user simply clicks on the image button), and if the link is unsupported by Kiwix, we show the save/open dialog. Now, we are also checking for this scenario on long clicks.
2024-06-07 13:35:56 +02:00
Kelson
694e76bbb0
Merge pull request #3868 from kiwix/update_changelog_for_3.11.0
Updated the CHANGELOG file for `3.11.0`.
2024-06-07 13:35:39 +02:00
MohitMaliFtechiz
c4dbb6bb9c Added last bug fix in CHANGELOG file. 2024-06-07 16:52:01 +05:30
MohitMaliFtechiz
3980c45277 Updated the CHANGELOG file for 3.11.0. 2024-06-07 14:55:36 +05:30
Kelson
42f20ea8da
Merge pull request #3867 from kiwix/use_java_libkiwix_2.2.0
Use java-libkiwix `2.2.0`
2024-06-07 10:26:45 +02:00
MohitMaliFtechiz
1bff4b9efa Fixed the compilation errors due to the new java-libkiwix. 2024-06-07 13:07:06 +05:30
MohitMaliFtechiz
3a3f413c87 Use java-libkiwix 2.2.0 2024-06-07 12:48:06 +05:30
Kelson
f17e3f948d
Merge pull request #3738 from kiwix/Fix#3737
Fixed: Some EPUB files are not downloading.
2024-06-07 06:41:36 +02:00
MohitMaliFtechiz
13fb613ebf Improved the naming of unsupported mimeType handler class.
* Improved the dialog's message and title.
2024-06-07 06:41:25 +02:00
MohitMaliFtechiz
c928943851 Fixed DownloadOrOpenEpubAndPdfHandlerTest failing on API level 24. 2024-06-07 06:41:25 +02:00
MohitMaliFtechiz
38fb31b6e0 Added unit test cases for testing this functionality with all possible scenarios e.g. "Download Failed", "Download Successfull", "When no reader application is installed in device", "File opens in external reader application", "When user clicks on NO Thanks button". 2024-06-07 06:41:25 +02:00
MohitMaliFtechiz
8794774816 Introduced a Open/Download dialog for Epub/Pdf files.
* This was requested in #3453 and this PR is related to the Epub opening issue so we are introducing this here.
2024-06-07 06:41:25 +02:00
MohitMaliFtechiz
2258cfabcb Fixed: Some EPUB files are not downloading.
* The issue was epub fileName containing the colon ":" in it that is not supported by most of fileSystem, that's why it is not creating the file in fileSystem and we are not able to download the epub file.
* So to fix this we have improved our `getDecodedFileName` method which returns the fileName of the epub file, here we are removing the colon from fileName if any contains. For this change we have added the test cases as well for our `getDecodedFileName` function to properly test it.
* We also refined our downloadFileFromUrl method. Previously, the generateSequence function was used to create new files with underscores and incremented numbers, anticipating multiple attempts to save the same file. However, since we now save files only once in our storage, this feature is no longer utilized. This enhancement is detailed in issue #2879.
* Added epub query in our manifest to properly open epub files in external application.
2024-06-07 06:41:25 +02:00