isPinMessageEnabled static method
Whether the Pin Message feature is enabled
(features.ux.messages.pinned.enabled).
Source precedence: the flag served on the logged-in user's /me
payload wins; the app-settings hash is the fallback for backends that
don't serve it per-user yet. Returns true when neither source served
the flag (older backend) so the feature is not dead-disabled; the
server still rejects the calls if the feature is genuinely off.
Implementation
static bool isPinMessageEnabled() {
// Never throws: UIs call this during build, possibly before init —
// pre-init reports the same absence-means-enabled default.
final fromMe = MeFeatureFlags.pinnedMessagesEnabled;
if (fromMe != null) return fromMe;
try {
final settings = SdkRegistry.getInstance().settings.getCachedSettings();
return settings?.pinnedMessagesEnabled ?? true;
} catch (_) {
return true;
}
}