Feat/nostr sync#13306
Conversation
d1e579a to
dec3aeb
Compare
dec3aeb to
be3a451
Compare
…nce callback Problem When entering fullscreen (rotation or fullscreen button), the app could crash with: java.lang.IllegalStateException: Fragment CommentsFragment ... not attached to a context at BaseListFragment.onSharedPreferenceChanged(BaseListFragment.java:477). Root cause BaseListFragment was calling getString(R.string.list_view_mode_key) inside onSharedPreferenceChanged(). During configuration change, SharedPreferences listeners can still be invoked while a fragment is already detached. At that moment, getString() requires an attached context and throws. Why this surfaced with Nostr sync Nostr sync updates SharedPreferences frequently (for relay status and sync bookkeeping), which increases preference change callbacks during lifecycle transitions and made this latent fragment bug reproducible while rotating or fullscreening. Fix - Added a cached field listViewModeKey in BaseListFragment. - Initialized listViewModeKey once in onCreate() while the fragment is attached. - Replaced getString(...) call in onSharedPreferenceChanged() with a null-safe comparison against the cached key. Result The callback no longer touches fragment context when detached, so fullscreen and rotation no longer crash through this code path. Functional behavior is unchanged: LIST_MODE_UPDATE_FLAG is still set only for list_view_mode_key changes.
d452a8d to
1fc68dd
Compare
|
Given your comment about AI usage, I presume you don't understand how this actually works. If you do, please provide an in-depth explanation. PR descriptions should be within the actual PR description, and not in a separate markdown file; that reduces cohesion and makes it inconvenient in having to go read a file somewhere else. I don't know what Nostr is or how it works, and if you consider this a big feature it would be useful to have a proper explanation that explains architectural design decisions, implementation functionality and etc. As it is, the NOSTR_SYNC is not understandable at all without extra research to make sense of it; that should not be the case. Right now, the code is the primary source of information for this PR, and that read me doesn't serve much use. All that being said, you did not follow contribution guidelines anyway as you have left no indication anywhere of your intent to implement this feature, nor did you discuss this with the team. Large features such as this require discussion so we can validate feasibility of solutions. Without this, such a feature will never be merged, and this step cannot be skipped because it will just end up being done at PR time (as it is now). Therefore it would have been better to discssued with the team beforehand. It's not worth our time to code review all of this out of the blue unprovoked. So, for these reasons I'll be closing this PR. If you're able to fix the problems I mentioned then it can be reopened. |
What is it?
refactorbranchDescription of the changes in your PR
Implemented private sync using Nostr protocol. At the moment the syncable features are
Related to #5325
This is achieved using:
kind:30078fromNIP-78, and ut usesNIP-44encryption so everything stays privateMore details are in the NOSTR_SYNC.md
Before/After Screenshots/Screen Record
Fixes the following issue(s)
Relies on the following changes
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.
Due diligence
AI NOTE
I do not know Kotlin well enough to be able to code in it such a big feature, so I did not adhere to the AI usage policy.
However I was missing the sync feature a lot. Nostr was my choice because of its decentralized nature and self-hosting possibility.