rhodes 2.0.0.beta2 → 2.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +2 -0
- data/Manifest.txt +27 -148
- data/Rakefile +49 -3
- data/lib/framework/builtinME.rb +6 -0
- data/lib/framework/rho/render.rb +13 -8
- data/lib/framework/rho/rho.rb +97 -43
- data/lib/framework/rho/rhoapplication.rb +8 -3
- data/lib/framework/rho/rhocontroller.rb +1 -1
- data/lib/framework/rhodes-framework.rb +1 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +7 -22
- data/lib/framework/rhofsconnector.rb +1 -1
- data/lib/framework/rholang/localization_simplified.rb +2 -2
- data/lib/framework/rhom/rhom.rb +1 -0
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -2
- data/lib/framework/rhom/rhom_model.rb +98 -0
- data/lib/framework/rhom/rhom_object_factory.rb +13 -12
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/jni/include/{JNIRhodes.h → rhodes/JNIRhodes.h} +3 -54
- data/platform/android/Rhodes/jni/include/{RhoClassFactory.h → rhodes/RhoClassFactory.h} +0 -0
- data/platform/android/Rhodes/jni/include/{SystemInfoImpl.h → rhodes/SystemInfoImpl.h} +0 -0
- data/platform/android/Rhodes/jni/include/{details → rhodes/details}/rhojava.inc +1 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_Logger.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_RhoConf.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_RhoLogConf.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_RhoMenu.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_Rhodes.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_SplashScreen.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_alert_Alert.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_camera_Camera.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_datetime_DateTimePicker.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_geolocation_GeoLocationImpl.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_socket_RhoSocketImpl.h +0 -0
- data/platform/android/Rhodes/jni/include/{jni → rhodes/jni}/com_rhomobile_rhodes_socket_SSLImpl.h +0 -0
- data/platform/android/Rhodes/jni/include/{sslimpl.h → rhodes/sslimpl.h} +0 -0
- data/platform/android/Rhodes/jni/include/rhodes.h +59 -0
- data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +3 -3
- data/platform/android/Rhodes/jni/src/alert.cpp +2 -2
- data/platform/android/Rhodes/jni/src/callbacks.cpp +4 -3
- data/platform/android/Rhodes/jni/src/camera.cpp +2 -2
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +2 -2
- data/platform/android/Rhodes/jni/src/geolocation.cpp +2 -2
- data/platform/android/Rhodes/jni/src/logconf.cpp +2 -2
- data/platform/android/Rhodes/jni/src/logger.cpp +2 -2
- data/platform/android/Rhodes/jni/src/mapview.cpp +1 -1
- data/platform/android/Rhodes/jni/src/menu.cpp +2 -2
- data/platform/android/Rhodes/jni/src/nativebar.cpp +1 -1
- data/platform/android/Rhodes/jni/src/navbar.cpp +17 -3
- data/platform/android/Rhodes/jni/src/phonebook.cpp +1 -1
- data/platform/android/Rhodes/jni/src/rhoconf.cpp +2 -2
- data/platform/android/Rhodes/jni/src/rhodes.cpp +3 -3
- data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
- data/platform/android/Rhodes/jni/src/socketimpl.cpp +2 -2
- data/platform/android/Rhodes/jni/src/splashscreen.cpp +2 -2
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -3
- data/platform/android/Rhodes/jni/src/syncengine.cpp +2 -2
- data/platform/android/Rhodes/jni/src/webview.cpp +15 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeLibraries.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NavBar.java +52 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +8 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +26 -28
- data/platform/android/build/RhodesSRC_build.files +21 -20
- data/platform/android/build/android.rake +69 -24
- data/platform/android/build/androidcommon.rb +17 -12
- data/platform/bb/build/bb.rake +23 -21
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +5 -2
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +6 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +9 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +31 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +17 -6
- data/platform/bb/rhodes/src/rhomobile/Utilities.java +6 -0
- data/platform/iphone/Classes/AppManager/AppManager.m +16 -4
- data/platform/iphone/Classes/DateTime.h +5 -6
- data/platform/iphone/Classes/DateTimePicker.m +4 -18
- data/platform/iphone/Classes/DateTimePickerDelegate.h +7 -9
- data/platform/iphone/Classes/DateTimePickerDelegate.m +141 -152
- data/platform/iphone/Classes/Rhodes.h +6 -1
- data/platform/iphone/Classes/Rhodes.m +17 -43
- data/platform/iphone/Classes/SimpleMainView.h +1 -1
- data/platform/iphone/Classes/SimpleMainView.m +54 -4
- data/platform/iphone/Classes/WebView.m +17 -0
- data/platform/iphone/rbuild/iphone.rake +1 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +0 -45
- data/platform/shared/common/PosixThreadImpl.cpp +8 -0
- data/platform/shared/common/PosixThreadImpl.h +1 -0
- data/platform/shared/common/RhoThread.cpp +1 -0
- data/platform/shared/common/RhoThread.h +4 -2
- data/platform/shared/curl/include/curl/curl.h +4 -0
- data/platform/shared/db/DBAdapter.cpp +47 -60
- data/platform/shared/db/DBAdapter.h +6 -2
- data/platform/shared/net/AsyncHttp.cpp +27 -11
- data/platform/shared/net/AsyncHttp.h +3 -1
- data/platform/shared/net/CURLNetRequest.cpp +11 -10
- data/platform/shared/net/CURLNetRequest.h +6 -4
- data/platform/shared/net/HttpServer.cpp +11 -6
- data/platform/shared/ruby/ext/asynchttp/asynchttp.i +2 -2
- data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +22 -11
- data/platform/shared/ruby/ext/rho/rhoruby.c +2 -2
- data/platform/shared/ruby/ext/rho/rhosupport.c +23 -3
- data/platform/shared/ruby/ext/webview/webview.i +4 -0
- data/platform/shared/ruby/ext/webview/webview_wrap.c +39 -0
- data/platform/shared/ruby/re.c +8 -0
- data/platform/shared/ruby/string.c +1 -1
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoClassFactory.java +6 -1
- data/platform/shared/rubyJVM/src/com/rho/RhoThread.java +3 -0
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +34 -0
- data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +40 -53
- data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +32 -15
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +31 -17
- data/platform/shared/rubyJVM/src/com/rho/net/RhoConnection.java +3 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONArrayIterator.java +17 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +158 -137
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +18 -17
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +10 -2
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubyFile_Methods.java +6 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyFile.java +18 -3
- data/platform/shared/rubyJVM/src/j2me/io/File.java +37 -9
- data/platform/shared/sqlite/sqlite3.c +14613 -13016
- data/platform/shared/sqlite/sqlite3.h +1461 -1499
- data/platform/shared/sqlite/sqlite3ext.h +0 -2
- data/platform/shared/sync/ClientRegister.cpp +3 -3
- data/platform/shared/sync/ClientRegister.h +2 -1
- data/platform/shared/sync/SyncEngine.cpp +20 -8
- data/platform/shared/sync/SyncSource.cpp +12 -12
- data/platform/shared/sync/SyncSource.h +4 -4
- data/platform/shared/sync/SyncThread.cpp +8 -1
- data/platform/shared/tcmalloc/rhomem.h +3 -0
- data/platform/shared/tcmalloc/tcmalloc_.cpp +11 -0
- data/platform/wm/rhodes/Alert.cpp +148 -101
- data/platform/wm/rhodes/Alert.h +4 -1
- data/platform/wm/rhodes/AppManager.cpp +212 -72
- data/platform/wm/rhodes/AppManager.h +24 -3
- data/platform/wm/rhodes/DateTimePicker.cpp +23 -11
- data/platform/wm/rhodes/DateTimePicker.h +16 -5
- data/platform/wm/rhodes/MainWindow.cpp +22 -7
- data/platform/wm/rhodes/OkCancelModalDialog.h +63 -0
- data/platform/wm/rhodes/Rhodes.cpp +29 -17
- data/platform/wm/rhodes/phonebook/NativeAddressBook.cpp +128 -4
- data/platform/wm/rhodes/phonebook/NativeAddressBook.h +33 -3
- data/platform/wm/rhodes/resource.h +1 -1
- data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +5 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +136 -102
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +12 -5
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +24 -10
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +6 -0
- data/platform/wm/rhodes/rhodes.vcproj +4 -0
- data/platform/wm/tools/detool/detool.cpp +17 -4
- data/rakefile.rb +49 -3
- data/res/build-tools/db/syncdb.schema +2 -2
- data/res/build-tools/detool.exe +0 -0
- data/res/generators/rhogen.rb +10 -10
- data/res/generators/templates/application/app/helpers/browser_helper.rb +9 -4
- data/res/generators/templates/application/app/index.bb.erb +5 -5
- data/res/generators/templates/application/build.yml +1 -0
- data/res/generators/templates/application/public/css/android.css +10 -8
- data/res/generators/templates/application/public/css/blackberry.css +40 -31
- data/res/generators/templates/application/public/css/iphone.css +4 -4
- data/res/generators/templates/application/public/css/webkit.css +7 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +31 -27
- data/res/generators/templates/application/rhoconfig.txt +2 -2
- data/res/generators/templates/model/edit.bb.erb +2 -2
- data/res/generators/templates/model/index.bb.erb +6 -4
- data/res/generators/templates/model/model.rb +2 -1
- data/res/generators/templates/model/new.bb.erb +2 -2
- data/res/generators/templates/model/show.bb.erb +2 -2
- data/rhobuild.yml +37 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/Account/account.rb +7 -0
- data/spec/framework_spec/app/Case/case.rb +6 -0
- data/spec/framework_spec/app/Customer/customer.rb +6 -0
- data/spec/framework_spec/app/Product/product.rb +9 -0
- data/spec/framework_spec/app/spec/rhom_object_spec.rb +1 -1
- data/spec/framework_spec/app/spec/syncengine_spec.rb +2 -1
- metadata +45 -151
- data/lib/build/manifest/createAppManifest.rb +0 -18
- data/lib/build/tasks/android.rake +0 -317
- data/lib/build/tasks/blackberry.rake +0 -355
- data/lib/build/tasks/common.rake +0 -62
- data/lib/build/tasks/iphone.rake +0 -108
- data/lib/build/tasks/linux.rake +0 -81
- data/lib/build/tasks/rhodes-build.rb +0 -11
- data/lib/build/tasks/rspec.rake +0 -20
- data/lib/build/tasks/symbian.rake +0 -202
- data/lib/build/tasks/wm.rake +0 -166
- data/lib/framework/ServeME.rb +0 -7
- data/platform/bb/build/MANIFEST.MF +0 -12
- data/platform/iphone/Classes/DateTimePicker.h +0 -17
- data/res/generators/templates/application/public/icons/Read me first - license.txt +0 -14
- data/res/generators/templates/application/public/icons/about.png +0 -0
- data/res/generators/templates/application/public/icons/airplane.png +0 -0
- data/res/generators/templates/application/public/icons/baby.png +0 -0
- data/res/generators/templates/application/public/icons/badge.png +0 -0
- data/res/generators/templates/application/public/icons/bandaid.png +0 -0
- data/res/generators/templates/application/public/icons/bar-chart.png +0 -0
- data/res/generators/templates/application/public/icons/battery.png +0 -0
- data/res/generators/templates/application/public/icons/beaker.png +0 -0
- data/res/generators/templates/application/public/icons/beaker2.png +0 -0
- data/res/generators/templates/application/public/icons/beermug.png +0 -0
- data/res/generators/templates/application/public/icons/bird.png +0 -0
- data/res/generators/templates/application/public/icons/book.png +0 -0
- data/res/generators/templates/application/public/icons/bookmark.png +0 -0
- data/res/generators/templates/application/public/icons/brightness.png +0 -0
- data/res/generators/templates/application/public/icons/bug.png +0 -0
- data/res/generators/templates/application/public/icons/cabinet.png +0 -0
- data/res/generators/templates/application/public/icons/calendar.png +0 -0
- data/res/generators/templates/application/public/icons/camera.png +0 -0
- data/res/generators/templates/application/public/icons/changeName.rb +0 -22
- data/res/generators/templates/application/public/icons/chat2.png +0 -0
- data/res/generators/templates/application/public/icons/chicken.png +0 -0
- data/res/generators/templates/application/public/icons/clock.png +0 -0
- data/res/generators/templates/application/public/icons/cloud.png +0 -0
- data/res/generators/templates/application/public/icons/coffee.png +0 -0
- data/res/generators/templates/application/public/icons/compass.png +0 -0
- data/res/generators/templates/application/public/icons/contrast.png +0 -0
- data/res/generators/templates/application/public/icons/dashboard.png +0 -0
- data/res/generators/templates/application/public/icons/display.png +0 -0
- data/res/generators/templates/application/public/icons/dogpaw.png +0 -0
- data/res/generators/templates/application/public/icons/download.png +0 -0
- data/res/generators/templates/application/public/icons/dumbbell.png +0 -0
- data/res/generators/templates/application/public/icons/ekg.png +0 -0
- data/res/generators/templates/application/public/icons/envelope.png +0 -0
- data/res/generators/templates/application/public/icons/equalizer.png +0 -0
- data/res/generators/templates/application/public/icons/eye.png +0 -0
- data/res/generators/templates/application/public/icons/film-roll.png +0 -0
- data/res/generators/templates/application/public/icons/flag.png +0 -0
- data/res/generators/templates/application/public/icons/fork-and-knife.png +0 -0
- data/res/generators/templates/application/public/icons/fuel.png +0 -0
- data/res/generators/templates/application/public/icons/gameplan.png +0 -0
- data/res/generators/templates/application/public/icons/gear.png +0 -0
- data/res/generators/templates/application/public/icons/gear2.png +0 -0
- data/res/generators/templates/application/public/icons/gift.png +0 -0
- data/res/generators/templates/application/public/icons/heart.png +0 -0
- data/res/generators/templates/application/public/icons/house.png +0 -0
- data/res/generators/templates/application/public/icons/inbox.png +0 -0
- data/res/generators/templates/application/public/icons/index-cards.png +0 -0
- data/res/generators/templates/application/public/icons/iphone.png +0 -0
- data/res/generators/templates/application/public/icons/ipod.png +0 -0
- data/res/generators/templates/application/public/icons/key.png +0 -0
- data/res/generators/templates/application/public/icons/lifebuoy.png +0 -0
- data/res/generators/templates/application/public/icons/lightbulb.png +0 -0
- data/res/generators/templates/application/public/icons/line-chart.png +0 -0
- data/res/generators/templates/application/public/icons/location.png +0 -0
- data/res/generators/templates/application/public/icons/lock.png +0 -0
- data/res/generators/templates/application/public/icons/loopback.png +0 -0
- data/res/generators/templates/application/public/icons/magnifying-glass.png +0 -0
- data/res/generators/templates/application/public/icons/map-marker.png +0 -0
- data/res/generators/templates/application/public/icons/map.png +0 -0
- data/res/generators/templates/application/public/icons/medical-bag.png +0 -0
- data/res/generators/templates/application/public/icons/medical.png +0 -0
- data/res/generators/templates/application/public/icons/microphone.png +0 -0
- data/res/generators/templates/application/public/icons/movie1.png +0 -0
- data/res/generators/templates/application/public/icons/movie2.png +0 -0
- data/res/generators/templates/application/public/icons/network.png +0 -0
- data/res/generators/templates/application/public/icons/note.png +0 -0
- data/res/generators/templates/application/public/icons/outlet.png +0 -0
- data/res/generators/templates/application/public/icons/palette.png +0 -0
- data/res/generators/templates/application/public/icons/paperclip.png +0 -0
- data/res/generators/templates/application/public/icons/phone.png +0 -0
- data/res/generators/templates/application/public/icons/photos.png +0 -0
- data/res/generators/templates/application/public/icons/piano.png +0 -0
- data/res/generators/templates/application/public/icons/picture-frame.png +0 -0
- data/res/generators/templates/application/public/icons/pill.png +0 -0
- data/res/generators/templates/application/public/icons/pin.png +0 -0
- data/res/generators/templates/application/public/icons/pinetree.png +0 -0
- data/res/generators/templates/application/public/icons/planet.png +0 -0
- data/res/generators/templates/application/public/icons/puzzle.png +0 -0
- data/res/generators/templates/application/public/icons/radar.png +0 -0
- data/res/generators/templates/application/public/icons/redo.png +0 -0
- data/res/generators/templates/application/public/icons/refresh.png +0 -0
- data/res/generators/templates/application/public/icons/runner.png +0 -0
- data/res/generators/templates/application/public/icons/shoebox.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-bag.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-cart.png +0 -0
- data/res/generators/templates/application/public/icons/shuffle.png +0 -0
- data/res/generators/templates/application/public/icons/signpost.png +0 -0
- data/res/generators/templates/application/public/icons/skull-n-crossbones.png +0 -0
- data/res/generators/templates/application/public/icons/skull.png +0 -0
- data/res/generators/templates/application/public/icons/sliders.png +0 -0
- data/res/generators/templates/application/public/icons/spraycan.png +0 -0
- data/res/generators/templates/application/public/icons/squiggle.png +0 -0
- data/res/generators/templates/application/public/icons/star.png +0 -0
- data/res/generators/templates/application/public/icons/stopwatch.png +0 -0
- data/res/generators/templates/application/public/icons/suitcase.png +0 -0
- data/res/generators/templates/application/public/icons/tag.png +0 -0
- data/res/generators/templates/application/public/icons/tags.png +0 -0
- data/res/generators/templates/application/public/icons/target.png +0 -0
- data/res/generators/templates/application/public/icons/testtube.png +0 -0
- data/res/generators/templates/application/public/icons/thermometer.png +0 -0
- data/res/generators/templates/application/public/icons/toolbox.png +0 -0
- data/res/generators/templates/application/public/icons/trophy.png +0 -0
- data/res/generators/templates/application/public/icons/tshirt.png +0 -0
- data/res/generators/templates/application/public/icons/tv.png +0 -0
- data/res/generators/templates/application/public/icons/umbrella.png +0 -0
- data/res/generators/templates/application/public/icons/walk.png +0 -0
- data/res/generators/templates/application/public/icons/weather.png +0 -0
- data/res/generators/templates/application/public/icons/widescreen.png +0 -0
- data/res/generators/templates/application/public/icons/wineglass.png +0 -0
- data/res/generators/templates/application/public/icons/zap.png +0 -0
- data/res/generators/templates/application/public/js/jquery-1.2.6.min.js +0 -32
- data/res/generators/templates/model/config.rb +0 -3
- data/res/generators/templates/spec/app/spec/webview_spec.rb +0 -5
- data/spec/framework_spec/app/Account/config.rb +0 -59
- data/spec/framework_spec/app/Case/config.rb +0 -3
- data/spec/framework_spec/app/Customer/config.rb +0 -3
- data/spec/framework_spec/app/Product/config.rb +0 -17
@@ -35,7 +35,6 @@
|
|
35
35
|
BDB15ED310B2EC6D00003DFA /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BD2C94DF10AE0A8C008D4692 /* libcurl.a */; };
|
36
36
|
BDB15ED410B2EC7500003DFA /* librholib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C7162970F8B7EEC0096B6AA /* librholib.a */; };
|
37
37
|
BDB15ED510B2EC8700003DFA /* librhorubylib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F59F16000E9449B8004103B4 /* librhorubylib.a */; };
|
38
|
-
BDB15ED610B2EC8E00003DFA /* libtcmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C12568C0F7CEA9200C87274 /* libtcmalloc.a */; };
|
39
38
|
BDB373661144220F006EA6DA /* SimpleMainView.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB373651144220F006EA6DA /* SimpleMainView.m */; };
|
40
39
|
BDB373C511444A8F006EA6DA /* Rhodes.m in Sources */ = {isa = PBXBuildFile; fileRef = BDB373C411444A8F006EA6DA /* Rhodes.m */; };
|
41
40
|
BDE35A7A107F900A009941C7 /* RhoFileImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = BDE35A79107F900A009941C7 /* RhoFileImpl.m */; };
|
@@ -66,20 +65,6 @@
|
|
66
65
|
/* End PBXBuildFile section */
|
67
66
|
|
68
67
|
/* Begin PBXContainerItemProxy section */
|
69
|
-
5C12568B0F7CEA9200C87274 /* PBXContainerItemProxy */ = {
|
70
|
-
isa = PBXContainerItemProxy;
|
71
|
-
containerPortal = 5C1256870F7CEA9200C87274 /* tcmalloc.xcodeproj */;
|
72
|
-
proxyType = 2;
|
73
|
-
remoteGlobalIDString = D2AAC046055464E500DB518D;
|
74
|
-
remoteInfo = tcmalloc;
|
75
|
-
};
|
76
|
-
5C1256A80F7CEC8100C87274 /* PBXContainerItemProxy */ = {
|
77
|
-
isa = PBXContainerItemProxy;
|
78
|
-
containerPortal = 5C1256870F7CEA9200C87274 /* tcmalloc.xcodeproj */;
|
79
|
-
proxyType = 1;
|
80
|
-
remoteGlobalIDString = D2AAC045055464E500DB518D;
|
81
|
-
remoteInfo = tcmalloc;
|
82
|
-
};
|
83
68
|
5C7162960F8B7EEC0096B6AA /* PBXContainerItemProxy */ = {
|
84
69
|
isa = PBXContainerItemProxy;
|
85
70
|
containerPortal = 5C7162920F8B7EEC0096B6AA /* RhoLib.xcodeproj */;
|
@@ -171,7 +156,6 @@
|
|
171
156
|
46B007061033776600D0C2F4 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
172
157
|
46C25E39103240A400A26428 /* RhoDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RhoDelegate.h; sourceTree = "<group>"; };
|
173
158
|
46C25E3A103240A400A26428 /* RhoDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RhoDelegate.m; sourceTree = "<group>"; };
|
174
|
-
5C1256870F7CEA9200C87274 /* tcmalloc.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = tcmalloc.xcodeproj; path = tcmalloc/tcmalloc.xcodeproj; sourceTree = "<group>"; };
|
175
159
|
5C5333790FC1B20000F268F0 /* NetRequestImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetRequestImpl.m; path = rho/net/NetRequestImpl.m; sourceTree = "<group>"; };
|
176
160
|
5C5335C40FC2F44500F268F0 /* RhoClassFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RhoClassFactory.cpp; path = rho/common/RhoClassFactory.cpp; sourceTree = "<group>"; };
|
177
161
|
5C5335C50FC2F44500F268F0 /* RhoClassFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RhoClassFactory.h; path = rho/common/RhoClassFactory.h; sourceTree = "<group>"; };
|
@@ -188,7 +172,6 @@
|
|
188
172
|
BD97AC201160EE8F006960F9 /* RhoAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RhoAlert.m; sourceTree = "<group>"; };
|
189
173
|
BD97AC3D1160F8A5006960F9 /* RingtoneManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RingtoneManager.h; sourceTree = "<group>"; };
|
190
174
|
BD97AC3E1160F8A5006960F9 /* RingtoneManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RingtoneManager.m; sourceTree = "<group>"; };
|
191
|
-
BD97ACA511610666006960F9 /* DateTimePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTimePicker.h; sourceTree = "<group>"; };
|
192
175
|
BD97ACA611610666006960F9 /* DateTimePicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DateTimePicker.m; sourceTree = "<group>"; };
|
193
176
|
BD9E5DF81185D2E10053049C /* NavBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavBar.h; sourceTree = "<group>"; };
|
194
177
|
BD9E5DF91185D2E10053049C /* NavBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavBar.m; sourceTree = "<group>"; };
|
@@ -248,7 +231,6 @@
|
|
248
231
|
isa = PBXFrameworksBuildPhase;
|
249
232
|
buildActionMask = 2147483647;
|
250
233
|
files = (
|
251
|
-
BDB15ED610B2EC8E00003DFA /* libtcmalloc.a in Frameworks */,
|
252
234
|
BDB15ED510B2EC8700003DFA /* librhorubylib.a in Frameworks */,
|
253
235
|
BDB15ED410B2EC7500003DFA /* librholib.a in Frameworks */,
|
254
236
|
BDB15ED310B2EC6D00003DFA /* libcurl.a in Frameworks */,
|
@@ -321,7 +303,6 @@
|
|
321
303
|
5C7162920F8B7EEC0096B6AA /* RhoLib.xcodeproj */,
|
322
304
|
F563D53B0EA8240D0062DA57 /* rhosynclib.xcodeproj */,
|
323
305
|
F59F15F90E9449B8004103B4 /* rhorubylib.xcodeproj */,
|
324
|
-
5C1256870F7CEA9200C87274 /* tcmalloc.xcodeproj */,
|
325
306
|
080E96DDFE201D6D7F000001 /* Classes */,
|
326
307
|
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
327
308
|
BD72CCE4112D629F003B7D27 /* Info.plist */,
|
@@ -367,7 +348,6 @@
|
|
367
348
|
46056D211031EDA900C21967 /* DateTimePickerDelegate.m */,
|
368
349
|
46B005F51033690F00D0C2F4 /* DateTime.h */,
|
369
350
|
46B005F61033690F00D0C2F4 /* DateTime.m */,
|
370
|
-
BD97ACA511610666006960F9 /* DateTimePicker.h */,
|
371
351
|
BD97ACA611610666006960F9 /* DateTimePicker.m */,
|
372
352
|
);
|
373
353
|
name = DateTimePicker;
|
@@ -393,14 +373,6 @@
|
|
393
373
|
name = NativeBar;
|
394
374
|
sourceTree = "<group>";
|
395
375
|
};
|
396
|
-
5C1256880F7CEA9200C87274 /* Products */ = {
|
397
|
-
isa = PBXGroup;
|
398
|
-
children = (
|
399
|
-
5C12568C0F7CEA9200C87274 /* libtcmalloc.a */,
|
400
|
-
);
|
401
|
-
name = Products;
|
402
|
-
sourceTree = "<group>";
|
403
|
-
};
|
404
376
|
5C5332610FBD6AC700F268F0 /* rho */ = {
|
405
377
|
isa = PBXGroup;
|
406
378
|
children = (
|
@@ -612,7 +584,6 @@
|
|
612
584
|
dependencies = (
|
613
585
|
F59F16040E9449E5004103B4 /* PBXTargetDependency */,
|
614
586
|
F563D5610EA8257A0062DA57 /* PBXTargetDependency */,
|
615
|
-
5C1256A90F7CEC8100C87274 /* PBXTargetDependency */,
|
616
587
|
5C7162C90F8B817F0096B6AA /* PBXTargetDependency */,
|
617
588
|
F5F0652F102B9CA0006CFD39 /* PBXTargetDependency */,
|
618
589
|
BD2C94F310AE0BC3008D4692 /* PBXTargetDependency */,
|
@@ -653,10 +624,6 @@
|
|
653
624
|
ProductGroup = F563D5410EA8240E0062DA57 /* Products */;
|
654
625
|
ProjectRef = F563D53B0EA8240D0062DA57 /* rhosynclib.xcodeproj */;
|
655
626
|
},
|
656
|
-
{
|
657
|
-
ProductGroup = 5C1256880F7CEA9200C87274 /* Products */;
|
658
|
-
ProjectRef = 5C1256870F7CEA9200C87274 /* tcmalloc.xcodeproj */;
|
659
|
-
},
|
660
627
|
);
|
661
628
|
projectRoot = "";
|
662
629
|
targets = (
|
@@ -666,13 +633,6 @@
|
|
666
633
|
/* End PBXProject section */
|
667
634
|
|
668
635
|
/* Begin PBXReferenceProxy section */
|
669
|
-
5C12568C0F7CEA9200C87274 /* libtcmalloc.a */ = {
|
670
|
-
isa = PBXReferenceProxy;
|
671
|
-
fileType = archive.ar;
|
672
|
-
path = libtcmalloc.a;
|
673
|
-
remoteRef = 5C12568B0F7CEA9200C87274 /* PBXContainerItemProxy */;
|
674
|
-
sourceTree = BUILT_PRODUCTS_DIR;
|
675
|
-
};
|
676
636
|
5C7162970F8B7EEC0096B6AA /* librholib.a */ = {
|
677
637
|
isa = PBXReferenceProxy;
|
678
638
|
fileType = archive.ar;
|
@@ -824,11 +784,6 @@
|
|
824
784
|
/* End PBXSourcesBuildPhase section */
|
825
785
|
|
826
786
|
/* Begin PBXTargetDependency section */
|
827
|
-
5C1256A90F7CEC8100C87274 /* PBXTargetDependency */ = {
|
828
|
-
isa = PBXTargetDependency;
|
829
|
-
name = tcmalloc;
|
830
|
-
targetProxy = 5C1256A80F7CEC8100C87274 /* PBXContainerItemProxy */;
|
831
|
-
};
|
832
787
|
5C7162C90F8B817F0096B6AA /* PBXTargetDependency */ = {
|
833
788
|
isa = PBXTargetDependency;
|
834
789
|
name = RhoLib;
|
@@ -14,6 +14,7 @@ namespace common
|
|
14
14
|
IMPLEMENT_LOGCLASS(CPosixThreadImpl, "RhoThread");
|
15
15
|
|
16
16
|
CPosixThreadImpl::CPosixThreadImpl()
|
17
|
+
:m_started(false)
|
17
18
|
{}
|
18
19
|
|
19
20
|
void *runProc(void *pv)
|
@@ -27,6 +28,13 @@ void *runProc(void *pv)
|
|
27
28
|
|
28
29
|
void CPosixThreadImpl::start(IRhoRunnable *pRunnable, IRhoRunnable::EPriority ePriority)
|
29
30
|
{
|
31
|
+
{
|
32
|
+
common::CMutexLock lock(m_mxSync);
|
33
|
+
if (m_started)
|
34
|
+
return;
|
35
|
+
m_started = true;
|
36
|
+
}
|
37
|
+
|
30
38
|
#if defined(OS_ANDROID)
|
31
39
|
// Android has no pthread_condattr_xxx API
|
32
40
|
pthread_cond_init(&m_condSync, NULL);
|
@@ -11,17 +11,19 @@ class CRhoThread : public IRhoRunnable
|
|
11
11
|
{
|
12
12
|
CAutoPtr<IRhoThreadImpl> m_pImpl;
|
13
13
|
bool m_isInWaitState;
|
14
|
-
|
14
|
+
bool m_bStop;
|
15
15
|
public:
|
16
16
|
|
17
17
|
CRhoThread(IRhoClassFactory* factory);
|
18
18
|
virtual ~CRhoThread(void){}
|
19
19
|
|
20
20
|
virtual void start(EPriority ePriority);
|
21
|
-
virtual void stop(unsigned int nTimeoutToKill){ m_pImpl->stop(nTimeoutToKill); }
|
21
|
+
virtual void stop(unsigned int nTimeoutToKill){ m_bStop = true; m_pImpl->stop(nTimeoutToKill); }
|
22
22
|
virtual void wait(unsigned int nTimeout){ m_isInWaitState = true; m_pImpl->wait(nTimeout); m_isInWaitState = false; }
|
23
23
|
virtual void stopWait(){ if (m_isInWaitState) m_pImpl->stopWait(); }
|
24
24
|
virtual void sleep(unsigned int nTimeout){ m_pImpl->sleep(nTimeout); }
|
25
|
+
|
26
|
+
bool isStopped(){return m_bStop;}
|
25
27
|
};
|
26
28
|
|
27
29
|
}
|
@@ -180,8 +180,12 @@ typedef int (*curl_progress_callback)(void *clientp,
|
|
180
180
|
Windows, while 16K for some odd reason performed a lot better.
|
181
181
|
We do the ifndef check to allow this value to easier be changed at build
|
182
182
|
time for those who feel adventurous. */
|
183
|
+
#if defined(OS_ANDROID) || defined(__APPLE__)
|
184
|
+
#define CURL_MAX_WRITE_SIZE 200*1024
|
185
|
+
#else
|
183
186
|
#define CURL_MAX_WRITE_SIZE 16384
|
184
187
|
#endif
|
188
|
+
#endif
|
185
189
|
|
186
190
|
#ifndef CURL_MAX_HTTP_HEADER
|
187
191
|
/* The only reason to have a max limit for this is to avoid the risk of a bad
|
@@ -140,7 +140,7 @@ boolean CDBAdapter::migrateDB(const CDBVersion& dbVer, const String& strRhoDBVer
|
|
140
140
|
//id INTEGER PRIMARY KEY, REMOVE
|
141
141
|
LOG(INFO) + "Migrate database from " + dbVer.m_strRhoVer + " to " + strRhoDBVer;
|
142
142
|
|
143
|
-
CDBAdapter db;
|
143
|
+
CDBAdapter db(m_strDbPartition.c_str());
|
144
144
|
db.open( m_strDbPath, m_strDbVer, true );
|
145
145
|
DBResult( res, db.executeSQL( "ALTER TABLE sources ADD priority INTEGER" ));
|
146
146
|
DBResult( res1, db.executeSQL( "ALTER TABLE sources ADD backend_refresh_time int default 0" ));
|
@@ -335,7 +335,7 @@ void CDBAdapter::destroy_tables(const rho::Vector<rho::String>& arIncludeTables,
|
|
335
335
|
CRhoFile::deleteFile((dbNewName+"-journal").c_str());
|
336
336
|
CRhoFile::deleteFile((dbNewName+".version").c_str());
|
337
337
|
|
338
|
-
CDBAdapter db;
|
338
|
+
CDBAdapter db(m_strDbPartition.c_str());
|
339
339
|
db.open( dbNewName, m_strDbVer, true );
|
340
340
|
|
341
341
|
//Copy all tables
|
@@ -352,21 +352,7 @@ void CDBAdapter::destroy_tables(const rho::Vector<rho::String>& arIncludeTables,
|
|
352
352
|
if (destroyTableName(tableName, arIncludeTables, arExcludeTables) )
|
353
353
|
continue;
|
354
354
|
|
355
|
-
|
356
|
-
DBResult( res , executeSQL( strSelect.c_str() ) );
|
357
|
-
String strInsert = "";
|
358
|
-
int rc = 0;
|
359
|
-
for ( ; !res.isEnd(); res.next() )
|
360
|
-
{
|
361
|
-
sqlite3_stmt* stInsert = createInsertStatement(res, tableName, db, strInsert);
|
362
|
-
|
363
|
-
if (stInsert)
|
364
|
-
{
|
365
|
-
rc = sqlite3_step(stInsert);
|
366
|
-
checkDbError(rc);
|
367
|
-
sqlite3_finalize(stInsert);
|
368
|
-
}
|
369
|
-
}
|
355
|
+
copyTable(tableName, *this, db );
|
370
356
|
}
|
371
357
|
|
372
358
|
db.endTransaction();
|
@@ -382,55 +368,50 @@ void CDBAdapter::destroy_tables(const rho::Vector<rho::String>& arIncludeTables,
|
|
382
368
|
open( dbOldName, m_strDbVer, false );
|
383
369
|
}
|
384
370
|
|
371
|
+
void CDBAdapter::copyTable(String tableName, CDBAdapter& dbFrom, CDBAdapter& dbTo)
|
372
|
+
{
|
373
|
+
String strSelect = "SELECT * from " + tableName;
|
374
|
+
DBResult( res , dbFrom.executeSQL( strSelect.c_str() ) );
|
375
|
+
String strInsert = "";
|
376
|
+
int rc = 0;
|
377
|
+
for ( ; !res.isEnd(); res.next() )
|
378
|
+
{
|
379
|
+
sqlite3_stmt* stInsert = createInsertStatement(res, tableName, dbTo, strInsert);
|
380
|
+
|
381
|
+
if (stInsert)
|
382
|
+
{
|
383
|
+
rc = sqlite3_step(stInsert);
|
384
|
+
checkDbError(rc);
|
385
|
+
sqlite3_finalize(stInsert);
|
386
|
+
}
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
385
390
|
void CDBAdapter::setBulkSyncDB(String fDataName)
|
386
391
|
{
|
387
|
-
CDBAdapter db;
|
392
|
+
CDBAdapter db(m_strDbPartition.c_str());
|
388
393
|
db.open( fDataName, m_strDbVer, true );
|
389
394
|
db.createTriggers();
|
390
395
|
|
391
396
|
db.startTransaction();
|
392
397
|
|
393
|
-
|
394
|
-
{
|
395
|
-
DBResult( res, executeSQL("SELECT * from client_info") );
|
396
|
-
String strInsert = "";
|
397
|
-
int rc = 0;
|
398
|
-
for ( ; !res.isEnd(); res.next() )
|
399
|
-
{
|
400
|
-
sqlite3_stmt* stInsert = createInsertStatement(res, "client_info", db, strInsert);
|
398
|
+
copyTable("client_info", *this, db );
|
401
399
|
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
DBResult( res , executeSQL( strSelect.c_str() ) );
|
415
|
-
String strInsert = "";
|
416
|
-
int rc = 0;
|
417
|
-
for ( ; !res.isEnd(); res.next() )
|
418
|
-
{
|
419
|
-
String strName = res.getStringByIdx(1);
|
420
|
-
DBResult( res2, db.executeSQL("SELECT name from sources where name=?", strName) );
|
421
|
-
if (!res2.isEnd())
|
422
|
-
continue;
|
423
|
-
|
424
|
-
sqlite3_stmt* stInsert = createInsertStatement(res, tableName, db, strInsert);
|
400
|
+
//update User partition
|
401
|
+
if ( m_strDbPartition.compare(USER_PARTITION_NAME())==0 )
|
402
|
+
{
|
403
|
+
//copy all NOT user sources from current db to bulk db
|
404
|
+
executeSQL("DELETE FROM sources WHERE partition=?", m_strDbPartition);
|
405
|
+
copyTable("sources", *this, db );
|
406
|
+
}else
|
407
|
+
{
|
408
|
+
//remove all m_strDbPartition sources from user db
|
409
|
+
//copy all sources from bulk db to user db
|
410
|
+
CDBAdapter& dbUser = getDB(USER_PARTITION_NAME());
|
411
|
+
dbUser.executeSQL("DELETE FROM sources WHERE partition=?", m_strDbPartition);
|
425
412
|
|
426
|
-
|
427
|
-
|
428
|
-
rc = sqlite3_step(stInsert);
|
429
|
-
checkDbError(rc);
|
430
|
-
sqlite3_finalize(stInsert);
|
431
|
-
}
|
432
|
-
}
|
433
|
-
}
|
413
|
+
copyTable("sources", db, dbUser );
|
414
|
+
}
|
434
415
|
|
435
416
|
db.endTransaction();
|
436
417
|
db.close();
|
@@ -694,7 +675,7 @@ void CDBAdapter::rollback()
|
|
694
675
|
|
695
676
|
/*static*/ CDBAdapter& CDBAdapter::getUserDB()
|
696
677
|
{
|
697
|
-
return *getDBPartitions().get(
|
678
|
+
return *getDBPartitions().get(USER_PARTITION_NAME());
|
698
679
|
}
|
699
680
|
|
700
681
|
/*static*/ CDBAdapter& CDBAdapter::getDB(const char* szPartition)
|
@@ -721,7 +702,7 @@ void CDBAdapter::rollback()
|
|
721
702
|
return *(it->second);
|
722
703
|
}
|
723
704
|
|
724
|
-
return *getDBPartitions().get(
|
705
|
+
return *getDBPartitions().get(USER_PARTITION_NAME());
|
725
706
|
}
|
726
707
|
|
727
708
|
}
|
@@ -737,7 +718,7 @@ int rho_db_open(const char* szDBPath, const char* szDBPartition, void** ppDB)
|
|
737
718
|
CDBAdapter* pDB = CDBAdapter::getDBPartitions().get(szDBPartition);
|
738
719
|
if ( !pDB )
|
739
720
|
{
|
740
|
-
pDB = new CDBAdapter();
|
721
|
+
pDB = new CDBAdapter(szDBPartition);
|
741
722
|
CDBAdapter::getDBPartitions().put(szDBPartition, pDB);
|
742
723
|
}
|
743
724
|
|
@@ -812,6 +793,12 @@ void* rho_db_user_get_handle()
|
|
812
793
|
return db.getDbHandle();
|
813
794
|
}
|
814
795
|
|
796
|
+
void* rho_db_user_get_adapter()
|
797
|
+
{
|
798
|
+
rho::db::CDBAdapter& db = rho::db::CDBAdapter::getUserDB();
|
799
|
+
return &db;
|
800
|
+
}
|
801
|
+
|
815
802
|
int rho_db_prepare_statement(void* pDB, const char* szSql, int nByte, sqlite3_stmt **ppStmt)
|
816
803
|
{
|
817
804
|
rho::db::CDBAdapter& db = *((rho::db::CDBAdapter*)pDB);
|
@@ -27,6 +27,8 @@ class CDBAdapter
|
|
27
27
|
{
|
28
28
|
sqlite3* m_dbHandle;
|
29
29
|
String m_strDbPath, m_strDbVer, m_strDbVerPath;
|
30
|
+
String m_strDbPartition;
|
31
|
+
|
30
32
|
Hashtable<String,sqlite3_stmt*> m_mapStatements;
|
31
33
|
common::CRubyMutex m_mxRuby;
|
32
34
|
common::CMutex m_mxDB;
|
@@ -48,10 +50,12 @@ class CDBAdapter
|
|
48
50
|
}
|
49
51
|
};
|
50
52
|
|
53
|
+
static const char* USER_PARTITION_NAME(){return "user";}
|
51
54
|
public:
|
52
55
|
DEFINE_LOGCLASS;
|
53
56
|
|
54
|
-
CDBAdapter(
|
57
|
+
CDBAdapter(const char* szDBPartition) : m_dbHandle(0), m_strDbPath(""), m_strDbPartition(szDBPartition),
|
58
|
+
m_bUIWaitDB(false), m_nTransactionCounter(0) {}
|
55
59
|
~CDBAdapter(void){}
|
56
60
|
|
57
61
|
void open (String strDbPath, String strVer, boolean bTemp);
|
@@ -244,7 +248,7 @@ private:
|
|
244
248
|
virtual DBResultPtr prepareStatement( const char* szSt );
|
245
249
|
|
246
250
|
boolean migrateDB(const CDBVersion& dbVer, const String& strRhoDBVer, const String& strAppDBVer);
|
247
|
-
|
251
|
+
void copyTable(String tableName, CDBAdapter& dbFrom, CDBAdapter& dbTo);
|
248
252
|
};
|
249
253
|
|
250
254
|
}
|
@@ -21,12 +21,14 @@ extern "C" void header_iter(const char* szName, const char* szValue, void* pHash
|
|
21
21
|
|
22
22
|
CAsyncHttp::CAsyncHttp(common::IRhoClassFactory* factory, EHttpCommands eCmd,
|
23
23
|
const char* url, unsigned long headers, const char* body,
|
24
|
+
const char* file_path,
|
24
25
|
const char* callback, const char* callback_params, boolean ssl_verify_peer) : CRhoThread(factory)
|
25
26
|
{
|
26
27
|
m_bFinished = false;
|
27
28
|
m_ptrFactory = factory;
|
28
29
|
m_strUrl = url != null ? url : "";
|
29
30
|
m_strBody = body != null ? body : "";
|
31
|
+
m_strFilePath = file_path != null ? file_path : "";
|
30
32
|
m_strCallback = callback != null ? callback : "";
|
31
33
|
m_strCallbackParams = callback_params != null ? callback_params : "";
|
32
34
|
m_eCmd = eCmd;
|
@@ -126,16 +128,27 @@ void CAsyncHttp::run()
|
|
126
128
|
break;
|
127
129
|
|
128
130
|
case hcDownload:
|
129
|
-
m_pNetResponse = m_pNetRequest->pullFile(m_strUrl,
|
131
|
+
m_pNetResponse = m_pNetRequest->pullFile(m_strUrl, m_strFilePath, null, &m_mapHeaders);
|
130
132
|
break;
|
131
133
|
|
132
134
|
case hcUpload:
|
133
135
|
{
|
134
|
-
net::CMultipartItem
|
135
|
-
oItem.m_strFilePath = m_strBody;
|
136
|
-
oItem.m_strContentType = "application/octet-stream";
|
136
|
+
VectorPtr<net::CMultipartItem*> arMultipartItems;
|
137
137
|
|
138
|
-
|
138
|
+
net::CMultipartItem* pItem = new net::CMultipartItem();
|
139
|
+
pItem->m_strFilePath = m_strFilePath;
|
140
|
+
pItem->m_strContentType = "application/octet-stream";
|
141
|
+
arMultipartItems.addElement(pItem);
|
142
|
+
|
143
|
+
if ( m_strBody.length() > 0 )
|
144
|
+
{
|
145
|
+
net::CMultipartItem* pItem = new net::CMultipartItem();
|
146
|
+
pItem->m_strBody = m_strBody;
|
147
|
+
pItem->m_strContentType = m_mapHeaders.get("content-type");
|
148
|
+
arMultipartItems.addElement(pItem);
|
149
|
+
}
|
150
|
+
|
151
|
+
m_pNetResponse = m_pNetRequest->pushMultipartData( m_strUrl, arMultipartItems, null, &m_mapHeaders );
|
139
152
|
break;
|
140
153
|
}
|
141
154
|
}
|
@@ -223,7 +236,10 @@ void CAsyncHttp::callNotify(rho::net::INetResponse& resp, int nError )
|
|
223
236
|
if (cookies.length()>0)
|
224
237
|
m_strResBody += "&cookies=" + URI::urlEncode(cookies);
|
225
238
|
|
226
|
-
|
239
|
+
String strHeaders = makeHeadersString();
|
240
|
+
if (strHeaders.length() > 0 )
|
241
|
+
m_strResBody += "&" + strHeaders;
|
242
|
+
|
227
243
|
m_strResBody += "&" + RHODESAPP().addCallbackObject(this, "body");
|
228
244
|
}
|
229
245
|
|
@@ -249,25 +265,25 @@ using namespace rho::net;
|
|
249
265
|
|
250
266
|
unsigned long rho_asynchttp_get(const char* url, unsigned long headers, const char* callback, const char* callback_params, int ssl_verify_peer)
|
251
267
|
{
|
252
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcGet, url, headers, null, callback, callback_params, ssl_verify_peer!=0 );
|
268
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcGet, url, headers, null, null, callback, callback_params, ssl_verify_peer!=0 );
|
253
269
|
return pHttp->getRetValue();
|
254
270
|
}
|
255
271
|
|
256
272
|
unsigned long rho_asynchttp_post(const char* url, unsigned long headers, const char* body, const char* callback, const char* callback_params, int ssl_verify_peer)
|
257
273
|
{
|
258
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcPost, url, headers, body!=null?body:"", callback, callback_params, ssl_verify_peer!=0 );
|
274
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcPost, url, headers, body!=null?body:"", null, callback, callback_params, ssl_verify_peer!=0 );
|
259
275
|
return pHttp->getRetValue();
|
260
276
|
}
|
261
277
|
|
262
278
|
unsigned long rho_asynchttp_downloadfile(const char* url, unsigned long headers, const char* file_path, const char* callback, const char* callback_params, int ssl_verify_peer)
|
263
279
|
{
|
264
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcDownload, url, headers, file_path, callback, callback_params, ssl_verify_peer!=0 );
|
280
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcDownload, url, headers, "", file_path, callback, callback_params, ssl_verify_peer!=0 );
|
265
281
|
return pHttp->getRetValue();
|
266
282
|
}
|
267
283
|
|
268
|
-
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* file_path, const char* callback, const char* callback_params, int ssl_verify_peer)
|
284
|
+
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* body, const char* file_path, const char* callback, const char* callback_params, int ssl_verify_peer)
|
269
285
|
{
|
270
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcUpload, url, headers, file_path, callback, callback_params, ssl_verify_peer!=0 );
|
286
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcUpload, url, headers, body, file_path, callback, callback_params, ssl_verify_peer!=0 );
|
271
287
|
return pHttp->getRetValue();
|
272
288
|
}
|
273
289
|
|
@@ -26,6 +26,7 @@ class CAsyncHttp : public common::CRhoThread, rho::ICallbackObject
|
|
26
26
|
Hashtable<String,String> m_mapHeaders;
|
27
27
|
|
28
28
|
String m_strUrl, m_strBody, m_strCallback, m_strCallbackParams;
|
29
|
+
String m_strFilePath;
|
29
30
|
String m_strResBody;
|
30
31
|
boolean m_sslVerifyPeer;
|
31
32
|
boolean m_bFinished;
|
@@ -39,6 +40,7 @@ public:
|
|
39
40
|
|
40
41
|
CAsyncHttp(common::IRhoClassFactory* factory, EHttpCommands eCmd,
|
41
42
|
const char* url, unsigned long headers, const char* body,
|
43
|
+
const char* file_path,
|
42
44
|
const char* callback, const char* callback_params, boolean ssl_verify_peer = true);
|
43
45
|
|
44
46
|
void cancel(boolean bWait);
|
@@ -70,7 +72,7 @@ extern "C" {
|
|
70
72
|
unsigned long rho_asynchttp_get(const char* url, unsigned long headers, const char* callback, const char* callback_params, int ssl_verify_peer);
|
71
73
|
unsigned long rho_asynchttp_post(const char* url, unsigned long headers, const char* body, const char* callback, const char* callback_params, int ssl_verify_peer);
|
72
74
|
unsigned long rho_asynchttp_downloadfile(const char* url, unsigned long headers, const char* filename, const char* callback, const char* callback_params, int ssl_verify_peer);
|
73
|
-
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* filename, const char* callback, const char* callback_params, int ssl_verify_peer);
|
75
|
+
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* body, const char* filename, const char* callback, const char* callback_params, int ssl_verify_peer);
|
74
76
|
void rho_asynchttp_cancel(const char* cancel_callback);
|
75
77
|
void rho_asynchttp_destroy();
|
76
78
|
|
@@ -83,7 +83,8 @@ CURLNetRequest::CURLNetRequest()
|
|
83
83
|
{
|
84
84
|
m_bTraceCalls = rho_conf_getBool("net_trace");
|
85
85
|
m_sslVerifyPeer = true;
|
86
|
-
|
86
|
+
// Init curl
|
87
|
+
curlm = curl_multi_init();
|
87
88
|
curl = curl_easy_init();
|
88
89
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &errbuf);
|
89
90
|
}
|
@@ -91,7 +92,7 @@ CURLNetRequest::CURLNetRequest()
|
|
91
92
|
CURLNetRequest::~CURLNetRequest()
|
92
93
|
{
|
93
94
|
curl_easy_cleanup(curl);
|
94
|
-
|
95
|
+
curl_multi_cleanup(curlm);
|
95
96
|
}
|
96
97
|
|
97
98
|
INetResponse *CURLNetRequest::makeResponse(String strBody, int nErrorCode)
|
@@ -149,7 +150,7 @@ INetResponse* CURLNetRequest::doRequest( const char* method, const String& strUr
|
|
149
150
|
|
150
151
|
rho_net_impl_network_indicator(1);
|
151
152
|
|
152
|
-
curl_slist *hdrs = set_curl_options(
|
153
|
+
curl_slist *hdrs = set_curl_options(method, strUrl, strBody, oSession, pHeaders);
|
153
154
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strRespBody);
|
154
155
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyStringCallback);
|
155
156
|
|
@@ -176,7 +177,7 @@ INetResponse* CURLNetRequest::pushMultipartData(const String& strUrl, VectorPtr<
|
|
176
177
|
|
177
178
|
rho_net_impl_network_indicator(1);
|
178
179
|
|
179
|
-
curl_slist *hdrs = set_curl_options(
|
180
|
+
curl_slist *hdrs = set_curl_options("POST", strUrl, String(), oSession, pHeaders);
|
180
181
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strRespBody);
|
181
182
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyStringCallback);
|
182
183
|
|
@@ -267,7 +268,7 @@ INetResponse* CURLNetRequest::pushFile(const String& strUrl, const String& strFi
|
|
267
268
|
|
268
269
|
rho_net_impl_network_indicator(1);
|
269
270
|
|
270
|
-
curl_slist *hdrs = set_curl_options(
|
271
|
+
curl_slist *hdrs = set_curl_options("POST", strUrl, String(), oSession, pHeaders);
|
271
272
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strRespBody);
|
272
273
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyStringCallback);
|
273
274
|
|
@@ -308,7 +309,7 @@ INetResponse* CURLNetRequest::pullFile(const String& strUrl, const String& strFi
|
|
308
309
|
|
309
310
|
rho_net_impl_network_indicator(1);
|
310
311
|
|
311
|
-
curl_slist *hdrs = set_curl_options(
|
312
|
+
curl_slist *hdrs = set_curl_options("GET", strUrl, String(), oSession, pHeaders);
|
312
313
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &oFile);
|
313
314
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyFileCallback);
|
314
315
|
|
@@ -459,8 +460,8 @@ static size_t curlHeaderCallback(void *ptr, size_t size, size_t nmemb, void *opa
|
|
459
460
|
return nBytes;
|
460
461
|
}
|
461
462
|
|
462
|
-
curl_slist *set_curl_options(
|
463
|
-
IRhoSession* pSession, Hashtable<String,String>* pHeaders
|
463
|
+
curl_slist *CURLNetRequest::set_curl_options(const char *method, const String& strUrl, const String& strBody,
|
464
|
+
IRhoSession* pSession, Hashtable<String,String>* pHeaders)
|
464
465
|
{
|
465
466
|
curl_easy_reset(curl);
|
466
467
|
if (strcasecmp(method, "GET") == 0)
|
@@ -485,7 +486,7 @@ curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const S
|
|
485
486
|
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 180);
|
486
487
|
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
|
487
488
|
|
488
|
-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)
|
489
|
+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)m_sslVerifyPeer);
|
489
490
|
|
490
491
|
// Set very large timeout in case of local requests
|
491
492
|
// It is required because otherwise requests (especially requests to writing!)
|
@@ -534,7 +535,7 @@ curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const S
|
|
534
535
|
|
535
536
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, hdrs);
|
536
537
|
|
537
|
-
if (
|
538
|
+
if (m_bTraceCalls) {
|
538
539
|
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, &curl_trace);
|
539
540
|
curl_easy_setopt(curl, CURLOPT_DEBUGDATA, NULL);
|
540
541
|
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
@@ -36,12 +36,14 @@ public:
|
|
36
36
|
virtual boolean isCancelled(){return m_bCancel;}
|
37
37
|
|
38
38
|
private:
|
39
|
-
|
40
|
-
|
39
|
+
curl_slist *set_curl_options(const char *method, const String& strUrl, const String& strBody,
|
40
|
+
IRhoSession* pSession, Hashtable<String,String>* pHeaders);
|
41
|
+
int getResponseCode(CURLMcode err, const String& strRespBody, IRhoSession* oSession);
|
42
|
+
String makeCookies();
|
41
43
|
INetResponse *makeResponse(String strBody, int nErrorCode);
|
42
|
-
|
44
|
+
|
43
45
|
boolean m_bCancel;
|
44
|
-
|
46
|
+
CURLM *curlm;
|
45
47
|
CURL *curl;
|
46
48
|
char *errbuf[CURL_ERROR_SIZE];
|
47
49
|
boolean m_bTraceCalls;
|
@@ -888,8 +888,6 @@ bool CHttpServer::decide(String const &method, String const &uri, String const &
|
|
888
888
|
Route route;
|
889
889
|
if (dispatch(uri, route)) {
|
890
890
|
RAWTRACE1("Uri %s is correct route, so enable MVC logic", uri.c_str());
|
891
|
-
if (method == "GET")
|
892
|
-
rho_rhodesapp_keeplastvisitedurl(uri.c_str());
|
893
891
|
|
894
892
|
VALUE req = create_request_hash(route.application, route.model, route.action, route.id,
|
895
893
|
method, uri, query, headers, body);
|
@@ -899,7 +897,10 @@ bool CHttpServer::decide(String const &method, String const &uri, String const &
|
|
899
897
|
|
900
898
|
if (!send_response(reply))
|
901
899
|
return false;
|
902
|
-
|
900
|
+
|
901
|
+
if (method == "GET")
|
902
|
+
rho_rhodesapp_keeplastvisitedurl(uri.c_str());
|
903
|
+
|
903
904
|
if (!route.id.empty())
|
904
905
|
rho_sync_addobjectnotify_bysrcname(route.model.c_str(), route.id.c_str());
|
905
906
|
|
@@ -926,14 +927,18 @@ bool CHttpServer::decide(String const &method, String const &uri, String const &
|
|
926
927
|
}
|
927
928
|
|
928
929
|
RAWTRACE1("Uri %s is index file, call serveIndex", uri.c_str());
|
929
|
-
if (method == "GET")
|
930
|
-
rho_rhodesapp_keeplastvisitedurl(uri.c_str());
|
931
930
|
|
932
931
|
VALUE data = callServeIndex((char *)fullPath.c_str());
|
933
932
|
String reply(getStringFromValue(data), getStringLenFromValue(data));
|
934
933
|
rho_ruby_releaseValue(data);
|
935
934
|
|
936
|
-
|
935
|
+
if (!send_response(reply))
|
936
|
+
return false;
|
937
|
+
|
938
|
+
if (method == "GET")
|
939
|
+
rho_rhodesapp_keeplastvisitedurl(uri.c_str());
|
940
|
+
|
941
|
+
return true;
|
937
942
|
}
|
938
943
|
//RAWLOG_INFO("Sending File");
|
939
944
|
|