getGlobalConfigs method
Implementation
String getGlobalConfigs() {
var globalParams = VoltronMap();
var platformManager = PlatformManager.getInstance();
var dimensionMap = getDimensions(-1, -1, false, null);
// windowHeight是无效值,则允许客户端定制
var deviceAdapter = _context.globalConfigs.deviceAdapter;
if (deviceAdapter != null) {
deviceAdapter.reviseDimensionIfNeed(null, dimensionMap, false, false);
}
var packageName = _thirdPartyAdapter?.getPackageName() ?? '';
var versionName = _thirdPartyAdapter?.getAppVersion() ?? '';
var pageUrl = _thirdPartyAdapter?.getPageUrl() ?? '';
var extraData = VoltronMap();
var jObject = _thirdPartyAdapter?.getExtraData() ?? {};
jObject.forEach((key, value) {
extraData.push(key, value);
});
globalParams.push("Dimensions", dimensionMap);
var localization = VoltronMap();
localization.push('country', platformManager.country);
localization.push('language', platformManager.language);
localization.push('direction', platformManager.direction);
if (Platform.isAndroid) {
var platformParams = VoltronMap();
platformParams.push<String>("OS", "android");
platformParams.push("APILevel", platformManager.apiLevel);
platformParams.push("PackageName", packageName);
platformParams.push("VersionName", versionName);
platformParams.push<bool>(
"NightMode", ScreenUtil.getInstance().brightness == Brightness.dark);
platformParams.push("Localization", localization);
globalParams.push("Platform", platformParams);
var tkd = VoltronMap();
tkd.push("url", pageUrl);
tkd.push("appName", packageName);
tkd.push("appVersion", versionName);
tkd.push("extra", extraData);
globalParams.push("tkd", tkd);
} else if (Platform.isIOS) {
globalParams.push<String>("OS", "ios");
globalParams.push<String>("OSVersion", platformManager.osVersion);
globalParams.push<String>("Device", platformManager.device);
globalParams.push<String>("SDKVersion", '');
globalParams.push<String>("AppVersion", platformManager.appVersion);
globalParams.push("Localization", localization);
}
if (_context.devSupportManager.supportDev()) {
var debugParams = VoltronMap();
debugParams.push<String>(
"debugClientId",
_context.devSupportManager.getDevInstanceUUID(),
);
globalParams.push<VoltronMap>("Debug", debugParams);
}
return objectToJson(globalParams);
}