rhodes 3.3.3.beta.3 → 3.3.3.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/Manifest.txt +16 -1
  2. data/Rakefile +77 -28
  3. data/doc/build.txt +5 -3
  4. data/doc/configuration.txt +13 -0
  5. data/doc/device-caps.txt +46 -27
  6. data/doc/rhom.txt +2 -2
  7. data/doc/test-log-debug.txt +6 -0
  8. data/doc/ui.txt +13 -0
  9. data/lib/build/jake.rb +11 -11
  10. data/lib/extensions/crypt/crypt/cbc.rb +5 -2
  11. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +14 -4
  12. data/lib/framework/rho/render.rb +17 -4
  13. data/lib/framework/rho/rho.rb +1 -1
  14. data/lib/framework/rho/rhocontroller.rb +11 -1
  15. data/lib/framework/rhomotoapi.rb +110 -0
  16. data/platform/android/Rhodes/jni/Android.mk +2 -5
  17. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  18. data/platform/android/Rhodes/jni/include/rhodes/fileapi.h +38 -0
  19. data/platform/android/Rhodes/jni/src/callbacks.cpp +7 -26
  20. data/platform/android/Rhodes/jni/src/extmanager.cpp +4 -1
  21. data/platform/android/Rhodes/jni/src/fileapi.cpp +38 -14
  22. data/platform/android/Rhodes/jni/src/mapview.cpp +1 -2
  23. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +10 -0
  24. data/platform/android/Rhodes/jni/src/rhodessystem.cpp +1 -1
  25. data/platform/android/Rhodes/jni/src/signature.cpp +1 -4
  26. data/platform/android/Rhodes/rhobundle.xml +1 -1
  27. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +11 -1
  28. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +4 -3
  29. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -6
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +70 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +3 -1
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +21 -7
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +19 -10
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +8 -5
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +18 -0
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +168 -31
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +46 -9
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +3 -2
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +27 -53
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +27 -3
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +13 -14
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +12 -5
  44. data/platform/android/build/RhodesSRC_build.files +2 -1
  45. data/platform/android/build/android.rake +48 -17
  46. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +1 -1
  47. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +24 -3
  48. data/platform/iphone/Classes/AppManager/AppManager.m +1 -1
  49. data/platform/iphone/Classes/Camera/PickImageDelegate.m +27 -2
  50. data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
  51. data/platform/iphone/Classes/DateTimePickerDelegate.m +85 -9
  52. data/platform/iphone/Classes/DateTimePickerViewController.h +21 -0
  53. data/platform/iphone/Classes/DateTimePickerViewController.m +75 -0
  54. data/platform/iphone/Classes/GeoLocation/LocationController.h +6 -2
  55. data/platform/iphone/Classes/GeoLocation/LocationController.m +54 -14
  56. data/platform/iphone/Classes/RhoMainView.h +2 -0
  57. data/platform/iphone/Classes/Rhodes.m +11 -5
  58. data/platform/iphone/Classes/Signature/SignatureDelegate.m +13 -12
  59. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -1
  60. data/platform/iphone/Classes/SimpleMainView.m +3 -0
  61. data/platform/iphone/Classes/SplitView/SplittedMainView.m +3 -0
  62. data/platform/iphone/Classes/TabbedMainView.m +30 -11
  63. data/platform/iphone/rbuild/iphone.rake +7 -1
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +6 -0
  65. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
  66. data/platform/shared/common/BundleManager.cpp +42 -2
  67. data/platform/shared/common/ExtManager.h +7 -0
  68. data/platform/shared/common/RhoFile.cpp +170 -2
  69. data/platform/shared/common/RhoFile.h +4 -0
  70. data/platform/shared/common/RhodesApp.cpp +30 -0
  71. data/platform/shared/common/RhodesApp.h +1 -0
  72. data/platform/shared/common/map/OSMMapEngine.cpp +11 -3
  73. data/platform/shared/common/map/OSMMapEngine.h +3 -0
  74. data/platform/shared/logging/RhoLogConf.cpp +8 -9
  75. data/platform/shared/logging/RhoLogConf.h +5 -7
  76. data/platform/shared/logging/RhoLogSink.cpp +3 -3
  77. data/platform/shared/logging/RhoLogSink.h +1 -1
  78. data/platform/shared/net/HttpServer.cpp +17 -9
  79. data/platform/shared/qt/rhodes/main.cpp +1 -1
  80. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
  81. data/platform/shared/ruby/ext/webview/webview.i +9 -4
  82. data/platform/shared/ruby/ext/webview/webview_wrap.c +2 -2
  83. data/platform/shared/test/Tests.cpp +2 -2
  84. data/platform/wm/build/build_inf.js +75 -47
  85. data/platform/wm/build/wm.rake +50 -53
  86. data/platform/wm/rhodes/Rhodes.cpp +40 -97
  87. data/platform/wm/rhodes/rho/common/ExtManager.cpp +23 -1
  88. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +9 -0
  89. data/platform/wm/tools/detool/detool.cpp +103 -52
  90. data/platform/wp7/RhoRubyExtGen/RhoDateTimePicker.cs +60 -0
  91. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
  92. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +4 -4
  93. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +15 -1
  94. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +12 -2
  95. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +2 -0
  96. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +3 -3
  97. data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +2 -2
  98. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +39 -24
  99. data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +8 -1
  100. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +3 -3
  101. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +1 -1
  102. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +22 -15
  103. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
  104. data/platform/wp7/RhoRubyLib/rubyext/RhoDateTimePicker.cs +237 -0
  105. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +5 -5
  106. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml +37 -0
  107. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml.cs +59 -0
  108. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +34 -41
  109. data/platform/wp7/rhodes/App.xaml.cs +1 -0
  110. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +18 -18
  111. data/platform/wp7/rhodes/Rhodes.csproj +5 -1
  112. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Cancel.png +0 -0
  113. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Check.png +0 -0
  114. data/rakefile.rb +77 -28
  115. data/res/build-tools/Microsoft.Phone.Controls.Toolkit.dll +0 -0
  116. data/res/build-tools/YUICompressorLicense.txt +54 -0
  117. data/res/build-tools/detool.exe +0 -0
  118. data/res/build-tools/yuicompressor-2.4.7.jar +0 -0
  119. data/res/generators/templates/application/app/layout.erb +1 -0
  120. data/res/generators/templates/application/public/js/jquery-wp7-patch.js +8 -2
  121. data/res/generators/templates/application/public/js/syncengine.js +147 -0
  122. data/spec/phone_spec/app/Data/septest.json +1 -1
  123. data/spec/phone_spec/app/spec/asynchttp_spec.rb +11 -10
  124. data/spec/phone_spec/app/spec/blobsync_spec.rb +9 -34
  125. data/spec/phone_spec/app/spec/date_spec.rb +6 -6
  126. data/spec/phone_spec/app/spec/rho_spec.rb +1 -6
  127. data/spec/phone_spec/app/spec/rhofile_spec.rb +13 -7
  128. data/spec/phone_spec/app/spec/rhom_object_spec.rb +4 -3
  129. data/spec/phone_spec/app/spec/syncengine_spec.rb +12 -14
  130. data/spec/phone_spec/app/spec_runner.rb +9 -10
  131. data/version +1 -1
  132. metadata +20 -5
  133. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +0 -15
data/doc/rhom.txt CHANGED
@@ -586,10 +586,10 @@ For such models if you try to add not listed property - you will get ArgumentErr
586
586
  obj = Customer.new( :wrong_address => 'test') #will raise ArgumentError exception
587
587
  obj = Customer.create( :wrong_address => 'test') #will raise ArgumentError exception
588
588
 
589
- obj = getCase().new
589
+ obj = Customer.new
590
590
  obj.wrong_address = 'test' #will raise ArgumentError exception
591
591
 
592
- obj = getCase().new
592
+ obj = Customer.new
593
593
  obj.update_attributes(:wrong_address => 'test') #will raise ArgumentError exception
594
594
 
595
595
 
@@ -98,6 +98,12 @@ In rholog.txt the lines appear as follows:
98
98
 
99
99
  <Timestamp> <category> | <message>
100
100
 
101
+ To enable remote logging just add the line to `rhoconfig.txt`:
102
+
103
+ rhologurl = 'http://<host>:<port>[/path]'
104
+
105
+ Then all log messages will be sent to the specified URL via POST HTTP-requests.
106
+
101
107
  ### RhoError class
102
108
 
103
109
  You may find access to the error class useful in logging and reporting:
data/doc/ui.txt CHANGED
@@ -162,6 +162,14 @@ In case of problems with pages transition performance just uncomment appropriate
162
162
 
163
163
  You may find it at very end of *mobileinit* handler function.
164
164
 
165
+ #### jQueryMobile CSS issues on Windows Phone 7.0
166
+ In case you have jQueryMobile rendering broken on Windows Phone 7.0 you need to add this tag inside of *<head>* tag in *layout.erb* file:
167
+
168
+ :::html
169
+ <meta http-equiv="X-UA-Compatible" content="IE=9"/>
170
+
171
+ It should fix jQueryMobile rendering problems on Windows Phone 7.0 platform.
172
+
165
173
  ## Loading screen
166
174
 
167
175
  Rhodes supports the display of a custom "Loading" screen while your application is launching. This screen's source is the file loading.html, located at <application-root>/app/loading.html.
@@ -400,6 +408,11 @@ Here is list of allowed values for actions for user defined menus, toolbars and
400
408
  * :separator - draw a separator line (if supported)
401
409
  * :close - close or put Rhodes to background (depending on platform)
402
410
  * :fullscreen - go to full screen mode
411
+ * :copy_paste - enable copy\paste functionality (Blackberry only). System menu items are displayed:
412
+
413
+ @default_menu = {
414
+ "Copy_Paste" => :copy_paste,
415
+ }
403
416
 
404
417
  Action can be also URL of user-defined controller method. URL can be prefixed with 'callback:' meaning it should be loaded by rhodes core, not WebView. This will effectively load specified url but in background, not touching UI.
405
418
 
data/lib/build/jake.rb CHANGED
@@ -527,7 +527,7 @@ class Jake
527
527
  end
528
528
 
529
529
  def self.zip_upgrade_bundle(folder_path, zip_file_path)
530
-
530
+
531
531
  File.delete(zip_file_path) if File.exists?(zip_file_path)
532
532
 
533
533
  currentdir = Dir.pwd()
@@ -545,7 +545,7 @@ class Jake
545
545
  Zip::ZipFile.open(zip_file_path, Zip::ZipFile::CREATE)do |zipfile|
546
546
  Find.find("RhoBundle") do |path|
547
547
  Find.prune if File.basename(path)[0] == ?.
548
- next if path.start_with?("RhoBundle/lib") || path.start_with?("RhoBundle/db")
548
+ next if path.start_with?("RhoBundle/lib") || path.start_with?("RhoBundle/db") || path == 'RhoBundle/hash' || path == 'RhoBundle/name'
549
549
 
550
550
  puts "add to zip : #{path}"
551
551
  zipfile.add(path, path)
@@ -559,16 +559,17 @@ class Jake
559
559
  else
560
560
  #chdir folder_path
561
561
  temp_dir = folder_path + '_tmp'
562
- cp_r folder_path, temp_dir
562
+ mkdir_p temp_dir
563
+ cp_r 'RhoBundle', temp_dir
563
564
  chdir temp_dir
564
- rm_rf File.join(temp_dir, 'RhoBundle/lib')
565
- rm_rf File.join(temp_dir, 'RhoBundle/db')
566
- rm_rf File.join(temp_dir, 'RhoBundle/hash')
567
- rm_rf File.join(temp_dir, 'RhoBundle/name')
565
+ rm_rf File.join(temp_dir, 'RhoBundle/lib')
566
+ rm_rf File.join(temp_dir, 'RhoBundle/db')
567
+ rm_rf File.join(temp_dir, 'RhoBundle/hash')
568
+ rm_rf File.join(temp_dir, 'RhoBundle/name')
568
569
  sh %{zip -r temporary_archive.zip .}
569
570
  cp_r 'temporary_archive.zip', zip_file_path
570
- rm_rf 'temporary_archive.zip'
571
- rm_rf temp_dir
571
+ rm_rf 'temporary_archive.zip'
572
+ rm_rf temp_dir
572
573
  end
573
574
 
574
575
  Dir.chdir currentdir
@@ -578,8 +579,7 @@ class Jake
578
579
  def self.run_rho_log_server(app_path)
579
580
 
580
581
  confpath_content = File.read($srcdir + "/apps/rhoconfig.txt") if File.exists?($srcdir + "/apps/rhoconfig.txt")
581
- confpath_content += "\r\n" + "rhologhost=" + $rhologhostaddr
582
- confpath_content += "\r\n" + "rhologport=" + $rhologhostport.to_s()
582
+ confpath_content += "\r\n" + "rhologurl=http://" + $rhologhostaddr + ":" + $rhologhostport.to_s() if !confpath_content.include?("rhologurl=")
583
583
  File.open($srcdir + "/apps/rhoconfig.txt", "w") { |f| f.write(confpath_content) } if confpath_content && confpath_content.length()>0
584
584
 
585
585
  begin
@@ -2,9 +2,12 @@
2
2
 
3
3
  module Crypt
4
4
  module CBC
5
-
5
+
6
6
  require 'crypt/stringio'
7
- require 'crypt/stringxor'
7
+ if defined?( RHO_WP7 )
8
+ require 'stringio'
9
+ end
10
+ require 'crypt/stringxor'
8
11
 
9
12
  ULONG = 0x100000000
10
13
 
@@ -193,15 +193,17 @@ public class Nfc implements RhodesActivityListener {
193
193
  log(" $$$$$$$$$ setEnable() FINISH() ");
194
194
  }
195
195
 
196
+ @Override
196
197
  public void onCreate(RhodesActivity activity, Intent intent) {
197
198
  getInstance().onNewIntent(activity, intent, true);
198
199
  }
199
200
 
201
+ @Override
200
202
  public void onRhodesActivityStartup(RhodesActivity activity) {
201
203
  activity.addRhodesActivityListener(getInstance());
202
204
  }
203
205
 
204
-
206
+ @Override
205
207
  public void onPause(RhodesActivity activity) {
206
208
  log(" $$$$$$$$$ onPause() ");
207
209
  NfcAdapter nfcAdapter = getDefaultAdapter(RhodesActivity.getContext());
@@ -211,6 +213,7 @@ public class Nfc implements RhodesActivityListener {
211
213
  }
212
214
  }
213
215
 
216
+ @Override
214
217
  public void onResume(RhodesActivity activity) {
215
218
  log(" $$$$$$$$$ onResume() ");
216
219
  NfcAdapter nfcAdapter = getDefaultAdapter(RhodesActivity.getContext());
@@ -230,6 +233,15 @@ public class Nfc implements RhodesActivityListener {
230
233
  }
231
234
  }
232
235
 
236
+ @Override
237
+ public void onStart(RhodesActivity activity) {}
238
+
239
+ @Override
240
+ public void onStop(RhodesActivity activity) {}
241
+
242
+ @Override
243
+ public void onDestroy(RhodesActivity activity) {}
244
+
233
245
  public void onNewIntent(RhodesActivity activity, Intent intent, boolean postpone) {
234
246
  String action = intent.getAction();
235
247
 
@@ -345,6 +357,7 @@ public class Nfc implements RhodesActivityListener {
345
357
  }
346
358
  }
347
359
 
360
+ @Override
348
361
  public void onNewIntent(RhodesActivity activity, Intent intent) {
349
362
  if (activity.isInsideStartStop()) {
350
363
  onNewIntent(activity, intent, false);
@@ -354,9 +367,6 @@ public class Nfc implements RhodesActivityListener {
354
367
  }
355
368
  }
356
369
 
357
-
358
-
359
-
360
370
  public static void setCallback(String callback) {
361
371
  ourCallback = callback;
362
372
  }
@@ -113,6 +113,14 @@ module Rho
113
113
  #puts "meta deleted"
114
114
  end
115
115
 
116
+ def __get_model
117
+ model = nil
118
+ begin
119
+ model = Object.const_get(@request['model'].to_sym()) if Object.const_defined?(@request['model'].to_sym() )
120
+ rescue Exception => exc
121
+ end
122
+ end
123
+
116
124
  def render(options = nil)
117
125
  if @params['rho_callback']
118
126
  rho_error( "render call in callback. Call WebView.navigate instead" )
@@ -128,12 +136,17 @@ module Rho
128
136
  action = options[:action] if options[:action]
129
137
  action = @request['action'].nil? ? default_action : @request['action'] unless action
130
138
 
131
- if $".include?( "rhodes_translator") and @request['model'] != nil
132
- model = nil
133
- model = Object.const_get(@request['model'].to_sym) if Object.const_defined?(@request['model'].to_sym)
139
+ if @request['model'] != nil
140
+
141
+ model = __get_model()
142
+
134
143
  if model && model.respond_to?( :metadata ) and model.metadata != nil
144
+ if $".include?( "rhodes_translator")
135
145
  metaenabled = model.metadata[action.to_s] != nil
136
- end
146
+ else
147
+ rho_error( "unable to load rhodes_translator gem." )
148
+ end
149
+ end
137
150
  end
138
151
 
139
152
  if not options[:string].nil?
@@ -1321,7 +1321,7 @@ module WebView
1321
1321
  alias_method :orig_execute_js, :execute_js
1322
1322
  end
1323
1323
 
1324
- def self.execute_js(func, index = 0, vals = nil)
1324
+ def self.execute_js(func, index = -1, vals = nil)
1325
1325
  if (vals && 0 < vals.size)
1326
1326
  func += '('
1327
1327
  vals.each do |val|
@@ -61,7 +61,17 @@ module Rho
61
61
  hashObjs = params['__rho_object']
62
62
 
63
63
  hashObjs.each do |name,index|
64
- params[name] = __rhoGetCallbackObject(index.to_i())
64
+ if name == '__rho_inline'
65
+ params.merge!( __rhoGetCallbackObject(index.to_i()) )
66
+
67
+ barcodeModule = Object.const_get('Barcode') if Object.const_defined?('Barcode')
68
+ if barcodeModule && barcodeModule.respond_to?( :rho_process_moto_callback )
69
+ barcodeModule.rho_process_moto_callback(params)
70
+ end
71
+
72
+ else
73
+ params[name] = __rhoGetCallbackObject(index.to_i())
74
+ end
65
75
  end
66
76
 
67
77
  params.delete('__rho_object')
@@ -0,0 +1,110 @@
1
+ #------------------------------------------------------------------------
2
+ # (The MIT License)
3
+ #
4
+ # Copyright (c) 2008-2011 Rhomobile, Inc.
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ # THE SOFTWARE.
23
+ #
24
+ # http://rhomobile.com
25
+ #------------------------------------------------------------------------
26
+
27
+ #TODO: enable it for Android also
28
+ if System.get_property('platform') == 'WINDOWS'
29
+ module Barcode
30
+
31
+ class << self
32
+
33
+ def take_barcode( callback, hashParams = {} )
34
+ enable(callback, hashParams)
35
+ RhoElementsExt.meta_proc('scanner', 'start', "")
36
+ end
37
+
38
+ def enable( callback = nil, hashParams = {} )
39
+ strParams = ""
40
+ scannerID = nil
41
+ hashParams.each do |key, value|
42
+ if key.to_s() == 'deviceName'
43
+ scannerID = value
44
+ next
45
+ end
46
+
47
+ strParams += "#{key}:#{value};"
48
+ end
49
+
50
+ strParams += "decodeEvent:url('#{callback}');" if callback
51
+
52
+ if scannerID
53
+ strParams += "enabled:#{scannerID};"
54
+ else
55
+ strParams += "enable;"
56
+ end
57
+
58
+ RhoElementsExt.meta_proc('scanner', strParams, "")
59
+ end
60
+
61
+ def enumerate(callback=nil)
62
+
63
+ if callback
64
+ RhoElementsExt.meta_proc('scanner', "EnumScannerEvent:url('#{callback}');enumerate", "")
65
+ else
66
+ RhoElementsExt.meta_proc('scanner', 'enumerate', '')
67
+ end
68
+
69
+ end
70
+
71
+ def disable
72
+ RhoElementsExt.meta_proc('scanner', 'disable', '')
73
+ end
74
+
75
+ def start
76
+ RhoElementsExt.meta_proc('scanner', 'start', '')
77
+ end
78
+
79
+ def stop
80
+ RhoElementsExt.meta_proc('scanner', 'stop', '')
81
+ end
82
+
83
+ def setEmml(argument)
84
+ RhoElementsExt.meta_proc('scanner', argument.to_s, '')
85
+ end
86
+
87
+ def method_missing(name, *args)
88
+ unless name == Fixnum
89
+ if name[name.length()-1] == '='
90
+ Scanner.send(name.to_s.chop().to_sym , args[0] ? args[0].to_s : "")
91
+ else
92
+ Scanner.send(name.to_sym)
93
+ end
94
+ end
95
+ end
96
+
97
+ def rho_process_moto_callback(params)
98
+ puts "rho_process_moto_callback : #{params}"
99
+
100
+ return unless params['event'] == 'Decode'
101
+ if params['data']
102
+ params['barcode'] = params['data']
103
+ params['status'] = 'ok'
104
+ else
105
+ params['status'] = 'cancel'
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -50,17 +50,14 @@ LOCAL_C_INCLUDES := \
50
50
 
51
51
  LOCAL_STATIC_LIBRARIES := \
52
52
  ruby rhorubyext json rhomain rhocommon rhodb rhoconnect rhonet curl sqlite rholog \
53
- rhocommon rhonet rhostat rhorubyext \
54
- unzip
53
+ rhocommon rhonet rhostat rhorubyext unzip \
54
+
55
55
  #barcode nfc
56
56
 
57
57
  LOCAL_LDLIBS := -llog -ldl -lz
58
58
 
59
59
  include $(BUILD_SHARED_LIBRARY)
60
60
 
61
- #include $(LOCAL_PATH)/../../../../lib/extensions/barcode/ext/barcode/platform/android/jni/Android.mk
62
-
63
- NDK_MODULE_PATH := $(SHARED_PATH_INC)
64
61
  $(call import-module,sqlite)
65
62
  $(call import-module,curl)
66
63
  $(call import-module,ruby)
@@ -38,6 +38,7 @@
38
38
  #include <logging/RhoLog.h>
39
39
 
40
40
  #ifndef RHO_NO_RUBY
41
+ //This include is required for rhojava.inc below
41
42
  #include <genconfig.h>
42
43
  #endif
43
44
 
@@ -0,0 +1,38 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2011 Rhomobile, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://rhomobile.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #ifndef FILEAPI_H_
28
+ #define FILEAPI_H_
29
+
30
+ #include "common/RhoDefs.h"
31
+ #include "common/RhoStd.h"
32
+
33
+ enum RhoFsMode {RHO_FS_DISK_ONLY = 0, RHO_FS_TRANSPARRENT};
34
+
35
+ RHO_GLOBAL void rho_file_set_fs_mode(int mode);
36
+ RHO_GLOBAL void rho_file_patch_stat_table(const rho::String& path);
37
+
38
+ #endif /* FILEAPI_H_ */
@@ -28,6 +28,7 @@
28
28
  #include "rhodes/JNIRhoRuby.h"
29
29
 
30
30
  #include "rhodes/RhoClassFactory.h"
31
+ #include "rhodes/fileapi.h"
31
32
 
32
33
  #include <ruby/ext/rho/rhoruby.h>
33
34
 
@@ -69,32 +70,6 @@ RHO_GLOBAL void rho_file_impl_delete_files_in_folder(const char *szFolderPath)
69
70
  env->CallStaticVoidMethod(cls, mid, objFolderPath.get());
70
71
  }
71
72
 
72
- RHO_GLOBAL void rho_file_impl_delete_folder(const char* szFolderPath) {
73
- /*
74
- JNIEnv *env = jnienv();
75
- jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
76
- if (!cls) return;
77
- jmethodID mid = getJNIClassStaticMethod(env, cls, "deleteFolder", "(Ljava/lang/String;)V");
78
- if (!mid) return;
79
- jhstring objFolderPath = rho_cast<jhstring>(szFolderPath);
80
- env->CallStaticVoidMethod(cls, mid, objFolderPath.get());
81
- */
82
-
83
- }
84
-
85
- RHO_GLOBAL void rho_file_impl_copy_folders_content_to_another_folder(const char* szSrcFolderPath, const char* szDstFolderPath) {
86
- /*
87
- JNIEnv *env = jnienv();
88
- jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
89
- if (!cls) return;
90
- jmethodID mid = getJNIClassStaticMethod(env, cls, "copyFoldersContentToAnotherFolder", "(Ljava/lang/String;Ljava/lang/String;)V");
91
- if (!mid) return;
92
- jhstring objSrcFolderPath = rho_cast<jhstring>(szSrcFolderPath);
93
- jhstring objDstFolderPath = rho_cast<jhstring>(szDstFolderPath);
94
- env->CallStaticVoidMethod(cls, mid, objSrcFolderPath.get(), objDstFolderPath.get());
95
- */
96
- }
97
-
98
73
  RHO_GLOBAL void rho_platform_restart_application() {
99
74
 
100
75
  }
@@ -307,3 +282,9 @@ RHO_GLOBAL void rho_sys_app_uninstall(const char *appname)
307
282
  RHO_GLOBAL void rho_sys_set_application_icon_badge(int badge_number) {
308
283
  //unsupported on Android
309
284
  }
285
+
286
+ RHO_GLOBAL void rho_sys_impl_before_exit()
287
+ {
288
+ rho_file_set_fs_mode(RHO_FS_DISK_ONLY);
289
+ }
290
+