platform/shared/common/RhodesApp.cpp in rhodes-5.5.0.7 vs platform/shared/common/RhodesApp.cpp in rhodes-5.5.0.22
- old
+ new
@@ -351,14 +351,14 @@
{
if ( m_uistate == ui_created_received )
{
processUiCreated();
}
- if (!RHODESAPP().getApplicationEventReceiver()->onAppStateChange(rho::common::applicationStateActivated))
- {
- callCallback("/system/activateapp");
- }
+
+ RHODESAPP().getApplicationEventReceiver()->onAppStateChange(rho::common::applicationStateActivated);
+ callCallback("/system/activateapp");
+
m_expected = app_deactivated;
}
break;
case screen_on:
RHODESAPP().getApplicationEventReceiver()->onDeviceScreenEvent(rho::common::screenOn);
@@ -386,19 +386,19 @@
}
}
#endif
// at this point JS app is unlikely to set its own handler, just navigate to overriden start path
- if (!RHODESAPP().getApplicationEventReceiver()->onUIStateChange(rho::common::UIStateCreated))
- {
+ RHODESAPP().getApplicationEventReceiver()->onUIStateChange(rho::common::UIStateCreated);
+
if ( rho_ruby_is_started() )
callCallback("/system/uicreated");
#if !defined(APP_BUILD_CAPABILITY_SHARED_RUNTIME) || !defined(OS_ANDROID)
else
rho_webview_navigate(startPath.c_str(), 0);
#endif
- }
+
m_uistate = ui_created_processed;
}
/*static*/ CRhodesApp* CRhodesApp::Create(const String& strRootPath, const String& strUserPath, const String& strRuntimePath)
{
@@ -740,20 +740,19 @@
void CRhodesApp::callUiDestroyedCallback()
{
if ( m_bExit/* || !rho_ruby_is_started()*/ )
return;
- if (!RHODESAPP().getApplicationEventReceiver()->onUIStateChange(rho::common::UIStateDestroyed))
+
+ RHODESAPP().getApplicationEventReceiver()->onUIStateChange(rho::common::UIStateDestroyed);
+ if ( rho_ruby_is_started() )
{
- if ( rho_ruby_is_started() )
+ String strUrl = m_strHomeUrl + "/system/uidestroyed";
+ NetResponse resp = getNetRequest().pullData( strUrl, null );
+ if ( !resp.isOK() )
{
- String strUrl = m_strHomeUrl + "/system/uidestroyed";
- NetResponse resp = getNetRequest().pullData( strUrl, null );
- if ( !resp.isOK() )
- {
- LOG(ERROR) + "UI destroy callback failed. Code: " + resp.getRespCode() + "; Error body: " + resp.getCharData();
- }
+ LOG(ERROR) + "UI destroy callback failed. Code: " + resp.getRespCode() + "; Error body: " + resp.getCharData();
}
}
}
void CRhodesApp::callAppActiveCallback(boolean bActive)
@@ -787,12 +786,12 @@
// All such operation will throw exception in ruby code when calling in 'deactivate' mode.
m_bDeactivationMode = true;
m_appCallbacksQueue->addQueueCommand(new CAppCallbacksQueue::Command(CAppCallbacksQueue::app_deactivated));
// TODO: Support stop_local_server command to be parsed from callback result
- if (!RHODESAPP().getApplicationEventReceiver()->onAppStateChange(rho::common::applicationStateDeactivated))
- {
+ RHODESAPP().getApplicationEventReceiver()->onAppStateChange(rho::common::applicationStateDeactivated);
+
#ifndef RHO_NO_RUBY_API
if ( rho_ruby_is_started() )
{
String strUrl = m_strHomeUrl + "/system/deactivateapp";
NetResponse resp = getNetRequest().pullData( strUrl, null );
@@ -812,10 +811,9 @@
#endif
}
}
}
#endif
- }
m_bDeactivationMode = false;
}
}