rhodes 3.0.1.beta.4 → 3.0.1.beta.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGELOG +2 -0
  2. data/Manifest.txt +13 -12
  3. data/Rakefile +1 -1
  4. data/bin/get-rhodes-info +61 -0
  5. data/bin/get-rhodes-info.bat +1 -0
  6. data/doc/connect-to-web-services.txt +5 -1
  7. data/doc/device-caps.txt +12 -0
  8. data/doc/nfc.txt +1 -1
  9. data/doc/rhom.txt +13 -11
  10. data/doc/ui.txt +5 -0
  11. data/lib/build/jake.rb +10 -7
  12. data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +11 -8
  13. data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +17 -17
  14. data/lib/extensions/nfc/ext/nfc/platform/android/{res → additional_files/res}/xml/filter_nfc.xml +1 -2
  15. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +26 -5
  16. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcActivity.java +68 -53
  17. data/lib/extensions/nfc/ext.yml +4 -0
  18. data/lib/framework/res/{back_btn.wp7.png → back_btn.wp.png} +0 -0
  19. data/lib/framework/res/{blue_pushpin_small.wp7.png → blue_pushpin_small.wp.png} +0 -0
  20. data/lib/framework/res/{callout.wp7.png → callout.wp.png} +0 -0
  21. data/lib/framework/res/{callout_link.wp7.png → callout_link.wp.png} +0 -0
  22. data/lib/framework/res/{esri.wp7.png → esri.wp.png} +0 -0
  23. data/lib/framework/res/{forward_btn.wp7.png → forward_btn.wp.png} +0 -0
  24. data/lib/framework/res/{home_btn.wp7.png → home_btn.wp.png} +0 -0
  25. data/lib/framework/res/{options_btn.wp7.png → options_btn.wp.png} +0 -0
  26. data/lib/framework/res/{refresh_btn.wp7.png → refresh_btn.wp.png} +0 -0
  27. data/lib/framework/rho/rho.rb +28 -15
  28. data/lib/framework/rho/rhoapplication.rb +9 -7
  29. data/lib/framework/rhom/rhom_object_factory.rb +34 -12
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +48 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +2 -1
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityStartupListeners.java +11 -0
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +5 -5
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +31 -0
  35. data/platform/android/build/RhodesSRC_build.files +1 -0
  36. data/platform/android/build/android.rake +192 -79
  37. data/platform/bb/build/bb.rake +1 -1
  38. data/platform/shared/db/DBAdapter.cpp +3 -0
  39. data/platform/shared/net/HttpServer.cpp +24 -8
  40. data/platform/shared/ruby/ext/rho/rhoruby.c +8 -0
  41. data/platform/wp7/RhoAppRunner/Program.cs +2 -2
  42. data/platform/wp7/build/wp.rake +7 -7
  43. data/rakefile.rb +1 -1
  44. data/res/build-tools/RhoAppRunner.exe +0 -0
  45. data/res/generators/templates/application/app/helpers/application_helper.rb +4 -1
  46. data/res/generators/templates/application/public/jqtouch/jqtouch.js +21 -9
  47. data/rhodes.gemspec +1 -1
  48. data/spec/phone_spec/app/spec/rhom_object_spec.rb +35 -1
  49. metadata +17 -16
  50. data/lib/framework/res/blue_pushpin.wp7.png +0 -0
  51. data/platform/android/Rhodes/res/xml/filter_nfc.xml +0 -9
@@ -253,6 +253,11 @@ namespace "config" do
253
253
 
254
254
  task :android => [:set_android_platform, "config:common"] do
255
255
 
256
+ $ext_android_rhodes_activity_listener = []
257
+ $ext_android_manifest_changes= []
258
+ $ext_android_resources_addons = []
259
+ $ext_android_additional_sources_list = []
260
+
256
261
  $gapikey = $app_config["android"]["apikey"] unless $app_config["android"].nil?
257
262
  $gapikey = $config["android"]["apikey"] if $gapikey.nil? and not $config["android"].nil?
258
263
  $gapikey = '' unless $gapikey.is_a? String
@@ -713,6 +718,39 @@ namespace "build" do
713
718
  $app_config["extensions"].each do |ext|
714
719
  $app_config["extpaths"].each do |p|
715
720
  extpath = File.join(p, ext, 'ext')
721
+
722
+ extyml = File.join(p, ext,"ext.yml")
723
+ if File.file? extyml
724
+ extconf = Jake.config(File.open(extyml))
725
+
726
+ android_listener = extconf["android_rhodes_activity_listener"]
727
+ $ext_android_rhodes_activity_listener << android_listener unless android_listener.nil?
728
+
729
+ android_manifest_changes = extconf["android_manifest_changes"]
730
+ if android_manifest_changes != nil
731
+ android_manifest_changes = File.join(p, ext, android_manifest_changes)
732
+ $ext_android_manifest_changes << android_manifest_changes
733
+ end
734
+
735
+ android_resources_addons = extconf["android_resources_addons"]
736
+ if android_resources_addons != nil
737
+ android_resources_addons = File.join(p, ext, android_resources_addons)
738
+ $ext_android_resources_addons << android_resources_addons
739
+ end
740
+
741
+ android_additional_sources_list = extconf["android_additional_sources_list"]
742
+ if android_additional_sources_list != nil
743
+ android_additional_sources_list = File.join(p, ext, android_additional_sources_list)
744
+
745
+ File.open(android_additional_sources_list, "r") do |f|
746
+ while line = f.gets
747
+ $ext_android_additional_sources_list << File.join(p, ext, line)
748
+ end
749
+ end
750
+
751
+ end
752
+ end
753
+
716
754
  if RUBY_PLATFORM =~ /(win|w)32$/
717
755
  next unless File.exists? File.join(extpath, 'build.bat')
718
756
  else
@@ -1112,10 +1150,131 @@ namespace "build" do
1112
1150
  task :rhodes => :rhobundle do
1113
1151
  javac = $config["env"]["paths"]["java"] + "/javac" + $exe_ext
1114
1152
 
1153
+
1154
+ set_app_name_android($appname)
1155
+
1156
+
1115
1157
  rm_rf $tmpdir + "/Rhodes"
1116
1158
  mkdir_p $tmpdir + "/Rhodes"
1117
1159
 
1118
- set_app_name_android($appname)
1160
+ $ext_android_manifest_changes << File.join($extensionsdir, "AndroidManifest.xml")
1161
+
1162
+ app_f = File.new($appmanifest)
1163
+ manifest_orig_doc = REXML::Document.new(app_f)
1164
+ app_f.close
1165
+ dst_manifest = manifest_orig_doc.elements["manifest"]
1166
+ dst_application = manifest_orig_doc.elements["manifest/application"]
1167
+ dst_main_activity = nil
1168
+ puts '$$$$$$$$$$$$$$ try to found MainActivity'
1169
+ dst_application.elements.each("activity") do |a|
1170
+ puts '$$$$$$$$ activity with attr = '+a.attribute('name','android').to_s
1171
+ if a.attribute('name','android').to_s == 'com.rhomobile.rhodes.RhodesActivity'
1172
+ puts ' $$$ FOUND !'
1173
+ dst_main_activity = a
1174
+ end
1175
+ end
1176
+
1177
+ $ext_android_manifest_changes.each do |m|
1178
+
1179
+ ext_manifest = m
1180
+ if File.exists? ext_manifest
1181
+ puts 'AndroidManifest.xml['+ext_manifest+'] from native extension found !'
1182
+
1183
+ manifest_ext_doc = REXML::Document.new(File.new(ext_manifest))
1184
+
1185
+ src_manifest = manifest_ext_doc.elements["manifest"]
1186
+
1187
+ src_application = manifest_ext_doc.elements["manifest/application"]
1188
+
1189
+ if src_application != nil
1190
+ puts 'Extension Manifest process application item :'
1191
+ src_application.elements.each do |e|
1192
+ puts '$$$$$$$$ process element with attr = '+e.attribute('name','android').to_s
1193
+ if e.attribute('name','android').to_s == 'com.rhomobile.rhodes.RhodesActivity'
1194
+ e.elements.each do |sube|
1195
+ puts ' add item to MainActivity['+sube.xpath+']'
1196
+ dst_main_activity.add sube
1197
+ end
1198
+ else
1199
+ puts ' add item ['+e.xpath+']'
1200
+ dst_application.add e
1201
+ end
1202
+ end
1203
+ end
1204
+
1205
+ puts 'Extension Manifest process root <manifest> item :'
1206
+ src_manifest.elements.each do |e|
1207
+ p = e.xpath
1208
+ if p != '/manifest/application'
1209
+ dst_e = manifest_orig_doc.elements[p]
1210
+ if dst_e != nil
1211
+ if p == '/manifest/uses-sdk'
1212
+ puts ' found and delete original item ['+p+']'
1213
+ manifest_orig_doc.elements.delete p
1214
+ end
1215
+ end
1216
+ puts ' and new item ['+p+']'
1217
+ dst_manifest.add e
1218
+ end
1219
+ end
1220
+
1221
+ else
1222
+ puts 'AndroidManifest change file ['+m+'] from native extension not found !'
1223
+ end
1224
+
1225
+ end
1226
+
1227
+ #puts 'Result Manifest :'
1228
+ #manifest_orig_doc.elements['manifest'].elements.each do |e|
1229
+ # puts ' + '+e.xpath
1230
+ # if e.xpath == '/manifest/application'
1231
+ # manifest_orig_doc.elements['manifest/application'].elements.each do |t|
1232
+ # puts ' + '+t.xpath
1233
+ # end
1234
+ # end
1235
+ #end
1236
+
1237
+ puts 'delete original manifest'
1238
+ File.delete($appmanifest)
1239
+
1240
+ updated_f = File.open($appmanifest, "w")
1241
+ manifest_orig_doc.write updated_f, 2
1242
+ updated_f.close
1243
+
1244
+ #rm tappmanifest
1245
+ puts 'Manifest updated by extension saved!'
1246
+
1247
+
1248
+ # RhodesActivity Listeners
1249
+ f = StringIO.new("", "w+")
1250
+ f.puts '// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!'
1251
+ f.puts 'package com.rhomobile.rhodes;'
1252
+ f.puts ''
1253
+ f.puts 'import com.rhomobile.rhodes.phonebook.ContactAccessor;'
1254
+ f.puts ''
1255
+ f.puts 'class RhodesActivityStartupListeners {'
1256
+ f.puts ''
1257
+ f.puts ' public static final String[] ourRunnableList = { ""'
1258
+ $ext_android_rhodes_activity_listener.each do |a|
1259
+ f.puts ' ,"'+a+'"'
1260
+ end
1261
+ f.puts ' };'
1262
+ f.puts ''
1263
+ f.puts '}'
1264
+ Jake.modify_file_if_content_changed(File.join($startdir, "platform","android","Rhodes","src","com","rhomobile","rhodes","RhodesActivityStartupListeners.java"), f)
1265
+
1266
+
1267
+ puts 'EXT: add additional files to project before build'
1268
+ $ext_android_resources_addons.each do |r|
1269
+ puts 'add resources from extension copy ['+r+'] to ['+$tmpdir+']'
1270
+ Dir.foreach(r) do |f|
1271
+ cp = File.join(r, f)
1272
+ if ((File.directory?(cp)) || (File.file?(cp))) && ((f != '.') && ( f != '..'))
1273
+ cp_r cp,$tmpdir
1274
+ end
1275
+ end
1276
+ end
1277
+
1119
1278
  generate_rjava
1120
1279
 
1121
1280
  srclist = File.join($builddir, "RhodesSRC_build.files")
@@ -1126,10 +1285,10 @@ namespace "build" do
1126
1285
  line.chomp!
1127
1286
  next if line =~ /\/AndroidR\.java\s*$/
1128
1287
 
1129
- if !$use_geomapping
1130
- next if line == "platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java"
1131
- next if line == "platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java"
1132
- end
1288
+ if !$use_geomapping
1289
+ next if line == "platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java"
1290
+ next if line == "platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java"
1291
+ end
1133
1292
 
1134
1293
  #next if !$use_geomapping and line =~ /\/GoogleMapView\//
1135
1294
  #next if !$use_geomapping and line =~ /\/AnnotationsOverlay\//
@@ -1155,74 +1314,12 @@ namespace "build" do
1155
1314
  puts 'ext_build.files not found - no additional java files for compilation'
1156
1315
  end
1157
1316
 
1158
- ext_manifest = File.join($extensionsdir, "AndroidManifest.xml")
1159
- if File.exists? ext_manifest
1160
- puts 'AndroidManifest.xml from native extension found !'
1161
-
1162
- #tappmanifest = $appmanifest + '_tmp'
1163
-
1164
- #cp_r $appmanifest,tappmanifest
1165
-
1166
- app_f = File.new($appmanifest)
1167
- manifest_orig_doc = REXML::Document.new(app_f)
1168
- app_f.close
1169
-
1170
- manifest_ext_doc = REXML::Document.new(File.new(ext_manifest))
1171
-
1172
- src_manifest = manifest_ext_doc.elements["manifest"]
1173
- dst_manifest = manifest_orig_doc.elements["manifest"]
1174
-
1175
-
1176
- src_application = manifest_ext_doc.elements["manifest/application"]
1177
- dst_application = manifest_orig_doc.elements["manifest/application"]
1178
-
1179
- if src_application != nil
1180
- puts 'Extension Manifest process application item :'
1181
- src_application.elements.each do |e|
1182
- puts ' add item ['+e.xpath+']'
1183
- dst_application.add e
1184
- end
1185
- end
1186
-
1187
- puts 'Extension Manifest process root <manifest> item :'
1188
- src_manifest.elements.each do |e|
1189
- p = e.xpath
1190
- if p != '/manifest/application'
1191
- dst_e = manifest_orig_doc.elements[p]
1192
- if dst_e != nil
1193
- if p == '/manifest/uses-sdk'
1194
- puts ' found and delete original item ['+p+']'
1195
- manifest_orig_doc.elements.delete p
1196
- end
1197
- end
1198
- puts ' and new item ['+p+']'
1199
- dst_manifest.add e
1200
- end
1201
- end
1202
-
1203
- #puts 'Result Manifest :'
1204
- #manifest_orig_doc.elements['manifest'].elements.each do |e|
1205
- # puts ' + '+e.xpath
1206
- # if e.xpath == '/manifest/application'
1207
- # manifest_orig_doc.elements['manifest/application'].elements.each do |t|
1208
- # puts ' + '+t.xpath
1209
- # end
1210
- # end
1211
- #end
1212
-
1213
- puts 'delete original manifest'
1214
- File.delete($appmanifest)
1215
-
1216
- updated_f = File.open($appmanifest, "w")
1217
- manifest_orig_doc.write updated_f, 2
1218
- updated_f.close
1219
-
1220
- #rm tappmanifest
1221
- puts 'Manifest updated by extension saved!'
1222
-
1223
-
1224
- else
1225
- puts 'AndroidManifest.xml from native extension not found - no any changes in main AndroidManifest.xml'
1317
+ # process collected ext src files
1318
+ puts 'process additional java files for build from extensions :'
1319
+ $ext_android_additional_sources_list.each do |s|
1320
+ s.chomp!
1321
+ puts 'java file : ' + s
1322
+ lines << "\""+s+"\""
1226
1323
  end
1227
1324
 
1228
1325
  File.open(newsrclist, "w") { |f| f.write lines.join("\n") }
@@ -1555,10 +1652,22 @@ def logcat(device_flag = '-e', log_path = $applog_path)
1555
1652
  end
1556
1653
  end
1557
1654
 
1655
+ def logcat_process(device_flag = '-e', log_path = $applog_path)
1656
+ if !log_path.nil?
1657
+ Thread.new { system("\"#{$adb}\" #{device_flag} logcat >> \"#{log_path}\" ") }
1658
+ end
1659
+ end
1660
+
1558
1661
  def logclear(device_flag = '-e')
1559
1662
  Jake.run($adb, [device_flag, 'logcat', '-c'], nil, true)
1560
1663
  end
1561
1664
 
1665
+ namespace "android" do
1666
+ task :get_log => "config:android" do
1667
+ puts "log_file=" + $applog_path
1668
+ end
1669
+ end
1670
+
1562
1671
  namespace "run" do
1563
1672
  namespace "android" do
1564
1673
 
@@ -1711,9 +1820,10 @@ namespace "run" do
1711
1820
  puts 'Sleep for 5 sec. waiting for "adb start-server"'
1712
1821
  sleep 5
1713
1822
 
1714
- if !$applog_file.nil?
1715
- Thread.new { Jake.run($adb, ['logcat', '>>', $applog_path], nil, true) }
1716
- end
1823
+ #if !$applog_file.nil?
1824
+ # Thread.new { Jake.run($adb, ['logcat', '>>', $applog_path], nil, true) }
1825
+ #end
1826
+ logcat_process()
1717
1827
 
1718
1828
  if $appavdname != nil
1719
1829
  $avdname = $appavdname
@@ -1765,9 +1875,10 @@ namespace "run" do
1765
1875
  Jake.run($adb, ['start-server'], nil, true)
1766
1876
  adbRestarts += 1
1767
1877
 
1768
- if !$applog_file.nil?
1769
- Thread.new { Jake.run($adb, ['logcat', '>>', $applog_path], nil, true) }
1770
- end
1878
+ #if !$applog_file.nil?
1879
+ # Thread.new { Jake.run($adb, ['logcat', '>>', $applog_path], nil, true) }
1880
+ #end
1881
+ logcat_process()
1771
1882
  else
1772
1883
  puts "Still waiting..."
1773
1884
  end
@@ -1824,6 +1935,8 @@ namespace "run" do
1824
1935
  task :device => "device:android:install" do
1825
1936
  puts "Starting application..."
1826
1937
  run_application("-d")
1938
+
1939
+ logcat_process("-d")
1827
1940
  end
1828
1941
  end
1829
1942
 
@@ -81,7 +81,7 @@ def startsim(hidden=false)
81
81
  args << "/no-guibacklight"
82
82
  end
83
83
 
84
- args << "/app-param=JvmDebugFile:"+Jake.get_absolute($app_config["applog"]) if $app_config["applog"] && $app_config["applog"].length() > 0
84
+ args << "/app-param=JvmDebugFile:"+Jake.get_absolute_ex($app_config["applog"], $app_path) if $app_config["applog"] && $app_config["applog"].length() > 0
85
85
 
86
86
  Jake.run2 command, args, {:directory => jde + "/simulator", :nowait => true}
87
87
  end
@@ -175,6 +175,9 @@ void CDBAdapter::open (String strDbPath, String strVer, boolean bTemp)
175
175
  executeSQL( "UPDATE client_info SET reset=1" );
176
176
  }
177
177
  }
178
+
179
+ // db.updateAllAttribChanges();
180
+ // db.copyTable("changed_values", db, *this );
178
181
  db.close();
179
182
 
180
183
  CRhoFile::deleteFile( (m_strDbPath+"_oldver").c_str());
@@ -1036,18 +1036,27 @@ bool CHttpServer::call_ruby_method(String const &uri, String const &body, String
1036
1036
  return true;
1037
1037
  }
1038
1038
 
1039
- bool CHttpServer::decide(String const &method, String const &uri, String const &query,
1039
+ bool CHttpServer::decide(String const &method, String const &arg_uri, String const &query,
1040
1040
  HeaderList const &headers, String const &body)
1041
1041
  {
1042
- RAWTRACE1("Decide what to do with uri %s", uri.c_str());
1043
- callback_t callback = registered(uri);
1042
+ RAWTRACE1("Decide what to do with uri %s", arg_uri.c_str());
1043
+ callback_t callback = registered(arg_uri);
1044
1044
  if (callback) {
1045
- RAWTRACE1("Uri %s is registered callback, so handle it appropriately", uri.c_str());
1045
+ RAWTRACE1("Uri %s is registered callback, so handle it appropriately", arg_uri.c_str());
1046
1046
  callback(this, query.length() ? query : body);
1047
1047
  return true;
1048
1048
  }
1049
-
1050
- String fullPath = CFilePath::join(m_root,uri);
1049
+
1050
+ String uri = arg_uri;
1051
+
1052
+ #ifdef OS_ANDROID
1053
+ //Work around malformed Android WebView URLs
1054
+ if ((uri.find("/app") != 0) && (uri.find("/public") != 0) && (uri.find("/rhodata/apps/") == String::npos)) {
1055
+ uri = CFilePath::join("/app", uri);
1056
+ }
1057
+ #endif
1058
+
1059
+ String fullPath = CFilePath::join(m_root, uri);
1051
1060
 
1052
1061
  Route route;
1053
1062
  if (dispatch(uri, route)) {
@@ -1071,6 +1080,7 @@ bool CHttpServer::decide(String const &method, String const &uri, String const &
1071
1080
  return true;
1072
1081
  }
1073
1082
 
1083
+ #ifndef OS_ANDROID
1074
1084
  if (isdir(fullPath)) {
1075
1085
  RAWTRACE1("Uri %s is directory, redirecting to index", uri.c_str());
1076
1086
  String q = query.empty() ? "" : "?" + query;
@@ -1081,7 +1091,14 @@ bool CHttpServer::decide(String const &method, String const &uri, String const &
1081
1091
  send_response(create_response("301 Moved Permanently", headers));
1082
1092
  return false;
1083
1093
  }
1084
-
1094
+ #else
1095
+ //Work around this Android redirect bug:
1096
+ //http://code.google.com/p/android/issues/detail?can=2&q=11583&id=11583
1097
+ if (isdir(fullPath)) {
1098
+ RAWTRACE1("Uri %s is directory, override with index", uri.c_str());
1099
+ return decide(method, CFilePath::join( uri, "index"RHO_ERB_EXT), query, headers, body);
1100
+ }
1101
+ #endif
1085
1102
  if (isindex(uri)) {
1086
1103
  if (!isfile(fullPath)) {
1087
1104
  RAWLOG_ERROR1("The file %s was not found", fullPath.c_str());
@@ -1107,7 +1124,6 @@ bool CHttpServer::decide(String const &method, String const &uri, String const &
1107
1124
 
1108
1125
  return true;
1109
1126
  }
1110
- //RAWLOG_INFO("Sending File");
1111
1127
 
1112
1128
  // Try to send requested file
1113
1129
  RAWTRACE1("Uri %s should be regular file, trying to send it", uri.c_str());
@@ -569,7 +569,15 @@ int getStringLenFromValue(VALUE val){
569
569
  rho_param *rho_param_fromvalue(VALUE v)
570
570
  {
571
571
  int i, size;
572
+ /*
573
+ if (v == NULL) {
574
+ return NULL;
575
+ }
572
576
 
577
+ if (rho_ruby_is_NIL(v)) {
578
+ return NULL;
579
+ }
580
+ */
573
581
  switch(TYPE(v)) {
574
582
  case T_ARRAY:
575
583
  {
@@ -23,9 +23,9 @@ namespace RhoAppRunner
23
23
  useEmulator = false;
24
24
 
25
25
  if (useEmulator)
26
- WP7Device = WP7SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone 7 Emulator"));
26
+ WP7Device = WP7SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone Emulator"));
27
27
  else
28
- WP7Device = WP7SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone 7 Device"));
28
+ WP7Device = WP7SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone Device"));
29
29
 
30
30
  Console.WriteLine("Connecting to Windows Phone 7 Emulator/Device...");
31
31
  WP7Device.Connect();
@@ -1,6 +1,6 @@
1
1
  namespace "config" do
2
2
  task :set_wp_platform do
3
- $current_platform = "wm" unless $current_platform
3
+ $current_platform = "wp" unless $current_platform
4
4
  end
5
5
 
6
6
  task :wp => [:set_wp_platform, "config:common"] do
@@ -177,14 +177,14 @@ end
177
177
  #doc = REXML::Document.new(File.open(out_dir + "XapCacheFile.xml"))
178
178
  #chdir $srcdir
179
179
  #Dir.glob(File.join("**", '*.*')).each do |f|
180
- # doc.root[1,0] = REXML::Element.new "file lastWriteTime='" + File.mtime(f).strftime("%m/%d/%Y %I:%M:%S %p") + "' source='" + $srcdir.gsub("/", "\\") + "\\" + f.gsub("/", "\\") + "' archivePath='" + f.gsub("/", "\\") + "'"
181
- # end
182
- # File.open(out_dir + "XapCacheFile.xml", "w") { |f| doc.write f, 2; f.close }
180
+ # doc.root[1,0] = REXML::Element.new "file lastWriteTime='" + File.mtime(f).strftime("%m/%d/%Y %I:%M:%S %p") + "' source='" + $srcdir.gsub("/", "\\") + "\\" + f.gsub("/", "\\") + "' archivePath='" + f.gsub("/", "\\") + "'"
181
+ #end
182
+ #File.open(out_dir + "XapCacheFile.xml", "w") { |f| doc.write f, 2; f.close }
183
183
 
184
- # chdir $startdir
184
+ #chdir $startdir
185
185
 
186
- # mkdir_p $config["build"]["wppath"] + "/rhodes/obj/Release" if not File.exists? $config["build"]["wppath"] + "/rhodes/obj/Release"
187
- # cp out_dir + "XapCacheFile.xml", $config["build"]["wppath"] + "/rhodes/obj/Release"
186
+ #mkdir_p $config["build"]["wppath"] + "/rhodes/obj/Release" if not File.exists? $config["build"]["wppath"] + "/rhodes/obj/Release"
187
+ #cp out_dir + "XapCacheFile.xml", $config["build"]["wppath"] + "/rhodes/obj/Release"
188
188
  end
189
189
 
190
190
  task :devrhobundleDebug => [:rhobundle, :rhobundlemap, "device:wp:addbundletoxapDebug"] do
data/rakefile.rb CHANGED
@@ -207,7 +207,7 @@ namespace "config" do
207
207
  extpaths << $app_config["paths"]["extensions"] if $app_config["paths"] and $app_config["paths"]["extensions"]
208
208
  extpaths << $config["env"]["paths"]["extensions"] if $config["env"]["paths"]["extensions"]
209
209
  extpaths << File.join($app_path, "extensions")
210
- extpaths << "lib/extensions"
210
+ extpaths << File.join($startdir, "lib","extensions")
211
211
  $app_config["extpaths"] = extpaths
212
212
 
213
213
  if $app_config["build"] and $app_config["build"] == "release"
Binary file
@@ -109,9 +109,12 @@ module ApplicationHelper
109
109
  def render_transition(params)
110
110
  @params["rho_callback"] = nil
111
111
  params[:layout] = false
112
+ tab_index = params[:tab_index]
113
+ tab_index = -1 if tab_index == nil
112
114
  # TODO: escape carriage returns instead of removing them altoegether
113
115
  content = render(params).split('\'').join('\\\'').split(/[\r\n]/).join('')
114
- WebView.execute_js("Rho.insertAsyncPage('<div>#{content}</div>')")
116
+ content = content.unpack("U*").collect {|s| (s > 127 ? "&##{s};" : s.chr) }.join("")
117
+ WebView.execute_js("Rho.insertAsyncPage('<div>#{content}</div>')", tab_index)
115
118
  end
116
119
 
117
120
  def caller_request_hash_to_query
@@ -256,7 +256,7 @@
256
256
  }
257
257
  }
258
258
 
259
- function goTo(toPage, animation) {
259
+ function goTo(toPage, animation, is_history) {
260
260
  var fromPage = hist[0].page;
261
261
 
262
262
  if (typeof(toPage) === 'string') {
@@ -272,7 +272,11 @@
272
272
  }
273
273
  }
274
274
  if (animatePages(fromPage, toPage, animation)) {
275
- addPageToHistory(toPage, animation);
275
+ if (is_history)
276
+ {
277
+ addPageToHistory(toPage, animation);
278
+ }
279
+
276
280
  return publicObj;
277
281
  }
278
282
  else
@@ -342,7 +346,7 @@
342
346
  // Branch on internal or external href
343
347
  else if (hash && hash != '#') {
344
348
  $el.addClass('active');
345
- goTo($(hash).data('referrer', $el), animation);
349
+ goTo($(hash).data('referrer', $el), animation, true);
346
350
  } else {
347
351
  $el.addClass('loading active');
348
352
  showPageByHref($el.attr('href'), {
@@ -469,7 +473,8 @@
469
473
  }, 100);
470
474
  }
471
475
 
472
- function insertPages(nodes, animation) {
476
+ function insertPages(nodes, animation, is_history) {
477
+
473
478
  var targetPage = null;
474
479
  $(nodes).each(function(index, node) {
475
480
  var $node = $(this);
@@ -482,7 +487,7 @@
482
487
  }
483
488
  });
484
489
  if (targetPage !== null) {
485
- goTo(targetPage, animation);
490
+ goTo(targetPage, animation, is_history);
486
491
  return targetPage;
487
492
  }
488
493
  else
@@ -492,9 +497,11 @@
492
497
  }
493
498
 
494
499
  function insertAsyncPage(data) {
495
- $('.waiting').remove();
500
+ //$('.waiting').remove();
501
+ setTimeout(function(){ $('.waiting').remove(); },450);
502
+
496
503
  var settings = asyncRequestSettings;
497
- var firstPage = insertPages(data, settings.animation);
504
+ var firstPage = insertPages(data, settings.animation,true);
498
505
  if (firstPage)
499
506
  {
500
507
  if (settings.method == 'GET' && jQTSettings.cacheGetRequests && settings.$referrer)
@@ -541,11 +548,16 @@
541
548
  $referrer: settings.$referrer,
542
549
  callback: settings.callback
543
550
  };
544
- $(data).addClass("waiting").appendTo($body);
551
+ data = $(data).addClass("waiting");
552
+ if(data[0] && data[0].childElementCount == 0) {
553
+ data.appendTo($body);
554
+ } else {
555
+ insertPages(data, settings.animation,false);
556
+ }
545
557
  } else {
546
558
 
547
559
  // success
548
- var firstPage = insertPages(data, settings.animation);
560
+ var firstPage = insertPages(data, settings.animation,true);
549
561
  if (firstPage)
550
562
  {
551
563
  if (settings.method == 'GET' && jQTSettings.cacheGetRequests && settings.$referrer)
data/rhodes.gemspec CHANGED
@@ -3,7 +3,7 @@ require "lib/rhodes.rb"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{rhodes}
6
- s.version = "3.0.1.beta.4"
6
+ s.version = "3.0.1.beta.5"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.authors = ["Rhomobile"]
@@ -1454,7 +1454,41 @@ end
1454
1454
  item2.time_test.is_a?(Integer).should == true
1455
1455
  end
1456
1456
  end
1457
-
1457
+
1458
+ it "should find by object" do
1459
+ accts = getAccount.find(:all,:conditions=>
1460
+ {
1461
+ { :name => "object", :op =>"IN" } => ['44e804f2-4933-4e20-271c-48fcecd9450d','63cf13da-cff4-99e7-f946-48fcec93f1cc']
1462
+ }
1463
+ )
1464
+ accts.length.should == 2
1465
+
1466
+ accts = getAccount.find(:all,:conditions=>
1467
+ {
1468
+ { :name => "object", :op =>"IN" } => ['1','2','3']
1469
+ }
1470
+ )
1471
+ accts.length.should == 0
1472
+
1473
+ end
1474
+
1475
+ it "should complex find by object" do
1476
+ accts = getAccount.find(:all,:conditions=> {
1477
+ { :name => "object", :op =>"IN" } => ['44e804f2-4933-4e20-271c-48fcecd9450d','63cf13da-cff4-99e7-f946-48fcec93f1cc'],
1478
+ { :name => "name" } => 'Mobio India'
1479
+ }
1480
+ )
1481
+ accts.length.should == 1
1482
+
1483
+ accts = getAccount.find(:all,:conditions=>{
1484
+ { :name => "object", :op =>"IN" } => ['1','2','3'],
1485
+ { :name => "name" } => 'Mobio India'
1486
+ }
1487
+ )
1488
+ accts.length.should == 0
1489
+
1490
+ end
1491
+
1458
1492
  end
1459
1493
  #=begin
1460
1494
  describe "Rhom#paginate" do