api/internal/gamification/game_bridge_protocol
library
Classes
-
BridgeEnvelope
-
A skin→native message: the envelope plus the optional request id.
-
GameBridgeError
-
Error codes for
{id, type:"error", payload:{code, message}} replies — the
whole set. A skin feature-detects by sending a request and handling
unsupported.
Functions
-
bridgeError(String id, String code, String message)
→ String
-
Builds
{id, type:"error", payload:{code, message}} for a request reply.
-
bridgeResult(String id, Map<String, Object?> payload)
→ String
-
Builds
{id, type:"result", payload} for a request reply.
-
clampSensorHz(double? hz)
→ int
-
Clamps a
motion subscribe rate to the 1..60 Hz the bridge supports.
-
compareVersions(String left, String right)
→ int
-
Compares dotted version names (
"3.3.0"). Non-numeric parts count as zero.
-
computeGameTier(bool reducedMotion, bool lowPower, String thermal, int ramMb, int cores)
→ String
-
The skin's performance tier, per the webview contract:
low when the
device cannot animate richly (reduced motion, power save,
serious/critical heat, or under 3 GB RAM), mid when it is merely
constrained, else high. Skins step effects down on mid, further on
low. Port of the tier thresholds the native SDKs apply before the
server-driven deviceTier rules (see device-tier.md); the values match
Android/iOS high/mid/low, never the legacy minimal/lite/full.
-
gameReceiveScript(String messageJson)
→ String
-
The script that delivers one native→skin message: the message JSON passed
as a JS string literal to
window.DigiaBridge.__receive. A page without
the bridge object ignores it.
-
isAllowedHttpPath(String path)
→ bool
-
Whether an
http path may be called. grantChance is always denied.
-
isSdkVersionCompatible(String? minSdkVersion, String currentSdkVersion)
→ bool
-
Whether this SDK build meets a skin's
minSdkVersion floor (null/blank
means no floor).
-
logBridgeDrop(String reason)
→ void
-
Logs a dropped skin message; the caller tracks GameBridge.dropNoted for
its once-flag.
-
parseBridgeEnvelope(String raw)
→ BridgeEnvelope?
-
Parses one skin→native envelope. Returns null when the message must be
dropped: over 64 KB, not a JSON object, or missing
type. payload
defaults to {} when absent or not an object. Never throws.