feat: PoW overhaul — background mining, persistent settings, reaction PoW#152
Merged
feat: PoW overhaul — background mining, persistent settings, reaction PoW#152
Conversation
Move note PoW mining to a background PowManager so compose screen navigates back immediately. Persist PoW settings (note/reaction enable + difficulty) in SharedPreferences. Add inline reaction PoW via Nip13.mine() in SocialActionManager. Show mining progress in the existing broadcast status pill with cancel support. Add PoW settings screen accessible from the drawer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PowManagerowned byFeedViewModel, so the compose screen navigates back immediately and mining progress shows in the bottom status pill with a cancel buttonSharedPreferencesviaPowPreferences, with a new settings screen accessible from the drawerSocialActionManager.toggleReaction()now mines inline PoW (default 12 bits, sub-second) before signing reactions when enabledNew files
repo/PowPreferences.kt— SharedPreferences-backed PoW settings (note/reaction enable + difficulty, clamped 8-32)viewmodel/PowManager.kt— Background mining manager withPowStatussealed class (Idle/Mining/Done/Failed)ui/screen/PowSettingsScreen.kt— Settings screen with enable switches and difficulty steppersModified files
FeedViewModel— ownsPowPreferencesandPowManager, passespowPrefstoSocialActionManagerComposeViewModel— removes old blocking PoW mining, hands off toPowManager.submitNote()for background miningSocialActionManager— adds inline reaction PoW viaNip13.mine()when enabledComposeScreen— removes difficulty adjuster and mining progress UI, shows "mined in background" bannerFeedScreen/BroadcastStatusBar— extended to showPowStatus(mining progress + cancel, done, failed states)Navigation.kt— addsPOW_SETTINGSroute, passespowManager/powPrefsto compose screen, wires status pillWispDrawerContent— adds "Proof of Work" entry under SettingsTest plan