Navigation Menu

Skip to content

Commit

Permalink
check ruby is started
Browse files Browse the repository at this point in the history
  • Loading branch information
genywind committed Jun 11, 2013
1 parent 278abe5 commit 00d228a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
58 changes: 31 additions & 27 deletions ext/rhoconnect-client/ext/shared/sync/SyncEngine.cpp
Expand Up @@ -581,16 +581,17 @@ void CSyncEngine::applyChangedValues(db::CDBAdapter& db)

void CSyncEngine::loadAllSources()
{
#ifndef RHO_NO_RUBY
if (isNoThreadedMode())
RhoAppAdapter.loadAllSyncSources();
else
if (rho_ruby_is_started())
{
NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/loadallsyncsources"), "", null );
}
#else
RhoAppAdapter.loadAllSyncSources();
#endif
if (isNoThreadedMode())
RhoAppAdapter.loadAllSyncSources();
else
{
NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/loadallsyncsources"), "", null );
}
}else
RhoAppAdapter.loadAllSyncSources();

m_sources.removeAllElements();

Vector<String> arPartNames = db::CDBAdapter::getDBAllPartitionNames();
Expand Down Expand Up @@ -712,16 +713,17 @@ void CSyncEngine::processServerSources(String strSources)
{
if ( strSources.length() > 0 )
{
#ifndef RHO_NO_RUBY
if (isNoThreadedMode())
RhoAppAdapter.loadServerSources(strSources);
else
if (rho_ruby_is_started())
{
NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/loadserversources"), strSources, null );
}
#else
RhoAppAdapter.loadServerSources(strSources);
#endif
if (isNoThreadedMode())
RhoAppAdapter.loadServerSources(strSources);
else
{
NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/loadserversources"), strSources, null );
}
}else
RhoAppAdapter.loadServerSources(strSources);

loadAllSources();

rho_db_init_attr_manager();
Expand Down Expand Up @@ -1081,16 +1083,18 @@ void CSyncEngine::login(String name, String password, const CSyncNotification& o
String strOldUser = RHOCONF().getString("rho_sync_user");
if ( name.compare(strOldUser) != 0 )
{
#ifndef RHO_NO_RUBY
if (isNoThreadedMode())
RhoAppAdapter.resetDBOnSyncUserChanged();
else
if ( !RhoAppAdapter.callCallbackOnSyncUserChanged())
{
NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/resetDBOnSyncUserChanged"), "", null );
}
#else
RhoAppAdapter.resetDBOnSyncUserChanged();
#endif
if (rho_ruby_is_started())
{
if (isNoThreadedMode())
RhoAppAdapter.resetDBOnSyncUserChanged();
else
{
NetResponse resp = getNet().pushData( getNet().resolveUrl("/system/resetDBOnSyncUserChanged"), "", null );
}
}
}
}
}
RHOCONF().setString("rho_sync_user", name, true);
Expand Down
5 changes: 5 additions & 0 deletions platform/shared/RhoConnectClient/RhoConnectClient.cpp
Expand Up @@ -1588,6 +1588,11 @@ namespace rho {
{
rho_connectclient_database_full_reset(false);
}

/*static*/ bool _CRhoAppAdapter::callCallbackOnSyncUserChanged()
{
return false;
}
}

extern "C"
Expand Down

0 comments on commit 00d228a

Please sign in to comment.