rhodes 3.3.3.beta.1 → 3.3.3.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. data/CHANGELOG +3 -0
  2. data/Manifest.txt +23 -9
  3. data/Rakefile +13 -2
  4. data/doc/build.txt +18 -11
  5. data/doc/device-caps.txt +4 -68
  6. data/doc/rhom.txt +33 -0
  7. data/doc/test-log-debug.txt +18 -42
  8. data/lib/framework/rho/render.rb +1 -1
  9. data/lib/framework/rho/rho.rb +31 -1
  10. data/lib/framework/rho/rhocontroller.rb +2 -2
  11. data/lib/framework/rhodes.rb +1 -1
  12. data/lib/framework/rhoframework.rb +4 -0
  13. data/lib/framework/rholang/localization_simplified.rb +1 -1
  14. data/lib/framework/rhom/rhom_object_factory.rb +22 -1
  15. data/lib/framework/version.rb +1 -1
  16. data/lib/rhodes.rb +1 -1
  17. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  18. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +25 -9
  19. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_extmanager_RhoExtManagerImpl.h +21 -0
  20. data/platform/android/Rhodes/jni/src/extmanager.cpp +36 -0
  21. data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
  22. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +14 -5
  23. data/platform/android/Rhodes/jni/src/rhodessystem.cpp +5 -0
  24. data/platform/android/Rhodes/jni/src/signature.cpp +29 -3
  25. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +3 -3
  26. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +4 -0
  27. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +42 -7
  28. data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +61 -10
  29. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +6 -0
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +39 -0
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +18 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +18 -0
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +142 -0
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +15 -0
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +6 -3
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +25 -13
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +15 -9
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -5
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +3 -3
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +14 -8
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +218 -51
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureProperties.java +94 -0
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +122 -37
  44. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +6 -2
  45. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/{WebView.java → IRhoWebView.java} +2 -1
  46. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +4 -0
  47. data/platform/android/build/RhodesSRC_build.files +8 -1
  48. data/platform/android/build/android.rake +5 -1
  49. data/platform/android/build/librhodes_build.files +1 -0
  50. data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +22 -1
  51. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +15 -0
  52. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +4 -0
  53. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +4 -2
  54. data/platform/bb/build/rhodes_build.files +2 -0
  55. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -1
  56. data/platform/bb/rhodes/src/com/rho/rubyext/PNGEncoder.java +613 -0
  57. data/platform/bb/rhodes/src/com/rho/rubyext/SignatureCapture.java +314 -0
  58. data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +1 -1
  59. data/platform/iphone/Classes/AppManager/AppManager.m +11 -0
  60. data/platform/iphone/Classes/Rhodes.m +1 -1
  61. data/platform/iphone/Classes/Signature/SignatureDelegate.h +5 -1
  62. data/platform/iphone/Classes/Signature/SignatureDelegate.m +186 -5
  63. data/platform/iphone/Classes/Signature/SignatureView.h +12 -0
  64. data/platform/iphone/Classes/Signature/SignatureView.m +11 -3
  65. data/platform/iphone/Classes/SimpleMainView.m +4 -0
  66. data/platform/iphone/Classes/rho/net/NetRequestImpl.m +98 -3
  67. data/platform/iphone/Info.plist +1 -1
  68. data/platform/iphone/rbuild/iphone.rake +18 -5
  69. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
  70. data/platform/shared/common/ExtManager.h +64 -9
  71. data/platform/shared/common/RhoSimConf.h +1 -0
  72. data/platform/shared/common/RhodesApp.cpp +77 -28
  73. data/platform/shared/common/RhodesApp.h +9 -4
  74. data/platform/shared/common/RhodesAppBase.cpp +4 -3
  75. data/platform/shared/common/RhodesAppBase.h +5 -3
  76. data/platform/shared/net/HttpServer.cpp +4 -4
  77. data/platform/shared/net/HttpServer.h +2 -2
  78. data/platform/shared/qt/rhodes/impl/MainWindowImpl.cpp +1 -1
  79. data/platform/shared/qt/rhodes/main.cpp +1 -1
  80. data/platform/shared/ruby/ext/rho/rhoruby.c +12 -2
  81. data/platform/shared/ruby/ext/rho/rhosupport.c +11 -1
  82. data/platform/shared/ruby/thread_win32.c +2 -1
  83. data/platform/shared/rubyext/System.cpp +6 -0
  84. data/platform/shared/sync/SyncSource.cpp +15 -0
  85. data/platform/wm/RhoLib/RhoLib.vcproj +0 -4
  86. data/platform/wm/build/build_inf.js +34 -4
  87. data/platform/wm/build/wm.rake +75 -25
  88. data/platform/wm/rhodes/AppManager.cpp +14 -3
  89. data/platform/wm/rhodes/IBrowserEngine.h +7 -0
  90. data/platform/wm/rhodes/IEBrowserEngine.cpp +43 -0
  91. data/platform/wm/rhodes/IEBrowserEngine.h +7 -0
  92. data/platform/wm/rhodes/LogOptionsDlg.cpp +1 -1
  93. data/platform/wm/rhodes/MainWindow.cpp +92 -7
  94. data/platform/wm/rhodes/MainWindow.h +28 -1
  95. data/platform/wm/rhodes/MapView/MapViewManager.cpp +4 -4
  96. data/platform/wm/rhodes/Rhodes.cpp +149 -10
  97. data/platform/wm/rhodes/resource.h +5 -1
  98. data/platform/wm/rhodes/rho/common/ExtManager.cpp +307 -0
  99. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +1 -1
  100. data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +1 -1
  101. data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +1 -1
  102. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +14 -2
  103. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +6 -3
  104. data/platform/wm/rhodes/rhodes.vcproj +5 -1
  105. data/platform/wm/rhodes/simulator/MainWindowQt.cpp +22 -1
  106. data/platform/wm/rhodes/simulator/MainWindowQt.h +4 -0
  107. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +1 -1
  108. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +1 -1
  109. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +33 -38
  110. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +134 -29
  111. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +12 -2
  112. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +17 -1
  113. data/platform/wp7/RhoRubyLib/views/RhoTabHeader.xaml +3 -3
  114. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +48 -8
  115. data/rakefile.rb +13 -2
  116. data/res/build-tools/iphonesim/build/Release/iphonesim_43 +0 -0
  117. data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +158 -0
  118. data/res/generators/rhogen.rb +33 -28
  119. data/res/generators/templates/application/app/layout.erb +6 -5
  120. data/res/generators/templates/application/public/css/android.css +21 -315
  121. data/res/generators/templates/application/public/css/iphone.css +1 -499
  122. data/res/generators/templates/application/public/css/jqmobile-patch.css +18 -5
  123. data/res/generators/templates/application/public/css/windows_phone7.css +378 -0
  124. data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
  125. data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
  126. data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0.css → jquery.mobile-1.0.1.css} +33 -11
  127. data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0.js → jquery.mobile-1.0.1.js} +249 -125
  128. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.1.min.css +2 -0
  129. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.1.min.js +177 -0
  130. data/res/generators/templates/application/public/jqmobile/{jquery.mobile.structure-1.0.css → jquery.mobile.structure-1.0.1.css} +33 -11
  131. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.1.min.css +2 -0
  132. data/res/generators/templates/application/public/jquery/jquery.json-2.3.js +193 -0
  133. data/res/generators/templates/application/public/jquery/jquery.json-2.3.min.js +23 -0
  134. data/res/generators/templates/application/public/js/jquery-wp7-patch.js +68 -20
  135. data/spec/phone_spec/app/Case/case.rb +22 -0
  136. data/spec/phone_spec/app/Customer/customer.rb +16 -0
  137. data/spec/phone_spec/app/spec/rhom_object_spec.rb +108 -11
  138. data/spec/phone_spec/app/spec/syncengine_spec.rb +43 -1
  139. data/spec/phone_spec/build.yml +2 -1
  140. data/version +1 -1
  141. metadata +27 -13
  142. data/platform/shared/common/ExtManager.cpp +0 -103
  143. data/res/generators/templates/application/public/jqmobile/jquery-mobile-iphone.css +0 -9
  144. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.css +0 -2
  145. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0.min.js +0 -172
  146. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.0.min.css +0 -2
@@ -572,6 +572,15 @@ end
572
572
  SyncEngine.set_source_property(src['source_id'], prop, src[prop] ? src[prop].to_s() : '' )
573
573
  end
574
574
  end
575
+
576
+ uniq_sources.each do|src|
577
+ if src.has_key?('freezed') || !src['schema'].nil?
578
+ hash_props = !src['schema'].nil? ? src['schema']["property"] : src["property"]
579
+ str_props = hash_props.keys.join(',')
580
+ SyncEngine.set_source_property(src['source_id'], 'freezed', str_props )
581
+ end
582
+ end
583
+
575
584
  end
576
585
 
577
586
  def self.processIndexes(index_param, src_name, is_unique)
@@ -1303,4 +1312,25 @@ module Kernel
1303
1312
  Rho::RHO.get_instance().load_model(name.to_s)
1304
1313
  end
1305
1314
 
1306
- end
1315
+ end
1316
+
1317
+ if defined?(RHO_WP7).nil?
1318
+ module WebView
1319
+
1320
+ class << self
1321
+ alias_method :orig_execute_js, :execute_js
1322
+ end
1323
+
1324
+ def self.execute_js(func, index = 0, vals = nil)
1325
+ if (vals && 0 < vals.size)
1326
+ func += '('
1327
+ vals.each do |val|
1328
+ func += val
1329
+ func += ',' if val != vals.last
1330
+ end
1331
+ func += ');'
1332
+ end
1333
+ orig_execute_js(func, index)
1334
+ end
1335
+ end
1336
+ end
@@ -52,8 +52,8 @@ module Rho
52
52
 
53
53
  def default_action
54
54
  return Hash['GET','show','PUT','update','POST','update',
55
- 'DELETE','delete'][@request['request-method']] unless @request['id'].nil?
56
- return Hash['GET','index','POST','create'][@request['request-method']]
55
+ 'DELETE','delete'][@request['request-method'].upcase] unless @request['id'].nil?
56
+ return Hash['GET','index','POST','create'][@request['request-method'].upcase]
57
57
  end
58
58
 
59
59
  def self.process_rho_object(params)
@@ -1,6 +1,6 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '3.3.2'
3
+ VERSION = '3.3.3'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
6
  DBVERSION = '2.2.0'
@@ -82,6 +82,10 @@ module Kernel
82
82
  ""
83
83
  end
84
84
 
85
+ def __rhoGetRuntimeDir
86
+ ""
87
+ end
88
+
85
89
  alias :orig_require :require
86
90
 
87
91
  def require(file_name)
@@ -47,7 +47,7 @@ module LocalizationSimplified
47
47
  if defined?( RHODES_EMULATOR )
48
48
  file = File.join( __rhoGetRhodesDir(), 'lib/framework', file)
49
49
  else
50
- file = File.join( __rhoGetCurrentDir(), 'lib', file)
50
+ file = File.join( __rhoGetRuntimeDir(), 'lib', file)
51
51
  end
52
52
  end
53
53
 
@@ -62,6 +62,8 @@ module Rhom
62
62
  end
63
63
 
64
64
  def initialize(obj=nil)
65
+ check_freezing_model(obj)
66
+
65
67
  @vars = {}
66
68
  self.rhom_init(@vars)
67
69
  self.vars[:object] = "#{generate_id()}" unless obj && obj[:object]
@@ -93,13 +95,30 @@ module Rhom
93
95
  def method_missing(name, *args)
94
96
  unless name == Fixnum
95
97
  if name[name.length()-1] == '='
96
- @vars[name.to_s.chop.to_sym()] = args[0]
98
+ s_name = name.to_s.chop
99
+ check_freezing_model(s_name)
100
+ @vars[s_name.to_sym()] = args[0]
97
101
  else
98
102
  @vars[name]
99
103
  end
100
104
  end
101
105
  end
102
106
 
107
+ def check_freezing_model(obj)
108
+ isSchemaSrc = is_inst_schema_source()
109
+ return unless obj && (isSchemaSrc || Rho::RhoConfig.sources[get_inst_source_name()]['freezed'])
110
+
111
+ hash_props = isSchemaSrc ? Rho::RhoConfig.sources[get_inst_source_name()]['schema']["property"] : Rho::RhoConfig.sources[get_inst_source_name()]["property"]
112
+ if obj.is_a?(Hash)
113
+ obj.each do |key, value|
114
+ next if key.to_s() == 'object'
115
+ raise ArgumentError.new( "Non-exist property : #{key}. For model : #{get_inst_source_name()}" ) unless hash_props[key.to_s()]
116
+ end
117
+ elsif obj.to_s() != 'object'
118
+ raise ArgumentError.new( "Non-exist property : #{obj}. For model : #{get_inst_source_name()}" ) unless hash_props[obj.to_s()]
119
+ end
120
+ end
121
+
103
122
  class << self
104
123
 
105
124
  def metadata
@@ -1679,6 +1698,8 @@ module Rhom
1679
1698
  # updates the current record in the viewable list and adds
1680
1699
  # a sync operation to update
1681
1700
  def update_attributes(attrs)
1701
+ check_freezing_model(attrs)
1702
+
1682
1703
  obj = self.object #self.inst_strip_braces(self.object)
1683
1704
  update_type='update'
1684
1705
  nSrcID = self.get_inst_source_id
@@ -1,6 +1,6 @@
1
1
  module RhodesFramework
2
2
  unless defined? RhodesFramework::VERSION
3
- VERSION = '3.3.2'
3
+ VERSION = '3.3.3'
4
4
  end
5
5
  unless defined? RhodesFramework::DBVERSION
6
6
  DBVERSION = '2.2.2'
data/lib/rhodes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '3.3.2'
3
+ VERSION = '3.3.3'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
6
  DBVERSION = '2.2.0'
@@ -2,8 +2,8 @@
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  package="com.rhomobile.rhodes"
4
4
  android:installLocation="auto"
5
- android:versionCode="37"
6
- android:versionName="3.3.2">
5
+ android:versionCode="38"
6
+ android:versionName="3.3.3">
7
7
 
8
8
  <uses-sdk android:minSdkVersion="8" />
9
9
 
@@ -11,14 +11,6 @@ extern "C" {
11
11
  #define com_rhomobile_rhodes_RhodesService_DEBUG 0L
12
12
  #undef com_rhomobile_rhodes_RhodesService_DOWNLOAD_PACKAGE_ID
13
13
  #define com_rhomobile_rhodes_RhodesService_DOWNLOAD_PACKAGE_ID 1L
14
- /*
15
- * Class: com_rhomobile_rhodes_RhodesService
16
- * Method: initClassLoader
17
- * Signature: (Ljava/lang/ClassLoader;)V
18
- */
19
- JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_initClassLoader
20
- (JNIEnv *, jobject, jobject);
21
-
22
14
  /*
23
15
  * Class: com_rhomobile_rhodes_RhodesService
24
16
  * Method: doSyncAllSources
@@ -49,7 +41,23 @@ JNIEXPORT jstring JNICALL Java_com_rhomobile_rhodes_RhodesService_normalizeUrl
49
41
  * Signature: (Ljava/lang/String;)V
50
42
  */
51
43
  JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequest
52
- (JNIEnv *, jobject, jstring);
44
+ (JNIEnv *, jclass, jstring);
45
+
46
+ /*
47
+ * Class: com_rhomobile_rhodes_RhodesService
48
+ * Method: doRequestAsync
49
+ * Signature: (Ljava/lang/String;)V
50
+ */
51
+ JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequestAsync
52
+ (JNIEnv *, jclass, jstring);
53
+
54
+ /*
55
+ * Class: com_rhomobile_rhodes_RhodesService
56
+ * Method: doRequestEx
57
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V
58
+ */
59
+ JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequestEx
60
+ (JNIEnv *, jclass, jstring, jstring, jstring, jboolean);
53
61
 
54
62
  /*
55
63
  * Class: com_rhomobile_rhodes_RhodesService
@@ -115,6 +123,14 @@ JNIEXPORT jstring JNICALL Java_com_rhomobile_rhodes_RhodesService_getBuildConfig
115
123
  JNIEXPORT jboolean JNICALL Java_com_rhomobile_rhodes_RhodesService_isOnStartPage
116
124
  (JNIEnv *, jclass);
117
125
 
126
+ /*
127
+ * Class: com_rhomobile_rhodes_RhodesService
128
+ * Method: getInvalidSecurityTokenMessage
129
+ * Signature: ()Ljava/lang/String;
130
+ */
131
+ JNIEXPORT jstring JNICALL Java_com_rhomobile_rhodes_RhodesService_getInvalidSecurityTokenMessage
132
+ (JNIEnv *, jclass);
133
+
118
134
  /*
119
135
  * Class: com_rhomobile_rhodes_RhodesService
120
136
  * Method: isTitleEnabled
@@ -0,0 +1,21 @@
1
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2
+ #include <jni.h>
3
+ /* Header for class com_rhomobile_rhodes_extmanager_RhoExtManagerImpl */
4
+
5
+ #ifndef _Included_com_rhomobile_rhodes_extmanager_RhoExtManagerImpl
6
+ #define _Included_com_rhomobile_rhodes_extmanager_RhoExtManagerImpl
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+ /*
11
+ * Class: com_rhomobile_rhodes_extmanager_RhoExtManagerImpl
12
+ * Method: nativeRequireRubyFile
13
+ * Signature: (Ljava/lang/String;)V
14
+ */
15
+ JNIEXPORT void JNICALL Java_com_rhomobile_rhodes_extmanager_RhoExtManagerImpl_nativeRequireRubyFile
16
+ (JNIEnv *, jclass, jstring);
17
+
18
+ #ifdef __cplusplus
19
+ }
20
+ #endif
21
+ #endif
@@ -0,0 +1,36 @@
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
+ #include "rhodes/JNIRhodes.h"
28
+ #include "rhodes/JNIRhoRuby.h"
29
+
30
+ #include <ruby/ext/rho/rhoruby.h>
31
+
32
+ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_extmanager_RhoExtManagerImpl_nativeRequireRubyFile
33
+ (JNIEnv * env, jclass, jstring jPath)
34
+ {
35
+
36
+ }
@@ -136,7 +136,7 @@ void* RhoNativeViewManager::getWebViewObject(int tab_index) {
136
136
  JNIEnv *env = jnienv();
137
137
  jclass cls = rho_find_class(env, "com/rhomobile/rhodes/nativeview/RhoNativeViewManager");
138
138
  if (!cls) return null;
139
- jmethodID mid = env->GetStaticMethodID( cls, "getWebViewObject", "(I)Lcom/rhomobile/rhodes/webview/WebView;");
139
+ jmethodID mid = env->GetStaticMethodID( cls, "getWebViewObject", "(I)Landroid/webkit/WebView;");
140
140
  if (!mid) return null;
141
141
  return env->CallStaticObjectMethod(cls, mid, tab_index);
142
142
  }
@@ -178,17 +178,26 @@ RHO_GLOBAL jstring JNICALL Java_com_rhomobile_rhodes_RhodesAppOptions_getBlobPat
178
178
  }
179
179
 
180
180
  RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequest
181
- (JNIEnv *env, jobject, jstring strUrl)
181
+ (JNIEnv *env, jclass, jstring strUrl)
182
182
  {
183
- std::string const &url = rho_cast<std::string>(strUrl);
183
+ std::string url = rho_cast<std::string>(strUrl);
184
184
  rho_net_request(url.c_str());
185
185
  }
186
186
 
187
187
  RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequestAsync
188
- (JNIEnv *env, jobject, jstring strUrl)
188
+ (JNIEnv *env, jclass, jstring strUrl)
189
+ {
190
+ std::string url = rho_cast<std::string>(strUrl);
191
+ RHODESAPP().runCallbackInThread(url, "");
192
+ }
193
+
194
+ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_doRequestEx
195
+ (JNIEnv *env, jclass, jstring jUrl, jstring jBody, jstring jData, jboolean waitForResponse)
189
196
  {
190
- std::string const &url = rho_cast<std::string>(strUrl);
191
- RHODESAPP().runCallbackInThread(url.c_str(), "");
197
+ std::string url = rho_cast<std::string>(jUrl);
198
+ std::string body = rho_cast<std::string>(jBody);
199
+ std::string data = rho_cast<std::string>(jData);
200
+ RHODESAPP().callCallbackWithData(url, body, data, waitForResponse);
192
201
  }
193
202
 
194
203
  RHO_GLOBAL jstring JNICALL Java_com_rhomobile_rhodes_RhodesService_normalizeUrl
@@ -59,6 +59,11 @@ const char* rho_native_rhopath()
59
59
  return rho_root_path().c_str();
60
60
  }
61
61
  //--------------------------------------------------------------------------------------------------
62
+ const char* rho_native_reruntimepath()
63
+ {
64
+ return rho_root_path().c_str();
65
+ }
66
+ //--------------------------------------------------------------------------------------------------
62
67
  rho::String rho_cur_path()
63
68
  {
64
69
  char buf[PATH_MAX];
@@ -79,15 +79,41 @@ RHO_GLOBAL void rho_signature_take(char* callback_url, rho_param* p)
79
79
 
80
80
  RHO_GLOBAL void rho_signature_visible(bool b, rho_param* p)
81
81
  {
82
- //TODO: rho_signature_visible
82
+ JNIEnv *env = jnienv();
83
+ jclass cls = getJNIClass(RHODES_JAVA_CLASS_SIGNATURE);
84
+ if (!cls) return;
85
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "inline_signature_visible", "(ILjava/lang/Object;)V");
86
+ if (!mid) return;
87
+
88
+ int visible = 0;
89
+ if (b) visible = 1;
90
+
91
+ jobject paramsObj = RhoValueConverter(env).createObject(p);
92
+ env->CallStaticVoidMethod(cls, mid, visible, paramsObj);
93
+ env->DeleteLocalRef(paramsObj);
83
94
  }
84
95
 
85
96
  RHO_GLOBAL void rho_signature_capture(const char* callback_url)
86
97
  {
87
- //TODO: rho_signature_capture
98
+ JNIEnv *env = jnienv();
99
+ jclass cls = getJNIClass(RHODES_JAVA_CLASS_SIGNATURE);
100
+ if (!cls) return;
101
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "inline_signature_capture", "(Ljava/lang/String;)V");
102
+ if (!mid) return;
103
+ jhstring objCallback = rho_cast<jhstring>(callback_url);
104
+
105
+ env->CallStaticVoidMethod(cls, mid, objCallback.get());
106
+
107
+
88
108
  }
89
109
 
90
110
  RHO_GLOBAL void rho_signature_clear()
91
111
  {
92
- //TODO: rho_signature_clear
112
+ JNIEnv *env = jnienv();
113
+ jclass cls = getJNIClass(RHODES_JAVA_CLASS_SIGNATURE);
114
+ if (!cls) return;
115
+ jmethodID mid = getJNIClassStaticMethod(env, cls, "inline_signature_clear", "()V");
116
+ if (!mid) return;
117
+ env->CallStaticVoidMethod(cls, mid);
118
+
93
119
  }
@@ -30,7 +30,7 @@ import com.rhomobile.rhodes.mainview.MainView;
30
30
  import com.rhomobile.rhodes.mainview.SimpleMainView;
31
31
  import com.rhomobile.rhodes.mainview.TabbedMainView;
32
32
  import com.rhomobile.rhodes.util.PerformOnUiThread;
33
- import com.rhomobile.rhodes.webview.WebView;
33
+ import com.rhomobile.rhodes.webview.IRhoWebView;
34
34
 
35
35
  public class NativeBar {
36
36
 
@@ -65,7 +65,7 @@ public class NativeBar {
65
65
  switch (type) {
66
66
  case NOBAR_TYPE:
67
67
  if (smv == null) {
68
- WebView webView = mainView.detachWebView();
68
+ IRhoWebView webView = mainView.detachWebView();
69
69
  v = new SimpleMainView(webView);
70
70
  } else
71
71
  smv.removeToolbar();
@@ -73,7 +73,7 @@ public class NativeBar {
73
73
  break;
74
74
  case TOOLBAR_TYPE:
75
75
  if (smv == null) {
76
- WebView webView = mainView.detachWebView();
76
+ IRhoWebView webView = mainView.detachWebView();
77
77
  v = new SimpleMainView(webView, params);
78
78
  }
79
79
  else
@@ -36,6 +36,7 @@ import com.rhomobile.rhodes.camera.Camera;
36
36
  import com.rhomobile.rhodes.mainview.MainView;
37
37
  import com.rhomobile.rhodes.mainview.SimpleMainView;
38
38
  import com.rhomobile.rhodes.mainview.SplashScreen;
39
+ import com.rhomobile.rhodes.signature.Signature;
39
40
  import com.rhomobile.rhodes.util.PerformOnUiThread;
40
41
  import com.rhomobile.rhodes.util.Utils;
41
42
 
@@ -161,6 +162,9 @@ public class RhodesActivity extends BaseActivity {
161
162
  mSplashScreen = new SplashScreen(this);
162
163
  setMainView(mSplashScreen);
163
164
 
165
+
166
+ Signature.registerSignatureCaptureExtension();
167
+
164
168
  processStartupListeners();
165
169
  {
166
170
  Iterator<RhodesActivityListener> iterator = mListeners.iterator();
@@ -227,8 +227,9 @@ public class RhodesService extends Service {
227
227
 
228
228
  public native String normalizeUrl(String url);
229
229
 
230
- public native void doRequest(String url);
231
- public native void doRequestAsync(String url);
230
+ public static native void doRequest(String url);
231
+ public static native void doRequestAsync(String url);
232
+ public static native void doRequestEx(String url, String body, String data, boolean waitForResponse);
232
233
 
233
234
  public static native void loadUrl(String url);
234
235
 
@@ -623,7 +624,7 @@ public class RhodesService extends Service {
623
624
  return hostExists;
624
625
  }
625
626
 
626
- private static boolean hasNetwork() {
627
+ private static boolean hasNetworkEx( boolean checkCell, boolean checkWifi, boolean checkEthernet, boolean checkWimax, boolean checkBluetooth, boolean checkAny) {
627
628
  if (!Capabilities.NETWORK_STATE_ENABLED) {
628
629
  Logger.E(TAG, "HAS_NETWORK: Capability NETWORK_STATE disabled");
629
630
  return false;
@@ -643,12 +644,30 @@ public class RhodesService extends Service {
643
644
  Logger.E(TAG, "HAS_NETWORK: cannot issue getAllNetworkInfo");
644
645
  return false;
645
646
  }
647
+
648
+ //{
649
+ // Utils.platformLog("NETWORK", "$$$$$$$$$$$$$$$$$$$ Networks ; $$$$$$$$$$$$$$$$$$$$$$");
650
+ // for (int i = 0, lim = info.length; i < lim; ++i)
651
+ // {
652
+ // int type = info[i].getType();
653
+ // String name = info[i].getTypeName();
654
+ // boolean is_connected = info[i].getState() == NetworkInfo.State.CONNECTED;
655
+ // Utils.platformLog("NETWORK", " - Name ["+name+"], type ["+String.valueOf(type)+"], connected ["+String.valueOf(is_connected)+"]");
656
+ // }
657
+ //}
646
658
 
647
659
  for (int i = 0, lim = info.length; i < lim; ++i)
648
660
  {
649
- //Logger.I(TAG, "HAS_NETWORK: " + info[i].toString() );
650
- if (info[i].getState() == NetworkInfo.State.CONNECTED)
651
- return true;
661
+ boolean is_connected = info[i].getState() == NetworkInfo.State.CONNECTED;
662
+ int type = info[i].getType();
663
+ if (is_connected) {
664
+ if ((type == ConnectivityManager.TYPE_MOBILE) && (checkCell)) return true;
665
+ if ((type == ConnectivityManager.TYPE_WIFI) && (checkWifi)) return true;
666
+ if ((type == 6) && (checkWimax)) return true;
667
+ if ((type == 9) && (checkEthernet)) return true;
668
+ if ((type == 7) && (checkBluetooth)) return true;
669
+ if (checkAny) return true;
670
+ }
652
671
  }
653
672
 
654
673
  Logger.I(TAG, "HAS_NETWORK: all networks are disconnected");
@@ -656,6 +675,18 @@ public class RhodesService extends Service {
656
675
  return false;
657
676
  }
658
677
 
678
+ private static boolean hasWiFiNetwork() {
679
+ return hasNetworkEx(false, true, true, true, false, false);
680
+ }
681
+
682
+ private static boolean hasCellNetwork() {
683
+ return hasNetworkEx(true, false, false, false, false, false);
684
+ }
685
+
686
+ private static boolean hasNetwork() {
687
+ return hasNetworkEx(true, true, true, true, false, true);
688
+ }
689
+
659
690
  private static String getCurrentLocale() {
660
691
  String locale = Locale.getDefault().getLanguage();
661
692
  if (locale.length() == 0)
@@ -724,7 +755,11 @@ public class RhodesService extends Service {
724
755
  else if (name.equalsIgnoreCase("has_camera"))
725
756
  return new Boolean(mCameraAvailable);
726
757
  else if (name.equalsIgnoreCase("has_network"))
727
- return hasNetwork();
758
+ return new Boolean(hasNetwork());
759
+ else if (name.equalsIgnoreCase("has_wifi_network"))
760
+ return new Boolean(hasWiFiNetwork());
761
+ else if (name.equalsIgnoreCase("has_cell_network"))
762
+ return new Boolean(hasCellNetwork());
728
763
  else if (name.equalsIgnoreCase("ppi_x"))
729
764
  return new Float(getScreenPpiX());
730
765
  else if (name.equalsIgnoreCase("ppi_y"))