rhodes 2.2.4.beta.1 → 2.2.5.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. data/CHANGELOG +10 -0
  2. data/Rakefile +119 -3
  3. data/lib/build/jake.rb +15 -1
  4. data/lib/framework/dateME.rb +6 -1
  5. data/lib/framework/rho/render.rb +18 -15
  6. data/lib/framework/rho/rho.rb +105 -43
  7. data/lib/framework/rho/rhoapplication.rb +1 -1
  8. data/lib/framework/rho/rhocontact.rb +41 -13
  9. data/lib/framework/rho/rhocontroller.rb +10 -1
  10. data/lib/framework/rho/rhoevent_c.rb +6 -1
  11. data/lib/framework/rho/rhosupport.rb +1 -1
  12. data/lib/framework/rhodes.rb +1 -1
  13. data/lib/framework/rholang/rhomsg_de.rb +1 -1
  14. data/lib/framework/rholang/rhomsg_es.rb +1 -1
  15. data/lib/framework/rholang/rhomsg_it.rb +28 -0
  16. data/lib/framework/rhom/rhom.rb +6 -0
  17. data/lib/framework/rhom/rhom_model.rb +14 -7
  18. data/lib/framework/rhom/rhom_object_factory.rb +121 -56
  19. data/lib/framework/version.rb +1 -1
  20. data/lib/rhodes.rb +1 -1
  21. data/platform/android/Rhodes/AndroidManifest.full.xml +62 -0
  22. data/platform/android/Rhodes/AndroidManifest.xml +3 -34
  23. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +17 -2
  24. data/platform/android/Rhodes/jni/src/alert.cpp +16 -0
  25. data/platform/android/Rhodes/jni/src/callbacks.cpp +27 -3
  26. data/platform/android/Rhodes/jni/src/nativebar.cpp +3 -0
  27. data/platform/android/Rhodes/jni/src/nativeview.cpp +131 -1
  28. data/platform/android/Rhodes/jni/src/phonebook.cpp +102 -41
  29. data/platform/android/Rhodes/jni/src/rhodes.cpp +113 -32
  30. data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +1 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +9 -8
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +184 -49
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +49 -25
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +104 -57
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +36 -2
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +24 -14
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +7 -8
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +185 -3
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +54 -1
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +107 -14
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +72 -24
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +22 -21
  44. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +91 -11
  45. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +10 -0
  46. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +11 -0
  47. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +10 -0
  48. data/platform/android/build/android.rake +50 -9
  49. data/platform/android/build/librhocommon_build.files +1 -0
  50. data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +3 -2
  51. data/platform/bb/Hsqldb/src/org/hsqldb/SchemaManager.java +3 -1
  52. data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +7 -0
  53. data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +2 -2
  54. data/platform/bb/RubyVM/RubyVM.jdp +1 -0
  55. data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +22 -0
  56. data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +5 -0
  57. data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +1 -1
  58. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +51 -4
  59. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +21 -10
  60. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +82 -33
  61. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +59 -6
  62. data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyFloat_Methods.java +5 -0
  63. data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +19 -7
  64. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/ArrayPacker.java +1 -1
  65. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFloat.java +5 -0
  66. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +55 -11
  67. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +18 -2
  68. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +8 -5
  69. data/platform/bb/RubyVM/src/j2me/lang/CharacterMe.java +1 -1
  70. data/platform/bb/RubyVM/src/j2me/util/StringParser.java +2 -0
  71. data/platform/bb/build/RubyVM_build.files +1 -0
  72. data/platform/bb/build/bb.rake +21 -2
  73. data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +3 -3
  74. data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +1 -1
  75. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -2
  76. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +15 -16
  77. data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -0
  78. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +58 -0
  79. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +90 -4
  80. data/platform/iphone/Classes/AppManager/AppManager.m +43 -5
  81. data/platform/iphone/Classes/Event/Event.h +2 -0
  82. data/platform/iphone/Classes/Event/Event.m +12 -1
  83. data/platform/iphone/Classes/GeoLocation/LocationController.m +9 -3
  84. data/platform/iphone/Classes/MapView/MapViewController.m +20 -9
  85. data/platform/iphone/Classes/NativeBar.m +27 -0
  86. data/platform/iphone/Classes/Phonebook/phonebook.m +17 -0
  87. data/platform/iphone/Classes/RhoAlert.m +61 -1
  88. data/platform/iphone/Classes/RhoMainView.h +1 -0
  89. data/platform/iphone/Classes/Rhodes.h +2 -0
  90. data/platform/iphone/Classes/Rhodes.m +108 -1
  91. data/platform/iphone/Classes/SimpleMainView.h +4 -0
  92. data/platform/iphone/Classes/SimpleMainView.m +30 -3
  93. data/platform/iphone/Classes/SplashViewController.m +3 -1
  94. data/platform/iphone/Classes/TabbedMainView.h +2 -0
  95. data/platform/iphone/Classes/TabbedMainView.m +63 -11
  96. data/platform/iphone/Classes/rho/net/NetRequestImpl.m +26 -0
  97. data/platform/iphone/Info.plist +12 -1
  98. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
  99. data/platform/iphone/rbuild/iphone.rake +181 -25
  100. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +5 -5
  101. data/platform/shared/common/IRhoThreadImpl.h +1 -1
  102. data/platform/shared/common/PosixThreadImpl.cpp +5 -3
  103. data/platform/shared/common/PosixThreadImpl.h +1 -1
  104. data/platform/shared/common/RhoFilePath.h +11 -0
  105. data/platform/shared/common/RhoNativeViewManager.h +17 -0
  106. data/platform/shared/common/RhoThread.h +1 -1
  107. data/platform/shared/common/RhodesApp.cpp +29 -8
  108. data/platform/shared/common/ThreadQueue.cpp +5 -3
  109. data/platform/shared/common/ThreadQueue.h +2 -1
  110. data/platform/shared/common/app_build_configs.c +25 -0
  111. data/platform/shared/common/app_build_configs.h +11 -0
  112. data/platform/shared/net/AsyncHttp.cpp +5 -5
  113. data/platform/shared/net/CURLNetRequest.cpp +25 -7
  114. data/platform/shared/net/CURLNetRequest.h +2 -1
  115. data/platform/shared/net/HttpServer.cpp +28 -0
  116. data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
  117. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +26 -1
  118. data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
  119. data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
  120. data/platform/shared/ruby/ext/rho/rhosupport.c +15 -2
  121. data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -2
  122. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +97 -2
  123. data/platform/shared/ruby/ext/system/system.i +13 -0
  124. data/platform/shared/ruby/ext/system/system_wrap.c +104 -1
  125. data/platform/shared/rubyext/RhoAppAdapter.cpp +7 -0
  126. data/platform/shared/sync/SyncEngine.cpp +43 -3
  127. data/platform/shared/sync/SyncEngine.h +13 -0
  128. data/platform/shared/sync/SyncNotify.cpp +41 -23
  129. data/platform/shared/sync/SyncNotify.h +18 -4
  130. data/platform/shared/sync/SyncSource.cpp +52 -14
  131. data/platform/shared/sync/SyncSource.h +1 -0
  132. data/platform/shared/sync/SyncThread.cpp +29 -9
  133. data/platform/shared/sync/SyncThread.h +4 -2
  134. data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
  135. data/platform/wm/build/build_inf.js +15 -9
  136. data/platform/wm/build/wm.rake +10 -5
  137. data/platform/wm/rhodes/Alert.cpp +10 -0
  138. data/platform/wm/rhodes/Alert.h +3 -3
  139. data/platform/wm/rhodes/MainWindow.cpp +171 -26
  140. data/platform/wm/rhodes/MainWindow.h +23 -1
  141. data/platform/wm/rhodes/MetaHandler.cpp +192 -0
  142. data/platform/wm/rhodes/MetaHandler.h +31 -0
  143. data/platform/wm/rhodes/RhoNativeViewManager.cpp +126 -0
  144. data/platform/wm/rhodes/RhoNativeViewManagerWM.h +20 -0
  145. data/platform/wm/rhodes/Rhodes.cpp +91 -2
  146. data/platform/wm/rhodes/Rhodes.rc +15 -6
  147. data/platform/wm/rhodes/SyncStatusDlg.cpp +32 -0
  148. data/platform/wm/rhodes/SyncStatusDlg.h +29 -0
  149. data/platform/wm/rhodes/resource.h +5 -2
  150. data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +3 -1
  151. data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +1 -1
  152. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +146 -14
  153. data/platform/wm/rhodes/rhodes.vcproj +28 -0
  154. data/rakefile.rb +119 -3
  155. data/res/build-tools/iphonesim/README +58 -0
  156. data/res/build-tools/iphonesim/Source/iPhoneSimulator.h +43 -0
  157. data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +224 -0
  158. data/res/build-tools/iphonesim/Source/main.m +52 -0
  159. data/res/build-tools/iphonesim/Source/nsprintf.h +3 -0
  160. data/res/build-tools/iphonesim/Source/nsprintf.m +42 -0
  161. data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
  162. data/res/build-tools/iphonesim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +124 -0
  163. data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +261 -0
  164. data/res/build-tools/iphonesim/iphonesim_Prefix.pch +7 -0
  165. data/res/generators/rhogen.rb +5 -0
  166. data/res/generators/templates/application/app/layout.erb +7 -13
  167. data/res/generators/templates/application/app/loading.png +0 -0
  168. data/res/generators/templates/application/build.yml +3 -0
  169. data/res/generators/templates/application/icon/icon114.png +0 -0
  170. data/res/generators/templates/application/icon/icon57.png +0 -0
  171. data/res/generators/templates/application/icon/icon72.png +0 -0
  172. data/res/generators/templates/application/public/css/iphone.css +96 -0
  173. data/res/generators/templates/application/public/images/backButton.png +0 -0
  174. data/res/generators/templates/application/public/jqtouch/jqtouch.js +2 -1
  175. data/res/generators/templates/application/rhoconfig.txt +2 -0
  176. data/rhodes.gemspec +1 -1
  177. data/spec/phone_spec/app/spec/array_pack_spec.rb +108 -0
  178. data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
  179. data/spec/phone_spec/app/spec/date_spec.rb +27 -0
  180. data/spec/phone_spec/app/spec/fixtures/classes.rb +91 -0
  181. data/spec/phone_spec/app/spec/lstrip_spec.rb +57 -0
  182. data/spec/phone_spec/app/spec/rho_spec.rb +50 -19
  183. data/spec/phone_spec/app/spec/rhom_object_spec.rb +78 -0
  184. data/spec/phone_spec/app/spec/rstrip_spec.rb +51 -0
  185. data/spec/phone_spec/app/spec/strip_spec.rb +50 -0
  186. data/spec/phone_spec/app/spec/syncengine_spec.rb +46 -3
  187. data/spec/phone_spec/app/spec_runner.rb +6 -0
  188. metadata +34 -4
@@ -1,26 +1,137 @@
1
1
  #
2
2
 
3
+
4
+ def extract_value_from_strings(line)
5
+ pre_str = '<string>'
6
+ post_str = '</string>'
7
+ pre_index = line.index(pre_str)
8
+ post_index = line.index(post_str)
9
+ return line.slice( pre_index + pre_str.length, post_index - (pre_index + pre_str.length))
10
+ end
11
+
3
12
  def set_app_name(newname)
13
+ ret_value = ''
4
14
  fname = $config["build"]["iphonepath"] + "/Info.plist"
5
15
  nextline = false
6
16
  replaced = false
7
17
  buf = ""
8
18
  File.new(fname,"r").read.each_line do |line|
9
19
  if nextline and not replaced
10
- return if line =~ /#{newname}/
20
+ ret_value = extract_value_from_strings(line)
21
+ return ret_value if line =~ /#{newname}/
11
22
  buf << line.gsub(/<string>.*<\/string>/,"<string>#{newname}</string>")
12
23
  puts "set name"
13
24
  replaced = true
14
25
  else
15
26
  buf << line
16
27
  end
17
-
18
28
  nextline = true if line =~ /CFBundleDisplayName/
19
-
20
29
  end
21
-
22
30
  File.open(fname,"w") { |f| f.write(buf) }
31
+ return ret_value
32
+ end
23
33
 
34
+ def set_app_version(newversion)
35
+ ret_value = ''
36
+ fname = $config["build"]["iphonepath"] + "/Info.plist"
37
+ nextline = false
38
+ replaced = false
39
+ buf = ""
40
+ File.new(fname,"r").read.each_line do |line|
41
+ if nextline and not replaced
42
+ ret_value = extract_value_from_strings(line)
43
+ return if line =~ /#{newversion}/
44
+ buf << line.gsub(/<string>.*<\/string>/,"<string>#{newversion}</string>")
45
+ puts "set name"
46
+ replaced = true
47
+ else
48
+ buf << line
49
+ end
50
+ nextline = true if line =~ /CFBundleVersion/
51
+ end
52
+ File.open(fname,"w") { |f| f.write(buf) }
53
+ return ret_value
54
+ end
55
+
56
+
57
+ def set_app_bundle_identifier(newname)
58
+ ret_value = ''
59
+ fname = $config["build"]["iphonepath"] + "/Info.plist"
60
+ nextline = false
61
+ replaced = false
62
+ buf = ""
63
+ File.new(fname,"r").read.each_line do |line|
64
+ if nextline and not replaced
65
+ ret_value = extract_value_from_strings(line)
66
+ return ret_value if line =~ /#{newname}/
67
+ buf << line.gsub(/<string>.*<\/string>/,"<string>#{newname}</string>")
68
+ puts "set bundle identifier"
69
+ replaced = true
70
+ else
71
+ buf << line
72
+ end
73
+ nextline = true if line =~ /CFBundleIdentifier/
74
+ end
75
+ File.open(fname,"w") { |f| f.write(buf) }
76
+ return ret_value
77
+ end
78
+
79
+ def set_app_url_scheme(newname)
80
+ ret_value = ''
81
+ fname = $config["build"]["iphonepath"] + "/Info.plist"
82
+ nextline = false
83
+ nextnextline = false
84
+ replaced = false
85
+ buf = ""
86
+ File.new(fname,"r").read.each_line do |line|
87
+ if nextline and not replaced
88
+ ret_value = extract_value_from_strings(line)
89
+ return ret_value if line =~ /#{newname}/
90
+ buf << line.gsub(/<string>.*<\/string>/,"<string>#{newname}</string>")
91
+ puts "set URL Scheme"
92
+ replaced = true
93
+ else
94
+ if nextnextline
95
+ nextline = true
96
+ end
97
+ buf << line
98
+ end
99
+ nextnextline = true if line =~ /CFBundleURLSchemes/
100
+ end
101
+ File.open(fname,"w") { |f| f.write(buf) }
102
+ return ret_value
103
+ end
104
+
105
+ def set_app_url_name(newname)
106
+ ret_value = ''
107
+ fname = $config["build"]["iphonepath"] + "/Info.plist"
108
+ nextline = false
109
+ replaced = false
110
+ buf = ""
111
+ File.new(fname,"r").read.each_line do |line|
112
+ if nextline and not replaced
113
+ ret_value = extract_value_from_strings(line)
114
+ return ret_value if line =~ /#{newname}/
115
+ buf << line.gsub(/<string>.*<\/string>/,"<string>#{newname}</string>")
116
+ puts "set URL name"
117
+ replaced = true
118
+ else
119
+ buf << line
120
+ end
121
+ nextline = true if line =~ /CFBundleURLName/
122
+ end
123
+ File.open(fname,"w") { |f| f.write(buf) }
124
+ return ret_value
125
+ end
126
+
127
+ def make_app_info
128
+ fname = File.join($app_path, 'bin', 'target', 'iOS', $sdk, $configuration, 'app_info.txt')
129
+ buf = ""
130
+ urlscheme = 'rhodes'
131
+ urlscheme = $app_config["name"] unless $app_config["name"].nil?
132
+ urlscheme = $app_config["iphone"]["BundleURLScheme"] unless $app_config["iphone"]["BundleURLScheme"].nil?
133
+ buf << urlscheme
134
+ File.open(fname,"w") { |f| f.write(buf) }
24
135
  end
25
136
 
26
137
  ICONS = ['icon', 'icon57', 'icon72', 'icon114']
@@ -80,12 +191,17 @@ def set_default_images
80
191
  ibak = File.join(ipath, defname + '.bak')
81
192
  imag = File.join(ipath, defname + '.png')
82
193
  appimage = File.join($app_path, 'app', name + '.png')
194
+ appsimage = File.join($app_path, 'app', name + '.iphone.png')
83
195
  if File.exists? imag
84
196
  cp imag, ibak unless File.exists? ibak
85
197
  end
86
198
  #bundlei = File.join($srcdir, defname + '.png')
87
199
  #cp appimage, bundlei unless !File.exist? appimage
88
- cp appimage, imag unless !File.exists? appimage
200
+ if File.exists? appsimage
201
+ cp appsimage, imag
202
+ else
203
+ cp appimage, imag unless !File.exists? appimage
204
+ end
89
205
  end
90
206
  rescue => e
91
207
  puts "WARNING!!! Can not change default image: #{e.to_s}"
@@ -149,27 +265,31 @@ namespace "config" do
149
265
  $guid = `uuidgen`.strip
150
266
  $applog = File.join($homedir,$app_config["applog"]) if $app_config["applog"]
151
267
 
152
-
153
268
  if $app_config["iphone"].nil?
154
269
  $signidentity = $config["env"]["iphone"]["codesignidentity"]
155
270
  $provisionprofile = $config["env"]["iphone"]["provisionprofile"]
156
271
  $entitlements = $config["env"]["iphone"]["entitlements"]
157
272
  $configuration = $config["env"]["iphone"]["configuration"]
158
273
  $sdk = $config["env"]["iphone"]["sdk"]
274
+ $emulatortarget = 'iphone'
159
275
  else
160
276
  $signidentity = $app_config["iphone"]["codesignidentity"]
161
277
  $provisionprofile = $app_config["iphone"]["provisionprofile"]
162
278
  $entitlements = $app_config["iphone"]["entitlements"]
163
279
  $configuration = $app_config["iphone"]["configuration"]
164
280
  $sdk = $app_config["iphone"]["sdk"]
281
+ $emulatortarget = $app_config["iphone"]["emulatortarget"]
282
+ if $emulatortarget == nil
283
+ $emulatortarget = 'iphone'
284
+ end
165
285
  end
166
286
 
167
287
  if $sdk =~ /iphonesimulator/
168
- sdkver = $sdk.gsub(/iphonesimulator/,"")
169
- $sdkroot = $devroot + "/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" + sdkver + ".sdk"
288
+ $sdkver = $sdk.gsub(/iphonesimulator/,"")
289
+ $sdkroot = $devroot + "/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" + $sdkver + ".sdk"
170
290
  else
171
- sdkver = $sdk.gsub(/iphoneos/,"")
172
- $sdkroot = $devroot + "/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" + sdkver + ".sdk"
291
+ $sdkver = $sdk.gsub(/iphoneos/,"")
292
+ $sdkroot = $devroot + "/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" + $sdkver + ".sdk"
173
293
  end
174
294
 
175
295
  $emulator_version = nil
@@ -177,7 +297,7 @@ namespace "config" do
177
297
  if File.exists? plist
178
298
  File.open(plist, 'r') do |f|
179
299
  while line = f.gets
180
- next unless line =~ /<string>(#{sdkver.gsub('.', '\.')}[^<]*)<\/string>/
300
+ next unless line =~ /<string>(#{$sdkver.gsub('.', '\.')}[^<]*)<\/string>/
181
301
  $emulator_version = $1
182
302
  break unless $emulator_version.nil?
183
303
  end
@@ -267,10 +387,29 @@ namespace "build" do
267
387
  # desc "Build rhodes"
268
388
  task :rhodes => ["config:iphone", "build:iphone:rhobundle"] do
269
389
 
270
- set_app_name($app_config["name"]) unless $app_config["name"].nil?
390
+ saved_name = ''
391
+ saved_version = ''
392
+ saved_identifier = ''
393
+ saved_url_scheme = ''
394
+ saved_url_name = ''
395
+
396
+ saved_name = set_app_name($app_config["name"]) unless $app_config["name"].nil?
397
+ saved_version = set_app_version($app_config["version"]) unless $app_config["version"].nil?
398
+ saved_identifier = set_app_bundle_identifier($app_config["iphone"]["BundleIdentifier"]) unless $app_config["iphone"]["BundleIdentifier"].nil?
399
+ saved_url_scheme = set_app_url_scheme($app_config["iphone"]["BundleURLScheme"]) unless $app_config["iphone"]["BundleURLScheme"].nil?
400
+ saved_url_name = set_app_url_name($app_config["iphone"]["BundleIdentifier"]) unless $app_config["iphone"]["BundleIdentifier"].nil?
401
+
402
+
403
+
271
404
  set_app_icon
272
405
  set_default_images
273
406
 
407
+ if $entitlements == ""
408
+ if $configuration == "Distribution"
409
+ $entitlements = "Entitlements.plist"
410
+ end
411
+ end
412
+
274
413
  set_signing_identity($signidentity,$provisionprofile,$entitlements.to_s) if $signidentity.to_s != ""
275
414
 
276
415
  chdir $config["build"]["iphonepath"]
@@ -281,7 +420,12 @@ namespace "build" do
281
420
 
282
421
  chdir $startdir
283
422
 
284
- set_app_name("Rhodes") unless $app_config["name"].nil?
423
+ set_app_name(saved_name) unless $app_config["name"].nil?
424
+ set_app_version(saved_version) unless $app_config["version"].nil?
425
+ set_app_bundle_identifier(saved_identifier) unless $app_config["iphone"]["BundleIdentifier"].nil?
426
+ set_app_url_scheme(saved_url_scheme) unless $app_config["iphone"]["BundleURLScheme"].nil?
427
+ set_app_url_name(saved_url_name) unless $app_config["iphone"]["BundleIdentifier"].nil?
428
+
285
429
  restore_default_images
286
430
  restore_app_icon
287
431
 
@@ -393,10 +537,10 @@ namespace "run" do
393
537
  end
394
538
  `killall "iPhone Simulator"`
395
539
 
396
- sdkver = $sdk.gsub(/^iphonesimulator/, '')
540
+ $sdkver = $sdk.gsub(/^iphonesimulator/, '')
397
541
  # Workaround: sometimes sdkver could differ from emulator version.
398
542
  # Example: iPhone SDK 4.0.1. In this case sdk is still iphonesimulator4.0 but version of simulator is 4.0.1
399
- sdkver = $emulator_version.to_s unless $emulator_version.nil?
543
+ $sdkver = $emulator_version.to_s unless $emulator_version.nil?
400
544
 
401
545
  elements = []
402
546
  binplist = File.join(ENV['HOME'], 'Library', 'Preferences', 'com.apple.iphonesimulator.plist')
@@ -427,7 +571,7 @@ namespace "run" do
427
571
  e.text = 'SimulateDevice'
428
572
  elements << e
429
573
  e = REXML::Element.new 'string'
430
- e.text = sdkver == '3.2' ? 'iPad' : 'iPhone'
574
+ e.text = $sdkver == '3.2' ? 'iPad' : 'iPhone'
431
575
  elements << e
432
576
  e = REXML::Element.new 'key'
433
577
  e.text = 'currentSDKRoot'
@@ -456,7 +600,7 @@ namespace "run" do
456
600
  puts "our app name: #{$app_config['name']}"
457
601
  puts "simdir: #{$simdir}"
458
602
 
459
- Dir.glob(File.join($simdir, sdkver, "Applications", "*")).each do |simapppath|
603
+ Dir.glob(File.join($simdir, $sdkver, "Applications", "*")).each do |simapppath|
460
604
  need_rm = true if File.directory? simapppath
461
605
  if File.exists?(File.join(simapppath, 'rhorunner.app', 'name'))
462
606
  name = File.read(File.join(simapppath, 'rhorunner.app', 'name'))
@@ -474,10 +618,10 @@ namespace "run" do
474
618
 
475
619
  puts "app guid: #{$guid}"
476
620
 
477
- mkdir_p File.join($simdir, sdkver)
621
+ mkdir_p File.join($simdir, $sdkver)
478
622
 
479
- simapp = File.join($simdir, sdkver, "Applications")
480
- simlink = File.join($simdir, sdkver, "Library", "Preferences")
623
+ simapp = File.join($simdir, $sdkver, "Applications")
624
+ simlink = File.join($simdir, $sdkver, "Library", "Preferences")
481
625
 
482
626
  $simrhodes = File.join(simapp, $guid)
483
627
 
@@ -495,9 +639,9 @@ namespace "run" do
495
639
 
496
640
 
497
641
  simpublic = simapp + "/" + $guid + "/Documents/apps/public"
498
- apppublic = $app_path + "/sim-public-#{sdkver}"
642
+ apppublic = $app_path + "/sim-public-#{$sdkver}"
499
643
 
500
- apprholog = $app_path + "/rholog-#{sdkver}.txt"
644
+ apprholog = $app_path + "/rholog-#{$sdkver}.txt"
501
645
  rm_f apprholog
502
646
  rm_f apppublic
503
647
  `ln -f -s "#{simpublic}" "#{apppublic}"`
@@ -513,7 +657,18 @@ namespace "run" do
513
657
  # testing we will not launch emulator directly
514
658
  desc "Builds everything, launches iphone simulator"
515
659
  task :iphone => :buildsim do
516
- system("open \"#{$sim}/iPhone Simulator.app\"")
660
+
661
+ iphonesim = File.join($startdir, 'res/build-tools/iphonesim/build/Release/iphonesim')
662
+
663
+ commandis = iphonesim + ' launch "' + File.join($simrhodes, 'rhorunner.app') + '" ' + $sdkver.gsub(/([0-9]\.[0-9]).*/,'\1') + ' ' + $emulatortarget
664
+
665
+ if ($emulatortarget != 'iphone') && ($emulatortarget != 'ipad')
666
+ puts 'use old execution way - just open iPhone Simulator'
667
+ system("open \"#{$sim}/iPhone Simulator.app\"")
668
+ else
669
+ puts 'use iphonesim tool - open iPhone Simulator and execute our application, also support device family (iphone/ipad)'
670
+ system(commandis)
671
+ end
517
672
 
518
673
  end
519
674
 
@@ -605,7 +760,7 @@ namespace "device" do
605
760
 
606
761
  #copy build results to app folder
607
762
 
608
- app_path = File.join($app_path, 'bin', 'target', 'iOS', $sdk)
763
+ app_path = File.join($app_path, 'bin', 'target', 'iOS', $sdk, $configuration)
609
764
 
610
765
  iphone_path = $config["build"]["iphonepath"]
611
766
  if $sdk =~ /iphonesimulator/
@@ -626,7 +781,8 @@ namespace "device" do
626
781
  mkdir_p app_path
627
782
 
628
783
  puts 'copy result build package to application target folder ...'
629
- cp_r src_file, dst_file
784
+ cp_r src_file, dst_file
785
+ make_app_info
630
786
 
631
787
  end
632
788
  end
@@ -955,8 +955,8 @@
955
955
  buildSettings = {
956
956
  ALWAYS_SEARCH_USER_PATHS = NO;
957
957
  CODE_SIGN_ENTITLEMENTS = "";
958
- CODE_SIGN_IDENTITY = "Don't Code Sign";
959
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
958
+ CODE_SIGN_IDENTITY = "iPhone Developer";
959
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
960
960
  COPY_PHASE_STRIP = NO;
961
961
  GCC_DYNAMIC_NO_PIC = NO;
962
962
  GCC_OPTIMIZATION_LEVEL = 0;
@@ -975,7 +975,7 @@
975
975
  PRODUCT_NAME = rhorunner;
976
976
  PROVISIONING_PROFILE = "";
977
977
  "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
978
- SDKROOT = iphoneos4.1;
978
+ SDKROOT = iphoneos;
979
979
  STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
980
980
  TARGETED_DEVICE_FAMILY = "1,2";
981
981
  USER_HEADER_SEARCH_PATHS = "../shared/ruby/iphone ../shared/ruby/include ../shared/curl/include ../shared/ ../shared/syncengine ../shared/logging ../shared/common rhoextlib";
@@ -1007,7 +1007,7 @@
1007
1007
  PRODUCT_NAME = rhorunner;
1008
1008
  PROVISIONING_PROFILE = "";
1009
1009
  "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
1010
- SDKROOT = iphoneos4.1;
1010
+ SDKROOT = iphoneos;
1011
1011
  TARGETED_DEVICE_FAMILY = "1,2";
1012
1012
  USER_HEADER_SEARCH_PATHS = "../shared/ruby/iphone ../shared/ruby/include ../shared/curl/include ../shared/ ../shared/syncengine ../shared/logging ../shared/common rhoextlib";
1013
1013
  };
@@ -1066,7 +1066,7 @@
1066
1066
  OTHER_CFLAGS = "";
1067
1067
  OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
1068
1068
  PRODUCT_NAME = rhorunner;
1069
- SDKROOT = iphoneos4.1;
1069
+ SDKROOT = iphoneos;
1070
1070
  TARGETED_DEVICE_FAMILY = "1,2";
1071
1071
  USER_HEADER_SEARCH_PATHS = "../shared/ruby/iphone ../shared/ruby/include ../shared/curl/include ../shared/ ../shared/syncengine ../shared/logging ../shared/common rhoextlib";
1072
1072
  };
@@ -16,7 +16,7 @@ struct IRhoThreadImpl
16
16
 
17
17
  virtual void start(IRhoRunnable* pRunnable, IRhoRunnable::EPriority ePriority) = 0;
18
18
  virtual void stop(unsigned int nTimeoutToKill) = 0;
19
- virtual void wait(unsigned int nTimeout) = 0;
19
+ virtual int wait(unsigned int nTimeout) = 0;
20
20
  virtual void stopWait() = 0;
21
21
  virtual void sleep(unsigned int nTimeout) = 0;
22
22
  };
@@ -71,7 +71,7 @@ void CPosixThreadImpl::stop(unsigned int nTimeoutToKill)
71
71
  pthread_join(m_thread,&status);
72
72
  }
73
73
 
74
- void CPosixThreadImpl::wait(unsigned int nTimeout)
74
+ int CPosixThreadImpl::wait(unsigned int nTimeout)
75
75
  {
76
76
  struct timeval tp;
77
77
  struct timespec ts;
@@ -89,7 +89,7 @@ void CPosixThreadImpl::wait(unsigned int nTimeout)
89
89
  }
90
90
 
91
91
  common::CMutexLock oLock(m_mxSync);
92
-
92
+ int nRet = 0;
93
93
  while (!m_stop_wait)
94
94
  {
95
95
  if (timed_wait) {
@@ -98,12 +98,14 @@ void CPosixThreadImpl::wait(unsigned int nTimeout)
98
98
  if (now > max)
99
99
  break;
100
100
 
101
- pthread_cond_timedwait(&m_condSync, m_mxSync.getNativeMutex(), &ts);
101
+ nRet = pthread_cond_timedwait(&m_condSync, m_mxSync.getNativeMutex(), &ts) == ETIMEDOUT ? 1 : 0;
102
102
  }
103
103
  else
104
104
  pthread_cond_wait(&m_condSync, m_mxSync.getNativeMutex());
105
105
  }
106
106
  m_stop_wait = false;
107
+
108
+ return nRet;
107
109
  }
108
110
 
109
111
  void CPosixThreadImpl::sleep(unsigned int nTimeout)
@@ -18,7 +18,7 @@ public:
18
18
 
19
19
  void start(IRhoRunnable *pRunnable, IRhoRunnable::EPriority ePriority);
20
20
  void stop(unsigned int nTimeoutToKill);
21
- void wait(unsigned int nTimeout);
21
+ int wait(unsigned int nTimeout);
22
22
  void stopWait();
23
23
  void sleep(unsigned int nTimeout);
24
24
 
@@ -19,6 +19,17 @@ public:
19
19
  return m_szPath;
20
20
  }
21
21
 
22
+ String getFolderName(){
23
+ const char* base = findLastSlash();
24
+ if (base)
25
+ {
26
+ String strRes = m_szPath;
27
+ return strRes.substr(0, base-m_szPath);
28
+ }
29
+
30
+ return m_szPath;
31
+ }
32
+
22
33
  String makeFullPath(const char* szFileName){
23
34
  String res = m_szPath;
24
35
  if ( res.length() > 0 && !findLastSlash() )
@@ -13,6 +13,7 @@
13
13
 
14
14
  class NativeView {
15
15
  public:
16
+ virtual ~NativeView(){}
16
17
  // that function must return native object provided view functionality :
17
18
  // UIView* for iPhone
18
19
  // jobject for Android - jobect must be android.view.View class type
@@ -24,10 +25,13 @@ public:
24
25
 
25
26
  class NativeViewFactory {
26
27
  public:
28
+ virtual ~NativeViewFactory(){}
27
29
  virtual NativeView* getNativeView(const char* viewType) = 0;
28
30
  virtual void destroyNativeView(NativeView* nativeView) = 0;
29
31
  };
30
32
 
33
+
34
+
31
35
  class RhoNativeViewManager {
32
36
  public:
33
37
  static void registerViewType(const char* viewType, NativeViewFactory* factory);
@@ -40,4 +44,17 @@ public:
40
44
  static void* getWebViewObject(int tab_index);
41
45
  };
42
46
 
47
+
48
+ class RhoNativeViewRunnable {
49
+ public:
50
+ virtual ~RhoNativeViewRunnable(){}
51
+ virtual void run() = 0;
52
+ };
53
+
54
+
55
+ class RhoNativeViewUtil {
56
+ public:
57
+ static void executeInUIThread_WM(RhoNativeViewRunnable* command);
58
+ };
59
+
43
60
  #endif
@@ -24,7 +24,7 @@ public:
24
24
 
25
25
  virtual void start(EPriority ePriority);
26
26
  virtual void stop(unsigned int nTimeoutToKill){ m_nState |= TS_STOPPING; if (m_nState&TS_RUNNING) m_pImpl->stop(nTimeoutToKill); m_nState &= ~TS_STOPPING; }
27
- virtual void wait(unsigned int nTimeout){ m_nState |= TS_WAIT; if ((m_nState&TS_RUNNING) && !(m_nState&TS_STOPPING) ) m_pImpl->wait(nTimeout); m_nState &= ~TS_WAIT; }
27
+ virtual int wait(unsigned int nTimeout){ m_nState |= TS_WAIT; int nRet = 0; if ((m_nState&TS_RUNNING) && !(m_nState&TS_STOPPING) ) nRet = m_pImpl->wait(nTimeout); m_nState &= ~TS_WAIT; return nRet; }
28
28
  virtual void stopWait(){ /*if (isWaiting())*/ m_pImpl->stopWait(); }
29
29
  virtual void sleep(unsigned int nTimeout){ m_pImpl->sleep(nTimeout); }
30
30
  virtual void run() = 0;
@@ -236,12 +236,14 @@ public:
236
236
  void CRhodesApp::callAppActiveCallback(boolean bActive)
237
237
  {
238
238
  LOG(INFO) + "callAppActiveCallback";
239
- int stop = !rho_conf_getBool("dont_stop_local_server_in_background");
240
239
  if (bActive)
241
240
  {
242
- if (stop)
243
- if (m_activateCounter++ > 0)
244
- this->stopWait();
241
+ // Restart server each time when we go to foreground
242
+ if (m_activateCounter++ > 0)
243
+ {
244
+ m_httpServer->stop();
245
+ this->stopWait();
246
+ }
245
247
 
246
248
  String strUrl = m_strHomeUrl + "/system/activateapp";
247
249
  // Activation callback need to be runned in separate thread
@@ -262,9 +264,20 @@ void CRhodesApp::callAppActiveCallback(boolean bActive)
262
264
  String strUrl = m_strHomeUrl + "/system/deactivateapp";
263
265
  NetResponse(resp,getNet().pullData( strUrl, null ));
264
266
  if ( !resp.isOK() )
267
+ {
265
268
  LOG(ERROR) + "deactivate app failed. Code: " + resp.getRespCode() + "; Error body: " + resp.getCharData();
266
- if (stop)
267
- m_httpServer->stop();
269
+ }else
270
+ {
271
+ const char* szData = resp.getCharData();
272
+ boolean bStop = szData && strcmp(szData,"stop_local_server") == 0;
273
+
274
+ if (bStop)
275
+ {
276
+ LOG(INFO) + "Stopping local server.";
277
+ m_httpServer->stop();
278
+ }
279
+ }
280
+
268
281
  m_bDeactivationMode = false;
269
282
  }
270
283
  }
@@ -387,6 +400,14 @@ static void callback_getrhomessage(void *arg, String const &strQuery)
387
400
  int nError = atoi(strError.c_str());
388
401
 
389
402
  strMsg = rho_ruby_internal_getErrorText(nError);
403
+ }else
404
+ {
405
+ size_t nErrorPos = strQuery.find("msgid=");
406
+ if ( nErrorPos != String::npos )
407
+ {
408
+ String strName = strQuery.substr(nErrorPos+6);
409
+ strMsg = rho_ruby_internal_getMessageText(strName.c_str());
410
+ }
390
411
  }
391
412
 
392
413
  rho_http_sendresponse(arg, strMsg.c_str());
@@ -399,7 +420,7 @@ const String& CRhodesApp::getRhoMessage(int nError, const char* szName)
399
420
  strUrl += "error=" + convertToStringA(nError);
400
421
  else if ( szName && *szName )
401
422
  {
402
- strUrl = "msgid=";
423
+ strUrl += "msgid=";
403
424
  strUrl += szName;
404
425
  }
405
426
 
@@ -1059,7 +1080,7 @@ const char* rho_ruby_getErrorText(int nError)
1059
1080
 
1060
1081
  const char* rho_ruby_getMessageText(const char* szName)
1061
1082
  {
1062
- return "";//RHODESAPP().getRhoMessage( 0, szName).c_str();
1083
+ return RHODESAPP().getRhoMessage( 0, szName).c_str();
1063
1084
  }
1064
1085
 
1065
1086
  int rho_rhodesapp_isrubycompiler()
@@ -17,6 +17,8 @@ CThreadQueue::~CThreadQueue(void)
17
17
 
18
18
  void CThreadQueue::addQueueCommandInt(IQueueCommand* pCmd)
19
19
  {
20
+ LOG(INFO) + "addCommand: " + pCmd->toString();
21
+
20
22
  synchronized(m_mxStackCommands);
21
23
 
22
24
  boolean bExist = false;
@@ -26,6 +28,7 @@ void CThreadQueue::addQueueCommandInt(IQueueCommand* pCmd)
26
28
  {
27
29
  if ( m_stackCommands.get(i)->equals(*pCmd) )
28
30
  {
31
+ LOG(INFO) + "Command already exists in queue. Skip it.";
29
32
  bExist = true;
30
33
  break;
31
34
  }
@@ -39,8 +42,6 @@ void CThreadQueue::addQueueCommandInt(IQueueCommand* pCmd)
39
42
 
40
43
  void CThreadQueue::addQueueCommand(IQueueCommand* pCmd)
41
44
  {
42
- LOG(INFO) + "addCommand: " + pCmd->toString();
43
-
44
45
  addQueueCommandInt(pCmd);
45
46
 
46
47
  if ( isNoThreadedMode() )
@@ -70,7 +71,8 @@ void CThreadQueue::run()
70
71
  if ( nWait >= 0 && !isStopping() && isNoCommands() )
71
72
  {
72
73
  LOG(INFO) + "ThreadQueue blocked for " + nWait + " seconds...";
73
- wait(nWait);
74
+ if ( wait(nWait) == 1 )
75
+ onTimeout();
74
76
  }
75
77
  nLastPollInterval = 0;
76
78
 
@@ -54,8 +54,9 @@ protected:
54
54
  virtual int getLastPollInterval(){ return 0;}
55
55
  virtual void processCommand(IQueueCommand* pCmd) = 0;
56
56
  virtual boolean isSkipDuplicateCmd() { return false; }
57
+ virtual void onTimeout(){}
57
58
 
58
- virtual void processCommands();
59
+ void processCommands();
59
60
 
60
61
  void addQueueCommandInt(IQueueCommand* pCmd);
61
62
 
@@ -0,0 +1,25 @@
1
+ // WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!
2
+ // Generated Tue Dec 07 06:35:02 +0300 2010
3
+
4
+ #include <string.h>
5
+
6
+ #include "app_build_configs.h"
7
+
8
+ static const char* keys[] = { ""
9
+ };
10
+
11
+ static const char* values[] = { ""
12
+ };
13
+
14
+ #define APP_BUILD_CONFIG_COUNT 1
15
+
16
+ const char* get_app_build_config_item(const char* key) {
17
+ int i;
18
+ for (i = 1; i < APP_BUILD_CONFIG_COUNT; i++) {
19
+ if (strcmp(key, keys[i]) == 0) {
20
+ return values[i];
21
+ }
22
+ }
23
+ return 0;
24
+ }
25
+
@@ -0,0 +1,11 @@
1
+ #pragma once
2
+
3
+ #ifdef __cplusplus
4
+ extern "C" {
5
+ #endif //__cplusplus
6
+
7
+ const char* get_app_build_config_item(const char* key);
8
+
9
+ #ifdef __cplusplus
10
+ }
11
+ #endif //__cplusplus