-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix/6404 app crashes theme change multi upload #6429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/6404 app crashes theme change multi upload #6429
Conversation
…ing index and list size (commons-app#6404)
… accessing imageAdapter (commons-app#6404)
…dex in onViewCreated (commons-app#6404)
…irect field assignments (commons-app#6404)
Hmm, there are so many changes, I'll review it by tomorrow :) |
Hi @rohit9625 , just checking in - is this PR still under review, or would you like me to make any changes ? |
I didn't get time to review this, I wonder why there are so many changes to fix this tiny crash. Did you also refactor the code? I'll review this once done with 16KB compilation task :) Meanwhile, please fix the tests. |
Thanks for the feedback! The multiple changes address the root causes of the crash across different components (UploadMediaPresenter, UploadMediaDetailFragment, ImageFragment, UploadActivity) to ensure tha robust state handling during theme chaenges and activity recreation. No refactoring was done; each change targets a specific issue (e.g., IndexOutOfBoundsException, UninitializedPropertyAccessException, and a compilation error) to prevent crashes comprehensively. I’ve included detailed loggingg to verify stability : ) |
I just tested your PR and can confirm that it resolves the issue. However, I need to take a closer look at the diffs to ensure that nothing unexpected happens in production. Screen_recording_20251008_011411.mp4Also, please update your PR description to match the default template and fix the unit tests, @Kota-Jagadeesh |
…d adding tha testInitializeFragmentWithUploadItem (commons-app#6404)
… with unresolved onImageProcessed (commons-app#6404)
…bsolete tests and initializing defaultKvStore (commons-app#6404)
@rohit9625 Fixed all the issues, Please review the PR : ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great!
Would you mind just fixing the various typos in the comments you added?
By the way thanks for adding these comments. :-)
Yeah, i'll update all the comments without any typo's |
Fixed all the typos : ) |
✅ Generated APK variants! |
Description (required)
Fixes #6404
This pull request addressses the crashes in the image upload flow of the app, specifically targeting issue #6404 (App crashes when switching between light and dark theme).
These changaes ensure proper handling of activity recreation and state restoration, improving stability during theme changes, rotation, and process death.
What changes did you make and why?
IndexOutOfBoundsException
insetUploadMediaDetails
by adding validation foruploadItemIndex
anduploadItems
list size.IndexOutOfBoundsException
by safely handling saved state andindexOfFragment
inonViewCreated
.setUploadMediaDetails
is only called with valid data.UninitializedPropertyAccessException
by safely initializing and accessingimageAdapter
inonCreateView
,onDestroy
, and related methods.Unresolved reference: setImageToBeUploaded
compilation error by replacing it with direct field assignments and deferredinitializeFragment
calls.Tests performed (required)
CustomSelectorActivity
ImageFragment
UploadActivity
UploadMediaDetailFragment
"Initialized imageAdapter"
"Set uploadMediaDetails for index X"
Additional Notes
Timber
logging across all changed files to aid debugging and trace lifecycle events.Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.