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
@@ -27,8 +27,20 @@
27
27
  #import <UIKit/UIKit.h>
28
28
 
29
29
 
30
+ @interface SignatureViewProperties : NSObject {
31
+ }
32
+
33
+ @property (nonatomic, assign) unsigned int penColor;
34
+ @property (nonatomic, assign) float penWidth;
35
+ @property (nonatomic, assign) unsigned int bgColor;
36
+ @property (nonatomic, assign) int left;
37
+ @property (nonatomic, assign) int top;
38
+ @property (nonatomic, assign) unsigned int width;
39
+ @property (nonatomic, assign) unsigned int height;
30
40
 
31
41
 
42
+ @end
43
+
32
44
 
33
45
  @interface SignatureView : UIView {
34
46
 
@@ -26,6 +26,13 @@
26
26
 
27
27
  #import "SignatureView.h"
28
28
 
29
+
30
+ @implementation SignatureViewProperties
31
+
32
+ @synthesize penColor, penWidth, bgColor, left, top, width, height;
33
+ @end
34
+
35
+
29
36
  @implementation SignatureView
30
37
 
31
38
  -(CGContextRef)CreateRGBABitmapContext:(int)width height:(int)height
@@ -116,6 +123,7 @@
116
123
  penColor = 0xFF66009A;
117
124
  penWidth = 3.0;
118
125
  bgColor = 0xFFFFFFFF;
126
+
119
127
  }
120
128
  mPath = nil;
121
129
  [self doClear];
@@ -134,13 +142,13 @@
134
142
  CGContextSetRGBFillColor(context, ((float)((bgColor & 0xFF0000) >> 16))/255.0,
135
143
  ((float)((bgColor & 0xFF00) >> 8))/255.0,
136
144
  ((float)((bgColor & 0xFF)))/255.0,
137
- 1);
145
+ ((float)((bgColor & 0xFF000000) >> 24))/255.0);
138
146
 
139
147
 
140
148
  CGContextSetRGBStrokeColor(context, ((float)((penColor & 0xFF0000) >> 16))/255.0,
141
149
  ((float)((penColor & 0xFF00) >> 8))/255.0,
142
150
  ((float)((penColor & 0xFF)))/255.0,
143
- 1);
151
+ ((float)((penColor & 0xFF000000) >> 24))/255.0);
144
152
  CGContextFillRect(context, rect);
145
153
 
146
154
  // draw signature
@@ -180,7 +188,7 @@
180
188
  CGContextSetRGBStrokeColor(context, ((float)((penColor & 0xFF0000) >> 16))/255.0,
181
189
  ((float)((penColor & 0xFF00) >> 8))/255.0,
182
190
  ((float)((penColor & 0xFF)))/255.0,
183
- 1);
191
+ ((float)((penColor & 0xFF000000) >> 24))/255.0);
184
192
  CGContextFillRect(context, rect);
185
193
 
186
194
  // draw signature
@@ -36,6 +36,8 @@
36
36
 
37
37
  #include "NativeBar.h"
38
38
 
39
+ #import "SignatureDelegate.h"
40
+
39
41
  #undef DEFAULT_LOGCATEGORY
40
42
  #define DEFAULT_LOGCATEGORY "SimpleMainView"
41
43
 
@@ -659,6 +661,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
659
661
  //[webView setNeedsDisplay];
660
662
  //}
661
663
  //else {
664
+ [[SignatureDelegate getSharedInstance] hideSignatureInlineView];
662
665
  [webView goBack];
663
666
  //}
664
667
  }
@@ -989,6 +992,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
989
992
  NSMutableURLRequest *r = (NSMutableURLRequest*)request;
990
993
  [r addValue:c forHTTPHeaderField:@"Cookie"];
991
994
  }
995
+ [[SignatureDelegate getSharedInstance] hideSignatureInlineView];
992
996
  return YES;
993
997
  }
994
998
 
@@ -47,8 +47,8 @@ typedef void (*FSAVECONNDATA)(void* pThis, void* pData);
47
47
  */
48
48
  typedef enum {
49
49
  NotReachable = 0,
50
- ReachableViaCarrierDataNetwork,
51
- ReachableViaWiFiNetwork
50
+ ReachableViaCarrierDataNetwork = 1,
51
+ ReachableViaWiFiNetwork = 2
52
52
  } NetworkStatus;
53
53
 
54
54
  void rho_net_impl_network_indicator(int active)
@@ -56,6 +56,58 @@ void rho_net_impl_network_indicator(int active)
56
56
  [UIApplication sharedApplication].networkActivityIndicatorVisible = active ? YES : NO;
57
57
  }
58
58
 
59
+
60
+ VALUE rho_sys_has_wifi_network() {
61
+ SCNetworkReachabilityFlags defaultRouteFlags;
62
+
63
+ int defaultRouteIsAvailable = 0;
64
+
65
+ int i = 0;
66
+ while ((!defaultRouteIsAvailable) && (i++ < MAX_CONNECTION_TRY)) {
67
+ defaultRouteIsAvailable = isNetworkAvailableFlags(&defaultRouteFlags);
68
+ }
69
+
70
+ if (defaultRouteIsAvailable == 1) {
71
+ if (defaultRouteFlags & kSCNetworkReachabilityFlagsIsDirect) {
72
+ // Ad-Hoc network, not available
73
+ return rho_ruby_create_boolean(0);
74
+ }
75
+ else if (defaultRouteFlags & ReachableViaWiFiNetwork) {
76
+ // WiFi network available
77
+ return rho_ruby_create_boolean(1);
78
+ }
79
+ }
80
+ return rho_ruby_create_boolean(0);
81
+ }
82
+
83
+ VALUE rho_sys_has_cell_network() {
84
+ SCNetworkReachabilityFlags defaultRouteFlags;
85
+
86
+ int defaultRouteIsAvailable = 0;
87
+
88
+ int i = 0;
89
+ while ((!defaultRouteIsAvailable) && (i++ < MAX_CONNECTION_TRY)) {
90
+ defaultRouteIsAvailable = isNetworkAvailableFlags(&defaultRouteFlags);
91
+ }
92
+
93
+ if (defaultRouteIsAvailable == 1) {
94
+ if (defaultRouteFlags & kSCNetworkReachabilityFlagsIsDirect) {
95
+ // Ad-Hoc network, not available
96
+ return rho_ruby_create_boolean(0);
97
+ }
98
+ else if (defaultRouteFlags & ReachableViaCarrierDataNetwork) {
99
+ // Cell network available
100
+ return rho_ruby_create_boolean(1);
101
+ }
102
+ else if (defaultRouteFlags & ReachableViaWiFiNetwork) {
103
+ // Wifi network available
104
+ return rho_ruby_create_boolean(1);
105
+ }
106
+ }
107
+ return rho_ruby_create_boolean(0);
108
+ }
109
+
110
+
59
111
  // Determines network connectivity
60
112
  VALUE rho_sys_has_network() {
61
113
  SCNetworkReachabilityFlags defaultRouteFlags;
@@ -109,6 +161,47 @@ int rho_net_ping_network(const char* szHost)
109
161
  return returnData == NULL ? 0 : 1;
110
162
  }
111
163
 
164
+ int networkStatusForFlags(SCNetworkReachabilityFlags flags)
165
+ {
166
+ if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
167
+ {
168
+ // if target host is not reachable
169
+ return NotReachable;
170
+ }
171
+
172
+ int retVal = NotReachable;
173
+
174
+ if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
175
+ {
176
+ // if target host is reachable and no connection is required
177
+ // then we'll assume (for now) that your on Wi-Fi
178
+ retVal = ReachableViaWiFiNetwork;
179
+ }
180
+
181
+
182
+ if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
183
+ (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
184
+ {
185
+ // ... and the connection is on-demand (or on-traffic) if the
186
+ // calling application is using the CFSocketStream or higher APIs
187
+
188
+ if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
189
+ {
190
+ // ... and no [user] intervention is needed
191
+ retVal = ReachableViaWiFiNetwork;
192
+ }
193
+ }
194
+
195
+ if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
196
+ {
197
+ // ... but WWAN connections are OK if the calling application
198
+ // is using the CFNetwork (CFSocketStream?) APIs.
199
+ retVal = retVal | ReachableViaCarrierDataNetwork;
200
+ }
201
+ return retVal;
202
+ }
203
+
204
+
112
205
  int isNetworkAvailableFlags(SCNetworkReachabilityFlags *outFlags)
113
206
  {
114
207
  struct sockaddr_in zeroAddress;
@@ -141,7 +234,9 @@ int isNetworkAvailableFlags(SCNetworkReachabilityFlags *outFlags)
141
234
  // Callers of this method might want to use the reachability flags, so if an 'out' parameter
142
235
  // was passed in, assign the reachability flags to it.
143
236
  if (outFlags) {
144
- *outFlags = flags;
237
+
238
+ int fl = networkStatusForFlags(flags);
239
+ *outFlags = fl;
145
240
  }
146
241
  CFRelease(defaultRouteReachability);
147
242
  return reachable;
@@ -38,7 +38,7 @@
38
38
  <key>CFBundleSignature</key>
39
39
  <string>????</string>
40
40
  <key>CFBundleVersion</key>
41
- <string>3.3.2</string>
41
+ <string>3.3.3</string>
42
42
  <key>LSRequiresIPhoneOS</key>
43
43
  <true/>
44
44
  <key>UILaunchImageFile</key>
@@ -475,8 +475,23 @@ namespace "config" do
475
475
  $tmpdir = $bindir +"/tmp"
476
476
 
477
477
  $devroot = '/Developer' if $devroot.nil?
478
+ $iphonesim = File.join($startdir, 'res/build-tools/iphonesim/build/Release/iphonesim') if $iphonesim.nil?
479
+
478
480
 
479
481
  $xcodebuild = $devroot + "/usr/bin/xcodebuild"
482
+
483
+ if !File.exists? $xcodebuild
484
+ $xcodebuild = "/Applications/Xcode.app/Contents/Developer" + "/usr/bin/xcodebuild"
485
+ $devroot = '/Applications/Xcode.app/Contents/Developer'
486
+ $iphonesim = File.join($startdir, 'res/build-tools/iphonesim/build/Release/iphonesim_43')
487
+ end
488
+
489
+ if !File.exists? $xcodebuild
490
+ puts 'ERROR: can not found XCode command line tools'
491
+ puts 'Install XCode to default location'
492
+ puts 'For XCode from 4.3 and later - you should install Command Line Tools package ! Open XCode - Preferences... - Downloads - Components - Command Line Tools'
493
+ exit 1
494
+ end
480
495
 
481
496
  $homedir = ENV['HOME']
482
497
  $simdir = "#{$homedir}/Library/Application Support/iPhone Simulator/"
@@ -761,8 +776,8 @@ namespace "run" do
761
776
  Thread.new {
762
777
  # run spec
763
778
  rhorunner = File.join($startdir, $config["build"]["iphonepath"],"build/#{$configuration}-iphonesimulator/rhorunner.app")
764
- iphonesim = File.join($startdir, 'res/build-tools/iphonesim/build/Release/iphonesim')
765
- commandis = iphonesim + ' launch "' + rhorunner + '" ' + $sdkver.gsub(/([0-9]\.[0-9]).*/,'\1') + ' ' + $emulatortarget + ' "' +log_name+'"'
779
+ #iphonesim = File.join($startdir, 'res/build-tools/iphonesim/build/Release/iphonesim')
780
+ commandis = $iphonesim + ' launch "' + rhorunner + '" ' + $sdkver.gsub(/([0-9]\.[0-9]).*/,'\1') + ' ' + $emulatortarget + ' "' +log_name+'"'
766
781
  puts 'use iphonesim tool - open iPhone Simulator and execute our application, also support device family (iphone/ipad)'
767
782
  puts 'execute command : ' + commandis
768
783
  system(commandis)
@@ -1097,10 +1112,8 @@ namespace "run" do
1097
1112
  desc "Builds everything, launches iphone simulator"
1098
1113
  task :iphone => :buildsim do
1099
1114
 
1100
- iphonesim = File.join($startdir, 'res/build-tools/iphonesim/build/Release/iphonesim')
1101
-
1102
1115
  rhorunner = File.join($startdir, $config["build"]["iphonepath"],"build/#{$configuration}-iphonesimulator/rhorunner.app")
1103
- commandis = iphonesim + ' launch "' + rhorunner + '" ' + $sdkver.gsub(/([0-9]\.[0-9]).*/,'\1') + ' ' + $emulatortarget
1116
+ commandis = $iphonesim + ' launch "' + rhorunner + '" ' + $sdkver.gsub(/([0-9]\.[0-9]).*/,'\1') + ' ' + $emulatortarget
1104
1117
 
1105
1118
  thr = Thread.new do
1106
1119
  puts 'start thread with execution of application'
@@ -141,7 +141,7 @@ void rho_connectclient_processmodels(RHOM_MODEL* pModels, int nModels)
141
141
  void rho_connectclient_init(RHOM_MODEL* pModels, int nModels)
142
142
  {
143
143
  rho_logconf_Init(rho_native_rhopath(), "");
144
- CRhodesAppBase::Create( rho_native_rhopath() );
144
+ CRhodesAppBase::Create( rho_native_rhopath(), rho_native_rhopath(), rho_native_rhopath() );
145
145
 
146
146
  String strDbPath = rho_native_rhopath();
147
147
 
@@ -38,26 +38,56 @@ namespace common {
38
38
 
39
39
  struct CRhoExtData
40
40
  {
41
- void* m_hWnd;
41
+ HWND m_hWnd;
42
42
  void* m_hInstance;
43
43
  int m_iTabIndex;
44
+ HWND m_hBrowserWnd;
44
45
  };
45
46
 
46
47
  struct IRhoExtension
47
48
  {
48
- virtual void onSetPropertiesData( const wchar_t* pData, const CRhoExtData& oExtData ){}
49
+ virtual ~IRhoExtension(){}
50
+ virtual void onSetPropertiesData( const wchar_t* pPropID, const wchar_t* pData, const CRhoExtData& oExtData ){}
49
51
  virtual void onSetProperty( const wchar_t* pName, const wchar_t* pValue, const CRhoExtData& oExtData ){}
50
- virtual void onBeforeNavigate(const CRhoExtData& oExtData){}
52
+ virtual void onBeforeNavigate(const wchar_t* szUrlBeingNavigatedTo, const CRhoExtData& oExtData){}
53
+ virtual void onNavigateComplete(const wchar_t* szUrlBeingNavigatedTo, const CRhoExtData& oExtData){}
54
+ virtual void onDocumentComplete(const wchar_t* szUrlOfDocument, const CRhoExtData& oExtData){}
55
+ virtual bool onWndMsg(MSG& oMsg){return false;}
56
+ virtual long OnNavigateTimeout(const wchar_t* szUrlBeingNavigatedTo, const CRhoExtData& oExtData){return 0;}
57
+ virtual long OnSIPState(bool bSIPState, const CRhoExtData& oExtData){return 0;}
58
+ virtual long OnAlertPopup(int nEnum, void* pData, const CRhoExtData& oExtData){return 0;}
59
+ virtual long OnNavigateError(const wchar_t* szUrlBeingNavigatedTo, const CRhoExtData& oExtData){return 0;}
60
+ virtual void OnAppActivate(bool bActivate, const CRhoExtData& oExtData){}
51
61
  };
52
62
 
53
63
  struct IRhoExtManager
54
64
  {
65
+ virtual ~IRhoExtManager(){}
66
+
55
67
  virtual void onUnhandledProperty( const wchar_t* pModuleName, const wchar_t* pName, const wchar_t* pValue, const CRhoExtData& oExtData ) = 0;
56
- virtual void executeRuby( const char* szMethod, const char* szParam) = 0;
57
- virtual void executeRubyCallback( const char* szCallback, const char* szCallbackBody, const char* szCallbackData) = 0;
68
+ virtual void executeRubyCallback( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse) = 0;
58
69
  virtual void requireRubyFile( const char* szFilePath ) = 0;
59
70
 
60
71
  virtual void navigate(const wchar_t* szUrl) = 0;
72
+ virtual bool existsJavascript(const wchar_t* szJSFunction) = 0;
73
+ virtual void executeJavascript(const wchar_t* szJSFunction) = 0;
74
+
75
+ virtual void rhoLog(int nSeverity, const char* szModule, const char* szMsg, const char* szFile, int nLine) = 0;
76
+ virtual StringW getCurrentUrl() = 0;
77
+ virtual void stopNavigate() = 0;
78
+ virtual void historyForward() = 0;
79
+ virtual void historyBack() = 0;
80
+ virtual void refreshPage(bool bFromCache) = 0;
81
+ virtual void quitApp() = 0;
82
+ virtual void minimizeApp() = 0;
83
+ virtual void restoreApp() = 0;
84
+ virtual void resizeBrowserWindow(RECT rc) = 0;
85
+ virtual void zoomPage(float fZoom) = 0;
86
+ virtual void zoomText(int nZoom) = 0;
87
+ virtual int getTextZoom() = 0; //Enum (0 to 4)
88
+ virtual StringW getPageTitle(UINT iTab) = 0;
89
+
90
+ virtual StringW getConfigPath() = 0;
61
91
  };
62
92
 
63
93
  class CExtManager : public IRhoExtManager
@@ -70,18 +100,43 @@ public:
70
100
  void registerExtension(const String& strName, IRhoExtension* pExt);
71
101
 
72
102
  IRhoExtension* getExtByName(const String& strName);
73
- void onBeforeNavigate();
103
+
104
+ void onSetPropertiesData( const wchar_t* pPropID, const wchar_t* pData);
105
+ void onBeforeNavigate(const wchar_t* szUrlBeingNavigatedTo);
106
+ void onNavigateComplete(const wchar_t* szUrlBeingNavigatedTo);
107
+ void onDocumentComplete(const wchar_t* szUrlOfDocument);
108
+ bool onWndMsg(MSG& oMsg);
109
+ long OnNavigateTimeout(const wchar_t* szUrlBeingNavigatedTo);
110
+ long OnSIPState(bool bSIPState);
111
+ long OnAlertPopup(int nEnum, void* pData);
112
+ long OnNavigateError(const wchar_t* szUrlBeingNavigatedTo);
113
+ void OnAppActivate(bool bActivate);
74
114
 
75
115
  CRhoExtData makeExtData();
76
116
  void close();
77
117
 
78
118
  //IRhoExtManager
79
119
  virtual void onUnhandledProperty( const wchar_t* pModuleName, const wchar_t* pName, const wchar_t* pValue, const CRhoExtData& oExtData );
80
- virtual void executeRuby( const char* szMethod, const char* szParam);
81
- virtual void executeRubyCallback( const char* szCallback, const char* szCallbackBody, const char* szCallbackData);
120
+ virtual void executeRubyCallback( const char* szCallback, const char* szCallbackBody, const char* szCallbackData, bool bWaitForResponse);
82
121
  virtual void navigate(const wchar_t* szUrl);
83
122
  virtual void requireRubyFile( const char* szFilePath );
84
-
123
+ virtual void executeJavascript(const wchar_t* szJSFunction);
124
+ virtual bool existsJavascript(const wchar_t* szJSFunction);
125
+ virtual void rhoLog(int nSeverity, const char* szModule, const char* szMsg, const char* szFile, int nLine);
126
+ virtual StringW getCurrentUrl();
127
+ virtual void stopNavigate();
128
+ virtual void historyForward();
129
+ virtual void historyBack();
130
+ virtual void refreshPage(bool bFromCache);
131
+ virtual void quitApp();
132
+ virtual void minimizeApp();
133
+ virtual void restoreApp();
134
+ virtual void resizeBrowserWindow(RECT rc);
135
+ virtual void zoomPage(float fZoom);
136
+ virtual void zoomText(int nZoom);
137
+ virtual int getTextZoom(); //Enum (0 to 4)
138
+ virtual StringW getPageTitle(UINT iTab);
139
+ virtual StringW getConfigPath();
85
140
  };
86
141
 
87
142
  } //namespace common
@@ -36,6 +36,7 @@ class RhoSimSettings : public RhoSettings
36
36
  {
37
37
  public:
38
38
  const String& getRhodesPath(){return getString("rhodes_path");}
39
+ const String& getRhoRuntimePath(){return getString("rhodes_path");}
39
40
  };
40
41
 
41
42
  extern RhoSimSettings g_RhoSimSettings;
@@ -105,6 +105,7 @@ private:
105
105
  void processCommand(IQueueCommand* pCmd);
106
106
 
107
107
  static char const *toString(int type);
108
+ void callCallback(const String& strCallback);
108
109
 
109
110
  private:
110
111
  callback_t m_expected;
@@ -149,6 +150,41 @@ void CAppCallbacksQueue::call(CAppCallbacksQueue::callback_t type)
149
150
  addQueueCommand(new Command(type));
150
151
  }*/
151
152
 
153
+ void CAppCallbacksQueue::callCallback(const String& strCallback)
154
+ {
155
+ String strUrl = RHODESAPP().getBaseUrl();
156
+ strUrl += strCallback;
157
+ NetResponse resp = getNetRequest().pullData( strUrl, null );
158
+ if ( !resp.isOK() )
159
+ {
160
+ boolean bTryAgain = false;
161
+ #if defined( __SYMBIAN32__ ) || defined( OS_ANDROID )
162
+ if ( String_startsWith( strUrl, "http://localhost:" ) )
163
+ {
164
+ RHODESAPP().setBaseUrl("http://127.0.0.1:");
165
+ bTryAgain = true;
166
+ }
167
+ #else
168
+ if ( String_startsWith( strUrl, "http://127.0.0.1:" ) )
169
+ {
170
+ RHODESAPP().setBaseUrl("http://localhost:");
171
+ bTryAgain = true;
172
+ }
173
+ #endif
174
+
175
+ if ( bTryAgain )
176
+ {
177
+ LOG(INFO) + "Change base url and try again.";
178
+ strUrl = RHODESAPP().getBaseUrl();
179
+ strUrl += strCallback;
180
+ resp = getNetRequest().pullData( strUrl, null );
181
+ }
182
+
183
+ if ( !resp.isOK() )
184
+ LOG(ERROR) + strCallback + " call failed. Code: " + resp.getRespCode() + "; Error body: " + resp.getCharData();
185
+ }
186
+ }
187
+
152
188
  void CAppCallbacksQueue::processCommand(IQueueCommand* pCmd)
153
189
  {
154
190
  Command *cmd = (Command *)pCmd;
@@ -234,23 +270,13 @@ void CAppCallbacksQueue::processCommand(IQueueCommand* pCmd)
234
270
  break;
235
271
  case ui_created:
236
272
  {
237
- String strUrl = RHODESAPP().getBaseUrl();
238
- strUrl += "/system/uicreated";
239
- NetResponse resp = getNetRequest().pullData( strUrl, null );
240
- if ( !resp.isOK() )
241
- LOG(ERROR) + "activate app failed. Code: " + resp.getRespCode() + "; Error body: " + resp.getCharData();
242
-
273
+ callCallback("/system/uicreated");
243
274
  m_expected = app_activated;
244
275
  }
245
276
  break;
246
277
  case app_activated:
247
278
  {
248
- String strUrl = RHODESAPP().getBaseUrl();
249
- strUrl += "/system/activateapp";
250
- NetResponse resp = getNetRequest().pullData( strUrl, null );
251
- if ( !resp.isOK() )
252
- LOG(ERROR) + "activate app failed. Code: " + resp.getRespCode() + "; Error body: " + resp.getCharData();
253
-
279
+ callCallback("/system/activateapp");
254
280
  m_expected = app_deactivated;
255
281
  }
256
282
  break;
@@ -261,12 +287,12 @@ void CAppCallbacksQueue::processCommand(IQueueCommand* pCmd)
261
287
  m_commands.clear();
262
288
  }
263
289
 
264
- /*static*/ CRhodesApp* CRhodesApp::Create(const String& strRootPath, const String& strUserPath)
290
+ /*static*/ CRhodesApp* CRhodesApp::Create(const String& strRootPath, const String& strUserPath, const String& strRuntimePath)
265
291
  {
266
292
  if ( m_pInstance != null)
267
293
  return (CRhodesApp*)m_pInstance;
268
294
 
269
- m_pInstance = new CRhodesApp(strRootPath, strUserPath);
295
+ m_pInstance = new CRhodesApp(strRootPath, strUserPath, strRuntimePath);
270
296
 
271
297
  String push_pin = RHOCONF().getString("push_pin");
272
298
  if(!push_pin.empty())
@@ -286,14 +312,15 @@ void CAppCallbacksQueue::processCommand(IQueueCommand* pCmd)
286
312
 
287
313
  }
288
314
 
289
- CRhodesApp::CRhodesApp(const String& strRootPath, const String& strUserPath)
290
- :CRhodesAppBase(strRootPath, strUserPath)
315
+ CRhodesApp::CRhodesApp(const String& strRootPath, const String& strUserPath, const String& strRuntimePath)
316
+ :CRhodesAppBase(strRootPath, strUserPath, strRuntimePath)
291
317
  {
292
318
  m_bExit = false;
293
319
  m_bDeactivationMode = false;
294
320
  m_bRestartServer = false;
295
321
  m_bSendingLog = false;
296
322
  //m_activateCounter = 0;
323
+ m_pExtManager = 0;
297
324
 
298
325
  m_appCallbacksQueue = new CAppCallbacksQueue();
299
326
 
@@ -591,6 +618,26 @@ void CRhodesApp::callBarcodeCallback(String strCallbackUrl, const String& strBar
591
618
  runCallbackInThread(strCallbackUrl, strBody);
592
619
  }
593
620
 
621
+ void CRhodesApp::callCallbackWithData(String strCallbackUrl, String strBody, const String& strCallbackData, bool bWaitForResponse)
622
+ {
623
+ strCallbackUrl = canonicalizeRhoUrl(strCallbackUrl);
624
+
625
+ strBody += "&rho_callback=1";
626
+
627
+ if (strCallbackData.length() > 0 )
628
+ {
629
+ if ( !String_startsWith( strCallbackData, "&" ) )
630
+ strBody += "&";
631
+
632
+ strBody += strCallbackData;
633
+ }
634
+
635
+ if (bWaitForResponse)
636
+ getNetRequest().pushData( strCallbackUrl, strBody, null );
637
+ else
638
+ runCallbackInThread(strCallbackUrl, strBody);
639
+ }
640
+
594
641
  void CRhodesApp::callCameraCallback(String strCallbackUrl, const String& strImagePath,
595
642
  const String& strError, boolean bCancel )
596
643
  {
@@ -780,11 +827,12 @@ void CRhodesApp::initHttpServer()
780
827
  {
781
828
  String strAppRootPath = getRhoRootPath();
782
829
  String strAppUserPath = getRhoUserPath();
830
+ String strRuntimePath = getRhoRuntimePath();
783
831
  #ifndef RHODES_EMULATOR
784
832
  strAppRootPath += "apps";
785
833
  #endif
786
834
 
787
- m_httpServer = new net::CHttpServer(atoi(getFreeListeningPort()), strAppRootPath, strAppUserPath);
835
+ m_httpServer = new net::CHttpServer(atoi(getFreeListeningPort()), strAppRootPath, strAppUserPath, strRuntimePath);
788
836
  m_httpServer->register_uri("/system/geolocation", rubyext::CGeoLocation::callback_geolocation);
789
837
  m_httpServer->register_uri("/system/syncdb", callback_syncdb);
790
838
  m_httpServer->register_uri("/system/redirect_to", callback_redirect_to);
@@ -1084,6 +1132,11 @@ const String& CRhodesApp::getBaseUrl()
1084
1132
  return m_strHomeUrl;
1085
1133
  }
1086
1134
 
1135
+ void CRhodesApp::setBaseUrl(const String& strBaseUrl)
1136
+ {
1137
+ m_strHomeUrl = strBaseUrl + getFreeListeningPort();
1138
+ }
1139
+
1087
1140
  const String& CRhodesApp::getOptionsUrl()
1088
1141
  {
1089
1142
  m_strOptionsUrl = canonicalizeRhoUrl( RHOCONF().getString("options_path") );
@@ -1416,12 +1469,17 @@ int rho_http_snprintf(char *buf, size_t buflen, const char *fmt, ...)
1416
1469
 
1417
1470
  void rho_rhodesapp_create(const char* szRootPath)
1418
1471
  {
1419
- rho::common::CRhodesApp::Create(szRootPath, szRootPath);
1472
+ rho::common::CRhodesApp::Create(szRootPath, szRootPath, szRootPath);
1420
1473
  }
1421
1474
 
1422
1475
  void rho_rhodesapp_create_with_separate_user_path(const char* szRootPath, const char* szUserPath)
1423
1476
  {
1424
- rho::common::CRhodesApp::Create(szRootPath, szUserPath);
1477
+ rho::common::CRhodesApp::Create(szRootPath, szUserPath, szRootPath);
1478
+ }
1479
+
1480
+ void rho_rhodesapp_create_with_separate_runtime(const char* szRootPath, const char* szRuntimePath)
1481
+ {
1482
+ rho::common::CRhodesApp::Create(szRootPath, szRootPath, szRuntimePath);
1425
1483
  }
1426
1484
 
1427
1485
 
@@ -1670,12 +1728,3 @@ int rho_rhodesapp_canstartapp(const char* szCmdLine, const char* szSeparators)
1670
1728
  }
1671
1729
 
1672
1730
  } //extern "C"
1673
-
1674
-
1675
-
1676
-
1677
-
1678
-
1679
-
1680
-
1681
-