rhodes 5.5.2 → 5.5.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -1
  3. data/CREDITS +3 -3
  4. data/LICENSE +1 -1
  5. data/README.html +1 -1
  6. data/Rakefile +53 -14
  7. data/bin/get-rhodes-info +0 -0
  8. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/Rakefile +1 -1
  9. data/lib/build/jake.rb +11 -0
  10. data/lib/commonAPI/barcode/ext/platform/iphone/impl/BarcodeFactory.m +2 -1
  11. data/lib/commonAPI/coreapi/ext/NativeTabbar.xml +4 -0
  12. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +1 -0
  13. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NativeTabbarSingleton.m +7 -2
  14. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NativeToolbarSingleton.m +6 -2
  15. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NavbarSingleton.m +8 -2
  16. data/lib/commonAPI/coreapi/ext/shared/ApplicationImpl.cpp +3 -0
  17. data/lib/commonAPI/coreapi/ext/shared/NetworkImpl.cpp +1 -0
  18. data/lib/commonAPI/coreapi/ext/shared/TimerImpl.cpp +36 -27
  19. data/lib/commonAPI/coreapi/public/api/rhoapi.js +6 -3
  20. data/lib/commonAPI/mediacapture/ext.yml +1 -2
  21. data/lib/commonAPI/mediacapture/ext/build.bat +8 -0
  22. data/lib/commonAPI/mediacapture/ext/platform/qt/MediaCapture.pro +82 -0
  23. data/lib/commonAPI/mediacapture/ext/platform/qt/Rakefile +35 -0
  24. data/lib/commonAPI/mediacapture/ext/platform/qt/resources/diaClosed.png +0 -0
  25. data/lib/commonAPI/mediacapture/ext/platform/qt/resources/diaOpened.png +0 -0
  26. data/lib/commonAPI/mediacapture/ext/platform/qt/resources/mediacapture.qrc +7 -0
  27. data/lib/commonAPI/mediacapture/ext/platform/qt/resources/photoSave.png +0 -0
  28. data/lib/commonAPI/mediacapture/ext/platform/qt/src/CCameraData.cpp +83 -0
  29. data/lib/commonAPI/mediacapture/ext/platform/qt/src/CCameraData.h +54 -0
  30. data/lib/commonAPI/mediacapture/ext/platform/qt/src/CameraDialogBuilder.h +36 -0
  31. data/lib/commonAPI/mediacapture/ext/platform/qt/src/CameraDialogController.h +31 -0
  32. data/lib/commonAPI/mediacapture/ext/platform/qt/src/CameraDialogView.h +73 -0
  33. data/lib/commonAPI/mediacapture/ext/platform/qt/src/Camera_impl.cpp +337 -0
  34. data/lib/commonAPI/mediacapture/ext/platform/qt/src/ImageFileNameGetter.h +40 -0
  35. data/lib/commonAPI/mediacapture/ext/platform/qt/src/ImageFilenameGetterResult.h +36 -0
  36. data/lib/commonAPI/mediacapture/ext/platform/qt/src/cameracrossthreadhalper.h +17 -0
  37. data/lib/commonAPI/mediacapture/ext/platform/qt/src/cameradialogview.cpp +178 -0
  38. data/lib/commonAPI/mediacapture/ext/shared/MediacaptureInit.cpp +8 -8
  39. data/lib/framework/rhodes.rb +1 -1
  40. data/lib/framework/version.rb +1 -1
  41. data/platform/android/Rhodes/AndroidManifest.xml.erb +1 -1
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +9 -2
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +33 -0
  44. data/platform/android/build/android.rake +97 -43
  45. data/platform/android/build/android_studio_project_generator.rb +21 -0
  46. data/platform/android/build/android_tools.rb +8 -6
  47. data/platform/iphone/Classes/AppManager/AppManager.h +6 -0
  48. data/platform/iphone/Classes/AppManager/AppManager.m +76 -37
  49. data/platform/iphone/Classes/MapView/GoogleGeocoder.m +2 -3
  50. data/platform/iphone/Classes/MapView/MapViewController.m +3 -3
  51. data/platform/iphone/Classes/NativeBar.h +1 -0
  52. data/platform/iphone/Classes/NativeBar.m +15 -0
  53. data/platform/iphone/Classes/RhoViewController.m +8 -3
  54. data/platform/iphone/Classes/RhoWKWebView.m +1 -1
  55. data/platform/iphone/Classes/Rhodes.m +55 -38
  56. data/platform/iphone/Classes/SimpleMainView.m +3 -2
  57. data/platform/iphone/Classes/TabbedMainView.h +2 -0
  58. data/platform/iphone/Classes/TabbedMainView.m +15 -3
  59. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.h +2 -0
  60. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +185 -30
  61. data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +105 -6
  62. data/platform/iphone/rbuild/iphone.rake +426 -267
  63. data/platform/iphone/rbuild/putsOverride.rake +8 -0
  64. data/platform/shared/api_generator/iphone/CJSConverter.mm +5 -3
  65. data/platform/shared/common/BundleManager.cpp +16 -6
  66. data/platform/shared/common/PosixThreadImpl.cpp +10 -4
  67. data/platform/shared/common/RhoTime.cpp +81 -40
  68. data/platform/shared/common/RhodesApp.cpp +2 -2
  69. data/platform/shared/common/RhodesApp.h +1 -1
  70. data/platform/shared/db/DBAdapter.cpp +33 -0
  71. data/platform/shared/db/DBAdapter.h +5 -0
  72. data/platform/shared/logging/RhoLogConf.cpp +17 -1
  73. data/platform/shared/logging/RhoLogConf.h +6 -0
  74. data/platform/shared/net/CURLNetRequest.cpp +6 -0
  75. data/platform/shared/net/HttpServer.cpp +27 -1
  76. data/platform/shared/net/INetRequest.cpp +33 -6
  77. data/platform/shared/net/INetRequest.h +2 -0
  78. data/platform/shared/qt/RhoSimulator_dev.pro +14 -10
  79. data/platform/shared/qt/rhodes/QtMainWindow.cpp +2 -2
  80. data/platform/shared/qt/rhodes/iexecutable.h +27 -0
  81. data/platform/shared/qt/rhodes/impl/MainWindowImpl.cpp +5 -0
  82. data/platform/shared/qt/rhodes/impl/MainWindowImpl.h +3 -0
  83. data/platform/shared/qt/rhodes/qkineticscroller.cpp +2 -2
  84. data/platform/shared/qt/rhodes/qkineticscroller_p.h +1 -1
  85. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +3 -3
  86. data/platform/shared/qt/rhodes/qtscrollevent.cpp +2 -2
  87. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +1 -1
  88. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +1 -1
  89. data/platform/shared/qt/rhodes/resources/rho.png +0 -0
  90. data/platform/shared/qt/rhodes/rhodes.pro +3 -2
  91. data/platform/wm/build/wm.rake +28 -9
  92. data/platform/wm/rhodes/browser/BrowserFactory.cpp +4 -6
  93. data/platform/wm/rhodes/browser/stubs.cpp +5 -0
  94. data/platform/wm/rhodes/rho/net/NetRequestImpl.h +3 -0
  95. data/platform/wm/rhodes/rhodes.vcproj +31 -2
  96. data/rakefile.rb +53 -14
  97. data/res/build-tools/iphonesim/build/Release/iphonesim_8 +2 -2
  98. data/res/generators/rhogen.rb +6 -147
  99. data/res/generators/templates/api/platform/iphone/generated/base_impl/MontanaBase.m +7 -7
  100. data/res/generators/templates/api/platform/iphone/generated/javascript/montana_js_wrap.mm +2 -4
  101. data/res/generators/templates/application/AndroidManifest.erb +1 -1
  102. data/res/generators/templates/application/app/Settings/home.erb +1 -1
  103. data/res/generators/templates/application/build.yml +52 -6
  104. data/res/generators/templates/application/icon/icon.png +0 -0
  105. data/res/generators/templates/application/resources/android/res/drawable-hdpi/ic_notification.png +0 -0
  106. data/res/generators/templates/application/resources/android/res/drawable-hdpi/icon.png +0 -0
  107. data/res/generators/templates/application/resources/android/res/drawable-hdpi/loading.png +0 -0
  108. data/res/generators/templates/application/resources/android/res/drawable-ldpi/ic_notification.png +0 -0
  109. data/res/generators/templates/application/resources/android/res/drawable-ldpi/icon.png +0 -0
  110. data/res/generators/templates/application/resources/android/res/drawable-ldpi/loading.png +0 -0
  111. data/res/generators/templates/application/resources/android/res/drawable-mdpi/ic_notification.png +0 -0
  112. data/res/generators/templates/application/resources/android/res/drawable-mdpi/icon.png +0 -0
  113. data/res/generators/templates/application/resources/android/res/drawable-mdpi/loading.png +0 -0
  114. data/res/generators/templates/application/resources/android/res/drawable-xhdpi/ic_notification.png +0 -0
  115. data/res/generators/templates/application/resources/android/res/drawable-xhdpi/icon.png +0 -0
  116. data/res/generators/templates/application/resources/android/res/drawable-xhdpi/loading.png +0 -0
  117. data/res/generators/templates/application/resources/android/res/drawable-xxhdpi/ic_notification.png +0 -0
  118. data/res/generators/templates/application/resources/android/res/drawable-xxhdpi/icon.png +0 -0
  119. data/res/generators/templates/application/resources/android/res/drawable-xxhdpi/loading.png +0 -0
  120. data/res/generators/templates/application/resources/android/res/drawable-xxxhdpi/ic_notification.png +0 -0
  121. data/res/generators/templates/application/resources/android/res/drawable-xxxhdpi/icon.png +0 -0
  122. data/res/generators/templates/application/resources/android/res/drawable-xxxhdpi/loading.png +0 -0
  123. data/res/generators/templates/application/resources/android/res/drawable/ic_notification.png +0 -0
  124. data/res/generators/templates/application/resources/android/res/drawable/icon.png +0 -0
  125. data/res/generators/templates/application/resources/android/res/drawable/loading.png +0 -0
  126. data/res/generators/templates/application/resources/android/res/mipmap-hdpi/icon.png +0 -0
  127. data/res/generators/templates/application/resources/android/res/mipmap-ldpi/icon.png +0 -0
  128. data/res/generators/templates/application/resources/android/res/mipmap-mdpi/icon.png +0 -0
  129. data/res/generators/templates/application/resources/android/res/mipmap-xhdpi/icon.png +0 -0
  130. data/res/generators/templates/application/resources/android/res/mipmap-xxhdpi/icon.png +0 -0
  131. data/res/generators/templates/application/resources/android/res/mipmap-xxxhdpi/icon.png +0 -0
  132. data/res/generators/templates/application/resources/android/res/mipmap/icon.png +0 -0
  133. data/res/generators/templates/application/{app/loading-568h@2x.png → resources/ios/Default-568h@2x.png} +0 -0
  134. data/res/generators/templates/application/{app/loading-667h@2x.png → resources/ios/Default-667h@2x.png} +0 -0
  135. data/res/generators/templates/application/{app/loading-736h@3x.png → resources/ios/Default-736h@3x.png} +0 -0
  136. data/res/generators/templates/application/{app/loading-Landscape.png → resources/ios/Default-Landscape.png} +0 -0
  137. data/res/generators/templates/application/{app/loading-Landscape@2x.png → resources/ios/Default-Landscape@2x.png} +0 -0
  138. data/res/generators/templates/application/{app/loading-LandscapeLeft.png → resources/ios/Default-LandscapeLeft.png} +0 -0
  139. data/res/generators/templates/application/{app/loading-LandscapeLeft@2x.png → resources/ios/Default-LandscapeLeft@2x.png} +0 -0
  140. data/res/generators/templates/application/{app/loading-LandscapeRight.png → resources/ios/Default-LandscapeRight.png} +0 -0
  141. data/res/generators/templates/application/{app/loading-LandscapeRight@2x.png → resources/ios/Default-LandscapeRight@2x.png} +0 -0
  142. data/res/generators/templates/application/{app/loading-Portrait.png → resources/ios/Default-Portrait.png} +0 -0
  143. data/res/generators/templates/application/{app/loading-Portrait@2x.png → resources/ios/Default-Portrait@2x.png} +0 -0
  144. data/res/generators/templates/application/{app/loading-PortraitUpsideDown.png → resources/ios/Default-PortraitUpsideDown.png} +0 -0
  145. data/res/generators/templates/application/{app/loading-PortraitUpsideDown@2x.png → resources/ios/Default-PortraitUpsideDown@2x.png} +0 -0
  146. data/res/generators/templates/application/resources/ios/Default.png +0 -0
  147. data/res/generators/templates/application/{app/loading@2x.png → resources/ios/Default@2x.png} +0 -0
  148. data/res/generators/templates/application/resources/ios/iTunesArtwork.png +0 -0
  149. data/res/generators/templates/application/resources/ios/iTunesArtwork@2x.png +0 -0
  150. data/res/generators/templates/application/resources/ios/icon114.png +0 -0
  151. data/res/generators/templates/application/resources/ios/icon120.png +0 -0
  152. data/res/generators/templates/application/resources/ios/icon144.png +0 -0
  153. data/res/generators/templates/application/resources/ios/icon152.png +0 -0
  154. data/res/generators/templates/application/resources/ios/icon180.png +0 -0
  155. data/res/generators/templates/application/resources/ios/icon57.png +0 -0
  156. data/res/generators/templates/application/resources/ios/icon60.png +0 -0
  157. data/res/generators/templates/application/resources/ios/icon72.png +0 -0
  158. data/res/generators/templates/application/resources/ios/icon76.png +0 -0
  159. data/res/generators/templates/application/rhoconfig.txt +2 -1
  160. data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +44 -0
  161. data/res/generators/templates/iphone_project/Resources/back_btn.png +0 -0
  162. data/res/generators/templates/iphone_project/Resources/back_btn@2x.png +0 -0
  163. data/res/generators/templates/iphone_project/Resources/back_btn@3x.png +0 -0
  164. data/res/generators/templates/iphone_project/Resources/forward_btn.png +0 -0
  165. data/res/generators/templates/iphone_project/Resources/forward_btn@2x.png +0 -0
  166. data/res/generators/templates/iphone_project/Resources/forward_btn@3x.png +0 -0
  167. data/res/generators/templates/iphone_project/Resources/gears.png +0 -0
  168. data/res/generators/templates/iphone_project/Resources/gears@2x.png +0 -0
  169. data/res/generators/templates/iphone_project/Resources/gears@3x.png +0 -0
  170. data/res/generators/templates/iphone_project/Resources/home_btn.png +0 -0
  171. data/res/generators/templates/iphone_project/Resources/home_btn@2x.png +0 -0
  172. data/res/generators/templates/iphone_project/Resources/home_btn@3x.png +0 -0
  173. data/res/generators/templates/iphone_project/Resources/sync_btn.png +0 -0
  174. data/res/generators/templates/iphone_project/Resources/sync_btn@2x.png +0 -0
  175. data/res/generators/templates/iphone_project/Resources/sync_btn@3x.png +0 -0
  176. data/res/generators/templates/iphone_project/buildRhoBundle +23 -7
  177. data/res/generators/templates/iphone_project/root/Info.plist +0 -7
  178. data/res/generators/templates/iphone_project/root/iTunesArtwork +0 -0
  179. data/res/generators/templates/iphone_project/root/iTunesArtwork@2x +0 -0
  180. data/res/generators/templates/iphone_project/root/icon114.png +0 -0
  181. data/res/generators/templates/iphone_project/root/icon120.png +0 -0
  182. data/res/generators/templates/iphone_project/root/icon144.png +0 -0
  183. data/res/generators/templates/iphone_project/root/icon152.png +0 -0
  184. data/res/generators/templates/iphone_project/root/icon180.png +0 -0
  185. data/res/generators/templates/iphone_project/root/icon57.png +0 -0
  186. data/res/generators/templates/iphone_project/root/icon60.png +0 -0
  187. data/res/generators/templates/iphone_project/root/icon72.png +0 -0
  188. data/res/generators/templates/iphone_project/root/icon76.png +0 -0
  189. data/res/generators/templates/project/android_studio_project/app/build.gradle.erb +88 -0
  190. data/res/generators/templates/project/android_studio_project/build.gradle +23 -0
  191. data/res/generators/templates/project/android_studio_project/gradle.properties +17 -0
  192. data/res/generators/templates/project/android_studio_project/gradlew +160 -0
  193. data/res/generators/templates/project/android_studio_project/gradlew.bat +90 -0
  194. data/res/generators/templates/project/android_studio_project/settings.gradle +1 -0
  195. data/rhodes.gemspec +7 -6
  196. data/version +1 -1
  197. metadata +135 -42
  198. data/res/generators/templates/application/icon/icon.svg +0 -22
  199. data/res/generators/templates/application/icon/icon114.png +0 -0
  200. data/res/generators/templates/application/icon/icon120.png +0 -0
  201. data/res/generators/templates/application/icon/icon144.png +0 -0
  202. data/res/generators/templates/application/icon/icon152.png +0 -0
  203. data/res/generators/templates/application/icon/icon180.png +0 -0
  204. data/res/generators/templates/application/icon/icon57.png +0 -0
  205. data/res/generators/templates/application/icon/icon60.png +0 -0
  206. data/res/generators/templates/application/icon/icon72.png +0 -0
  207. data/res/generators/templates/application/icon/icon76.png +0 -0
  208. data/res/generators/templates/application/production/iTunesArtwork.png +0 -0
  209. data/res/generators/templates/application/production/iTunesArtwork@2x.png +0 -0
@@ -0,0 +1,8 @@
1
+ def puts(o=nil)
2
+ if o != nil
3
+ $stdout.puts(o)
4
+ if $out_file_buf_enable
5
+ $out_file_buf << o.to_s
6
+ end
7
+ end
8
+ end
@@ -4,10 +4,12 @@
4
4
  #import "CMethodResult.h"
5
5
 
6
6
  #import "json/JSONIterator.h"
7
+ #import "logging/RhoLog.h"
7
8
 
8
9
  @implementation CJSConverter
9
10
 
10
-
11
+ #undef DEFAULT_LOGCATEGORY
12
+ #define DEFAULT_LOGCATEGORY "CJSConverter.h"
11
13
 
12
14
  + (NSString*) quoteString:(NSString*)str {
13
15
  return [NSString stringWithUTF8String:rho::json::CJSONEntry::quoteValue([str UTF8String]).c_str()];
@@ -153,7 +155,7 @@
153
155
  [ns_array addObject:obj];
154
156
  }
155
157
  else {
156
- NSLog(@"ERROR during convert JSON data !");
158
+ RAWLOG_ERROR1("ERROR during convert JSON data 1 ! data = %s", jsonEntry->getString());
157
159
  }
158
160
  }
159
161
  return ns_array;
@@ -173,7 +175,7 @@
173
175
  [ns_hash setObject:obj forKey:[NSString stringWithUTF8String:(key.c_str())]];
174
176
  }
175
177
  else {
176
- NSLog(@"ERROR during convert JSON data !");
178
+ RAWLOG_ERROR1("ERROR during convert JSON data 2 ! data = %s", jsonEntry->getString());
177
179
  }
178
180
 
179
181
  js_iterator.next();
@@ -68,7 +68,7 @@ void rho_sys_impl_exit_with_errormessage(const char* szTitle, const char* szMsg)
68
68
  }
69
69
  #endif
70
70
 
71
-
71
+ extern "C" void rho_startup_logging(const char* message);
72
72
 
73
73
 
74
74
  extern "C" void rho_file_operation_test() {
@@ -456,13 +456,16 @@ void CFileTransaction::commit()
456
456
 
457
457
  unsigned int CFileTransaction::rollback()
458
458
  {
459
- LOG(TRACE) + "FileTransaction is rolling back: " + m_strFolder;
460
-
459
+ if (rho_log_system_is_ready()) {
460
+ LOG(TRACE) + "FileTransaction is rolling back: " + m_strFolder;
461
+ }
461
462
  String strFolder = m_strFolder;
462
463
  m_strFolder = "";
463
464
 
464
465
  if ( strFolder.length() == 0 ) {
465
- LOG(TRACE) + "FileTransaction rolling back: empty transaction" + m_strFolder;
466
+ if (rho_log_system_is_ready()) {
467
+ LOG(TRACE) + "FileTransaction rolling back: empty transaction" + m_strFolder;
468
+ }
466
469
  return 0;
467
470
  }
468
471
 
@@ -470,6 +473,9 @@ unsigned int CFileTransaction::rollback()
470
473
  CRhoFile::deleteFolder( (strFolder + "_temp_journal").c_str() );
471
474
 
472
475
  if ( !CRhoFile::isFileExist((strFolder + "_journal").c_str()) )
476
+ if (rho_log_system_is_ready()) {
477
+ LOG(TRACE) + "FileTransaction stop: file not exist : " + (strFolder + "_journal");
478
+ }
473
479
  return 0;
474
480
 
475
481
  m_nError = CRhoFile::deleteFolder( (strFolder).c_str() );
@@ -488,7 +494,9 @@ unsigned int CFileTransaction::rollback()
488
494
  return m_nError;
489
495
  }
490
496
 
491
- LOG(TRACE) + "FileTransaction has rolled back";
497
+ if (rho_log_system_is_ready()) {
498
+ LOG(TRACE) + "FileTransaction has rolled back";
499
+ }
492
500
 
493
501
  return m_nError;
494
502
  }
@@ -1290,7 +1298,9 @@ void rho_sys_replace_current_bundle(const char* path, rho_param *p)
1290
1298
 
1291
1299
  int rho_sys_check_rollback_bundle(const char* szRhoPath)
1292
1300
  {
1293
- LOG(INFO) + "rho_sys_check_rollback_bundle()";
1301
+ if (rho_log_system_is_ready()) {
1302
+ LOG(INFO) + "rho_sys_check_rollback_bundle()";
1303
+ }
1294
1304
  CFileTransaction oFT( CFilePath::join(szRhoPath, "apps"), false );
1295
1305
  return oFT.rollback() != 0 ? 0 : 1;
1296
1306
  }
@@ -113,11 +113,17 @@ int CPosixThreadImpl::wait(unsigned int nTimeoutMs)
113
113
  if (timed_wait)
114
114
  {
115
115
  gettimeofday(&tp, NULL);
116
+
117
+
118
+ unsigned long long nanosecs = tp.tv_usec * 1000 + ((unsigned long long)nTimeoutMs)*((unsigned long long)1000000);
119
+ unsigned long long nanosec_sec = nanosecs / ((unsigned long long)1000000000);
120
+ nanosecs = nanosecs - (nanosec_sec * ((unsigned long long)1000000000));
121
+
116
122
  /* Convert from timeval to timespec */
117
- ts.tv_sec = tp.tv_sec;
118
- ts.tv_nsec = tp.tv_usec * 1000 + ((unsigned long long)(nTimeoutMs - nTimeout*1000))*1000000;
119
- ts.tv_sec += nTimeout;
120
- max = ((unsigned long long)tp.tv_sec + nTimeout)*1000000 + tp.tv_usec;
123
+ ts.tv_sec = tp.tv_sec + nanosec_sec;
124
+ ts.tv_nsec = nanosecs;//tp.tv_usec * 1000 + ((unsigned long long)(nTimeoutMs - nTimeout*1000))*1000000;
125
+ //ts.tv_sec += nTimeout;
126
+ max = ((unsigned long long)tp.tv_sec)*1000000 + tp.tv_usec + ((unsigned long long)nTimeoutMs)*((unsigned long long)1000);
121
127
  }
122
128
 
123
129
  common::CMutexLock oLock(m_mxSync);
@@ -1,18 +1,18 @@
1
1
  /*------------------------------------------------------------------------
2
2
  * (The MIT License)
3
- *
3
+ *
4
4
  * Copyright (c) 2008-2011 Rhomobile, Inc.
5
- *
5
+ *
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
8
8
  * in the Software without restriction, including without limitation the rights
9
9
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
10
  * copies of the Software, and to permit persons to whom the Software is
11
11
  * furnished to do so, subject to the following conditions:
12
- *
12
+ *
13
13
  * The above copyright notice and this permission notice shall be included in
14
14
  * all copies or substantial portions of the Software.
15
- *
15
+ *
16
16
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
17
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
18
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -20,13 +20,39 @@
20
20
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  * THE SOFTWARE.
23
- *
23
+ *
24
24
  * http://rhomobile.com
25
25
  *------------------------------------------------------------------------*/
26
26
 
27
27
  #include "common/RhoTime.h"
28
28
  #include "common/RhodesApp.h"
29
29
 
30
+ #include "common/RhoConf.h"
31
+
32
+
33
+ #include "logging/RhoLog.h"
34
+
35
+ #undef DEFAULT_LOGCATEGORY
36
+ #define DEFAULT_LOGCATEGORY "RhoTimer"
37
+
38
+
39
+ static bool is_net_trace() {
40
+ static int res = -1;
41
+ if (res == -1) {
42
+ if (rho_conf_getBool("net_trace") ) {
43
+ res = 1;
44
+ }
45
+ else {
46
+ res = 0;
47
+ }
48
+ }
49
+ return res == 1;
50
+ }
51
+
52
+
53
+
54
+
55
+
30
56
  namespace rho{
31
57
  namespace common{
32
58
 
@@ -143,33 +169,34 @@ boolean CRhoTimer::checkTimers()
143
169
  for( int i = (int)m_arItems.size()-1; i >= 0; i--)
144
170
  {
145
171
  CTimerItem oItem = m_arItems.elementAt(i);
146
- if(oItem.m_overflow==false)
147
- {
148
-
149
- if ( curTime.toULong() >= oItem.m_oFireTime.toULong() )
150
- {
151
- RAWTRACE("CRhoTimer::checkTimers: firing timer");
152
- m_arItems.removeElementAt(i);
153
- if ( RHODESAPP().callTimerCallback(oItem.m_strCallback, oItem.m_strCallbackData) )
154
- bRet = true;
155
- }
156
-
157
- }
158
- else
159
- {
160
- if ( curTime.toULong() >= oItem.m_oFireTime.toULong() )
161
- {
162
- if((curTime.toULong()-oItem.m_oFireTime.toULong())<=oItem.m_nInterval)
163
- {
172
+
173
+ if(oItem.m_overflow==false)
174
+ {
175
+
176
+ if ( curTime.toULong() >= oItem.m_oFireTime.toULong() )
177
+ {
164
178
  RAWTRACE("CRhoTimer::checkTimers: firing timer");
165
- m_arItems.removeElementAt(i);
166
- if ( RHODESAPP().callTimerCallback(oItem.m_strCallback, oItem.m_strCallbackData) )
167
- bRet = true;
168
- }
169
-
170
- }
171
-
172
- }
179
+ m_arItems.removeElementAt(i);
180
+ if ( RHODESAPP().callTimerCallback(oItem.m_strCallback, oItem.m_strCallbackData) )
181
+ bRet = true;
182
+ }
183
+
184
+ }
185
+ else
186
+ {
187
+ if ( curTime.toULong() >= oItem.m_oFireTime.toULong() )
188
+ {
189
+ if((curTime.toULong()-oItem.m_oFireTime.toULong())<=oItem.m_nInterval)
190
+ {
191
+ RAWTRACE("CRhoTimer::checkTimers: firing timer");
192
+ m_arItems.removeElementAt(i);
193
+ if ( RHODESAPP().callTimerCallback(oItem.m_strCallback, oItem.m_strCallbackData) )
194
+ bRet = true;
195
+ }
196
+
197
+ }
198
+
199
+ }
173
200
  }
174
201
 
175
202
  for( int i = (int)m_arNativeItems.size()-1; i >= 0; i--)
@@ -177,28 +204,42 @@ boolean CRhoTimer::checkTimers()
177
204
  CNativeTimerItem oItem = m_arNativeItems.elementAt(i);
178
205
 
179
206
  if(oItem.m_overflow==false)
180
- {
207
+ {
181
208
  if ( curTime.toULong() >= oItem.m_oFireTime.toULong() )
182
209
  {
183
210
  RAWTRACE("CRhoTimer::checkTimers: firing native timer");
184
211
  m_arNativeItems.removeElementAt(i);
185
- if ( oItem.m_pCallback->onTimer() )
212
+ if (is_net_trace()) {
213
+ RAWTRACE("$NetRequestProcess$ PRE ONTIMER CRhoTimer::checkTimers() 1 TIMER");
214
+ }
215
+ if ( oItem.m_pCallback->onTimer() ) {
186
216
  bRet = true;
217
+ }
218
+ if (is_net_trace()) {
219
+ RAWTRACE("$NetRequestProcess$ POST ONTIMER CRhoTimer::checkTimers() 1 TIMER");
220
+ }
187
221
  }
188
222
  }
189
223
  else
190
224
  {
191
225
  if ( curTime.toULong() >= oItem.m_oFireTime.toULong() )
192
- {
193
- if((curTime.toULong()-oItem.m_oFireTime.toULong())<=oItem.m_nInterval)
194
- {
226
+ {
227
+ if((curTime.toULong()-oItem.m_oFireTime.toULong())<=oItem.m_nInterval)
228
+ {
195
229
  RAWTRACE("CRhoTimer::checkTimers: firing native timer");
196
230
  m_arNativeItems.removeElementAt(i);
197
- if ( oItem.m_pCallback->onTimer() )
231
+ if (is_net_trace()) {
232
+ RAWTRACE("$NetRequestProcess$ PRE ONTIMER CRhoTimer::checkTimers() 2 TIMER");
233
+ }
234
+ if ( oItem.m_pCallback->onTimer() ) {
198
235
  bRet = true;
199
- }
200
-
201
- }
236
+ }
237
+ if (is_net_trace()) {
238
+ RAWTRACE("$NetRequestProcess$ POST ONTIMER CRhoTimer::checkTimers() 2 TIMER");
239
+ }
240
+ }
241
+
242
+ }
202
243
  }
203
244
  }
204
245
 
@@ -2641,7 +2641,7 @@ int rho_http_get_port()
2641
2641
  }
2642
2642
 
2643
2643
  #ifdef OS_MACOSX
2644
- const char* rho_http_direct_request( const char* method, const char* uri, const char* query, const void* headers, const char* body, int* responseLength )
2644
+ const char* rho_http_direct_request( const char* method, const char* uri, const char* query, const void* headers, const char* body, int bodylen, int* responseLength )
2645
2645
  {
2646
2646
 
2647
2647
  String sMethod;
@@ -2663,7 +2663,7 @@ const char* rho_http_direct_request( const char* method, const char* uri, const
2663
2663
  }
2664
2664
 
2665
2665
  if ( body != 0 ) {
2666
- sBody = body;
2666
+ sBody.assign(body, bodylen);
2667
2667
  }
2668
2668
 
2669
2669
  if ( headers != 0 ) {
@@ -361,7 +361,7 @@ int rho_http_started();
361
361
  int rho_http_get_port();
362
362
 
363
363
  #ifdef OS_MACOSX
364
- const char* rho_http_direct_request( const char* method, const char* uri, const char* query, const void* headers, const char* body, int* responseLength );
364
+ const char* rho_http_direct_request( const char* method, const char* uri, const char* query, const void* headers, const char* body, int bodylen, int* responseLength );
365
365
  void rho_http_free_response( const char* data );
366
366
 
367
367
  void* rho_http_init_headers_list();
@@ -633,6 +633,39 @@ void CDBAdapter::copyTable(String tableName, CDBAdapter& dbFrom, CDBAdapter& dbT
633
633
  }
634
634
  }
635
635
  }
636
+
637
+ // add file.blob attrib_type for blob attribs in changed_values
638
+ void CDBAdapter::updateAllBlobAttribChanges()
639
+ {
640
+ //Check for attrib = object
641
+ IDBResult res = executeSQL("SELECT object, source_id, attrib "
642
+ "FROM changed_values where update_type = 'update' and sent=0");
643
+
644
+ if ( res.isEnd() )
645
+ return;
646
+
647
+ startTransaction();
648
+
649
+ Vector<String> arObj, arAttrib;
650
+ Vector<int> arSrcID;
651
+ for( ; !res.isEnd(); res.next() )
652
+ {
653
+ arObj.addElement(res.getStringByIdx(0));
654
+ arSrcID.addElement(res.getIntByIdx(1));
655
+ arAttrib.addElement(res.getStringByIdx(2));
656
+ }
657
+
658
+ for( int i = 0; i < (int)arObj.size(); i++ )
659
+ {
660
+ String attribType = getAttrMgr().isBlobAttr(arSrcID.elementAt(i), arAttrib.elementAt(i).c_str()) ? "blob.file" : "";
661
+ if (attribType.length() > 0) {
662
+ executeSQL("UPDATE changed_values SET attrib_type=? WHERE source_id=? and object=? and attrib=? and sent=0", attribType, arSrcID.elementAt(i), arObj.elementAt(i), arAttrib.elementAt(i));
663
+ }
664
+ }
665
+
666
+ endTransaction();
667
+ }
668
+
636
669
 
637
670
  void CDBAdapter::updateAllAttribChanges()
638
671
  {
@@ -359,7 +359,12 @@ public:
359
359
 
360
360
  DBResultPtr prepareStatement( const char* szSt );
361
361
  DBResultPtr executeStatement(common::CAutoPtr<CDBResult>& res, const char* szSt);
362
+
363
+ // unpack object in changed_values with update_type==create to set of objects's attribs
362
364
  void updateAllAttribChanges();
365
+
366
+ // add file.blob attrib_type for blob attribs in changed_values
367
+ void updateAllBlobAttribChanges();
363
368
  void updateFullUpdateChanges(int nSrcID);
364
369
 
365
370
  String exportDatabase();
@@ -107,7 +107,8 @@ LogSettings::LogSettings()
107
107
  m_bLogToSocket = false;
108
108
 
109
109
  m_nMaxLogFileSize = 0;
110
- m_bLogPrefix = true;
110
+ m_bLogPrefix = true;
111
+ m_bIsInitialized = false;
111
112
 
112
113
  m_strLogURL = "";
113
114
 
@@ -311,6 +312,7 @@ void LogSettings::loadFromConf(rho::common::RhoSettings& oRhoConf)
311
312
  int milliseconds = oRhoConf.getInt("LogMemPeriod");
312
313
  setCollectMemoryInfoInterval(milliseconds);
313
314
  }
315
+ m_bIsInitialized = true;
314
316
  }
315
317
 
316
318
  void LogSettings::setLogFilePath(const String& logFilePath){
@@ -522,6 +524,14 @@ void rho_logconf_Init_with_separate_user_path(const char* szLogPath, const char*
522
524
  rho_conf_Init_with_separate_user_path(szRootPath, szUserPath);
523
525
 
524
526
  LOGCONF().loadFromConf(RHOCONF());
527
+
528
+ // print rhodes gem version
529
+ if (RHOCONF().isExist("rhodes_gem_version")) {
530
+ if (LOGCONF().getMinSeverity() < 2) {
531
+ String rho_gem_version = "RHODES_GEM_VERSION=" + RHOCONF().getString("rhodes_gem_version");
532
+ LOGCONF().sinkLogMessage(rho_gem_version);
533
+ }
534
+ }
525
535
  }
526
536
 
527
537
  void rho_logconf_Init(const char* szLogPath, const char* szRootPath, const char* szLogPort){
@@ -590,6 +600,12 @@ void rho_log_resetup_http_url(const char* http_log_url)
590
600
  //LOGCONF().reinitRemoteLog();
591
601
  }
592
602
 
603
+ bool rho_log_system_is_ready() {
604
+ return LOGCONF().isReadyForLogging();
605
+ }
606
+
607
+
608
+
593
609
  #ifndef RHO_NO_RUBY
594
610
  VALUE rho_conf_get_property_by_name(char* name)
595
611
  {
@@ -88,6 +88,8 @@ class LogSettings{
88
88
  String m_strLogURL;
89
89
 
90
90
  bool m_bLogPrefix;
91
+
92
+ bool m_bIsInitialized;
91
93
 
92
94
  String m_strEnabledCategories, m_strDisabledCategories;
93
95
  Vector<String> m_arExcludeAttribs;
@@ -130,6 +132,8 @@ public:
130
132
 
131
133
  bool isLogPrefix()const{ return m_bLogPrefix;}
132
134
  void setLogPrefix(bool bLogPrefix){ m_bLogPrefix = bLogPrefix; }
135
+
136
+ bool isReadyForLogging() { return m_bIsInitialized;}
133
137
 
134
138
  const String& getLogURL() const { return m_strLogURL; }
135
139
  void setLogURL(const char* szLogURL);
@@ -218,6 +222,8 @@ int rho_conf_send_log_in_same_thread();
218
222
  void rho_conf_clean_log();
219
223
 
220
224
  void rho_log_resetup_http_url(const char* http_log_url);
225
+
226
+ bool rho_log_system_is_ready();
221
227
 
222
228
  #ifdef __cplusplus
223
229
  }