rhodes 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -0
- data/lib/framework/rho/rhoerror.rb +4 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom.rb +21 -1
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +21 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesInstance.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +10 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +2 -2
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +4 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +52 -11
- data/platform/iphone/Classes/NativeBar.m +37 -18
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +27 -8
- data/platform/iphone/Classes/SimpleMainView.h +7 -5
- data/platform/iphone/Classes/SimpleMainView.m +155 -36
- data/platform/iphone/Classes/TabbedMainView.h +2 -4
- data/platform/iphone/Classes/TabbedMainView.m +12 -10
- data/platform/iphone/Classes/WebView.m +1 -0
- data/platform/iphone/Info.plist +7 -1
- data/platform/iphone/icon114.png +0 -0
- data/platform/iphone/icon57.png +0 -0
- data/platform/iphone/icon72.png +0 -0
- data/platform/iphone/rbuild/iphone.rake +102 -16
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +17 -22
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoThread.cpp +7 -3
- data/platform/shared/common/RhoThread.h +21 -7
- data/platform/shared/common/RhodesApp.cpp +13 -9
- data/platform/shared/common/RhodesApp.h +1 -1
- data/platform/shared/common/ThreadQueue.cpp +6 -4
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoThread.java +18 -8
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +70 -2
- data/platform/shared/rubyJVM/src/com/rho/ThreadQueue.java +143 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +15 -5
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +42 -36
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +63 -20
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +4 -4
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +12 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RhoSupport.java +9 -3
- data/platform/shared/sync/ClientRegister.cpp +11 -3
- data/platform/shared/sync/ClientRegister.h +1 -0
- data/platform/shared/sync/SyncEngine.cpp +38 -35
- data/platform/shared/sync/SyncEngine.h +2 -1
- data/platform/shared/sync/SyncNotify.cpp +53 -20
- data/platform/shared/sync/SyncNotify.h +9 -2
- data/platform/shared/sync/SyncSource.cpp +3 -3
- data/platform/shared/sync/SyncSource.h +1 -1
- data/platform/shared/sync/SyncThread.cpp +9 -2
- data/platform/wm/rhodes/Alert.cpp +35 -21
- data/platform/wm/rhodes/Alert.h +11 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +11 -12
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +2 -0
- data/res/generators/templates/application/build.yml +1 -1
- data/rhodes.gemspec +2 -2
- data/spec/framework_spec/rhoconfig.txt +1 -0
- data/spec/phone_spec/rhoconfig.txt +2 -0
- metadata +8 -5
- data/Manifest.txt +0 -5333
@@ -21,6 +21,8 @@ public class SyncNotify {
|
|
21
21
|
String m_strUrl, m_strParams;
|
22
22
|
boolean m_bRemoveAfterFire;
|
23
23
|
|
24
|
+
SyncNotification(){m_bRemoveAfterFire = false;}
|
25
|
+
|
24
26
|
SyncNotification(String strUrl, String strParams, boolean bRemoveAfterFire)
|
25
27
|
{ m_strUrl = strUrl; m_strParams = strParams; m_bRemoveAfterFire = bRemoveAfterFire; }
|
26
28
|
};
|
@@ -40,6 +42,7 @@ public class SyncNotify {
|
|
40
42
|
Hashtable/*<int,SyncNotification>*/ m_mapSyncNotifications = new Hashtable();
|
41
43
|
SyncNotification m_pSearchNotification;
|
42
44
|
SyncNotification m_bulkSyncNotify;
|
45
|
+
SyncNotification m_emptyNotify = new SyncNotification();
|
43
46
|
|
44
47
|
Mutex m_mxSyncNotifications = new Mutex();
|
45
48
|
ISyncStatusListener m_syncStatusListener = null;
|
@@ -253,9 +256,10 @@ public class SyncNotify {
|
|
253
256
|
{
|
254
257
|
SyncSource src = (SyncSource)sources.elementAt(nSrc);
|
255
258
|
|
256
|
-
fireSyncNotification( src, true, src.m_nErrCode, "");
|
257
259
|
if ( getSync().getState() == SyncEngine.esStop )
|
258
|
-
fireAllSyncNotifications(true, src.m_nErrCode,
|
260
|
+
fireAllSyncNotifications(true, src.m_nErrCode, src.m_strError, sources, nSrc );
|
261
|
+
else
|
262
|
+
fireSyncNotification( src, true, src.m_nErrCode, "");
|
259
263
|
|
260
264
|
cleanCreateObjectErrors();
|
261
265
|
}
|
@@ -346,14 +350,6 @@ public class SyncNotify {
|
|
346
350
|
}
|
347
351
|
}
|
348
352
|
|
349
|
-
void fireAllSyncNotifications( boolean bFinish, int nErrCode, String strMessage, Vector/*Ptr<CSyncSource*>&*/ sources )
|
350
|
-
{
|
351
|
-
for( int i = 0; i < sources.size(); i++ )
|
352
|
-
{
|
353
|
-
doFireSyncNotification( (SyncSource)sources.elementAt(i), bFinish, nErrCode, strMessage );
|
354
|
-
}
|
355
|
-
}
|
356
|
-
|
357
353
|
void fireBulkSyncNotification( boolean bFinish, String status, String partition, int nErrCode )
|
358
354
|
{
|
359
355
|
if ( getSync().getState() == SyncEngine.esExit )
|
@@ -414,7 +410,41 @@ public class SyncNotify {
|
|
414
410
|
}
|
415
411
|
|
416
412
|
}
|
417
|
-
|
413
|
+
|
414
|
+
void fireAllSyncNotifications( boolean bFinish, int nErrCode, String strError, Vector/*Ptr<CSyncSource*>&*/ sources, int nCurSrc )
|
415
|
+
{
|
416
|
+
synchronized(m_mxSyncNotifications)
|
417
|
+
{
|
418
|
+
if ( nCurSrc >= 0 )
|
419
|
+
{
|
420
|
+
SyncSource src = (SyncSource)sources.elementAt(nCurSrc);
|
421
|
+
SyncNotification pSN = getSyncNotifyBySrc(src);
|
422
|
+
if ( pSN != null )
|
423
|
+
{
|
424
|
+
src.m_strError = strError;
|
425
|
+
src.m_nErrCode = nErrCode;
|
426
|
+
|
427
|
+
fireSyncNotification( src, bFinish, nErrCode, "" );
|
428
|
+
return;
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
//find any source with notify
|
433
|
+
for( int i = 0; i < (int)sources.size(); i++ )
|
434
|
+
{
|
435
|
+
SyncSource src = (SyncSource)sources.elementAt(i);
|
436
|
+
SyncNotification pSN = getSyncNotifyBySrc(src);
|
437
|
+
if ( pSN != null )
|
438
|
+
{
|
439
|
+
src.m_strError = strError;
|
440
|
+
src.m_nErrCode = nErrCode;
|
441
|
+
fireSyncNotification( src, bFinish, nErrCode, "" );
|
442
|
+
break;
|
443
|
+
}
|
444
|
+
}
|
445
|
+
}
|
446
|
+
}
|
447
|
+
|
418
448
|
void fireSyncNotification( SyncSource src, boolean bFinish, int nErrCode, String strMessage )
|
419
449
|
{
|
420
450
|
if ( getSync().getState() == SyncEngine.esExit )
|
@@ -431,10 +461,24 @@ public class SyncNotify {
|
|
431
461
|
}
|
432
462
|
}
|
433
463
|
|
434
|
-
doFireSyncNotification(src, bFinish, nErrCode,
|
464
|
+
doFireSyncNotification(src, bFinish, nErrCode, "" );
|
435
465
|
}
|
436
466
|
|
437
|
-
|
467
|
+
SyncNotification getSyncNotifyBySrc(SyncSource src)
|
468
|
+
{
|
469
|
+
SyncNotification pSN = null;
|
470
|
+
if ( src.isSearch() )
|
471
|
+
pSN = m_pSearchNotification;
|
472
|
+
else
|
473
|
+
pSN = (SyncNotification)m_mapSyncNotifications.get(src.getID());
|
474
|
+
|
475
|
+
if ( pSN == null )//&& !getSync().isNoThreadedMode() )
|
476
|
+
return null;
|
477
|
+
|
478
|
+
return pSN != null ? pSN : m_emptyNotify;
|
479
|
+
}
|
480
|
+
|
481
|
+
void doFireSyncNotification( SyncSource src, boolean bFinish, int nErrCode, String strError )
|
438
482
|
{
|
439
483
|
if ( src == null || getSync().isStoppedByUser() )
|
440
484
|
return; //TODO: implement all sources callback
|
@@ -444,12 +488,7 @@ public class SyncNotify {
|
|
444
488
|
boolean bRemoveAfterFire = bFinish;
|
445
489
|
{
|
446
490
|
synchronized(m_mxSyncNotifications){
|
447
|
-
SyncNotification sn =
|
448
|
-
if ( src.isSearch() )
|
449
|
-
sn = m_pSearchNotification;
|
450
|
-
else
|
451
|
-
sn = (SyncNotification)m_mapSyncNotifications.get(src.getID());
|
452
|
-
|
491
|
+
SyncNotification sn = getSyncNotifyBySrc(src);
|
453
492
|
if ( sn == null )
|
454
493
|
return;
|
455
494
|
|
@@ -474,7 +513,11 @@ public class SyncNotify {
|
|
474
513
|
|
475
514
|
strBody += "error";
|
476
515
|
strBody += "&error_code=" + nErrCode;
|
477
|
-
|
516
|
+
|
517
|
+
if ( strError != null && strError.length() > 0 )
|
518
|
+
strBody += "&error_message=" + URI.urlEncode(strError);
|
519
|
+
else
|
520
|
+
strBody += "&error_message=" + URI.urlEncode(src.m_strError);
|
478
521
|
}
|
479
522
|
}
|
480
523
|
else
|
@@ -77,7 +77,7 @@ class SyncSource
|
|
77
77
|
boolean m_bGetAtLeastOnePage = false;
|
78
78
|
int m_nErrCode = RhoRuby.ERR_NONE;
|
79
79
|
String m_strError = "";
|
80
|
-
|
80
|
+
boolean m_bIsSearch = false;
|
81
81
|
|
82
82
|
//String m_strPushBody = "";
|
83
83
|
Vector/*Ptr<CSyncBlob*>*/ m_arSyncBlobs = new Vector();
|
@@ -139,7 +139,7 @@ class SyncSource
|
|
139
139
|
m_bGetAtLeastOnePage = false;
|
140
140
|
|
141
141
|
m_nErrCode = RhoRuby.ERR_NONE;
|
142
|
-
m_bIsSearch =
|
142
|
+
m_bIsSearch = m_syncEngine.getState() == SyncEngine.esSearch;
|
143
143
|
m_bSchemaSource = db.isTableExist(m_strName);
|
144
144
|
}
|
145
145
|
|
@@ -158,7 +158,7 @@ class SyncSource
|
|
158
158
|
m_bGetAtLeastOnePage = false;
|
159
159
|
|
160
160
|
m_nErrCode = RhoRuby.ERR_NONE;
|
161
|
-
m_bIsSearch =
|
161
|
+
m_bIsSearch = m_syncEngine.getState() == SyncEngine.esSearch;
|
162
162
|
|
163
163
|
IDBResult res = db.executeSQL("SELECT token,associations from sources WHERE source_id=?", m_nID);
|
164
164
|
if ( !res.isEnd() )
|
@@ -203,7 +203,7 @@ class SyncSource
|
|
203
203
|
getNotify().fireSyncNotification(null, false, RhoRuby.ERR_NONE, RhoRuby.getMessageText("syncronizing") + getName() + "...");
|
204
204
|
|
205
205
|
TimeInterval startTime = TimeInterval.getCurrentTime();
|
206
|
-
m_bIsSearch = false;
|
206
|
+
//m_bIsSearch = false;
|
207
207
|
|
208
208
|
try{
|
209
209
|
if ( isEmptyToken() )
|
@@ -133,7 +133,6 @@ public class SyncThread extends RhoThread
|
|
133
133
|
{
|
134
134
|
m_oSyncEngine.exitSync();
|
135
135
|
stop(SYNC_WAIT_BEFOREKILL_SECONDS);
|
136
|
-
LOG.INFO( "Sync engine thread shutdown" );
|
137
136
|
|
138
137
|
if ( ClientRegister.getInstance() != null )
|
139
138
|
ClientRegister.getInstance().Destroy();
|
@@ -246,6 +245,8 @@ public class SyncThread extends RhoThread
|
|
246
245
|
}
|
247
246
|
}
|
248
247
|
}
|
248
|
+
|
249
|
+
LOG.INFO("Sync engine thread shutdown");
|
249
250
|
}
|
250
251
|
|
251
252
|
boolean isNoCommands()
|
@@ -670,9 +671,18 @@ public class SyncThread extends RhoThread
|
|
670
671
|
getSyncEngine().setSyncServer(syncserver);
|
671
672
|
|
672
673
|
if ( syncserver != null && syncserver.length() > 0 )
|
674
|
+
{
|
673
675
|
SyncThread.getInstance().start(SyncThread.epLow);
|
676
|
+
if ( ClientRegister.getInstance() != null )
|
677
|
+
ClientRegister.getInstance().startUp();
|
678
|
+
}
|
674
679
|
else
|
675
|
-
|
680
|
+
{
|
681
|
+
//DO NOT STOP thread. because they cannot be restarted
|
682
|
+
//SyncThread.getInstance().stop(SYNC_WAIT_BEFOREKILL_SECONDS);
|
683
|
+
//if ( ClientRegister.getInstance() != null )
|
684
|
+
// ClientRegister.getInstance().stop(SYNC_WAIT_BEFOREKILL_SECONDS);
|
685
|
+
}
|
676
686
|
|
677
687
|
}catch(Exception e)
|
678
688
|
{
|
@@ -2,6 +2,7 @@ package com.xruby.runtime.lang;
|
|
2
2
|
|
3
3
|
import com.rho.IRhoRubyHelper;
|
4
4
|
import com.rho.RhoClassFactory;
|
5
|
+
import com.rho.RhoConf;
|
5
6
|
import com.rho.RhoEmptyLogger;
|
6
7
|
import com.rho.RhoLogger;
|
7
8
|
import com.rho.RhodesApp;
|
@@ -181,12 +182,12 @@ public class RhoSupport {
|
|
181
182
|
required_file = required_file.replace('\\', '.');
|
182
183
|
required_file = StringMe.replaceAll(required_file,"-", "minus");
|
183
184
|
|
184
|
-
int nDot = required_file.lastIndexOf('.');
|
185
|
+
/*int nDot = required_file.lastIndexOf('.');
|
185
186
|
if (nDot>0)
|
186
187
|
{
|
187
188
|
String fName = required_file.substring(nDot+1);
|
188
189
|
required_file = required_file.substring(0, nDot+1) + fName.toLowerCase();
|
189
|
-
}
|
190
|
+
}*/
|
190
191
|
|
191
192
|
required_file += ".main";
|
192
193
|
return getAppName() + "." + required_file;
|
@@ -259,7 +260,12 @@ public class RhoSupport {
|
|
259
260
|
}
|
260
261
|
|
261
262
|
if ( strValue == null || strValue.length() == 0 )
|
262
|
-
|
263
|
+
{
|
264
|
+
if ( RhoConf.getInstance().isExist(name) )
|
265
|
+
strValue = RhoConf.getInstance().getString(name);
|
266
|
+
else
|
267
|
+
return RubyConstant.QNIL;
|
268
|
+
}
|
263
269
|
|
264
270
|
return ObjectFactory.createString(strValue);
|
265
271
|
}
|
@@ -41,8 +41,7 @@ CClientRegister::CClientRegister(common::IRhoClassFactory* factory,const char* d
|
|
41
41
|
|
42
42
|
delete factory;
|
43
43
|
|
44
|
-
|
45
|
-
start(epLow);
|
44
|
+
startUp();
|
46
45
|
}
|
47
46
|
|
48
47
|
CClientRegister::~CClientRegister()
|
@@ -53,10 +52,19 @@ CClientRegister::~CClientRegister()
|
|
53
52
|
m_pInstance = null;
|
54
53
|
}
|
55
54
|
|
55
|
+
void CClientRegister::startUp()
|
56
|
+
{
|
57
|
+
if ( RHOCONF().getString("syncserver").length() > 0 )
|
58
|
+
{
|
59
|
+
start(epLow);
|
60
|
+
stopWait();
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
56
64
|
void CClientRegister::run()
|
57
65
|
{
|
58
66
|
LOG(INFO)+"ClientRegister start";
|
59
|
-
while(!
|
67
|
+
while(!isStopping())
|
60
68
|
{
|
61
69
|
if ( CSyncThread::getInstance() != null )
|
62
70
|
{
|
@@ -37,11 +37,12 @@ void CSyncEngine::initProtocol()
|
|
37
37
|
m_SyncProtocol = new CSyncProtocol_3();
|
38
38
|
}
|
39
39
|
|
40
|
-
void CSyncEngine::prepareSync(ESyncState eState)
|
40
|
+
void CSyncEngine::prepareSync(ESyncState eState, const CSourceID* oSrcID)
|
41
41
|
{
|
42
42
|
setState(eState);
|
43
43
|
m_bStopByUser = false;
|
44
44
|
m_nErrCode = RhoRuby.ERR_NONE;
|
45
|
+
m_strError = "";
|
45
46
|
|
46
47
|
loadAllSources();
|
47
48
|
|
@@ -59,20 +60,26 @@ void CSyncEngine::prepareSync(ESyncState eState)
|
|
59
60
|
}else
|
60
61
|
m_nErrCode = RhoRuby.ERR_CLIENTISNOTLOGGEDIN;
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
CSyncSource* src = null;
|
64
|
+
if ( oSrcID != null )
|
65
|
+
src = findSource(*oSrcID);
|
66
|
+
|
67
|
+
if ( src != null )
|
68
|
+
{
|
69
|
+
src->m_nErrCode = m_nErrCode;
|
70
|
+
src->m_strError = m_strError;
|
71
|
+
getNotify().fireSyncNotification(src, true, src->m_nErrCode, "");
|
67
72
|
}else
|
68
|
-
|
73
|
+
{
|
74
|
+
getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError, m_sources, getStartSource());
|
75
|
+
}
|
69
76
|
|
70
77
|
stopSync();
|
71
78
|
}
|
72
79
|
|
73
80
|
void CSyncEngine::doSyncAllSources()
|
74
81
|
{
|
75
|
-
prepareSync(esSyncAllSources);
|
82
|
+
prepareSync(esSyncAllSources, null);
|
76
83
|
|
77
84
|
if ( isContinueSync() )
|
78
85
|
{
|
@@ -104,7 +111,7 @@ void CSyncEngine::doSyncAllSources()
|
|
104
111
|
|
105
112
|
void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams, String strAction, boolean bSearchSyncChanges, int nProgressStep)
|
106
113
|
{
|
107
|
-
prepareSync(esSearch);
|
114
|
+
prepareSync(esSearch, null);
|
108
115
|
if ( !isContinueSync() )
|
109
116
|
{
|
110
117
|
if ( getState() != esExit )
|
@@ -125,7 +132,6 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
125
132
|
}
|
126
133
|
}
|
127
134
|
|
128
|
-
int nErrCode = 0;
|
129
135
|
while( isContinueSync() )
|
130
136
|
{
|
131
137
|
int nSearchCount = 0;
|
@@ -153,7 +159,8 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
153
159
|
if ( !resp.isOK() )
|
154
160
|
{
|
155
161
|
stopSync();
|
156
|
-
|
162
|
+
m_nErrCode = RhoRuby.getErrorFromResponse(resp);
|
163
|
+
m_strError = resp.getCharData();
|
157
164
|
continue;
|
158
165
|
}
|
159
166
|
|
@@ -177,7 +184,8 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
177
184
|
LOG(ERROR) + "Sync server send search data with incompatible version. Client version: " + convertToStringA(getProtocol().getVersion()) +
|
178
185
|
"; Server response version: " + convertToStringA(nVersion);
|
179
186
|
stopSync();
|
180
|
-
|
187
|
+
m_nErrCode = RhoRuby.ERR_UNEXPECTEDSERVERRESPONSE;
|
188
|
+
m_strError = resp.getCharData();
|
181
189
|
continue;
|
182
190
|
}
|
183
191
|
|
@@ -185,7 +193,8 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
185
193
|
{
|
186
194
|
LOG(ERROR) + "Sync server send search data without source name.";
|
187
195
|
stopSync();
|
188
|
-
|
196
|
+
m_nErrCode = RhoRuby.ERR_UNEXPECTEDSERVERRESPONSE;
|
197
|
+
m_strError = resp.getCharData();
|
189
198
|
continue;
|
190
199
|
}
|
191
200
|
|
@@ -195,12 +204,12 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
195
204
|
{
|
196
205
|
LOG(ERROR) + "Sync server send search data for unknown source name:" + strSrcName;
|
197
206
|
stopSync();
|
198
|
-
|
207
|
+
m_nErrCode = RhoRuby.ERR_UNEXPECTEDSERVERRESPONSE;
|
208
|
+
m_strError = resp.getCharData();
|
199
209
|
continue;
|
200
210
|
}
|
201
211
|
|
202
212
|
oSrcArr.reset(0);
|
203
|
-
pSrc->m_bIsSearch = true;
|
204
213
|
pSrc->setProgressStep(nProgressStep);
|
205
214
|
pSrc->processServerResponse_ver3(oSrcArr);
|
206
215
|
|
@@ -211,20 +220,7 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
211
220
|
break;
|
212
221
|
}
|
213
222
|
|
214
|
-
|
215
|
-
{
|
216
|
-
CSyncSource& src = *m_sources.elementAt(getStartSource());
|
217
|
-
src.m_bIsSearch = true;
|
218
|
-
|
219
|
-
getNotify().fireSyncNotification(&src, true, RhoRuby.ERR_NONE, RhoRuby.getMessageText("sync_completed"));
|
220
|
-
}
|
221
|
-
else if ( nErrCode != 0 )
|
222
|
-
{
|
223
|
-
CSyncSource& src = *m_sources.elementAt(getStartSource());
|
224
|
-
src.m_nErrCode = nErrCode;
|
225
|
-
src.m_bIsSearch = true;
|
226
|
-
getNotify().fireSyncNotification(&src, true, src.m_nErrCode, "");
|
227
|
-
}
|
223
|
+
getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError, m_sources, getStartSource());
|
228
224
|
|
229
225
|
//update db info
|
230
226
|
CTimeInterval endTime = CTimeInterval::getCurrentTime();
|
@@ -250,7 +246,7 @@ void CSyncEngine::doSearch(rho::Vector<rho::String>& arSources, String strParams
|
|
250
246
|
|
251
247
|
void CSyncEngine::doSyncSource(const CSourceID& oSrcID)
|
252
248
|
{
|
253
|
-
prepareSync(esSyncSource);
|
249
|
+
prepareSync(esSyncSource, &oSrcID);
|
254
250
|
|
255
251
|
if ( isContinueSync() )
|
256
252
|
{
|
@@ -358,6 +354,9 @@ String CSyncEngine::loadClientID()
|
|
358
354
|
else
|
359
355
|
getUserDB().executeSQL("INSERT INTO client_info (client_id) values (?)", clientID);
|
360
356
|
|
357
|
+
if ( CClientRegister::getInstance() != null )
|
358
|
+
CClientRegister::getInstance()->startUp();
|
359
|
+
|
361
360
|
}else if ( bResetClient )
|
362
361
|
{
|
363
362
|
if ( !resetClientIDByNet(clientID) )
|
@@ -413,7 +412,10 @@ boolean CSyncEngine::resetClientIDByNet(const String& strClientID)//throws Excep
|
|
413
412
|
//"}}]}");
|
414
413
|
|
415
414
|
if ( !resp.isOK() )
|
415
|
+
{
|
416
416
|
m_nErrCode = RhoRuby.getErrorFromResponse(resp);
|
417
|
+
m_strError = resp.getCharData();
|
418
|
+
}
|
417
419
|
/*else
|
418
420
|
{
|
419
421
|
processServerSources(resp.getCharData());
|
@@ -459,6 +461,7 @@ String CSyncEngine::requestClientIDByNet()
|
|
459
461
|
m_nErrCode = RhoRuby.getErrorFromResponse(resp);
|
460
462
|
if ( m_nErrCode == RhoRuby.ERR_NONE )
|
461
463
|
m_nErrCode = RhoRuby.ERR_UNEXPECTEDSERVERRESPONSE;
|
464
|
+
m_strError = resp.getCharData();
|
462
465
|
}
|
463
466
|
|
464
467
|
return "";
|
@@ -675,13 +678,13 @@ void CSyncEngine::login(String name, String password, String callback)
|
|
675
678
|
else
|
676
679
|
getUserDB().executeSQL("INSERT INTO client_info (session) values (?)", strSession);
|
677
680
|
|
678
|
-
|
679
|
-
if ( CClientRegister::getInstance() != null )
|
680
|
-
CClientRegister::getInstance()->stopWait();
|
681
|
-
|
682
681
|
getNotify().callLoginCallback(callback, RhoRuby.ERR_NONE, "" );
|
683
682
|
|
684
683
|
PROF_STOP("Login");
|
684
|
+
|
685
|
+
if ( CClientRegister::getInstance() != null )
|
686
|
+
CClientRegister::getInstance()->startUp();
|
687
|
+
|
685
688
|
//}catch(Exception exc)
|
686
689
|
//{
|
687
690
|
// LOG.ERROR("Login failed.", exc);
|
@@ -715,7 +718,7 @@ void CSyncEngine::logout()
|
|
715
718
|
getUserDB().executeSQL( "UPDATE client_info SET session=NULL" );
|
716
719
|
m_strSession = "";
|
717
720
|
|
718
|
-
loadAllSources();
|
721
|
+
//loadAllSources();
|
719
722
|
}
|
720
723
|
|
721
724
|
void CSyncEngine::setSyncServer(char* syncserver)
|