rhoconnect-client 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/CREDITS +0 -0
- data/LICENSE +9 -0
- data/README.md +47 -0
- data/ext/rhoconnect-client/RhoConnectClient.rb +190 -0
- data/ext/rhoconnect-client/ext/RhoConnectClient.xml +726 -0
- data/ext/rhoconnect-client/ext/build +26 -0
- data/ext/rhoconnect-client/ext/build.bat +30 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_java.files +1 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_native.files +14 -0
- data/ext/rhoconnect-client/ext/platform/android/src/com/rhoconnectclient/RhoconnectClient.java +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/.gitignore +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/Rakefile +74 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient.xcodeproj/project.pbxproj +390 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient_Prefix.pch +7 -0
- data/ext/rhoconnect-client/ext/platform/iphone/impl/readme.txt +7 -0
- data/ext/rhoconnect-client/ext/platform/qt/Rakefile +35 -0
- data/ext/rhoconnect-client/ext/platform/qt/rhoconnect-client.pro +88 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.sln +36 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vcproj +774 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vsprops +15 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.cpp +40 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.h +2 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.props +22 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.sln +32 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj +220 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj.filters +103 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.cpp +273 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.h +60 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientSingletonImpl.h +53 -0
- data/ext/rhoconnect-client/ext/shared/initRhoconnectClient.cpp +207 -0
- data/ext/rhoconnect-client/ext/shared/rhoconnectclient.c +18 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.cpp +398 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.h +147 -0
- data/ext/rhoconnect-client/ext/shared/sync/ISyncProtocol.h +91 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.cpp +1245 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.h +213 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.cpp +737 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.h +209 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_3.h +220 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_4.h +259 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.cpp +1694 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.h +212 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.cpp +583 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.h +250 -0
- data/ext/rhoconnect-client/ext.yml +12 -0
- data/lib/build/run_rhoconnect_spec.rb +135 -0
- data/lib/rhoconnect-client.rb +3 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1673 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.h +181 -0
- data/platform/shared/RhoConnectClient/RhoError.h +77 -0
- data/rhoconnect-client/C++/Tests/RhoConnectClientTest.cpp +830 -0
- data/rhoconnect-client/C++/Tests/win32/.gitignore +3 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.sln +65 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.vcproj +634 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/RhoConnectClientTest.vcproj +222 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/stdafx.h +65 -0
- data/rhoconnect-client/C++/Tests/win32/stdafx.h +65 -0
- data/rhoconnect-client/CHANGELOG +18 -0
- data/rhoconnect-client/Java/Android/build/android.rake +387 -0
- data/rhoconnect-client/Java/Android/build/android_sdk.rb +582 -0
- data/rhoconnect-client/Java/Android/build/libcurl_build.files +73 -0
- data/rhoconnect-client/Java/Android/build/libjson_build.files +9 -0
- data/rhoconnect-client/Java/Android/build/librhocommon_build.files +14 -0
- data/rhoconnect-client/Java/Android/build/librhodb_build.files +5 -0
- data/rhoconnect-client/Java/Android/build/librhoimpl_build.files +13 -0
- data/rhoconnect-client/Java/Android/build/librholog_build.files +4 -0
- data/rhoconnect-client/Java/Android/build/libsqlite_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/libsync_build.files +7 -0
- data/rhoconnect-client/Java/Android/build/libunzip_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/rhoconnectclient_build.files +3 -0
- data/rhoconnect-client/Java/Android/build/rhoimpljava_build.files +21 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/Capabilities.java +63 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/MemoryInfoCollector.java +79 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/util/ContextFactory.java +63 -0
- data/rhoconnect-client/Java/Android/test/.classpath +9 -0
- data/rhoconnect-client/Java/Android/test/.project +33 -0
- data/rhoconnect-client/Java/Android/test/AndroidManifest.xml +14 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/androidtest.png +0 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/Android/test/assets/rho.dat +9 -0
- data/rhoconnect-client/Java/Android/test/proguard.cfg +36 -0
- data/rhoconnect-client/Java/Android/test/project.properties +11 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/layout/main.xml +12 -0
- data/rhoconnect-client/Java/Android/test/res/values/strings.xml +5 -0
- data/rhoconnect-client/Java/Android/test/rhoimpl.jar +0 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClient.java +343 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClientBlobs.java +219 -0
- data/rhoconnect-client/Java/RhoConnect/.classpath +6 -0
- data/rhoconnect-client/Java/RhoConnect/.project +93 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/RhoConnect/assets/rho.dat +8 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/RhoConnectJniNotify.h +61 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectClient.h +181 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhomModel.h +103 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/rhojava.inc +76 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniClient.cpp +401 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniModel.cpp +332 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniNotify.cpp +223 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectUtil.cpp +82 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhodesApp.cpp +114 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectClient.java +108 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectNotify.java +78 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectObjectNotify.java +71 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhomModel.java +195 -0
- data/rhoconnect-client/JavaScript/.classpath +10 -0
- data/rhoconnect-client/JavaScript/.gitignore +4 -0
- data/rhoconnect-client/JavaScript/.project +17 -0
- data/rhoconnect-client/JavaScript/README.textile +1 -0
- data/rhoconnect-client/JavaScript/build.xml +185 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.js +44 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.png +0 -0
- data/rhoconnect-client/JavaScript/src/RhoSyncJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/RhoSyncStubsJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Capabilities.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/IRhoRubyHelper.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Mutex.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoAppAdapter.java +39 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoClassFactory.java +29 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoConf.java +100 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyLogger.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyProfiler.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoLogger.java +32 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoProfiler.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhodesApp.java +25 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/TimeInterval.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Tokenizer.java +23 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAdapter.java +174 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAttrManager.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBException.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/IDBResult.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/IFileAccess.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/SimpleFile.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/IHttpConnection.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetRequest.java +324 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetResponse.java +51 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/URI.java +64 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/ClientRegister.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONArrayIterator.java +37 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONEntry.java +48 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONStructIterator.java +41 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncNotify.java +98 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncThread.java +92 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet-deps.jar +0 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet.jar +0 -0
- data/rhoconnect-client/JavaScript/war/js/fsm-sample.js +54 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-api.js +237 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-fsm.js +307 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/4C71D69C9BBC9E6F05C6BA49B01BCBC1.cache.html +3122 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5146F4FFF34511C8BB2661E920B49E3A.cache.html +3254 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5248C67481D9D27AD0703D15CDBD2A1C.cache.html +3147 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/EE1DC2692C9C32367B53A39E2358AF23.cache.html +3195 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/clear.cache.gif +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topleft.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topright.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/splitPanelThumb.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard.css +1144 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard_rtl.css +1145 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/hosted.html +350 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/rhosyncjs.nocache.js +314 -0
- data/rhoconnect-client/JavaScript/war/test/SpecRunner.html +35 -0
- data/rhoconnect-client/JavaScript/war/test/dbtest.html +38 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/MIT.LICENSE +20 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine-html.js +188 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.css +166 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.js +2421 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SpecHelper.js +7 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SyncApiSpec.js +573 -0
- data/rhoconnect-client/JavaScript/war/test/spec/samples/PlayerSpec.js +58 -0
- data/rhoconnect-client/JavaScript/war/test/worker-test.js +17 -0
- data/rhoconnect-client/LICENSE +41 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.h +118 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.m +641 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.xcodeproj/project.pbxproj +1434 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.h +83 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.m +181 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.h +65 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.m +73 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.h +101 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.m +320 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/MainWindow.xib +198 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest.xcodeproj/project.pbxproj +373 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.h +58 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.m +84 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest_Prefix.pch +8 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/invalid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/main.m +1096 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test2.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/valid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.h +62 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.m +35 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.h +78 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.m +549 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/MainWindow.xib +227 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/main.m +17 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests.xcodeproj/project.pbxproj +363 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptestsViewController.xib +641 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests_Prefix.pch +8 -0
- data/rhoconnect-client/README.textile +23 -0
- data/rhoconnect-client/Rakefile +20 -0
- data/rhoconnect-client/Samples/Java/android_store/.classpath +8 -0
- data/rhoconnect-client/Samples/Java/android_store/.project +33 -0
- data/rhoconnect-client/Samples/Java/android_store/AndroidManifest.xml +24 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/rho.dat +8 -0
- data/rhoconnect-client/Samples/Java/android_store/default.properties +11 -0
- data/rhoconnect-client/Samples/Java/android_store/project.properties +14 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/layout/main.xml +12 -0
- data/rhoconnect-client/Samples/Java/android_store/res/values/strings.xml +5 -0
- data/rhoconnect-client/Samples/Java/android_store/rhoimpl.jar +0 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreActivity.java +68 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreApplication.java +15 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.h +70 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.m +94 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.h +82 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.m +119 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.h +63 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.m +314 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.h +65 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.m +110 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.h +61 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.m +171 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/LoginViewController.xib +779 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/MainWindow.xib +580 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/RootViewController.xib +384 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/WaitLoginController.xib +557 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/icon.png +0 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/main.m +22 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store-Info.plist +30 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store.xcodeproj/project.pbxproj +367 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store_Prefix.pch +14 -0
- data/rhoconnect-client/build.yml +3 -0
- data/rhoconnect-client/version +1 -0
- metadata +314 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
#include "generated/cpp/RhoConnectClientBase.h"
|
2
|
+
#include "sync/SyncThread.h"
|
3
|
+
|
4
|
+
namespace rho {
|
5
|
+
|
6
|
+
class RhoConnectClientImpl : public CRhoConnectClientSingletonBase
|
7
|
+
{
|
8
|
+
private:
|
9
|
+
sync::CSyncThread* getSyncThread() const { return sync::CSyncThread::getInstance(); }
|
10
|
+
sync::CSyncEngine& getSyncEngine() const { return sync::CSyncThread::getSyncEngine(); }
|
11
|
+
public:
|
12
|
+
|
13
|
+
|
14
|
+
RhoConnectClientImpl();
|
15
|
+
|
16
|
+
virtual void getUserName(rho::apiGenerator::CMethodResult& oResult);
|
17
|
+
virtual void getPollInterval(rho::apiGenerator::CMethodResult& oResult);
|
18
|
+
virtual void setPollInterval( int value, rho::apiGenerator::CMethodResult& oResult);
|
19
|
+
virtual void getSyncServer(rho::apiGenerator::CMethodResult& oResult);
|
20
|
+
virtual void setSyncServer( const rho::String& value, rho::apiGenerator::CMethodResult& oResult);
|
21
|
+
virtual void getBulksyncState( rho::apiGenerator::CMethodResult& oResult);
|
22
|
+
virtual void setBulksyncState( int state, rho::apiGenerator::CMethodResult& oResult);
|
23
|
+
virtual void getPageSize(rho::apiGenerator::CMethodResult& oResult);
|
24
|
+
virtual void setPageSize( int value, rho::apiGenerator::CMethodResult& oResult);
|
25
|
+
virtual void getThreadedMode(rho::apiGenerator::CMethodResult& oResult);
|
26
|
+
virtual void setThreadedMode( bool value, rho::apiGenerator::CMethodResult& oResult);
|
27
|
+
virtual void getShowStatusPopup(rho::apiGenerator::CMethodResult& oResult);
|
28
|
+
virtual void setShowStatusPopup( bool value, rho::apiGenerator::CMethodResult& oResult);
|
29
|
+
virtual void getSslVerifyPeer(rho::apiGenerator::CMethodResult& oResult);
|
30
|
+
virtual void setSslVerifyPeer( bool value, rho::apiGenerator::CMethodResult& oResult);
|
31
|
+
virtual void isLoggedIn(rho::apiGenerator::CMethodResult& oResult);
|
32
|
+
virtual void isSyncing(rho::apiGenerator::CMethodResult& oResult);
|
33
|
+
|
34
|
+
virtual void search( const rho::Hashtable<rho::String, rho::String>& args, rho::apiGenerator::CMethodResult& oResult);
|
35
|
+
virtual void doSync( bool showStatusPopup, const rho::String& queryParams, bool syncOnlyChangedSources, rho::apiGenerator::CMethodResult& oResult);
|
36
|
+
virtual void doSyncSource( const rho::String& sourceName, bool showStatusPopup, const rho::String& queryParams, rho::apiGenerator::CMethodResult& oResult);
|
37
|
+
virtual void login( const rho::String& login, const rho::String& password, rho::apiGenerator::CMethodResult& oResult);
|
38
|
+
virtual void logout(rho::apiGenerator::CMethodResult& oResult);
|
39
|
+
virtual void stopSync(rho::apiGenerator::CMethodResult& oResult);
|
40
|
+
virtual void setNotification( const rho::String& sourceName, rho::apiGenerator::CMethodResult& oResult);
|
41
|
+
virtual void clearNotification( const rho::String& sourceName, rho::apiGenerator::CMethodResult& oResult);
|
42
|
+
virtual void setObjectNotification(rho::apiGenerator::CMethodResult& oResult);
|
43
|
+
virtual void addObjectNotify( const rho::String& sourceName, const rho::String& object, rho::apiGenerator::CMethodResult& oResult);
|
44
|
+
virtual void cleanObjectNotify(rho::apiGenerator::CMethodResult& oResult);
|
45
|
+
virtual void getLastSyncObjectCount( const rho::String& sourceName, rho::apiGenerator::CMethodResult& oResult);
|
46
|
+
virtual void setSourceProperty( const rho::String& sourceName, const rho::String& propertyName, const rho::String& propertyValue, rho::apiGenerator::CMethodResult& oResult);
|
47
|
+
virtual void getSourceProperty( const rho::String& sourceName, const rho::String& propertyName, rho::apiGenerator::CMethodResult& oResult);
|
48
|
+
|
49
|
+
private:
|
50
|
+
void handleSyncResult(rho::apiGenerator::CMethodResult& oResult);
|
51
|
+
|
52
|
+
|
53
|
+
};
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
}
|
59
|
+
|
60
|
+
extern "C" void Init_RhoConnectClient_API();
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#include "IRhoConnectClient.h"
|
2
|
+
|
3
|
+
namespace rho {
|
4
|
+
|
5
|
+
|
6
|
+
class RhoConnectClientSingletonImpl : public IRhoConnectClient
|
7
|
+
{
|
8
|
+
virtual ~IRhoConnectClientSingleton(){}
|
9
|
+
|
10
|
+
virtual void GetUserName(rho::apiGenerator::CMethodResult& oResult);
|
11
|
+
virtual void OnSyncCreateError( const rho::StringW& srcName, const rho::Vector<rho::StringW>& objects, const rho::StringW& action, rho::apiGenerator::CMethodResult& oResult);
|
12
|
+
virtual void PushChanges( const rho::StringW& srcName, rho::apiGenerator::CMethodResult& oResult) = 0;
|
13
|
+
virtual void OnSyncUpdateError( const rho::StringW& srcName, const rho::Vector<rho::StringW>& objects, const rho::StringW& action, const rho::StringW& rollbackData, rho::apiGenerator::CMethodResult& oResult) = 0;
|
14
|
+
virtual void OnSyncDeleteError( const rho::StringW& srcName, const rho::Vector<rho::StringW>& objects, const rho::StringW& action, rho::apiGenerator::CMethodResult& oResult) = 0;
|
15
|
+
virtual void Search( const rho::Hashtable<rho::StringW, rho::StringW>& args, rho::apiGenerator::CMethodResult& oResult) = 0;
|
16
|
+
virtual void DoSync( bool showStatusPopup, const rho::StringW& queryParams, bool syncOnlyChangedSources, rho::apiGenerator::CMethodResult& oResult) = 0;
|
17
|
+
virtual void DoSyncSource( int64 sourceId, bool showStatusPopup, const rho::StringW& queryParams, rho::apiGenerator::CMethodResult& oResult) = 0;
|
18
|
+
virtual void DoSearch( const rho::Vector<rho::StringW>& arSources, const rho::StringW& from, const rho::StringW& params, bool syncChanges, int64 nProgressStep, const rho::StringW& callback, const rho::StringW& callbackParams, rho::apiGenerator::CMethodResult& oResult) = 0;
|
19
|
+
virtual void Login( const rho::StringW& login, const rho::StringW& password, const rho::StringW& callback, rho::apiGenerator::CMethodResult& oResult) = 0;
|
20
|
+
virtual void LoggedIn(rho::apiGenerator::CMethodResult& oResult) = 0;
|
21
|
+
virtual void Logout(rho::apiGenerator::CMethodResult& oResult) = 0;
|
22
|
+
virtual void StopSync(rho::apiGenerator::CMethodResult& oResult) = 0;
|
23
|
+
virtual void SetNotification( int64 sourceId, const rho::StringW& url, const rho::StringW& params, rho::apiGenerator::CMethodResult& oResult) = 0;
|
24
|
+
virtual void ClearNotification( int64 sourceId, rho::apiGenerator::CMethodResult& oResult) = 0;
|
25
|
+
virtual void SetPollInterval( int64 interval, rho::apiGenerator::CMethodResult& oResult) = 0;
|
26
|
+
virtual void GetPollInterval(rho::apiGenerator::CMethodResult& oResult) = 0;
|
27
|
+
virtual void SetSyncServer( const rho::StringW& syncServer, rho::apiGenerator::CMethodResult& oResult) = 0;
|
28
|
+
virtual void GetSourceAttributes( const rho::StringW& partition, int64 sourceId, rho::apiGenerator::CMethodResult& oResult) = 0;
|
29
|
+
virtual void SetObjectNotifyUrl( const rho::StringW& url, rho::apiGenerator::CMethodResult& oResult) = 0;
|
30
|
+
virtual void AddObjectNotify( int64 sourceId, const rho::StringW& object, rho::apiGenerator::CMethodResult& oResult) = 0;
|
31
|
+
virtual void CleanObjectNotify(rho::apiGenerator::CMethodResult& oResult) = 0;
|
32
|
+
virtual void GetLastSyncObjectCount( int64 sourceId, rho::apiGenerator::CMethodResult& oResult) = 0;
|
33
|
+
virtual void GetBulksyncState( rho::apiGenerator::CMethodResult& oResult) = 0;
|
34
|
+
virtual void SetBulksyncState( const int state, rho::apiGenerator::CMethodResult& oResult) = 0;
|
35
|
+
virtual void GetPageSize(rho::apiGenerator::CMethodResult& oResult) = 0;
|
36
|
+
virtual void SetPageSize( int64 pageSize, rho::apiGenerator::CMethodResult& oResult) = 0;
|
37
|
+
virtual void SetThreadedMode( bool threadedModeEnabled, rho::apiGenerator::CMethodResult& oResult) = 0;
|
38
|
+
virtual void EnableStatusPopup( bool statusPopupEnabled, rho::apiGenerator::CMethodResult& oResult) = 0;
|
39
|
+
virtual void SetSourceProperty( int64 sourceId, const rho::StringW& propertyName, const rho::StringW& propertyValue, rho::apiGenerator::CMethodResult& oResult) = 0;
|
40
|
+
virtual void GetSourceProperty( int64 sourceId, const rho::StringW& propertyName, rho::apiGenerator::CMethodResult& oResult) = 0;
|
41
|
+
virtual void SetSslVerifyPeer( bool verifyPeer, rho::apiGenerator::CMethodResult& oResult) = 0;
|
42
|
+
virtual void IsSyncing(rho::apiGenerator::CMethodResult& oResult) = 0;
|
43
|
+
virtual void RegisterPush(rho::apiGenerator::CMethodResult& oResult) = 0;
|
44
|
+
|
45
|
+
virtual void addCommandToQueue(rho::common::IRhoRunnable* pFunctor) = 0;
|
46
|
+
virtual void callCommandInThread(rho::common::IRhoRunnable* pFunctor) = 0;
|
47
|
+
|
48
|
+
};
|
49
|
+
|
50
|
+
extern "C" void Init_RhoConnectClient_API();
|
51
|
+
|
52
|
+
|
53
|
+
}
|
@@ -0,0 +1,207 @@
|
|
1
|
+
|
2
|
+
#include "sync/RhoconnectClientManager.h"
|
3
|
+
#include "sync/ILoginListener.h"
|
4
|
+
#include "sync/SyncThread.h"
|
5
|
+
#include "sync/ClientRegister.h"
|
6
|
+
#include "RhoConnectClientImpl.h"
|
7
|
+
#include "common/RhodesApp.h"
|
8
|
+
|
9
|
+
#undef DEFAULT_LOGCATEGORY
|
10
|
+
#define DEFAULT_LOGCATEGORY "initRhoconnectClient"
|
11
|
+
|
12
|
+
class RhoConnectClientRhodesInterfaceImpl : public rho::sync::IRhoconnectClient {
|
13
|
+
public:
|
14
|
+
virtual ~RhoConnectClientRhodesInterfaceImpl() {}
|
15
|
+
|
16
|
+
virtual void doSyncSourceByName( const char* srcName ) {
|
17
|
+
rho_sync_doSyncSourceByName( srcName );
|
18
|
+
}
|
19
|
+
|
20
|
+
virtual void doSyncAllSources( int show_status_popup, const char* query_params, int sync_only_changed_sources ) {
|
21
|
+
rho_sync_doSyncAllSources(show_status_popup, query_params, sync_only_changed_sources );
|
22
|
+
}
|
23
|
+
|
24
|
+
virtual void clientRegisterCreate( const char* szDevicePin ) {
|
25
|
+
rho::sync::CClientRegister::Create(szDevicePin);
|
26
|
+
}
|
27
|
+
|
28
|
+
virtual void clientRegisterDestroy() {
|
29
|
+
rho::sync::CClientRegister::Destroy();
|
30
|
+
}
|
31
|
+
|
32
|
+
virtual bool clientRegisterHaveInstance() {
|
33
|
+
return rho::sync::CClientRegister::getInstance() != 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
virtual void clientRegisterCreate( ) {
|
37
|
+
rho::sync::CClientRegister::Create();
|
38
|
+
}
|
39
|
+
|
40
|
+
virtual void clientRegisterAddLoginListener( rho::sync::ILoginListener* listener ) {
|
41
|
+
rho::sync::CClientRegister::AddLoginListener(listener);
|
42
|
+
}
|
43
|
+
|
44
|
+
virtual void clientRegisterSetDevicePin(const char* pin ) {
|
45
|
+
rho::sync::CClientRegister::Get()->setDevicehPin(pin);
|
46
|
+
}
|
47
|
+
|
48
|
+
virtual void rho_sync_addobjectnotify_bysrcname(const char* szSrcName, const char* szObject) {
|
49
|
+
rho::sync::CSyncThread::getSyncEngine().getNotify().addObjectNotify(szSrcName, szObject);
|
50
|
+
}
|
51
|
+
|
52
|
+
virtual const rho::String& clientRegisterGetDevicePin() {
|
53
|
+
return rho::sync::CClientRegister::Get()->getDevicePin();
|
54
|
+
}
|
55
|
+
|
56
|
+
virtual rho::String syncEnineReadClientID() {
|
57
|
+
return rho::sync::CSyncThread::getSyncEngine().readClientID();
|
58
|
+
}
|
59
|
+
|
60
|
+
virtual rho::net::IRhoSession* getRhoSession() {
|
61
|
+
return &(rho::sync::CSyncThread::getSyncEngine());
|
62
|
+
}
|
63
|
+
|
64
|
+
virtual void syncEngineApplyChangedValues(rho::db::CDBAdapter& db) {
|
65
|
+
rho::sync::CSyncThread::getSyncEngine().applyChangedValues(db);
|
66
|
+
}
|
67
|
+
|
68
|
+
virtual void syncThreadCreate() {
|
69
|
+
rho::sync::CSyncThread::Create();
|
70
|
+
}
|
71
|
+
|
72
|
+
virtual void syncThreadDestroy() {
|
73
|
+
rho::sync::CSyncThread::Destroy();
|
74
|
+
}
|
75
|
+
|
76
|
+
virtual bool haveSyncThread() {
|
77
|
+
return rho::sync::CSyncThread::getInstance() != 0;
|
78
|
+
}
|
79
|
+
|
80
|
+
virtual unsigned int syncThreadGetThreadID() {
|
81
|
+
rho::sync::CSyncThread* t = rho::sync::CSyncThread::getInstance();
|
82
|
+
return (t!=0)?t->getThreadID():((unsigned int)-1);
|
83
|
+
|
84
|
+
}
|
85
|
+
|
86
|
+
virtual bool syncEngineNotifyIsReportingEnabled() {
|
87
|
+
return rho::sync::CSyncThread::getInstance()->getSyncEngine().getNotify().isReportingEnabled();
|
88
|
+
}
|
89
|
+
|
90
|
+
virtual int logged_in() {
|
91
|
+
return rho_sync_logged_in();
|
92
|
+
}
|
93
|
+
|
94
|
+
virtual unsigned long login(const char* loginStr, const char* password, const char* callback) {
|
95
|
+
// commented out because it will cause a crash: callback should be a MethodResult, not char*
|
96
|
+
//return rho_sync_login(login, password, callback);
|
97
|
+
return 0;
|
98
|
+
}
|
99
|
+
|
100
|
+
virtual void logout() {
|
101
|
+
rho_sync_logout();
|
102
|
+
}
|
103
|
+
|
104
|
+
virtual void stop() {
|
105
|
+
rho_sync_stop();
|
106
|
+
}
|
107
|
+
|
108
|
+
virtual void set_bulksyncstate( int new_state ) {
|
109
|
+
rho_sync_set_bulksyncstate(new_state);
|
110
|
+
}
|
111
|
+
|
112
|
+
virtual bool has_bulksyncstate() {
|
113
|
+
return rho_sync_has_bulksyncstate();
|
114
|
+
}
|
115
|
+
|
116
|
+
virtual int get_bulksyncstate() {
|
117
|
+
return rho_sync_get_bulksyncstate();
|
118
|
+
}
|
119
|
+
|
120
|
+
virtual int set_pollinterval( int interval ) {
|
121
|
+
return rho_sync_set_pollinterval(interval);
|
122
|
+
}
|
123
|
+
|
124
|
+
virtual int get_pollinterval() {
|
125
|
+
return rho_sync_get_pollinterval();
|
126
|
+
}
|
127
|
+
|
128
|
+
virtual void set_syncserver( const char* syncserver ) {
|
129
|
+
rho_sync_set_syncserver(syncserver);
|
130
|
+
}
|
131
|
+
|
132
|
+
virtual int get_pagesize() {
|
133
|
+
return rho_sync_get_pagesize();
|
134
|
+
}
|
135
|
+
|
136
|
+
virtual void set_pagesize(int nPageSize) {
|
137
|
+
rho_sync_set_pagesize(nPageSize);
|
138
|
+
}
|
139
|
+
|
140
|
+
virtual int get_lastsync_objectcount(int nSrcID) {
|
141
|
+
return rho_sync_get_lastsync_objectcount(nSrcID);
|
142
|
+
}
|
143
|
+
|
144
|
+
virtual int issyncing() {
|
145
|
+
return rho_sync_issyncing();
|
146
|
+
}
|
147
|
+
|
148
|
+
virtual void enable_status_popup(int b) {
|
149
|
+
rho_sync_enable_status_popup(b);
|
150
|
+
}
|
151
|
+
|
152
|
+
virtual void set_threaded_mode(int b) {
|
153
|
+
rho_sync_set_threaded_mode(b);
|
154
|
+
}
|
155
|
+
|
156
|
+
virtual void register_push() {
|
157
|
+
rho_sync_register_push();
|
158
|
+
}
|
159
|
+
|
160
|
+
virtual void set_ssl_verify_peer(int b) {
|
161
|
+
rho_sync_set_ssl_verify_peer(b);
|
162
|
+
}
|
163
|
+
|
164
|
+
virtual void setobjectnotify_url(const char* szUrl) {
|
165
|
+
rho_sync_setobjectnotify_url(szUrl);
|
166
|
+
}
|
167
|
+
|
168
|
+
virtual void cleanobjectnotify() {
|
169
|
+
rho_sync_cleanobjectnotify();
|
170
|
+
}
|
171
|
+
|
172
|
+
virtual void clear_notification(int srcID) {
|
173
|
+
rho_sync_clear_notification(srcID);
|
174
|
+
}
|
175
|
+
|
176
|
+
virtual void set_source_property(int srcID, const char* propName, const char* propValue) {
|
177
|
+
rho_sync_set_source_property(srcID, propName, propValue);
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
};
|
182
|
+
|
183
|
+
RhoConnectClientRhodesInterfaceImpl g_client;
|
184
|
+
|
185
|
+
namespace rho {
|
186
|
+
|
187
|
+
class RhoConnectClientFactory : public CRhoConnectClientFactoryBase
|
188
|
+
{
|
189
|
+
public:
|
190
|
+
RhoConnectClientFactory(){}
|
191
|
+
|
192
|
+
IRhoConnectClientSingleton* createModuleSingleton(){ return new RhoConnectClientImpl(); }
|
193
|
+
};
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
extern "C" {
|
198
|
+
|
199
|
+
void initRhoconnectClient() {
|
200
|
+
RHODESAPP().getExtManager().requireRubyFile("RhoConnectClient");
|
201
|
+
|
202
|
+
rho::RhoConnectClientFactory::setInstance( new rho::RhoConnectClientFactory() );
|
203
|
+
|
204
|
+
rho::sync::RhoconnectClientManager::setRhoconnectClientImpl( &g_client );
|
205
|
+
}
|
206
|
+
|
207
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#ifdef __cplusplus
|
2
|
+
extern "C" {
|
3
|
+
#endif
|
4
|
+
|
5
|
+
#include "logging/RhoLog.h"
|
6
|
+
|
7
|
+
extern void Init_RhoConnectClient_API(void);
|
8
|
+
extern void initRhoconnectClient();
|
9
|
+
|
10
|
+
// this method executed once on start of program
|
11
|
+
void Init_Rhoconnectclient_extension(void) {
|
12
|
+
Init_RhoConnectClient_API();
|
13
|
+
initRhoconnectClient();
|
14
|
+
}
|
15
|
+
|
16
|
+
#ifdef __cplusplus
|
17
|
+
} //extern "C"
|
18
|
+
#endif
|
@@ -0,0 +1,398 @@
|
|
1
|
+
/*------------------------------------------------------------------------
|
2
|
+
* (The MIT License)
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008-2011 Rhomobile, Inc.
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
11
|
+
* furnished to do so, subject to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
14
|
+
* all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
* THE SOFTWARE.
|
23
|
+
*
|
24
|
+
* http://rhomobile.com
|
25
|
+
|
26
|
+
* Copyright (c) 2011-2016 Symbol Technologies, Inc.
|
27
|
+
*
|
28
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
29
|
+
* of this software and associated documentation files (the "Software"), to deal
|
30
|
+
* in the Software without restriction, including without limitation the rights
|
31
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
32
|
+
* copies of the Software, and to permit persons to whom the Software is
|
33
|
+
* furnished to do so, subject to the following conditions:
|
34
|
+
*
|
35
|
+
* The above copyright notice and this permission notice shall be included in
|
36
|
+
* all copies or substantial portions of the Software.
|
37
|
+
*
|
38
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
39
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
40
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
41
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
42
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
43
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
44
|
+
* THE SOFTWARE.
|
45
|
+
*
|
46
|
+
* http://symbol.com
|
47
|
+
*------------------------------------------------------------------------*/
|
48
|
+
|
49
|
+
#include "ClientRegister.h"
|
50
|
+
#include "SyncThread.h"
|
51
|
+
#include "sync/ILoginListener.h"
|
52
|
+
#include "common/RhoConf.h"
|
53
|
+
#include "common/RhodesApp.h"
|
54
|
+
#include "System.h"
|
55
|
+
#include "Push.h"
|
56
|
+
|
57
|
+
rho::String rho_sysimpl_get_phone_id();
|
58
|
+
|
59
|
+
namespace rho{
|
60
|
+
namespace sync{
|
61
|
+
|
62
|
+
using namespace rho::common;
|
63
|
+
using namespace rho::db;
|
64
|
+
|
65
|
+
static const int THREAD_WAIT_TIMEOUT = 10;
|
66
|
+
|
67
|
+
|
68
|
+
IMPLEMENT_LOGCLASS(CClientRegister,"ClientRegister");
|
69
|
+
|
70
|
+
CClientRegister* CClientRegister::m_pInstance = 0;
|
71
|
+
bool CClientRegister::s_sslVerifyPeer = true;
|
72
|
+
VectorPtr<ILoginListener*> CClientRegister::s_loginListeners;
|
73
|
+
|
74
|
+
/*static*/ CClientRegister* CClientRegister::Get()
|
75
|
+
{
|
76
|
+
if (!m_pInstance)
|
77
|
+
{
|
78
|
+
m_pInstance = new CClientRegister();
|
79
|
+
}
|
80
|
+
return m_pInstance;
|
81
|
+
}
|
82
|
+
|
83
|
+
/*static*/ CClientRegister* CClientRegister::Create()
|
84
|
+
{
|
85
|
+
LOG(TRACE) + "Starting ClientRegister";
|
86
|
+
Get()->startUp();
|
87
|
+
return m_pInstance;
|
88
|
+
}
|
89
|
+
|
90
|
+
/*static*/ CClientRegister* CClientRegister::Create(const String& devicePin)
|
91
|
+
{
|
92
|
+
Get()->setDevicehPin(devicePin);
|
93
|
+
return m_pInstance;
|
94
|
+
}
|
95
|
+
|
96
|
+
/*static*/ void CClientRegister::Stop()
|
97
|
+
{
|
98
|
+
if(m_pInstance)
|
99
|
+
{
|
100
|
+
m_pInstance->doStop();
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
/*static*/ void CClientRegister::Destroy()
|
105
|
+
{
|
106
|
+
if ( m_pInstance )
|
107
|
+
delete m_pInstance;
|
108
|
+
|
109
|
+
m_pInstance = 0;
|
110
|
+
}
|
111
|
+
|
112
|
+
/*static*/ void CClientRegister::SetSslVerifyPeer(boolean b)
|
113
|
+
{
|
114
|
+
s_sslVerifyPeer = b;
|
115
|
+
if (m_pInstance)
|
116
|
+
m_pInstance->m_NetRequest.setSslVerifyPeer(b);
|
117
|
+
}
|
118
|
+
|
119
|
+
bool CClientRegister::GetSslVerifyPeer()
|
120
|
+
{
|
121
|
+
return s_sslVerifyPeer;
|
122
|
+
}
|
123
|
+
|
124
|
+
/*static*/void CClientRegister::AddLoginListener(ILoginListener* listener)
|
125
|
+
{
|
126
|
+
s_loginListeners.addElement(listener);
|
127
|
+
}
|
128
|
+
|
129
|
+
CClientRegister::CClientRegister() : m_nPollInterval(POLL_INTERVAL_SECONDS), m_state(stRegister)
|
130
|
+
{
|
131
|
+
m_NetRequest.setSslVerifyPeer(s_sslVerifyPeer);
|
132
|
+
}
|
133
|
+
|
134
|
+
CClientRegister::~CClientRegister()
|
135
|
+
{
|
136
|
+
doStop();
|
137
|
+
m_pInstance = null;
|
138
|
+
}
|
139
|
+
void CClientRegister::setRhoconnectCredentials(const String& user, const String& pass, const String& session)
|
140
|
+
{
|
141
|
+
LOG(INFO) + "New Sync credentials - user: " + user + ", sess: " + session;
|
142
|
+
|
143
|
+
setState(stRegister);
|
144
|
+
|
145
|
+
notifyLoggedIn(user,pass,session);
|
146
|
+
|
147
|
+
startUp();
|
148
|
+
}
|
149
|
+
|
150
|
+
void CClientRegister::dropRhoconnectCredentials(const String& session,const String& clientID)
|
151
|
+
{
|
152
|
+
LOG(INFO) + "Dropping credentials - sess: " + session;
|
153
|
+
|
154
|
+
setState(stUnregister);
|
155
|
+
|
156
|
+
m_unregisterSession = session;
|
157
|
+
m_unregisterClientID = clientID;
|
158
|
+
|
159
|
+
notifyLoggedOut(session);
|
160
|
+
|
161
|
+
startUp();
|
162
|
+
}
|
163
|
+
|
164
|
+
void CClientRegister::notifyLoggedIn(const String& user, const String& pass, const String& session)
|
165
|
+
{
|
166
|
+
for(VectorPtr<ILoginListener*>::iterator I = s_loginListeners.begin(); I != s_loginListeners.end(); ++I)
|
167
|
+
{
|
168
|
+
(*I)->onLogin(user, pass, session);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
void CClientRegister::notifyLoggedOut(const String& session)
|
173
|
+
{
|
174
|
+
for(VectorPtr<ILoginListener*>::iterator I = s_loginListeners.begin(); I != s_loginListeners.end(); ++I)
|
175
|
+
{
|
176
|
+
(*I)->onLogout(session);
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
void CClientRegister::setDevicehPin(const String& pin)
|
181
|
+
{
|
182
|
+
m_strDevicePin = pin;
|
183
|
+
|
184
|
+
if (pin.length() > 0)
|
185
|
+
{
|
186
|
+
startUp();
|
187
|
+
} else
|
188
|
+
{
|
189
|
+
doStop();
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
void CClientRegister::startUp()
|
194
|
+
{
|
195
|
+
if ( RHOCONF().getString("syncserver").length() > 0 )
|
196
|
+
{
|
197
|
+
LOG(INFO) + "Starting ClientRegister...";
|
198
|
+
|
199
|
+
start(epLow);
|
200
|
+
stopWait();
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
void CClientRegister::run()
|
205
|
+
{
|
206
|
+
unsigned i = 0;
|
207
|
+
LOG(INFO)+"ClientRegister is started";
|
208
|
+
while(!isStopping())
|
209
|
+
{
|
210
|
+
i++;
|
211
|
+
LOG(INFO)+"Try to (un)register: " + i;
|
212
|
+
if ( CSyncThread::getInstance() != null )
|
213
|
+
{
|
214
|
+
EnState state = getState();
|
215
|
+
if ( (stRegister==state) && doRegister(CSyncThread::getSyncEngine()) )
|
216
|
+
{
|
217
|
+
LOG(INFO)+"Registered: " + i;
|
218
|
+
break;
|
219
|
+
} else if ( (stUnregister==state) && doUnregister(CSyncThread::getSyncEngine()) ) {
|
220
|
+
LOG(INFO)+"Unregistered: " + i;
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
} else
|
224
|
+
LOG(INFO)+"SyncThread is not ready";
|
225
|
+
|
226
|
+
LOG(INFO)+"Waiting for "+ m_nPollInterval+ " sec to try again to register client";
|
227
|
+
wait(m_nPollInterval*1000);
|
228
|
+
}
|
229
|
+
LOG(INFO)+"ClientRegister thread shutdown";
|
230
|
+
}
|
231
|
+
|
232
|
+
String CClientRegister::getRegisterBody(const String& strClientID)
|
233
|
+
{
|
234
|
+
String strPushType = rho::push::CPushManager::getInstance()->getDefaultID();
|
235
|
+
if(strPushType == "rhoconnect")
|
236
|
+
{
|
237
|
+
strPushType = "rhoconnect_push";
|
238
|
+
}
|
239
|
+
|
240
|
+
int port = RHOCONF().getInt("push_port");
|
241
|
+
|
242
|
+
String body = CSyncThread::getSyncEngine().getProtocol().getClientRegisterBody( strClientID, m_strDevicePin,
|
243
|
+
port > 0 ? port : DEFAULT_PUSH_PORT, rho_rhodesapp_getplatform(), rho::System::getPhoneId(),
|
244
|
+
strPushType);
|
245
|
+
|
246
|
+
LOG(INFO)+"getRegisterBody() BODY is: " + body;
|
247
|
+
return body;
|
248
|
+
}
|
249
|
+
|
250
|
+
String CClientRegister::getUnregisterBody(const String& strClientID)
|
251
|
+
{
|
252
|
+
String body = CSyncThread::getSyncEngine().getProtocol().getClientRegisterBody( strClientID, "", 0, "", "", "" );
|
253
|
+
LOG(INFO)+"getUnregisterBody() BODY is: " + body;
|
254
|
+
return body;
|
255
|
+
}
|
256
|
+
|
257
|
+
boolean CClientRegister::doRegister(CSyncEngine& oSync)
|
258
|
+
{
|
259
|
+
String session = oSync.loadSession();
|
260
|
+
if ( session.length() == 0 )
|
261
|
+
{
|
262
|
+
m_nPollInterval = POLL_INTERVAL_INFINITE;
|
263
|
+
LOG(INFO)+"Session is empty, do register later";
|
264
|
+
return false;
|
265
|
+
}
|
266
|
+
|
267
|
+
if ( m_strDevicePin.length() == 0 )
|
268
|
+
{
|
269
|
+
notifyLoggedIn("","",session);
|
270
|
+
m_nPollInterval = POLL_INTERVAL_INFINITE;
|
271
|
+
LOG(INFO)+"Device PUSH pin is empty, do register later";
|
272
|
+
return false;
|
273
|
+
}
|
274
|
+
m_nPollInterval = POLL_INTERVAL_SECONDS;
|
275
|
+
|
276
|
+
String client_id = oSync.loadClientID();
|
277
|
+
if ( client_id.length() == 0 )
|
278
|
+
{
|
279
|
+
LOG(WARNING)+"Sync client_id is empty, do register later";
|
280
|
+
return false;
|
281
|
+
}
|
282
|
+
|
283
|
+
IDBResult res = CDBAdapter::getUserDB().executeSQL("SELECT token,token_sent from client_info");
|
284
|
+
if ( !res.isEnd() ) {
|
285
|
+
String token = res.getStringByIdx(0);
|
286
|
+
int token_sent = res.getIntByIdx(1) && !RHOCONF().getBool("register_push_at_startup");
|
287
|
+
|
288
|
+
if ( m_strDevicePin.compare(token) == 0 && token_sent > 0 )
|
289
|
+
{
|
290
|
+
//token in db same as new one and it was already send to the server
|
291
|
+
//so we do nothing
|
292
|
+
|
293
|
+
return true;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
String strBody = getRegisterBody(client_id);
|
298
|
+
NetResponse resp = getNet().pushData( oSync.getProtocol().getClientRegisterUrl(client_id), strBody, &oSync );
|
299
|
+
if( resp.isOK() )
|
300
|
+
{
|
301
|
+
CDBAdapter::getUserDB().executeSQL("UPDATE client_info SET token_sent=?, token=?", 1, m_strDevicePin );
|
302
|
+
LOG(INFO)+"Registered client sucessfully...";
|
303
|
+
|
304
|
+
return true;
|
305
|
+
|
306
|
+
}
|
307
|
+
|
308
|
+
LOG(WARNING)+"Network error: "+ resp.getRespCode();
|
309
|
+
return false;
|
310
|
+
}
|
311
|
+
|
312
|
+
boolean CClientRegister::doUnregister(CSyncEngine& oSync)
|
313
|
+
{
|
314
|
+
String session = m_unregisterSession;
|
315
|
+
if ( session.length() == 0 )
|
316
|
+
{
|
317
|
+
m_unregisterSession = "";
|
318
|
+
m_unregisterClientID = "";
|
319
|
+
|
320
|
+
LOG(INFO)+"Session is empty, don't need to unregister";
|
321
|
+
return true;
|
322
|
+
}
|
323
|
+
|
324
|
+
m_nPollInterval = POLL_INTERVAL_SECONDS;
|
325
|
+
|
326
|
+
String client_id = m_unregisterClientID;
|
327
|
+
if ( client_id.length() == 0 )
|
328
|
+
{
|
329
|
+
m_unregisterSession = "";
|
330
|
+
m_unregisterClientID = "";
|
331
|
+
|
332
|
+
LOG(WARNING)+"Sync client_id is empty, don't need to unregister";
|
333
|
+
return true;
|
334
|
+
}
|
335
|
+
|
336
|
+
String strBody = getUnregisterBody(client_id);
|
337
|
+
LOG(INFO)+"Unregistered client with body = " + strBody;
|
338
|
+
|
339
|
+
class UnregisterSession : public net::IRhoSession {
|
340
|
+
String m_session;
|
341
|
+
String m_contentType;
|
342
|
+
public:
|
343
|
+
UnregisterSession(const String& session, const String& contentType) : m_session(session), m_contentType(contentType) {}
|
344
|
+
virtual void logout() {}
|
345
|
+
virtual const String& getSession() {
|
346
|
+
return m_session;
|
347
|
+
}
|
348
|
+
virtual const String& getContentType() {
|
349
|
+
return m_contentType;
|
350
|
+
}
|
351
|
+
};
|
352
|
+
|
353
|
+
UnregisterSession unregSession(session, oSync.getProtocol().getContentType() );
|
354
|
+
|
355
|
+
NetResponse resp = getNet().pushData( oSync.getProtocol().getClientRegisterUrl(client_id), strBody, &unregSession );
|
356
|
+
if( resp.isOK() )
|
357
|
+
{
|
358
|
+
m_unregisterSession = "";
|
359
|
+
m_unregisterClientID = "";
|
360
|
+
|
361
|
+
CDBAdapter::getUserDB().executeSQL("UPDATE client_info SET token_sent=?", 0 );
|
362
|
+
LOG(INFO)+"Unregistered client sucessfully...";
|
363
|
+
|
364
|
+
return true;
|
365
|
+
|
366
|
+
}
|
367
|
+
|
368
|
+
LOG(WARNING)+"Network error: "+ resp.getRespCode();
|
369
|
+
return false;
|
370
|
+
}
|
371
|
+
|
372
|
+
void CClientRegister::setState( EnState st ) {
|
373
|
+
synchronized(m_mxStateAccess)
|
374
|
+
{
|
375
|
+
m_state = st;
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
CClientRegister::EnState CClientRegister::getState() {
|
380
|
+
EnState state = stRegister;
|
381
|
+
synchronized(m_mxStateAccess)
|
382
|
+
{
|
383
|
+
state = m_state;
|
384
|
+
}
|
385
|
+
|
386
|
+
return state;
|
387
|
+
}
|
388
|
+
|
389
|
+
void CClientRegister::doStop()
|
390
|
+
{
|
391
|
+
LOG(INFO) + "Stopping ClientRegister...";
|
392
|
+
|
393
|
+
m_NetRequest.cancel();
|
394
|
+
stop(WAIT_BEFOREKILL_SECONDS);
|
395
|
+
}
|
396
|
+
|
397
|
+
}
|
398
|
+
}
|