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
@@ -12,9 +12,31 @@
12
12
  #import "common/RhoFilePath.h"
13
13
  #import "common/StringConverter.h"
14
14
  #import "common/RhoConf.h"
15
+ #import "logging/RhoLog.h"
16
+
17
+
18
+ #undef DEFAULT_LOGCATEGORY
19
+ #define DEFAULT_LOGCATEGORY "iPhoneNetRequest"
15
20
 
16
21
  extern "C" void rho_net_impl_network_indicator(int active);
17
22
 
23
+
24
+ static bool is_net_trace() {
25
+ static int res = -1;
26
+ if (res == -1) {
27
+ if (rho_conf_getBool("net_trace") ) {
28
+ res = 1;
29
+ }
30
+ else {
31
+ res = 0;
32
+ }
33
+ }
34
+ return res == 1;
35
+ }
36
+
37
+
38
+
39
+
18
40
  @interface NetRequestDelegateContext : NSObject
19
41
  {
20
42
  NSCondition* netDelegateThreadStartCond;
@@ -115,6 +137,13 @@ public:
115
137
 
116
138
  - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
117
139
 
140
+ - (nullable NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(nullable NSURLResponse *)response;
141
+ - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten
142
+ totalBytesWritten:(NSInteger)totalBytesWritten
143
+ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
144
+
145
+
146
+
118
147
  //- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response;
119
148
 
120
149
  @property (retain)NSHTTPURLResponse* response;
@@ -146,18 +175,28 @@ public:
146
175
 
147
176
  - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err
148
177
  {
178
+ if (is_net_trace()) {
179
+ RAWTRACE3("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didFailWithError uri = %s ERRCODE = %d, ERRTEXT = %s", [[[[connection currentRequest] URL] absoluteString] UTF8String], (int)[err code], [err localizedDescription]);
180
+ }
181
+
149
182
  self.error = err;
150
183
  m_pCppDelegate->onDone();
151
184
  }
152
185
 
153
186
  - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)resp
154
187
  {
188
+ if (is_net_trace()) {
189
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didReceiveResponse uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
190
+ }
155
191
  self.response = (NSHTTPURLResponse*)resp;
156
192
  m_pCppDelegate->onResponse((NSHTTPURLResponse*)resp);
157
193
  }
158
194
 
159
195
  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
160
196
  {
197
+ if (is_net_trace()) {
198
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didReceiveData uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
199
+ }
161
200
  if ( m_pCppDelegate->shouldSaveData() )
162
201
  {
163
202
  [self.data appendData:data];
@@ -167,11 +206,17 @@ public:
167
206
 
168
207
  - (void)connectionDidFinishLoading:(NSURLConnection *)connection
169
208
  {
209
+ if (is_net_trace()) {
210
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::connectionDidFinishLoading uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
211
+ }
170
212
  m_pCppDelegate->onDone();
171
213
  }
172
214
 
173
215
  - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
174
216
  {
217
+ if (is_net_trace()) {
218
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::willSendRequestForAuthenticationChallenge uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
219
+ }
175
220
  if ( (!m_pCppDelegate->verifySSLPeers()) && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust] )
176
221
  {
177
222
  SecTrustRef trust = challenge.protectionSpace.serverTrust;
@@ -184,6 +229,24 @@ public:
184
229
  }
185
230
  }
186
231
 
232
+ - (nullable NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(nullable NSURLResponse *)response {
233
+ if (is_net_trace()) {
234
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::willSendRequest uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
235
+ }
236
+ return request;
237
+ }
238
+
239
+
240
+ - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten
241
+ totalBytesWritten:(NSInteger)totalBytesWritten
242
+ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite {
243
+ if (is_net_trace()) {
244
+ RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didSendBodyData uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
245
+ }
246
+ }
247
+
248
+
249
+
187
250
  /*
188
251
  - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response
189
252
  {
@@ -246,6 +309,7 @@ namespace net {
246
309
  String m_data;
247
310
  int m_nRespCode;
248
311
  String m_cookies;
312
+ String m_errorMessage;
249
313
 
250
314
  public:
251
315
  CIPhoneNetResponseImpl(char const *data, size_t size, int nRespCode)
@@ -288,7 +352,17 @@ namespace net {
288
352
  {
289
353
  m_nRespCode = nRespCode;
290
354
  }
291
-
355
+
356
+ void setErrorMessage( const char* message )
357
+ {
358
+ m_errorMessage = message;
359
+ }
360
+
361
+ virtual String getErrorMessage()
362
+ {
363
+ return m_errorMessage;
364
+ }
365
+
292
366
  boolean isOK()
293
367
  {
294
368
  return m_nRespCode == 200 || m_nRespCode == 206;
@@ -633,7 +707,7 @@ public:
633
707
  close(fileDescriptor);
634
708
 
635
709
  if (fileDescriptor == -1) {
636
- NSLog(@"Error while creating tmp file");
710
+ RAWLOG_ERROR("Error while creating tmp file");
637
711
  free(tempFileNameCString);
638
712
  return nil;
639
713
  }
@@ -651,16 +725,28 @@ public:
651
725
 
652
726
  INetResponse* perform( Hashtable<String,String>* pHeaders, IRhoSession* pSession )
653
727
  {
654
-
655
- [m_pPerformCond lock];
728
+ if (is_net_trace()) {
729
+ RAWLOG_INFO1("$NetRequestProcess$ PRE LOCK IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
730
+ }
731
+
732
+ [m_pPerformCond lock];
733
+ if (is_net_trace()) {
734
+ RAWLOG_INFO1("$NetRequestProcess$ POST LOCK IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
735
+ }
656
736
 
657
737
  //start();
658
738
  rho_net_impl_network_indicator(1);
659
739
 
660
740
  [m_pConnDelegate performSelector:@selector(startAsyncRequest) onThread:[[NetRequestDelegateContext sharedInstance] netRequestDelegateThread] withObject:nil waitUntilDone:NO];
661
741
 
742
+ if (is_net_trace()) {
743
+ RAWTRACE1("$NetRequestProcess$ PRE WAIT IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
744
+ }
662
745
  [m_pPerformCond wait];
663
746
  [m_pPerformCond unlock];
747
+ if (is_net_trace()) {
748
+ RAWTRACE1("$NetRequestProcess$ POST WAIT IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
749
+ }
664
750
 
665
751
  NSHTTPURLResponse* resp = nil;
666
752
  NSError* err = nil;
@@ -681,6 +767,7 @@ public:
681
767
  if ( err != nil )
682
768
  {
683
769
  ret = new CIPhoneNetResponseImpl(-1);
770
+ ret->setErrorMessage([[err localizedDescription] UTF8String]);
684
771
 
685
772
  if ( m_pCallback != 0 )
686
773
  {
@@ -739,6 +826,11 @@ public:
739
826
  }
740
827
  }
741
828
  rho_net_impl_network_indicator(0);
829
+
830
+ if (is_net_trace()) {
831
+ RAWTRACE1("$NetRequestProcess$ FINISH IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
832
+ }
833
+
742
834
  return ret;
743
835
 
744
836
  }
@@ -747,8 +839,15 @@ public:
747
839
  {
748
840
  [m_pConn initWithRequest:m_pReq delegate:m_pConnDelegate startImmediately:NO];
749
841
  // [m_pConn setDelegateQueue:[NSOperationQueue mainQueue]];
750
- // [m_pConn scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
842
+ //[m_pConn scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
843
+ if (is_net_trace()) {
844
+ RAWTRACE1("$NetRequestProcess$ PRE START IPhoneNetRequest::start uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
845
+ }
846
+
751
847
  [m_pConn start];
848
+ if (is_net_trace()) {
849
+ RAWTRACE1("$NetRequestProcess$ POST START IPhoneNetRequest::start uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
850
+ }
752
851
  }
753
852
 
754
853
  void cancel()
@@ -933,4 +1032,4 @@ void CIPhoneNetRequest::setCallback(INetRequestCallback* cb)
933
1032
 
934
1033
  }
935
1034
 
936
- }
1035
+ }
@@ -28,6 +28,35 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'iphonecommon'))
28
28
  require File.dirname(__FILE__) + '/../../../lib/build/BuildConfig'
29
29
 
30
30
 
31
+ $out_file_buf_enable = false
32
+ $out_file_buf_path = 'rhobuildlog.txt'
33
+ $out_file_buf = []
34
+
35
+ puts 'iphone.rake execute'
36
+ puts 'ENV["RHO_BUNDLE_BUILD_LOG_FILE"] = '+ENV["RHO_BUNDLE_BUILD_LOG_FILE"].to_s
37
+ if (ENV["RHO_BUNDLE_BUILD_LOG_FILE"] != nil)
38
+ $out_file_buf_path = ENV["RHO_BUNDLE_BUILD_LOG_FILE"]
39
+ $out_file_buf_enable = true
40
+ load File.expand_path(File.join(File.dirname(__FILE__), 'putsOverride.rake'))
41
+ end
42
+
43
+
44
+
45
+ def save_out_file
46
+ if $out_file_buf_enable
47
+ f = File.new($out_file_buf_path,"w")
48
+ $out_file_buf.each do |line|
49
+ f.write(line)
50
+ f.write("\n")
51
+ end
52
+ f.close
53
+ end
54
+ end
55
+
56
+
57
+
58
+
59
+
31
60
  def load_plist(fname)
32
61
  require 'cfpropertylist'
33
62
 
@@ -149,6 +178,203 @@ end
149
178
  # return ret_value
150
179
  # end
151
180
 
181
+ def recursive_replace_bool(value)
182
+ if value.kind_of?(Hash)
183
+ value.each_key do |nkey|
184
+ value[nkey] = recursive_replace_bool(value[nkey])
185
+ end
186
+ elsif value.kind_of?(Array)
187
+ new_array = []
188
+ value.each do |el|
189
+ new_array << recursive_replace_bool(el)
190
+ end
191
+ else
192
+ if (value.to_s.downcase == 'true') || (value.to_s.downcase == 'yes')
193
+ value = true
194
+ end
195
+ if (value.to_s.downcase == 'false') || (value.to_s.downcase == 'no')
196
+ value = false
197
+ end
198
+ end
199
+ return value
200
+ end
201
+
202
+ def recursive_merge_hash(hash, key, value)
203
+ old_value = hash[key]
204
+ if old_value.nil?
205
+ hash[key] = value
206
+ elsif value.kind_of?(Array)
207
+ if old_value.kind_of?(Array)
208
+ value.each do |element|
209
+ if !old_value.include?(element)
210
+ old_value << element
211
+ end
212
+ end
213
+ else
214
+ hash[key] = value
215
+ end
216
+ elsif value.kind_of?(Hash)
217
+ if old_value.kind_of?(Hash)
218
+ value.each do |nkey, nvalue|
219
+ recursive_merge_hash(old_value, nkey, nvalue)
220
+ end
221
+ else
222
+ hash[key] = value
223
+ end
224
+ else
225
+ hash[key] = value
226
+ end
227
+ end
228
+
229
+
230
+ def recursive_remove_hash(hash, key)
231
+ if key.kind_of?(Array)
232
+ key.each do |element|
233
+ recursive_remove_hash(hash, element)
234
+ end
235
+ elsif key.kind_of?(Hash)
236
+ key.each do |keykey, keyvalue|
237
+ if hash.has_key? keykey
238
+ oldkey = hash[keykey]
239
+ recursive_remove_hash(oldkey, keyvalue)
240
+ end
241
+ end
242
+ elsif key.kind_of?(String)
243
+ #if hash.has_key? key
244
+ hash.delete(key)
245
+ #end
246
+ end
247
+ end
248
+
249
+
250
+
251
+ def update_plist_procedure
252
+ appname = $app_config["name"] ? $app_config["name"] : "rhorunner"
253
+ appname_fixed = appname.split(/[^a-zA-Z0-9]/).map { |w| w }.join("")
254
+
255
+ vendor = $app_config['vendor'] ? $app_config['vendor'] : "rhomobile"
256
+ bundle_identifier = "com.#{vendor}.#{appname}"
257
+ bundle_identifier = $app_config["iphone"]["BundleIdentifier"] unless $app_config["iphone"]["BundleIdentifier"].nil?
258
+
259
+ on_suspend = $app_config["iphone"]["UIApplicationExitsOnSuspend"]
260
+ on_suspend_value = false
261
+
262
+ if on_suspend.nil?
263
+ puts "UIApplicationExitsOnSuspend not configured, using default of false"
264
+ elsif on_suspend.to_s.downcase == "true" || on_suspend.to_s == "1"
265
+ on_suspend_value = true
266
+ elsif on_suspend.to_s.downcase == "false" || on_suspend.to_s == "0"
267
+ on_suspend_value = false
268
+ else
269
+ raise "UIApplicationExitsOnSuspend is not set to a valid value. Current value: '#{$app_config["iphone"]["UIApplicationExitsOnSuspend"]}'"
270
+ end
271
+
272
+ init_extensions( nil, "get_ext_xml_paths")
273
+
274
+ ext_name, changed_value = get_ext_plist_changes($app_extension_cfg)
275
+
276
+ set_app_plist_options($app_path + "/project/iphone/Info.plist", appname, bundle_identifier, $app_config["version"], $app_config["iphone"]["BundleURLScheme"]) do |hash|
277
+ hash['UIApplicationExitsOnSuspend'] = on_suspend_value
278
+
279
+ changed_value.each do |k, v|
280
+ puts "Info.plist: Setting key #{k} = #{v} from #{File.basename(ext_name[k])}"
281
+ hash[k] = v
282
+ end
283
+
284
+ #setup GPS access
285
+ gps_request_text = nil
286
+ if $app_config["capabilities"].index("gps") != nil
287
+ gps_request_text = 'application tracks your position'
288
+ end
289
+ if !$app_config["iphone"].nil?
290
+ if !$app_config["iphone"]["capabilities"].nil?
291
+ if $app_config["iphone"]["capabilities"].index("gps") != nil
292
+ gps_request_text = 'application tracks your position'
293
+ end
294
+ end
295
+ end
296
+ if gps_request_text != nil
297
+ if hash['NSLocationWhenInUseUsageDescription'] == nil
298
+ puts "Info.plist: added key [NSLocationWhenInUseUsageDescription]"
299
+ hash['NSLocationWhenInUseUsageDescription'] = gps_request_text
300
+ end
301
+ end
302
+
303
+ #setup Camera access
304
+ camera_request_text = nil
305
+ if $app_config["capabilities"].index("camera") != nil
306
+ camera_request_text = 'application wants to use camera'
307
+ end
308
+ if !$app_config["iphone"].nil?
309
+ if !$app_config["iphone"]["capabilities"].nil?
310
+ if $app_config["iphone"]["capabilities"].index("camera") != nil
311
+ camera_request_text = 'application wants to use camera'
312
+ end
313
+ end
314
+ end
315
+ if camera_request_text != nil
316
+ if hash['NSCameraUsageDescription'] == nil
317
+ puts "Info.plist: added key [NSCameraUsageDescription]"
318
+ hash['NSCameraUsageDescription'] = camera_request_text
319
+ end
320
+ end
321
+
322
+
323
+ #LSApplicationQueriesSchemes
324
+ if $app_config["iphone"].has_key?("ApplicationQueriesSchemes")
325
+ arr_app_queries_schemes = $app_config["iphone"]["ApplicationQueriesSchemes"]
326
+ if arr_app_queries_schemes.kind_of?(Array)
327
+ hash['LSApplicationQueriesSchemes'] = arr_app_queries_schemes
328
+ else
329
+ hash['LSApplicationQueriesSchemes'] = []
330
+ end
331
+ end
332
+
333
+ #http_connection_domains
334
+ if $app_config["iphone"].has_key?("http_connection_domains")
335
+ http_connection_domains = $app_config["iphone"]["http_connection_domains"]
336
+ if http_connection_domains.kind_of?(Array)
337
+ if !hash.has_key?("NSAppTransportSecurity")
338
+ hash['NSAppTransportSecurity'] = {}
339
+ end
340
+ hash['NSAppTransportSecurity']['NSExceptionDomains'] = {}
341
+ http_connection_domains.each do |domain|
342
+ domain_hash = {}
343
+ domain_hash['NSIncludesSubdomains'] = true
344
+ domain_hash['NSTemporaryExceptionAllowsInsecureHTTPLoads'] = true
345
+ domain_hash['NSTemporaryExceptionMinimumTLSVersion'] = 'TLSv1.0'
346
+ domain_hash['NSExceptionAllowsInsecureHTTPLoads'] = true
347
+ domain_hash['NSExceptionMinimumTLSVersion'] = 'TLSv1.0'
348
+ hash['NSAppTransportSecurity']['NSExceptionDomains'][domain.to_s] = domain_hash
349
+ end
350
+ end
351
+ end
352
+
353
+ # add custom data
354
+ if $app_config["iphone"].has_key?("info_plist_data_remove")
355
+ info_plist_data_remove = $app_config["iphone"]["info_plist_data_remove"]
356
+ if info_plist_data_remove.kind_of?(Array)
357
+ info_plist_data_remove.each do |key|
358
+ recursive_remove_hash(hash, key)
359
+ end
360
+ end
361
+ end
362
+ if $app_config["iphone"].has_key?("info_plist_data")
363
+ info_plist_data = $app_config["iphone"]["info_plist_data"]
364
+ if info_plist_data.kind_of?(Hash)
365
+ info_plist_data.each do |key, value|
366
+ value = recursive_replace_bool(value)
367
+ recursive_merge_hash(hash, key, value)
368
+ end
369
+ end
370
+ end
371
+
372
+
373
+ set_app_icon(false)
374
+ set_default_images(false, hash)
375
+ end
376
+ end
377
+
152
378
  def set_signing_identity(identity,profile,entitlements)
153
379
 
154
380
  appname = $app_config["name"] ? $app_config["name"] : "rhorunner"
@@ -252,29 +478,6 @@ def prepare_production_ipa (app_path, app_name)
252
478
 
253
479
  #cp mprovision_in_app, mprovision_in_payload
254
480
 
255
-
256
- itunes_artwork = File.join($app_path, "/project/iphone/iTunesArtwork")
257
- #itunes_artwork = File.join($config["build"]["iphonepath"], "iTunesArtwork.jpg")
258
- itunes_artwork_dst = File.join(tmp_dir, "iTunesArtwork")
259
-
260
- if !$app_config["iphone"].nil?
261
- if !$app_config["iphone"]["production"].nil?
262
- if !$app_config["iphone"]["production"]["ipa_itunesartwork_image"].nil?
263
- art_test_name = $app_config["iphone"]["production"]["ipa_itunesartwork_image"]
264
- if File.exists? art_test_name
265
- itunes_artwork = art_test_name
266
- else
267
- art_test_name = File.join($app_path,$app_config["iphone"]["production"]["ipa_itunesartwork_image"])
268
- if File.exists? art_test_name
269
- itunes_artwork = art_test_name
270
- else
271
- itunes_artwork = $app_config["iphone"]["production"]["ipa_itunesartwork_image"]
272
- end
273
- end
274
- end
275
- end
276
- end
277
-
278
481
  # now iTunesArtwork should be placed into application bundle !
279
482
  #cp itunes_artwork, itunes_artwork_dst
280
483
 
@@ -291,10 +494,19 @@ def prepare_production_ipa (app_path, app_name)
291
494
  end
292
495
 
293
496
  def copy_all_png_from_icon_folder_to_product(app_path)
294
- app_icon_folder = File.join($app_path, 'icon')
295
497
  rm_rf File.join(app_path, "*.png")
296
- Dir.glob(File.join(app_icon_folder, "*.png")).each do |icon_file|
297
- cp icon_file, app_path
498
+
499
+ app_icon_folder = File.join($app_path, 'resources', 'ios')
500
+ if File.exists? app_icon_folder
501
+ # NEW resources
502
+ Dir.glob(File.join(app_icon_folder, "icon*.png")).each do |icon_file|
503
+ cp icon_file, app_path
504
+ end
505
+ else
506
+ app_icon_folder = File.join($app_path, 'icon')
507
+ Dir.glob(File.join(app_icon_folder, "*.png")).each do |icon_file|
508
+ cp icon_file, app_path
509
+ end
298
510
  end
299
511
  end
300
512
 
@@ -362,7 +574,14 @@ def set_app_icon(make_bak)
362
574
  name = pair[0]
363
575
  #ibak = File.join(ipath, name + '.bak')
364
576
  icon = File.join(ipath, name + '.png')
365
- appicon = File.join($app_path, 'icon', pair[1] + '.png')
577
+ appicon_old = File.join($app_path, 'icon', pair[1] + '.png')
578
+ appicon = appicon_old
579
+ appicon_new = File.join($app_path, 'resources', 'ios', pair[1] + '.png')
580
+
581
+ if File.exists? appicon_new
582
+ appicon = appicon_new
583
+ end
584
+
366
585
  #if make_bak
367
586
  # cp icon, ibak unless File.exists? ibak
368
587
  #end
@@ -441,6 +660,14 @@ def set_default_images(make_bak, plist_hash)
441
660
  imag = File.join(ipath, defname + '.png')
442
661
  appimage = File.join($app_path, 'app', name + '.png')
443
662
  appsimage = File.join($app_path, 'app', name + '.iphone.png')
663
+ resourcesiamge = File.join($app_path, 'resources', 'ios', defname + '.png')
664
+ if File.exists? appsimage
665
+ appimage = appsimage
666
+ end
667
+ if File.exists? resourcesiamge
668
+ appimage = resourcesiamge
669
+ end
670
+
444
671
  if File.exists? imag
445
672
  #if make_bak
446
673
  # cp imag, ibak unless File.exists? ibak
@@ -449,14 +676,9 @@ def set_default_images(make_bak, plist_hash)
449
676
  end
450
677
  #bundlei = File.join($srcdir, defname + '.png')
451
678
  #cp appimage, bundlei unless !File.exist? appimage
452
- if File.exists? appsimage
453
- cp appsimage, imag
454
- existing_loading_images << (defname + '.png')
455
- else
456
- if File.exists? appimage
457
- cp appimage, imag
458
- existing_loading_images << (defname + '.png')
459
- end
679
+ if File.exists? appimage
680
+ cp appimage, imag
681
+ existing_loading_images << (defname + '.png')
460
682
  end
461
683
  end
462
684
  rescue => e
@@ -883,6 +1105,118 @@ namespace "config" do
883
1105
  $signidentity = 'iPhone Developer'
884
1106
  end
885
1107
 
1108
+
1109
+
1110
+ # find UUID for name of mobileprovision
1111
+ if (!$skip_checking_XCode) && ($provisionprofile != nil)
1112
+ $homedir = ENV['HOME']
1113
+ mp_folder = "#{$homedir}/Library/MobileDevice/Provisioning Profiles/"
1114
+
1115
+ mp_latest_UUID = nil
1116
+ mp_latest_Time = nil
1117
+
1118
+ Dir.entries(mp_folder).select do |entry|
1119
+ path = File.join(mp_folder,entry)
1120
+ #puts '$$$ '+path.to_s
1121
+ if !(File.directory? path) and !(entry =='.' || entry == '..' || entry == '.DS_Store')
1122
+ #puts ' $$$ '+path.to_s
1123
+ plist_path = path
1124
+ # make XML
1125
+ xml_lines_arr = []
1126
+ args = ['cms', '-D', '-i', plist_path]
1127
+ Jake.run2('security',args,{:rootdir => $startdir, :hide_output => true}) do |line|
1128
+ xml_lines_arr << line.to_s
1129
+ true
1130
+ end
1131
+ xml_lines = xml_lines_arr.join.to_s
1132
+ #puts '%%%%%%% '+xml_lines
1133
+
1134
+ plist_obj = CFPropertyList::List.new(:data => xml_lines)
1135
+ mp_plist_hash = CFPropertyList.native_types(plist_obj.value)
1136
+ #puts ' $$$ '+mp_plist_hash.to_s
1137
+ mp_name = mp_plist_hash['Name']
1138
+ mp_uuid = mp_plist_hash['UUID']
1139
+ mp_creation_date = mp_plist_hash['CreationDate']
1140
+
1141
+ #puts ' '+mp_creation_date.class.to_s+' '+mp_creation_date.to_s
1142
+
1143
+ #puts '$$$$$ MP: Name: "'+mp_name+'" UUID: ['+mp_uuid+']'
1144
+
1145
+ if mp_name == $provisionprofile
1146
+ puts 'Found MobileProvision Name: "'+mp_name+'" UUID: ['+mp_uuid+'] Creation Time: '+mp_creation_date.to_s+' File: '+path.to_s
1147
+ #$provisionprofile = mp_uuid
1148
+ if mp_latest_UUID == nil
1149
+ mp_latest_UUID = mp_uuid
1150
+ mp_latest_Time = mp_creation_date
1151
+ else
1152
+ if mp_creation_date > mp_latest_Time
1153
+ mp_latest_UUID = mp_uuid
1154
+ mp_latest_Time = mp_creation_date
1155
+ end
1156
+ end
1157
+ end
1158
+ end
1159
+ end
1160
+ if mp_latest_UUID != nil
1161
+ $provisionprofile = mp_latest_UUID
1162
+ end
1163
+ puts 'Processed MobileProvision UUID = '+$provisionprofile.to_s
1164
+ end
1165
+
1166
+ # process special SDK names: latest, latest_simulator, latest_device
1167
+ if ($sdk =~ /latest/) && (!$skip_checking_XCode)
1168
+ args = ['-showsdks']
1169
+ nullversion = Gem::Version.new('0.0')
1170
+ latestsimulator = Gem::Version.new('0.0')
1171
+ latestdevice = Gem::Version.new('0.0')
1172
+ simulatorsdkmask = /(.*)iphonesimulator([0-9]+).([0-9]+)(.*)/
1173
+ devicemask = /(.*)iphoneos([0-9]+).([0-9]+)(.*)/
1174
+
1175
+ Jake.run2($xcodebuild,args,{:rootdir => $startdir, :hide_output => true}) do |line|
1176
+ #puts 'LINE = '+line.to_s
1177
+ if (simulatorsdkmask=~line) == 0
1178
+ parsed = line.scan(simulatorsdkmask)
1179
+ curver = Gem::Version.new(parsed[0][1].to_s+'.'+parsed[0][2].to_s)
1180
+ if curver > latestsimulator
1181
+ latestsimulator = curver
1182
+ end
1183
+ end
1184
+ if (devicemask=~line) == 0
1185
+ parsed = line.scan(devicemask)
1186
+ curver = Gem::Version.new(parsed[0][1].to_s+'.'+parsed[0][2].to_s)
1187
+ if curver > latestdevice
1188
+ latestdevice = curver
1189
+ end
1190
+ end
1191
+ true
1192
+ end
1193
+ puts 'detect latestsimulator sdk = '+latestsimulator.to_s
1194
+ puts 'detect latestdevice sdk = '+latestdevice.to_s
1195
+ retx = $?
1196
+ #puts '### +'+retx.to_s
1197
+ if retx == 0
1198
+ if $sdk.to_s.downcase == 'latest'
1199
+ if Rake.application.top_level_tasks.to_s =~ /run/
1200
+ $sdk = 'latest_simulator'
1201
+ else
1202
+ $sdk = 'latest_device'
1203
+ end
1204
+ end
1205
+ if $sdk.to_s.downcase == 'latest_simulator'
1206
+ if nullversion != latestsimulator
1207
+ $sdk = 'iphonesimulator'+latestsimulator.to_s
1208
+ end
1209
+ end
1210
+ if $sdk.to_s.downcase == 'latest_device'
1211
+ if nullversion != latestsimulator
1212
+ $sdk = 'iphoneos'+latestdevice.to_s
1213
+ end
1214
+ end
1215
+ else
1216
+ puts "ERROR: cannot run xcodebuild for get list of installed SDKs !"
1217
+ end
1218
+ end
1219
+
886
1220
  if $sdk !~ /iphone/
887
1221
  if Rake.application.top_level_tasks.to_s =~ /run/
888
1222
  $sdk = "iphonesimulator#{$sdk}"
@@ -891,7 +1225,7 @@ namespace "config" do
891
1225
  end
892
1226
  end
893
1227
 
894
- puts $sdk
1228
+ puts 'SDK = '+$sdk
895
1229
 
896
1230
  if !$skip_checking_XCode
897
1231
  check_sdk($sdk)
@@ -980,6 +1314,8 @@ namespace "build" do
980
1314
 
981
1315
  print_timestamp('build:iphone:rhobundle FINISH')
982
1316
 
1317
+ save_out_file
1318
+
983
1319
  end
984
1320
 
985
1321
  desc "build upgrade package with full bundle"
@@ -1183,6 +1519,7 @@ namespace "build" do
1183
1519
  end
1184
1520
 
1185
1521
  def is_options_was_changed(options_hash, options_file)
1522
+ puts " is_options_was_changed( "+options_hash.to_s+", "+options_file.to_s+")"
1186
1523
  if !File.exist?(options_file)
1187
1524
  File.open(options_file,"w") {|f| f.write(YAML::dump(options_hash)) }
1188
1525
  return true
@@ -1221,6 +1558,7 @@ namespace "build" do
1221
1558
  arch = ENV['ARCHS']
1222
1559
  gccbin = bindir + '/gcc-4.2'
1223
1560
  arbin = bindir + '/ar'
1561
+ xcode_version = ENV['XCODE_VERSION_ACTUAL']
1224
1562
 
1225
1563
  iphone_path = '.'
1226
1564
 
@@ -1233,33 +1571,53 @@ namespace "build" do
1233
1571
  result_lib = iphone_path + '/build/' + configuration + '-' + ( simulator ? "iphonesimulator" : "iphoneos") + '/lib'+xcodetarget+'.a'
1234
1572
  target_lib = targetdir + '/lib'+xcodetarget+'.a'
1235
1573
 
1236
- if check_for_rebuild(result_lib, depfile) || is_options_was_changed({"configuration" => configuration,"sdk" => sdk}, "lastbuildoptions.yml")
1574
+ puts "BEGIN build xcode extension : ["+extpath+"]"
1575
+ puts " result_lib : ["+result_lib+"]"
1576
+ puts " target_lib : ["+target_lib+"]"
1577
+ puts " depfile : ["+depfile.to_s+"]"
1578
+ puts " configuration : ["+configuration+"]"
1579
+ puts " sdk : ["+sdk+"]"
1237
1580
 
1238
- rm_rf 'build'
1239
- rm_rf target_lib
1240
1581
 
1241
- args = ['build', '-target', xcodetarget, '-configuration', configuration, '-sdk', sdk, '-project', xcodeproject]
1242
1582
 
1243
- additional_string = ''
1244
- if simulator
1245
- #args << '-arch'
1246
- #args << 'i386'
1247
- additional_string = ' ARCHS="i386 x86_64"'
1248
- end
1583
+ rm_rf target_lib
1249
1584
 
1250
- require rootdir + '/lib/build/jake.rb'
1585
+ check_f_r = check_for_rebuild(result_lib, depfile)
1586
+ puts " check_for_rebuild = "+check_f_r.to_s
1587
+ is_opt_c = is_options_was_changed({"configuration" => configuration,"sdk" => sdk, "xcode_version" => xcode_version}, "lastbuildoptions.yml")
1588
+ puts " is_options_was_changed = "+is_opt_c.to_s
1251
1589
 
1252
- ret = IPhoneBuild.run_and_trace(xcodebuild,args,{:rootdir => rootdir, :string_for_add_to_command_line => additional_string})
1590
+ if check_f_r || is_opt_c
1591
+ puts " we should rebuild because previous builded library is not actual or not exist !"
1253
1592
  else
1593
+ puts " ssskip rebuild because previous builded library is still actual !"
1594
+ end
1595
+
1596
+ if !File.exist?(result_lib)
1597
+ # library bot found ! We should build it !
1598
+ puts " build xcode extension !"
1254
1599
 
1255
- puts "ssskip rebuild because previous builded library is still actual !"
1256
- rm_rf target_lib
1600
+ rm_rf 'build'
1601
+
1602
+ args = ['build', '-target', xcodetarget, '-configuration', configuration, '-sdk', sdk, '-project', xcodeproject]
1603
+
1604
+ additional_string = ''
1605
+ if simulator
1606
+ #args << '-arch'
1607
+ #args << 'i386'
1608
+ additional_string = ' ARCHS="i386 x86_64"'
1609
+ end
1610
+
1611
+ require rootdir + '/lib/build/jake.rb'
1612
+
1613
+ ret = IPhoneBuild.run_and_trace(xcodebuild,args,{:rootdir => rootdir, :string_for_add_to_command_line => additional_string})
1257
1614
 
1258
1615
  end
1259
1616
 
1260
1617
  cp result_lib,target_lib
1261
1618
 
1262
1619
  Dir.chdir currentdir
1620
+ puts "END build xcode extension : ["+extpath+"]"
1263
1621
 
1264
1622
 
1265
1623
  end
@@ -1271,6 +1629,9 @@ namespace "build" do
1271
1629
 
1272
1630
  puts "build extension START :" + extpath
1273
1631
 
1632
+
1633
+ ENV["SDK_NAME"] ||= sdk
1634
+ sdk = ENV["SDK_NAME"]
1274
1635
  #puts "xcodeproject = "+xcodeproject.to_s
1275
1636
  #puts "xcodetarget = "+xcodetarget.to_s
1276
1637
 
@@ -1301,7 +1662,7 @@ namespace "build" do
1301
1662
  # added by dmitrys
1302
1663
  ENV["XCODEBUILD"] = $xcodebuild
1303
1664
  ENV["CONFIGURATION"] ||= $configuration
1304
- ENV["SDK_NAME"] ||= sdk
1665
+
1305
1666
 
1306
1667
 
1307
1668
  build_script = File.join(extpath, 'build')
@@ -1861,121 +2222,12 @@ namespace "build" do
1861
2222
 
1862
2223
 
1863
2224
  task :update_plist => ["config:iphone"] do
1864
- appname = $app_config["name"] ? $app_config["name"] : "rhorunner"
1865
- appname_fixed = appname.split(/[^a-zA-Z0-9]/).map { |w| w }.join("")
1866
2225
 
1867
2226
  chdir $app_path
1868
2227
 
1869
2228
  puts 'update info.plist'
1870
2229
 
1871
- vendor = $app_config['vendor'] ? $app_config['vendor'] : "rhomobile"
1872
- bundle_identifier = "com.#{vendor}.#{appname}"
1873
- bundle_identifier = $app_config["iphone"]["BundleIdentifier"] unless $app_config["iphone"]["BundleIdentifier"].nil?
1874
-
1875
- on_suspend = $app_config["iphone"]["UIApplicationExitsOnSuspend"]
1876
- on_suspend_value = false
1877
-
1878
- if on_suspend.nil?
1879
- puts "UIApplicationExitsOnSuspend not configured, using default of false"
1880
- elsif on_suspend.to_s.downcase == "true" || on_suspend.to_s == "1"
1881
- on_suspend_value = true
1882
- elsif on_suspend.to_s.downcase == "false" || on_suspend.to_s == "0"
1883
- on_suspend_value = false
1884
- else
1885
- raise "UIApplicationExitsOnSuspend is not set to a valid value. Current value: '#{$app_config["iphone"]["UIApplicationExitsOnSuspend"]}'"
1886
- end
1887
-
1888
- init_extensions( nil, "get_ext_xml_paths")
1889
-
1890
- ext_name, changed_value = get_ext_plist_changes($app_extension_cfg)
1891
-
1892
- set_app_plist_options($app_path + "/project/iphone/Info.plist", appname, bundle_identifier, $app_config["version"], $app_config["iphone"]["BundleURLScheme"]) do |hash|
1893
- hash['UIApplicationExitsOnSuspend'] = on_suspend_value
1894
-
1895
- changed_value.each do |k, v|
1896
- puts "Info.plist: Setting key #{k} = #{v} from #{File.basename(ext_name[k])}"
1897
- hash[k] = v
1898
- end
1899
-
1900
- #setup GPS access
1901
- gps_request_text = nil
1902
- if $app_config["capabilities"].index("gps") != nil
1903
- gps_request_text = 'application tracks your position'
1904
- end
1905
- if !$app_config["iphone"].nil?
1906
- if !$app_config["iphone"]["capabilities"].nil?
1907
- if $app_config["iphone"]["capabilities"].index("gps") != nil
1908
- gps_request_text = 'application tracks your position'
1909
- end
1910
- end
1911
- end
1912
- if gps_request_text != nil
1913
- if hash['NSLocationWhenInUseUsageDescription'] == nil
1914
- puts "Info.plist: added key [NSLocationWhenInUseUsageDescription]"
1915
- hash['NSLocationWhenInUseUsageDescription'] = gps_request_text
1916
- end
1917
- end
1918
-
1919
- #setup Camera access
1920
- camera_request_text = nil
1921
- if $app_config["capabilities"].index("camera") != nil
1922
- camera_request_text = 'application wants to use camera'
1923
- end
1924
- if !$app_config["iphone"].nil?
1925
- if !$app_config["iphone"]["capabilities"].nil?
1926
- if $app_config["iphone"]["capabilities"].index("camera") != nil
1927
- camera_request_text = 'application wants to use camera'
1928
- end
1929
- end
1930
- end
1931
- if camera_request_text != nil
1932
- if hash['NSCameraUsageDescription'] == nil
1933
- puts "Info.plist: added key [NSCameraUsageDescription]"
1934
- hash['NSCameraUsageDescription'] = camera_request_text
1935
- end
1936
- end
1937
-
1938
-
1939
- #LSApplicationQueriesSchemes
1940
- if $app_config["iphone"].has_key?("ApplicationQueriesSchemes")
1941
- arr_app_queries_schemes = $app_config["iphone"]["ApplicationQueriesSchemes"]
1942
- if arr_app_queries_schemes.kind_of?(Array)
1943
- hash['LSApplicationQueriesSchemes'] = arr_app_queries_schemes
1944
- else
1945
- hash['LSApplicationQueriesSchemes'] = []
1946
- end
1947
- end
1948
-
1949
- #http_connection_domains
1950
- if !hash.has_key?("NSAppTransportSecurity")
1951
- hash['NSAppTransportSecurity'] = {}
1952
- end
1953
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoads")
1954
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true
1955
- end
1956
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoadsInWebContent")
1957
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoadsInWebContent'] = true
1958
- end
1959
- if $app_config["iphone"].has_key?("http_connection_domains")
1960
- http_connection_domains = $app_config["iphone"]["http_connection_domains"]
1961
- if http_connection_domains.kind_of?(Array)
1962
- hash['NSAppTransportSecurity']['NSExceptionDomains'] = {}
1963
- http_connection_domains.each do |domain|
1964
- domain_hash = {}
1965
- domain_hash['NSIncludesSubdomains'] = true
1966
- domain_hash['NSTemporaryExceptionAllowsInsecureHTTPLoads'] = true
1967
- domain_hash['NSTemporaryExceptionMinimumTLSVersion'] = 'TLSv1.0'
1968
-
1969
- hash['NSAppTransportSecurity']['NSExceptionDomains'][domain.to_s] = domain_hash
1970
- end
1971
- end
1972
- end
1973
-
1974
-
1975
- set_app_icon(false)
1976
- set_default_images(false, hash)
1977
- end
1978
-
2230
+ update_plist_procedure
1979
2231
 
1980
2232
  set_signing_identity($signidentity,$provisionprofile,$entitlements) #if $signidentity.to_s != ""
1981
2233
  end
@@ -2006,112 +2258,7 @@ namespace "build" do
2006
2258
  #xml_path = File.join($startdir, "/lib/commonAPI/coreapi/ext/Application.xml")
2007
2259
  #Jake.run3("\"#{$startdir}/bin/rhogen\" api \"#{xml_path}\"")
2008
2260
 
2009
- vendor = $app_config['vendor'] ? $app_config['vendor'] : "rhomobile"
2010
- bundle_identifier = "com.#{vendor}.#{appname}"
2011
- bundle_identifier = $app_config["iphone"]["BundleIdentifier"] unless $app_config["iphone"]["BundleIdentifier"].nil?
2012
-
2013
- on_suspend = $app_config["iphone"]["UIApplicationExitsOnSuspend"]
2014
- on_suspend_value = false
2015
-
2016
- if on_suspend.nil?
2017
- puts "UIApplicationExitsOnSuspend not configured, using default of false"
2018
- elsif on_suspend.to_s.downcase == "true" || on_suspend.to_s == "1"
2019
- on_suspend_value = true
2020
- elsif on_suspend.to_s.downcase == "false" || on_suspend.to_s == "0"
2021
- on_suspend_value = false
2022
- else
2023
- raise "UIApplicationExitsOnSuspend is not set to a valid value. Current value: '#{$app_config["iphone"]["UIApplicationExitsOnSuspend"]}'"
2024
- end
2025
-
2026
- init_extensions( nil, "get_ext_xml_paths")
2027
-
2028
- ext_name, changed_value = get_ext_plist_changes($app_extension_cfg)
2029
-
2030
- set_app_plist_options($app_path + "/project/iphone/Info.plist", appname, bundle_identifier, $app_config["version"], $app_config["iphone"]["BundleURLScheme"]) do |hash|
2031
- hash['UIApplicationExitsOnSuspend'] = on_suspend_value
2032
-
2033
- changed_value.each do |k, v|
2034
- puts "Info.plist: Setting key #{k} = #{v} from #{File.basename(ext_name[k])}"
2035
- hash[k] = v
2036
- end
2037
-
2038
- #setup GPS access
2039
- gps_request_text = nil
2040
- if $app_config["capabilities"].index("gps") != nil
2041
- gps_request_text = 'application tracks your position'
2042
- end
2043
- if !$app_config["iphone"].nil?
2044
- if !$app_config["iphone"]["capabilities"].nil?
2045
- if $app_config["iphone"]["capabilities"].index("gps") != nil
2046
- gps_request_text = 'application tracks your position'
2047
- end
2048
- end
2049
- end
2050
- if gps_request_text != nil
2051
- if hash['NSLocationWhenInUseUsageDescription'] == nil
2052
- puts "Info.plist: added key [NSLocationWhenInUseUsageDescription]"
2053
- hash['NSLocationWhenInUseUsageDescription'] = gps_request_text
2054
- end
2055
- end
2056
-
2057
- #setup Camera access
2058
- camera_request_text = nil
2059
- if $app_config["capabilities"].index("camera") != nil
2060
- camera_request_text = 'application wants to use camera'
2061
- end
2062
- if !$app_config["iphone"].nil?
2063
- if !$app_config["iphone"]["capabilities"].nil?
2064
- if $app_config["iphone"]["capabilities"].index("camera") != nil
2065
- camera_request_text = 'application wants to use camera'
2066
- end
2067
- end
2068
- end
2069
- if camera_request_text != nil
2070
- if hash['NSCameraUsageDescription'] == nil
2071
- puts "Info.plist: added key [NSCameraUsageDescription]"
2072
- hash['NSCameraUsageDescription'] = camera_request_text
2073
- end
2074
- end
2075
-
2076
-
2077
- #LSApplicationQueriesSchemes
2078
- if $app_config["iphone"].has_key?("ApplicationQueriesSchemes")
2079
- arr_app_queries_schemes = $app_config["iphone"]["ApplicationQueriesSchemes"]
2080
- if arr_app_queries_schemes.kind_of?(Array)
2081
- hash['LSApplicationQueriesSchemes'] = arr_app_queries_schemes
2082
- else
2083
- hash['LSApplicationQueriesSchemes'] = []
2084
- end
2085
- end
2086
-
2087
- #http_connection_domains
2088
- if !hash.has_key?("NSAppTransportSecurity")
2089
- hash['NSAppTransportSecurity'] = {}
2090
- end
2091
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoads")
2092
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true
2093
- end
2094
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoadsInWebContent")
2095
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoadsInWebContent'] = true
2096
- end
2097
- if $app_config["iphone"].has_key?("http_connection_domains")
2098
- http_connection_domains = $app_config["iphone"]["http_connection_domains"]
2099
- if http_connection_domains.kind_of?(Array)
2100
- hash['NSAppTransportSecurity']['NSExceptionDomains'] = {}
2101
- http_connection_domains.each do |domain|
2102
- domain_hash = {}
2103
- domain_hash['NSIncludesSubdomains'] = true
2104
- domain_hash['NSTemporaryExceptionAllowsInsecureHTTPLoads'] = true
2105
- domain_hash['NSTemporaryExceptionMinimumTLSVersion'] = 'TLSv1.0'
2106
-
2107
- hash['NSAppTransportSecurity']['NSExceptionDomains'][domain.to_s] = domain_hash
2108
- end
2109
- end
2110
- end
2111
-
2112
- set_app_icon(false)
2113
- set_default_images(false, hash)
2114
- end
2261
+ update_plist_procedure
2115
2262
 
2116
2263
 
2117
2264
  if $entitlements == ""
@@ -2130,6 +2277,12 @@ namespace "build" do
2130
2277
  itunes_artwork_in_project_2 = File.join($app_path, "project","iphone","iTunesArtwork@2x")
2131
2278
  itunes_artwork = File.join($app_path, "project","iphone","iTunesArtwork")
2132
2279
 
2280
+ itunes_artwork_new = File.join($app_path, "resources","ios","iTunesArtwork.png")
2281
+ if File.exists? itunes_artwork_new
2282
+ itunes_artwork = itunes_artwork_new
2283
+ end
2284
+
2285
+
2133
2286
  if !$app_config["iphone"].nil?
2134
2287
  if !$app_config["iphone"]["production"].nil?
2135
2288
  if !$app_config["iphone"]["production"]["ipa_itunesartwork_image"].nil?
@@ -3292,6 +3445,12 @@ namespace "device" do
3292
3445
  itunes_artwork_default = File.join($app_path, "/project/iphone/iTunesArtwork")
3293
3446
  itunes_artwork = itunes_artwork_default
3294
3447
 
3448
+ itunes_artwork_new = File.join($app_path, "resources","ios","iTunesArtwork.png")
3449
+ if File.exists? itunes_artwork_new
3450
+ itunes_artwork = itunes_artwork_new
3451
+ end
3452
+
3453
+
3295
3454
  if !$app_config["iphone"].nil?
3296
3455
  if !$app_config["iphone"]["production"].nil?
3297
3456
  if !$app_config["iphone"]["production"]["ipa_itunesartwork_image"].nil?