feat(ui): per-kind active-game limit lock on the New Game screen
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 12s
CI / integration (pull_request) Successful in 28s
CI / ui (pull_request) Successful in 1m11s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m46s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 12s
CI / integration (pull_request) Successful in 28s
CI / ui (pull_request) Successful in 1m11s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m46s
Carry the caller's per-tier active-game caps and each game's kind on the wire (Profile.game_limits + GameView.kind, additive FBS + gateway transcode + client codec, committed regen). The New Game screen counts the player's active games per kind from the lobby and locks a capped start: an outline button with a lock that opens a funnel modal instead of a game -- a sign-in prompt for a guest, a "finish a current game first" notice for a signed-in account (native Telegram popup, in-app modal elsewhere). The lock lifts via the existing profile refetch after a guest->durable upgrade. Remove the lobby's old at_game_limit New-Game tab disable + notice: the flag (now the random-kind cap) conflicted with the per-kind lock -- it hid the screen where the lock lives and wrongly blocked an unfulfilled kind. The New Game tab is always enabled; the per-kind start lock is the only gate. The at_game_limit wire field stays (unused by the client) for a later cleanup. Tests: client lock logic + codec kind/game_limits roundtrip + gateway transcode encode + native popup builders (unit); a mock e2e for the lock badge and the modal.
This commit is contained in:
@@ -80,6 +80,11 @@ table GameView {
|
||||
// message (not just a nudge). With unread_chat it colours the badge — both set is the regular
|
||||
// badge, unread_chat alone is the softer nudge-only badge.
|
||||
unread_messages:bool;
|
||||
// kind is the game's origin for the active-game limits: 0 unknown (a pre-existing game, never
|
||||
// gated), 1 vs_ai, 2 random, 3 friends. The lobby counts active games per kind against the
|
||||
// caller's per-kind limits (Profile.game_limits) to lock a capped New-Game start (added
|
||||
// trailing — backward-compatible).
|
||||
kind:int;
|
||||
}
|
||||
|
||||
// MoveRecord is one decoded move (a committed play, or a hint preview).
|
||||
@@ -267,6 +272,10 @@ table Profile {
|
||||
// ads carries the post-move interstitial config (cooldowns + suppressed) for the client-mirrored
|
||||
// gate (added trailing — backward-compatible).
|
||||
ads:AdsInfo;
|
||||
// game_limits carries the caller's tier active-game caps per kind (-1 = unlimited); the client
|
||||
// counts its active games per kind from the lobby and locks a capped New-Game start (added
|
||||
// trailing — backward-compatible).
|
||||
game_limits:GameLimits;
|
||||
}
|
||||
|
||||
// AdsInfo is the post-move interstitial config: the client-mirrored cooldowns (seconds) and whether
|
||||
@@ -278,6 +287,15 @@ table AdsInfo {
|
||||
suppressed:bool;
|
||||
}
|
||||
|
||||
// GameLimits is the caller's tier active-game caps per kind (-1 = unlimited), resolved to the
|
||||
// guest or durable tier server-side. It rides Profile.game_limits for the client's per-kind
|
||||
// New-Game lock.
|
||||
table GameLimits {
|
||||
vs_ai:int;
|
||||
random:int;
|
||||
friends:int;
|
||||
}
|
||||
|
||||
// BlockStatus reports the caller's current manual block. The UI fetches it after any operation
|
||||
// returns the "account_blocked" result code, then replaces every screen with the terminal blocked
|
||||
// screen and stops all push/poll. permanent is false for a temporary block; until is an RFC3339
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package scrabblefb
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
|
||||
type GameLimits struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func GetRootAsGameLimits(buf []byte, offset flatbuffers.UOffsetT) *GameLimits {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset:])
|
||||
x := &GameLimits{}
|
||||
x.Init(buf, n+offset)
|
||||
return x
|
||||
}
|
||||
|
||||
func FinishGameLimitsBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
|
||||
builder.Finish(offset)
|
||||
}
|
||||
|
||||
func GetSizePrefixedRootAsGameLimits(buf []byte, offset flatbuffers.UOffsetT) *GameLimits {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
|
||||
x := &GameLimits{}
|
||||
x.Init(buf, n+offset+flatbuffers.SizeUint32)
|
||||
return x
|
||||
}
|
||||
|
||||
func FinishSizePrefixedGameLimitsBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
|
||||
builder.FinishSizePrefixed(offset)
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) Table() flatbuffers.Table {
|
||||
return rcv._tab
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) VsAi() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) MutateVsAi(n int32) bool {
|
||||
return rcv._tab.MutateInt32Slot(4, n)
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) Random() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) MutateRandom(n int32) bool {
|
||||
return rcv._tab.MutateInt32Slot(6, n)
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) Friends() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *GameLimits) MutateFriends(n int32) bool {
|
||||
return rcv._tab.MutateInt32Slot(8, n)
|
||||
}
|
||||
|
||||
func GameLimitsStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(3)
|
||||
}
|
||||
func GameLimitsAddVsAi(builder *flatbuffers.Builder, vsAi int32) {
|
||||
builder.PrependInt32Slot(0, vsAi, 0)
|
||||
}
|
||||
func GameLimitsAddRandom(builder *flatbuffers.Builder, random int32) {
|
||||
builder.PrependInt32Slot(1, random, 0)
|
||||
}
|
||||
func GameLimitsAddFriends(builder *flatbuffers.Builder, friends int32) {
|
||||
builder.PrependInt32Slot(2, friends, 0)
|
||||
}
|
||||
func GameLimitsEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
@@ -209,8 +209,20 @@ func (rcv *GameView) MutateUnreadMessages(n bool) bool {
|
||||
return rcv._tab.MutateBoolSlot(32, n)
|
||||
}
|
||||
|
||||
func (rcv *GameView) Kind() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(34))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *GameView) MutateKind(n int32) bool {
|
||||
return rcv._tab.MutateInt32Slot(34, n)
|
||||
}
|
||||
|
||||
func GameViewStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(15)
|
||||
builder.StartObject(16)
|
||||
}
|
||||
func GameViewAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0)
|
||||
@@ -260,6 +272,9 @@ func GameViewAddUnreadChat(builder *flatbuffers.Builder, unreadChat bool) {
|
||||
func GameViewAddUnreadMessages(builder *flatbuffers.Builder, unreadMessages bool) {
|
||||
builder.PrependBoolSlot(14, unreadMessages, false)
|
||||
}
|
||||
func GameViewAddKind(builder *flatbuffers.Builder, kind int32) {
|
||||
builder.PrependInt32Slot(15, kind, 0)
|
||||
}
|
||||
func GameViewEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
|
||||
@@ -244,8 +244,21 @@ func (rcv *Profile) Ads(obj *AdsInfo) *AdsInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcv *Profile) GameLimits(obj *GameLimits) *GameLimits {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(40))
|
||||
if o != 0 {
|
||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||
if obj == nil {
|
||||
obj = new(GameLimits)
|
||||
}
|
||||
obj.Init(rcv._tab.Bytes, x)
|
||||
return obj
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ProfileStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(18)
|
||||
builder.StartObject(19)
|
||||
}
|
||||
func ProfileAddUserId(builder *flatbuffers.Builder, userId flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(userId), 0)
|
||||
@@ -307,6 +320,9 @@ func ProfileStartDictVersionsVector(builder *flatbuffers.Builder, numElems int)
|
||||
func ProfileAddAds(builder *flatbuffers.Builder, ads flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(17, flatbuffers.UOffsetT(ads), 0)
|
||||
}
|
||||
func ProfileAddGameLimits(builder *flatbuffers.Builder, gameLimits flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(18, flatbuffers.UOffsetT(gameLimits), 0)
|
||||
}
|
||||
func ProfileEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ type GameView struct {
|
||||
// UnreadMessages is a per-viewer flag: at least one unread entry is a real message (not just
|
||||
// a nudge), so the badge can be coloured apart from the nudge-only case.
|
||||
UnreadMessages bool
|
||||
// Kind is the game's origin for the active-game limits: 0 unknown (a pre-existing game), 1 vs_ai,
|
||||
// 2 random, 3 friends. The lobby counts active games per kind to lock a capped New-Game start.
|
||||
Kind int
|
||||
}
|
||||
|
||||
// TileRecord is one tile in a decoded MoveRecord (the concrete letter, "?" for a blank
|
||||
@@ -169,6 +172,7 @@ func BuildGameView(b *flatbuffers.Builder, g GameView) flatbuffers.UOffsetT {
|
||||
fb.GameViewAddVsAi(b, g.VsAI)
|
||||
fb.GameViewAddUnreadChat(b, g.UnreadChat)
|
||||
fb.GameViewAddUnreadMessages(b, g.UnreadMessages)
|
||||
fb.GameViewAddKind(b, int32(g.Kind))
|
||||
return fb.GameViewEnd(b)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user