rhodes 5.5.0.22 → 5.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -1
  3. data/CREDITS +3 -3
  4. data/Rakefile +0 -22
  5. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/Rakefile +1 -1
  6. data/lib/build/jake.rb +0 -5
  7. data/lib/commonAPI/coreapi/ext/shared/TimerImpl.cpp +27 -36
  8. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.h +0 -2
  9. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +25 -183
  10. data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +4 -91
  11. data/platform/iphone/rbuild/iphone.rake +231 -272
  12. data/platform/shared/common/RhoTime.cpp +40 -81
  13. data/platform/shared/db/DBAdapter.cpp +0 -33
  14. data/platform/shared/db/DBAdapter.h +0 -5
  15. data/platform/shared/net/HttpServer.cpp +1 -27
  16. data/platform/shared/net/INetRequest.cpp +6 -33
  17. data/platform/shared/qt/rhodes/qkineticscroller.cpp +2 -2
  18. data/platform/shared/qt/rhodes/qkineticscroller_p.h +1 -1
  19. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +3 -3
  20. data/platform/shared/qt/rhodes/qtscrollevent.cpp +2 -2
  21. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +1 -1
  22. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +1 -1
  23. data/platform/wm/build/wm.rake +3 -7
  24. data/platform/wm/rhodes/browser/BrowserFactory.cpp +6 -4
  25. data/platform/wm/rhodes/rhodes.vcproj +2 -31
  26. data/rakefile.rb +0 -22
  27. data/res/generators/templates/application/app/Settings/home.erb +1 -1
  28. data/res/generators/templates/application/build.yml +4 -61
  29. data/res/generators/templates/application/icon/icon.png +0 -0
  30. data/res/generators/templates/application/icon/icon114.png +0 -0
  31. data/res/generators/templates/application/icon/icon120.png +0 -0
  32. data/res/generators/templates/application/icon/icon144.png +0 -0
  33. data/res/generators/templates/application/icon/icon152.png +0 -0
  34. data/res/generators/templates/application/icon/icon180.png +0 -0
  35. data/res/generators/templates/application/icon/icon57.png +0 -0
  36. data/res/generators/templates/application/icon/icon60.png +0 -0
  37. data/res/generators/templates/application/icon/icon72.png +0 -0
  38. data/res/generators/templates/application/icon/icon76.png +0 -0
  39. data/res/generators/templates/application/production/iTunesArtwork.png +0 -0
  40. data/res/generators/templates/application/production/iTunesArtwork@2x.png +0 -0
  41. data/res/generators/templates/iphone_project/buildRhoBundle +7 -23
  42. data/res/generators/templates/iphone_project/root/Info.plist +2 -0
  43. data/res/generators/templates/iphone_project/root/iTunesArtwork +0 -0
  44. data/res/generators/templates/iphone_project/root/iTunesArtwork@2x +0 -0
  45. data/res/generators/templates/iphone_project/root/icon114.png +0 -0
  46. data/res/generators/templates/iphone_project/root/icon120.png +0 -0
  47. data/res/generators/templates/iphone_project/root/icon144.png +0 -0
  48. data/res/generators/templates/iphone_project/root/icon152.png +0 -0
  49. data/res/generators/templates/iphone_project/root/icon180.png +0 -0
  50. data/res/generators/templates/iphone_project/root/icon57.png +0 -0
  51. data/res/generators/templates/iphone_project/root/icon60.png +0 -0
  52. data/res/generators/templates/iphone_project/root/icon72.png +0 -0
  53. data/res/generators/templates/iphone_project/root/icon76.png +0 -0
  54. data/rhodes.gemspec +6 -7
  55. data/version +1 -1
  56. metadata +16 -46
  57. data/platform/iphone/rbuild/putsOverride.rake +0 -8
  58. data/platform/wm/rhodes/browser/stubs.cpp +0 -5
@@ -12,31 +12,9 @@
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"
20
15
 
21
16
  extern "C" void rho_net_impl_network_indicator(int active);
22
17
 
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
-
40
18
  @interface NetRequestDelegateContext : NSObject
41
19
  {
42
20
  NSCondition* netDelegateThreadStartCond;
@@ -137,13 +115,6 @@ public:
137
115
 
138
116
  - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
139
117
 
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
-
147
118
  //- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response;
148
119
 
149
120
  @property (retain)NSHTTPURLResponse* response;
@@ -175,28 +146,18 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
175
146
 
176
147
  - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err
177
148
  {
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
-
182
149
  self.error = err;
183
150
  m_pCppDelegate->onDone();
184
151
  }
185
152
 
186
153
  - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)resp
187
154
  {
188
- if (is_net_trace()) {
189
- RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didReceiveResponse uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
190
- }
191
155
  self.response = (NSHTTPURLResponse*)resp;
192
156
  m_pCppDelegate->onResponse((NSHTTPURLResponse*)resp);
193
157
  }
194
158
 
195
159
  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
196
160
  {
197
- if (is_net_trace()) {
198
- RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::didReceiveData uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
199
- }
200
161
  if ( m_pCppDelegate->shouldSaveData() )
201
162
  {
202
163
  [self.data appendData:data];
@@ -206,17 +167,11 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
206
167
 
207
168
  - (void)connectionDidFinishLoading:(NSURLConnection *)connection
208
169
  {
209
- if (is_net_trace()) {
210
- RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::connectionDidFinishLoading uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
211
- }
212
170
  m_pCppDelegate->onDone();
213
171
  }
214
172
 
215
173
  - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
216
174
  {
217
- if (is_net_trace()) {
218
- RAWTRACE1("$NetRequestProcess$ DELEGATE IPhoneNetRequest::delegate::willSendRequestForAuthenticationChallenge uri = %s ", [[[[connection currentRequest] URL] absoluteString] UTF8String]);
219
- }
220
175
  if ( (!m_pCppDelegate->verifySSLPeers()) && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust] )
221
176
  {
222
177
  SecTrustRef trust = challenge.protectionSpace.serverTrust;
@@ -229,24 +184,6 @@ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
229
184
  }
230
185
  }
231
186
 
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
-
250
187
  /*
251
188
  - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response
252
189
  {
@@ -714,28 +651,16 @@ public:
714
651
 
715
652
  INetResponse* perform( Hashtable<String,String>* pHeaders, IRhoSession* pSession )
716
653
  {
717
- if (is_net_trace()) {
718
- RAWLOG_INFO1("$NetRequestProcess$ PRE LOCK IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
719
- }
720
-
721
- [m_pPerformCond lock];
722
- if (is_net_trace()) {
723
- RAWLOG_INFO1("$NetRequestProcess$ POST LOCK IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
724
- }
654
+
655
+ [m_pPerformCond lock];
725
656
 
726
657
  //start();
727
658
  rho_net_impl_network_indicator(1);
728
659
 
729
660
  [m_pConnDelegate performSelector:@selector(startAsyncRequest) onThread:[[NetRequestDelegateContext sharedInstance] netRequestDelegateThread] withObject:nil waitUntilDone:NO];
730
661
 
731
- if (is_net_trace()) {
732
- RAWTRACE1("$NetRequestProcess$ PRE WAIT IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
733
- }
734
662
  [m_pPerformCond wait];
735
663
  [m_pPerformCond unlock];
736
- if (is_net_trace()) {
737
- RAWTRACE1("$NetRequestProcess$ POST WAIT IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
738
- }
739
664
 
740
665
  NSHTTPURLResponse* resp = nil;
741
666
  NSError* err = nil;
@@ -814,11 +739,6 @@ public:
814
739
  }
815
740
  }
816
741
  rho_net_impl_network_indicator(0);
817
-
818
- if (is_net_trace()) {
819
- RAWTRACE1("$NetRequestProcess$ FINISH IPhoneNetRequest::perform uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
820
- }
821
-
822
742
  return ret;
823
743
 
824
744
  }
@@ -827,15 +747,8 @@ public:
827
747
  {
828
748
  [m_pConn initWithRequest:m_pReq delegate:m_pConnDelegate startImmediately:NO];
829
749
  // [m_pConn setDelegateQueue:[NSOperationQueue mainQueue]];
830
- //[m_pConn scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
831
- if (is_net_trace()) {
832
- RAWTRACE1("$NetRequestProcess$ PRE START IPhoneNetRequest::start uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
833
- }
834
-
750
+ // [m_pConn scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
835
751
  [m_pConn start];
836
- if (is_net_trace()) {
837
- RAWTRACE1("$NetRequestProcess$ POST START IPhoneNetRequest::start uri = %s", [[[m_pReq URL] absoluteString] UTF8String]);
838
- }
839
752
  }
840
753
 
841
754
  void cancel()
@@ -1020,4 +933,4 @@ void CIPhoneNetRequest::setCallback(INetRequestCallback* cb)
1020
933
 
1021
934
  }
1022
935
 
1023
- }
936
+ }
@@ -28,35 +28,6 @@ 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
-
60
31
  def load_plist(fname)
61
32
  require 'cfpropertylist'
62
33
 
@@ -178,205 +149,6 @@ end
178
149
  # return ret_value
179
150
  # end
180
151
 
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 !hash.has_key?("NSAppTransportSecurity")
335
- hash['NSAppTransportSecurity'] = {}
336
- end
337
- if !hash['NSAppTransportSecurity'].has_key?("NSAllowsArbitraryLoads")
338
- hash['NSAppTransportSecurity']['NSAllowsArbitraryLoads'] = true
339
- end
340
- if $app_config["iphone"].has_key?("http_connection_domains")
341
- http_connection_domains = $app_config["iphone"]["http_connection_domains"]
342
- if http_connection_domains.kind_of?(Array)
343
- hash['NSAppTransportSecurity']['NSExceptionDomains'] = {}
344
- http_connection_domains.each do |domain|
345
- domain_hash = {}
346
- domain_hash['NSIncludesSubdomains'] = true
347
- domain_hash['NSTemporaryExceptionAllowsInsecureHTTPLoads'] = true
348
- domain_hash['NSTemporaryExceptionMinimumTLSVersion'] = 'TLSv1.0'
349
-
350
- hash['NSAppTransportSecurity']['NSExceptionDomains'][domain.to_s] = domain_hash
351
- end
352
- end
353
- end
354
-
355
- # add custom data
356
- if $app_config["iphone"].has_key?("info_plist_data_remove")
357
- info_plist_data_remove = $app_config["iphone"]["info_plist_data_remove"]
358
- if info_plist_data_remove.kind_of?(Array)
359
- info_plist_data_remove.each do |key|
360
- recursive_remove_hash(hash, key)
361
- end
362
- end
363
- end
364
- if $app_config["iphone"].has_key?("info_plist_data")
365
- info_plist_data = $app_config["iphone"]["info_plist_data"]
366
- if info_plist_data.kind_of?(Hash)
367
- info_plist_data.each do |key, value|
368
- value = recursive_replace_bool(value)
369
- recursive_merge_hash(hash, key, value)
370
- end
371
- end
372
- end
373
-
374
-
375
- set_app_icon(false)
376
- set_default_images(false, hash)
377
- end
378
- end
379
-
380
152
  def set_signing_identity(identity,profile,entitlements)
381
153
 
382
154
  appname = $app_config["name"] ? $app_config["name"] : "rhorunner"
@@ -1208,8 +980,6 @@ namespace "build" do
1208
980
 
1209
981
  print_timestamp('build:iphone:rhobundle FINISH')
1210
982
 
1211
- save_out_file
1212
-
1213
983
  end
1214
984
 
1215
985
  desc "build upgrade package with full bundle"
@@ -1413,7 +1183,6 @@ namespace "build" do
1413
1183
  end
1414
1184
 
1415
1185
  def is_options_was_changed(options_hash, options_file)
1416
- puts " is_options_was_changed( "+options_hash.to_s+", "+options_file.to_s+")"
1417
1186
  if !File.exist?(options_file)
1418
1187
  File.open(options_file,"w") {|f| f.write(YAML::dump(options_hash)) }
1419
1188
  return true
@@ -1452,7 +1221,6 @@ namespace "build" do
1452
1221
  arch = ENV['ARCHS']
1453
1222
  gccbin = bindir + '/gcc-4.2'
1454
1223
  arbin = bindir + '/ar'
1455
- xcode_version = ENV['XCODE_VERSION_ACTUAL']
1456
1224
 
1457
1225
  iphone_path = '.'
1458
1226
 
@@ -1465,53 +1233,33 @@ namespace "build" do
1465
1233
  result_lib = iphone_path + '/build/' + configuration + '-' + ( simulator ? "iphonesimulator" : "iphoneos") + '/lib'+xcodetarget+'.a'
1466
1234
  target_lib = targetdir + '/lib'+xcodetarget+'.a'
1467
1235
 
1468
- puts "BEGIN build xcode extension : ["+extpath+"]"
1469
- puts " result_lib : ["+result_lib+"]"
1470
- puts " target_lib : ["+target_lib+"]"
1471
- puts " depfile : ["+depfile.to_s+"]"
1472
- puts " configuration : ["+configuration+"]"
1473
- puts " sdk : ["+sdk+"]"
1236
+ if check_for_rebuild(result_lib, depfile) || is_options_was_changed({"configuration" => configuration,"sdk" => sdk}, "lastbuildoptions.yml")
1474
1237
 
1238
+ rm_rf 'build'
1239
+ rm_rf target_lib
1475
1240
 
1241
+ args = ['build', '-target', xcodetarget, '-configuration', configuration, '-sdk', sdk, '-project', xcodeproject]
1476
1242
 
1477
- rm_rf target_lib
1243
+ additional_string = ''
1244
+ if simulator
1245
+ #args << '-arch'
1246
+ #args << 'i386'
1247
+ additional_string = ' ARCHS="i386 x86_64"'
1248
+ end
1478
1249
 
1479
- check_f_r = check_for_rebuild(result_lib, depfile)
1480
- puts " check_for_rebuild = "+check_f_r.to_s
1481
- is_opt_c = is_options_was_changed({"configuration" => configuration,"sdk" => sdk, "xcode_version" => xcode_version}, "lastbuildoptions.yml")
1482
- puts " is_options_was_changed = "+is_opt_c.to_s
1250
+ require rootdir + '/lib/build/jake.rb'
1483
1251
 
1484
- if check_f_r || is_opt_c
1485
- puts " we should rebuild because previous builded library is not actual or not exist !"
1252
+ ret = IPhoneBuild.run_and_trace(xcodebuild,args,{:rootdir => rootdir, :string_for_add_to_command_line => additional_string})
1486
1253
  else
1487
- puts " ssskip rebuild because previous builded library is still actual !"
1488
- end
1489
-
1490
- if !File.exist?(result_lib)
1491
- # library bot found ! We should build it !
1492
- puts " build xcode extension !"
1493
-
1494
- rm_rf 'build'
1495
-
1496
- args = ['build', '-target', xcodetarget, '-configuration', configuration, '-sdk', sdk, '-project', xcodeproject]
1497
1254
 
1498
- additional_string = ''
1499
- if simulator
1500
- #args << '-arch'
1501
- #args << 'i386'
1502
- additional_string = ' ARCHS="i386 x86_64"'
1503
- end
1504
-
1505
- require rootdir + '/lib/build/jake.rb'
1506
-
1507
- ret = IPhoneBuild.run_and_trace(xcodebuild,args,{:rootdir => rootdir, :string_for_add_to_command_line => additional_string})
1255
+ puts "ssskip rebuild because previous builded library is still actual !"
1256
+ rm_rf target_lib
1508
1257
 
1509
1258
  end
1510
1259
 
1511
1260
  cp result_lib,target_lib
1512
1261
 
1513
1262
  Dir.chdir currentdir
1514
- puts "END build xcode extension : ["+extpath+"]"
1515
1263
 
1516
1264
 
1517
1265
  end
@@ -1523,9 +1271,6 @@ namespace "build" do
1523
1271
 
1524
1272
  puts "build extension START :" + extpath
1525
1273
 
1526
-
1527
- ENV["SDK_NAME"] ||= sdk
1528
- sdk = ENV["SDK_NAME"]
1529
1274
  #puts "xcodeproject = "+xcodeproject.to_s
1530
1275
  #puts "xcodetarget = "+xcodetarget.to_s
1531
1276
 
@@ -1556,7 +1301,7 @@ namespace "build" do
1556
1301
  # added by dmitrys
1557
1302
  ENV["XCODEBUILD"] = $xcodebuild
1558
1303
  ENV["CONFIGURATION"] ||= $configuration
1559
-
1304
+ ENV["SDK_NAME"] ||= sdk
1560
1305
 
1561
1306
 
1562
1307
  build_script = File.join(extpath, 'build')
@@ -2116,12 +1861,121 @@ namespace "build" do
2116
1861
 
2117
1862
 
2118
1863
  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("")
2119
1866
 
2120
1867
  chdir $app_path
2121
1868
 
2122
1869
  puts 'update info.plist'
2123
1870
 
2124
- update_plist_procedure
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
+
2125
1979
 
2126
1980
  set_signing_identity($signidentity,$provisionprofile,$entitlements) #if $signidentity.to_s != ""
2127
1981
  end
@@ -2152,7 +2006,112 @@ namespace "build" do
2152
2006
  #xml_path = File.join($startdir, "/lib/commonAPI/coreapi/ext/Application.xml")
2153
2007
  #Jake.run3("\"#{$startdir}/bin/rhogen\" api \"#{xml_path}\"")
2154
2008
 
2155
- update_plist_procedure
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
2156
2115
 
2157
2116
 
2158
2117
  if $entitlements == ""