Repository navigation
feat(chat): edit a group's balance requirements from Edit Group - #1720
Merged
Merged
Conversation
Edit Group now shows the Balance Requirements card under its rows. The Join row reads the listener rule and the Chat row reads the speaker rule, falling back to Join's, as the group profile does. A row the group has no rule for reads "None". Tapping a row opens the shared amount keypad for that rule. The keypad enters in the preferred currency and saves in USD, through the same conversion group creation uses. That conversion moves to shared/chat as minimumBalanceFor. The keypad is seeded with the current rule. A replaced rule keeps its mints; a new rule names none. Save stays disabled for an empty or zero entry, without a usable rate, or when the entry matches the current rule to the cent. Saving asks for confirmation first. flipcash2-client-protocol 0.18.0 has no RPC that changes a group's rules after StartChat. GroupOperations.setMinimumBalance therefore fails with SetGroupMinimumBalanceError.Unavailable for now. The screen shows that as "Not Available Yet" and does not report it; any other failure is reported. Swap in the real call inside GroupFeedDelegate.setMinimumBalance.
Send the group's whole rule set back with only the edited minimum changed, in the listener rule's currency, and refuse locally what the server would: amounts under the minimum transfer value, a Chat minimum not above Join, a Join minimum not below Chat, and minimums the creator doesn't meet. The Chat minimum can be removed. Replaces the Unavailable stub.
Members follow a rules change through RulesChanged into rules_json, and every in-chat consumer reads that row. A viewer outside the group, as after a leave, gets no events for it, so the gate before Join could show an old minimum. ChatViewModel now fetches the rules once each time the viewer is found outside the group, and again when a join fails with RULES_NOT_SATISFIED, through ChatCoordinator.refreshRules. Tests cover rules_json round-tripping a speaker rule added and removed, and the stored chat row re-emitting on each updateRules.
bmc08gt
force-pushed
the
feat/group-balance-requirement-edit
branch
from
October 29, 2026 14:28
1d9b737 to
7f8b9ce
Compare
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.
Edit Group now lets a group's creator change its Join and Chat minimums. Saving sends the group's full rule set through
EditChat(EditChatParameters.rules), and every member's chat follows a rules change as it arrives.Depends on #1876 (flipcash2 0.23.0 scaffolding), which adds
EditChatRequest.rulesandMetadataUpdate.RulesChanged.Which groups can be edited
EditChatRequest.rulesonly accepts a public group created with a listener minimum: a private group is DENIED and any other group is INVALID_RULES. The Balance Requirements card is always shown, but its rows only open the keypad for such a group (isBalanceEditable). A rule this build can't decode (UnsupportedSpeakerRule) also makes the rows read-only, since sending the set back would have to drop it.What gets sent
withMinimum,withoutSpeakerMinimuminshared/chat/GroupRulesEdit.kt).minimumBalanceIn). This replaces the USD-onlyminimumBalanceFor.Metadatafrom the response is stored, so the screen doesn't wait for the event.Checked before sending
Removing the Chat minimum. The Chat keypad has a Remove action in its app bar when the group has its own speaker rule. It sends the set without that rule, so speaking needs only joining. Without a speaker rule, the Edit Group Chat row shows the Join amount, as the profile does.
Server errors.
RULES_NOT_SATISFIEDshows "You Don't Meet This Requirement".INVALID_RULESshows "This Requirement Isn't Valid" and is reported to Bugsnag, as are other failures ("Couldn't Save the Requirement"). TheUnavailablestub, its "Not Available Yet" copy and its test are gone.The old known gap, where the Chat row treated the Join amount as its current value and saving it created a separate chat rule, is closed: a Chat amount at or below Join is now blocked before sending.
Rules changing live
RulesChangedwas already mapped and stored throughChatMetadataDao.updateRules, and the in-chat consumers (subject, bottom bar, gate bars, holding label, profile card) read the stored row, so a member's chat follows it without reopening. A member who falls below a raised Join minimum stays in the group and keeps reading but loses speaking, the same state as when their balance drops.RulesChangedonly reaches members, so this addsChatCoordinator.refreshRules(aGetChatthat stores only the rules) for the places it doesn't:RULES_NOT_SATISFIED;Tests.
EditGroupBalanceRequirementViewModelTestcovers each rule above.GroupRulesEditTestcovers editability and the rule-set builders.ChatMetadataDaoTestand the mapper tests showrules_jsonround-trips a speaker rule being added and removed, and that the stored chat re-emits onupdateRules.GroupFeedDelegateTestcoversrefreshRules.