useRememberConfig method

dynamic useRememberConfig()

Implementation

useRememberConfig() {
  final rememberBeautyConfig = getConfig().basicConfig?.rememberBeautyConfig ?? false;
  final rememberVirtualBackgroundConfig = getConfig().basicConfig?.rememberVirtualBackgroundConfig ?? false;
  final enableVirtualBackground = getConfig().basicConfig?.enableVirtualBackground ?? false;
  if (rememberBeautyConfig) {
    final beautyConfig = sharedPreferences.getString("beautyConfig-${_config.userId}");
    if (beautyConfig != null) {
      final beautyConfigJson = jsonDecode(beautyConfig);
      final beautyLevel = beautyConfigJson['beautyLevel'];
      final whitenessLevel = beautyConfigJson['whitenessLevel'];
      final ruddinessLevel = beautyConfigJson['ruddinessLevel'];
      setBeautyStyle(TRTCBeautyStyle.smooth, beautyLevel, whitenessLevel, ruddinessLevel);
    }
  }
  if (rememberVirtualBackgroundConfig && enableVirtualBackground) {
    final virtualBackgroundConfig = sharedPreferences.getString("virtualBackgroundConfig-${_config.userId}");
    if (virtualBackgroundConfig != null) {
      final virtualBackgroundConfigJson = jsonDecode(virtualBackgroundConfig);
      final index = virtualBackgroundConfigJson['index'];
      setVirtualBackgroundByIndex(index);
    }
  }
}