getConversationUpdateSettings static method
Future<ConversationUpdateSettings>
getConversationUpdateSettings({
- dynamic onSuccess()?,
- dynamic onError(
- CometChatException excep
Retrieves the ConversationUpdateSettings object to enable or disable certain features.
Migration Note: Migrated from platform channels to native Dart. Uses SettingsRepository to get cached conversation update settings. Behavior and signature remain identical.
Android Reference: CometChat.getConversationUpdateSettings() -> ConversationUpdateSettingsRepo.getConversationUpdateSettings()
Implementation
static Future<ConversationUpdateSettings> getConversationUpdateSettings(
{Function(ConversationUpdateSettings)? onSuccess,
Function(CometChatException excep)? onError}) async {
try {
// Get SDK instance from registry
final sdk = SdkRegistry.getInstance();
// Get conversation update settings from settings repository
final settingsMap = sdk.settings.getConversationUpdateSettings();
// Create ConversationUpdateSettings from map
final settings = ConversationUpdateSettings(
callActivities: settingsMap['callActivities'] ?? true,
groupActions: settingsMap['groupActions'] ?? true,
customMessages: settingsMap['customMessages'] ?? true,
messageReplies: settingsMap['messageReplies'] ?? true,
);
if (onSuccess != null) {
onSuccess(settings);
}
return settings;
} on StateError catch (e) {
// SDK not initialized
Logger.error(
'CometChat',
'getConversationUpdateSettings failed: SDK not initialized',
e,
StackTrace.current);
final exception = CometChatException(
'ERROR_SDK_NOT_INITIALIZED',
'SDK not initialized. Call CometChat.init() first.',
'SDK not initialized',
);
if (onError != null) {
onError(exception);
}
// Return default values on error (matches Android SDK behavior)
return ConversationUpdateSettings(
callActivities: true,
customMessages: true,
messageReplies: true,
groupActions: true,
);
} catch (e) {
Logger.error('CometChat', 'getConversationUpdateSettings failed', e,
StackTrace.current);
_errorCallbackHandler(null, null, e, onError);
// Return default values on error (matches Android SDK behavior)
return ConversationUpdateSettings(
callActivities: true,
customMessages: true,
messageReplies: true,
groupActions: true,
);
}
}