return false;
if (!FillMetadata(widget_app, application.meta_data))
return false;
+ if (!FillResControl(widget_app, application.res_controls))
+ return false;
}
return true;
}
if (!FillBackgroundCategoryInfo(service_app,
application.background_category))
return false;
+ if (!FillResControl(service_app, application.res_controls))
+ return false;
}
return true;
}
return false;
if (!FillSplashScreen(ui_app, application.app_splashscreens))
return false;
+ if (!FillResControl(ui_app, application.res_controls))
+ return false;
}
return true;
}
if (!FillBackgroundCategoryInfo(watch_app,
watch_application.background_category))
return false;
+ if (!FillResControl(watch_app, watch_application.res_controls))
+ return false;
manifest->application = g_list_append(manifest->application, watch_app);
}
return true;
return true;
}
+template <typename T>
+bool StepParseManifest::FillResControl(application_x* app,
+ const T& res_control_list) {
+ for (auto& res_control : res_control_list) {
+ if (res_control.resource_type().empty())
+ continue;
+
+ res_control_x* rc =
+ static_cast<res_control_x*>(calloc(1, sizeof(res_control_x)));
+ if (!rc) {
+ LOG(ERROR) << "Out of memory";
+ return false;
+ }
+
+ rc->res_type = strdup(res_control.resource_type().c_str());
+ if (!res_control.min_res_version().empty())
+ rc->min_res_version = strdup(res_control.min_res_version().c_str());
+ if (!res_control.max_res_version().empty())
+ rc->max_res_version = strdup(res_control.max_res_version().c_str());
+ if (!res_control.auto_close().empty())
+ rc->auto_close = strdup(res_control.auto_close().c_str());
+
+ app->res_control = g_list_prepend(app->res_control, rc);
+ }
+ return true;
+}
+
void StepParseManifest::GetLegacySplashScreenFromMetadata(application_x* app,
const std::string& key, const std::string& val) {
std::string operation;
return false;
if (!FillSplashScreen(app, application.app_splashscreens))
return false;
+ if (!FillResControl(app, application.res_controls))
+ return false;
}
return true;