MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / transitionAppToState

Method transitionAppToState

Tactility/Source/service/loader/Loader.cpp:235–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void LoaderService::transitionAppToState(const std::shared_ptr<app::AppInstance>& app, app::State state) {
236 const app::AppManifest& app_manifest = app->getManifest();
237 const app::State old_state = app->getState();
238
239 LOGGER.info( "App \"{}\" state: {} -> {}",
240 app_manifest.appId,
241 appStateToString(old_state),
242 appStateToString(state)
243 );
244
245 switch (state) {
246 using enum app::State;
247 case Initial:
248 check(false, LOG_MESSAGE_ILLEGAL_STATE);
249 case Created:
250 assert(app->getState() == app::State::Initial);
251 app->getApp()->onCreate(*app);
252 pubsubExternal->publish(Event::ApplicationStarted);
253 break;
254 case Showing: {
255 assert(app->getState() == app::State::Hiding || app->getState() == app::State::Created);
256 pubsubExternal->publish(Event::ApplicationShowing);
257 break;
258 }
259 case Hiding: {
260 assert(app->getState() == app::State::Showing);
261 pubsubExternal->publish(Event::ApplicationHiding);
262 break;
263 }
264 case Destroyed:
265 app->getApp()->onDestroy(*app);
266 pubsubExternal->publish(Event::ApplicationStopped);
267 break;
268 }
269
270 app->setState(state);
271}
272
273app::LaunchId LoaderService::start(const std::string& id, std::shared_ptr<const Bundle> parameters) {
274 const auto launch_id = nextLaunchId++;

Callers

nothing calls this directly

Calls 9

appStateToStringFunction · 0.85
infoMethod · 0.80
getAppMethod · 0.80
publishMethod · 0.80
checkFunction · 0.50
getStateMethod · 0.45
onCreateMethod · 0.45
onDestroyMethod · 0.45
setStateMethod · 0.45

Tested by

no test coverage detected