kiwix-android
kiwix-android copied to clipboard
Convert BookmarksDao.java to kotlin
Fixes #2997 Parent Issue: #1826
Converted BookmarksDao.java to kotlin
Codecov Report
Base: 48.90% // Head: 48.83% // Decreases project coverage by -0.06%
:warning:
Coverage data is based on head (
f5f2b34
) compared to base (ab5556f
). Patch coverage: 0.00% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## develop #2998 +/- ##
=============================================
- Coverage 48.90% 48.83% -0.07%
Complexity 25 25
=============================================
Files 299 299
Lines 9754 9753 -1
Branches 1192 1193 +1
=============================================
- Hits 4770 4763 -7
- Misses 4419 4427 +8
+ Partials 565 563 -2
Impacted Files | Coverage Δ | |
---|---|---|
...kiwix/kiwixmobile/core/data/local/KiwixDatabase.kt | 36.45% <0.00%> (-1.18%) |
:arrow_down: |
...ix/kiwixmobile/core/data/local/dao/BookmarksDao.kt | 0.00% <0.00%> (ø) |
|
.../org/kiwix/kiwixmobile/core/main/DocumentParser.kt | 68.00% <0.00%> (-28.00%) |
:arrow_down: |
.../kiwix/kiwixmobile/core/main/TableDrawerAdapter.kt | 48.93% <0.00%> (-2.13%) |
:arrow_down: |
...rg/kiwix/kiwixmobile/core/search/SearchFragment.kt | 64.04% <0.00%> (+1.12%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
This pull request has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
This class too. We won't need anymore after the Room.
We should create a "Room" project and move this ticket there. I woukd keep them open until a ticket/PR removes the code. Does that sounds good?
Ok @kelson42. Sounds good to me!
See #3105 for the class BookmarksDao.java deletion request
@MohitMaliDeveloper At the beginning of the installation, it crashes on several occasions.
hi @gouri-panda , I have try to install the APK, it successfully installed on my device also i have add some bookmarks that also successfully saved. so i'm unable to reproduce the crash. can you please let me know where you are facing crashes in app. can you please provide the logs.
i'm using Redmi Note 9 (Android 11).
@MohitMaliDeveloper If you freshly install the app, you can encounter the crash. Here are logs. Let me know if you need anything.
Logs
2022-11-17 15:11:53.108 23487-23818 AndroidRuntime org.kiwix.kiwixmobile E FATAL EXCEPTION: RxCachedThreadScheduler-13
Process: org.kiwix.kiwixmobile, PID: 23487
io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | java.lang.IllegalAccessError: Field 'org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity$Book.tags' is inaccessible to class 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' (declaration of 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' appears in /data/app/~~pcjRw-tcTUcWr2tQmLXd_A==/org.kiwix.kiwixmobile-4-VWlsCtUnWsEimCgGqmKg==/base.apk!classes11.dex)
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.IllegalAccessError: Field 'org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity$Book.tags' is inaccessible to class 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' (declaration of 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' appears in /data/app/~~pcjRw-tcTUcWr2tQmLXd_A==/org.kiwix.kiwixmobile-4-VWlsCtUnWsEimCgGqmKg==/base.apk!classes11.dex)
at org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk.<init>(BooksOnDiskListItem.kt:47)
at org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk.<init>(BooksOnDiskListItem.kt:66)
at org.kiwix.kiwixmobile.core.StorageObserver.convertToBookOnDisk(StorageObserver.kt:53)
at org.kiwix.kiwixmobile.core.StorageObserver._get_booksOnFileSystem_$lambda-0(StorageObserver.kt:41)
at org.kiwix.kiwixmobile.core.StorageObserver.$r8$lambda$GdHqLldRNXLqIZ5ZbeFUQDsiNuo(Unknown Source:0)
at org.kiwix.kiwixmobile.core.StorageObserver$$ExternalSyntheticLambda1.apply(Unknown Source:4)
at io.reactivex.internal.operators.flowable.FlowableMap$MapConditionalSubscriber.onNext(FlowableMap.java:106)
at io.reactivex.subscribers.SerializedSubscriber.onNext(SerializedSubscriber.java:100)
at io.reactivex.internal.operators.flowable.FlowableWithLatestFrom$WithLatestFromSubscriber.tryOnNext(FlowableWithLatestFrom.java:94)
at io.reactivex.internal.operators.flowable.FlowableWithLatestFrom$WithLatestFromSubscriber.onNext(FlowableWithLatestFrom.java:76)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.onNext(FlowableSubscribeOn.java:97)
at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.drainAsync(FlowableCombineLatest.java:374)
at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.drain(FlowableCombineLatest.java:406)
at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.innerValue(FlowableCombineLatest.java:250)
at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestInnerSubscriber.onNext(FlowableCombineLatest.java:521)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.onNext(FlowableSubscribeOn.java:97)
at io.reactivex.internal.subscriptions.DeferredScalarSubscription.complete(DeferredScalarSubscription.java:132)
2022-11-17 15:11:53.108 23487-23818 AndroidRuntime org.kiwix.kiwixmobile E at io.reactivex.internal.operators.flowable.FlowableFromCallable.subscribeActual(FlowableFromCallable.java:50)
at io.reactivex.Flowable.subscribe(Flowable.java:14935)
at io.reactivex.Flowable.subscribe(Flowable.java:14882)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
... 6 more
2022-11-17 15:11:53.139 23487-23818 Process org.kiwix.kiwixmobile I Sending signal. PID: 23487 SIG: 9
---------------------------- PROCESS ENDED (23487) for package org.kiwix.kiwixmobile ----------------------------
@MohitMaliDeveloper If you freshly install the app, you can encounter the crash. Here are logs. Let me know if you need anything.
Logs
2022-11-17 15:11:53.108 23487-23818 AndroidRuntime org.kiwix.kiwixmobile E FATAL EXCEPTION: RxCachedThreadScheduler-13 Process: org.kiwix.kiwixmobile, PID: 23487 io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | java.lang.IllegalAccessError: Field 'org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity$Book.tags' is inaccessible to class 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' (declaration of 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' appears in /data/app/~~pcjRw-tcTUcWr2tQmLXd_A==/org.kiwix.kiwixmobile-4-VWlsCtUnWsEimCgGqmKg==/base.apk!classes11.dex) at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367) at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:69) at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923) Caused by: java.lang.IllegalAccessError: Field 'org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity$Book.tags' is inaccessible to class 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' (declaration of 'org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk' appears in /data/app/~~pcjRw-tcTUcWr2tQmLXd_A==/org.kiwix.kiwixmobile-4-VWlsCtUnWsEimCgGqmKg==/base.apk!classes11.dex) at org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk.<init>(BooksOnDiskListItem.kt:47) at org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk.<init>(BooksOnDiskListItem.kt:66) at org.kiwix.kiwixmobile.core.StorageObserver.convertToBookOnDisk(StorageObserver.kt:53) at org.kiwix.kiwixmobile.core.StorageObserver._get_booksOnFileSystem_$lambda-0(StorageObserver.kt:41) at org.kiwix.kiwixmobile.core.StorageObserver.$r8$lambda$GdHqLldRNXLqIZ5ZbeFUQDsiNuo(Unknown Source:0) at org.kiwix.kiwixmobile.core.StorageObserver$$ExternalSyntheticLambda1.apply(Unknown Source:4) at io.reactivex.internal.operators.flowable.FlowableMap$MapConditionalSubscriber.onNext(FlowableMap.java:106) at io.reactivex.subscribers.SerializedSubscriber.onNext(SerializedSubscriber.java:100) at io.reactivex.internal.operators.flowable.FlowableWithLatestFrom$WithLatestFromSubscriber.tryOnNext(FlowableWithLatestFrom.java:94) at io.reactivex.internal.operators.flowable.FlowableWithLatestFrom$WithLatestFromSubscriber.onNext(FlowableWithLatestFrom.java:76) at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.onNext(FlowableSubscribeOn.java:97) at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.drainAsync(FlowableCombineLatest.java:374) at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.drain(FlowableCombineLatest.java:406) at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.innerValue(FlowableCombineLatest.java:250) at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestInnerSubscriber.onNext(FlowableCombineLatest.java:521) at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.onNext(FlowableSubscribeOn.java:97) at io.reactivex.internal.subscriptions.DeferredScalarSubscription.complete(DeferredScalarSubscription.java:132) 2022-11-17 15:11:53.108 23487-23818 AndroidRuntime org.kiwix.kiwixmobile E at io.reactivex.internal.operators.flowable.FlowableFromCallable.subscribeActual(FlowableFromCallable.java:50) at io.reactivex.Flowable.subscribe(Flowable.java:14935) at io.reactivex.Flowable.subscribe(Flowable.java:14882) at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82) at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66) ... 6 more 2022-11-17 15:11:53.139 23487-23818 Process org.kiwix.kiwixmobile I Sending signal. PID: 23487 SIG: 9 ---------------------------- PROCESS ENDED (23487) for package org.kiwix.kiwixmobile ----------------------------
hi @gouri-panda ,
i have tried with freshly app, but i'm still unable to reproduce the error. i'm using Redmi Note 9 (Android 11)
. According to these logs problem occurs in this line https://github.com/kiwix/kiwix-android/blob/ef545094a2c5ffa4c72358b42284b24042b15328/core/src/main/java/org/kiwix/kiwixmobile/core/zim_manager/fileselect_view/adapter/BooksOnDiskListItem.kt#L47
Can you please let me know which device you using.
Yes sorry! It's Realme 7 ,api 30. I don't think it's related to device problem.
Yes sorry! It's Realme 7 ,api 30. I don't think it's related to device problem.
hi @gouri-panda , Yes this is not device related problem. but i have tried with different zim files/devices and i'm not facing any crash issue or is there any spacial case or zim file that i'm missing here?. I'm using latest develop branch.
@MohitMaliDeveloper I'm testing with this PR's branch. Here are the exact steps
- Uninstall the app
- Reinstall the app
- Give all the necessary permissions
- Wait for the search of the zim files in the device.
@MohitMaliDeveloper I'm testing with this PR's branch. Here are the exact steps
- Uninstall the app
- Reinstall the app
- Give all the necessary permissions
- Wait for the search of the zim files in the device.
hi @gouri-panda , i have tried with the following steps with this PR's branch but i'm unable to reproduce the crash. here you can see.
https://user-images.githubusercontent.com/34593983/202644752-399e8363-e762-4d39-b11c-7204bb71594d.mp4
@MohitMaliDeveloper I don't know how to reproduce it on other devices but it seems to me that the crash is not small trivial. Please let me know how to help you to produce this on your device.
@MohitMaliFtechiz @gouri-panda Last Kotlin PR. What is the way forward?
@MohitMaliDeveloper Should I give a complete log in case you want it? I think the bug is in the code. I have tried in the multiple pixel emulators but the bug is not there. it's still crashing on my device. I think it's some edge cases that are causing this problem.
pixel emulators but the bug is not there.
hi @gouri-panda can you further work on this PR since its only specific to your device.
@MohitMaliFtechiz @gouri-panda I’m not sure what to do here. I think to some extend it would good if @gouri-panda could investigate to understand what goes wrong… but if things start to be really complicayed, then it would be good if @MohitMaliFtechiz you buy a mobile device of this very same model.
@kelson42 Sounds good to me!
ds good to me!
hi @gouri-panda so are you carry your investigation or I am going to ordered same device for testing ?
@MohitMaliFtechiz @kelson42 Currently I'm busy with Room. The bug seems not trivial. It maybe happens under some conditions. Let me know what to do?
I can say nothing, if the device crash should be doable to identify which line is a problem and why.
@kelson42 We know which line is causing this problem. It happens because some objects are already consumed while it needs them.When we are accessing them it gives us the crash.
So? none of you know how to fix this?
@kelson42 I can fix this. It produces on my end. I'm busy now with the Room. If you want I can push the fix the commits here later.
@gouri-panda This is the last PR for Kotlin, please deal with that in top priority, so we can finally close this chapter.
@kelson42 Ok.
@gouri-panda merci, crossing the fingers for you it won't take too long.
@MohitMaliDeveloper I have placed the fix here. Please review it :)
OK, but CI fails!