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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. data/CHANGELOG +10 -0
  2. data/Rakefile +119 -3
  3. data/lib/build/jake.rb +15 -1
  4. data/lib/framework/dateME.rb +6 -1
  5. data/lib/framework/rho/render.rb +18 -15
  6. data/lib/framework/rho/rho.rb +105 -43
  7. data/lib/framework/rho/rhoapplication.rb +1 -1
  8. data/lib/framework/rho/rhocontact.rb +41 -13
  9. data/lib/framework/rho/rhocontroller.rb +10 -1
  10. data/lib/framework/rho/rhoevent_c.rb +6 -1
  11. data/lib/framework/rho/rhosupport.rb +1 -1
  12. data/lib/framework/rhodes.rb +1 -1
  13. data/lib/framework/rholang/rhomsg_de.rb +1 -1
  14. data/lib/framework/rholang/rhomsg_es.rb +1 -1
  15. data/lib/framework/rholang/rhomsg_it.rb +28 -0
  16. data/lib/framework/rhom/rhom.rb +6 -0
  17. data/lib/framework/rhom/rhom_model.rb +14 -7
  18. data/lib/framework/rhom/rhom_object_factory.rb +121 -56
  19. data/lib/framework/version.rb +1 -1
  20. data/lib/rhodes.rb +1 -1
  21. data/platform/android/Rhodes/AndroidManifest.full.xml +62 -0
  22. data/platform/android/Rhodes/AndroidManifest.xml +3 -34
  23. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +17 -2
  24. data/platform/android/Rhodes/jni/src/alert.cpp +16 -0
  25. data/platform/android/Rhodes/jni/src/callbacks.cpp +27 -3
  26. data/platform/android/Rhodes/jni/src/nativebar.cpp +3 -0
  27. data/platform/android/Rhodes/jni/src/nativeview.cpp +131 -1
  28. data/platform/android/Rhodes/jni/src/phonebook.cpp +102 -41
  29. data/platform/android/Rhodes/jni/src/rhodes.cpp +113 -32
  30. data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +1 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +9 -8
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +184 -49
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +49 -25
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +104 -57
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +36 -2
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +24 -14
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +7 -8
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +185 -3
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +54 -1
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +107 -14
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +72 -24
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +22 -21
  44. data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +91 -11
  45. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +10 -0
  46. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +11 -0
  47. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +10 -0
  48. data/platform/android/build/android.rake +50 -9
  49. data/platform/android/build/librhocommon_build.files +1 -0
  50. data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +3 -2
  51. data/platform/bb/Hsqldb/src/org/hsqldb/SchemaManager.java +3 -1
  52. data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +7 -0
  53. data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +2 -2
  54. data/platform/bb/RubyVM/RubyVM.jdp +1 -0
  55. data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +22 -0
  56. data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +5 -0
  57. data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +1 -1
  58. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +51 -4
  59. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +21 -10
  60. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +82 -33
  61. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +59 -6
  62. data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyFloat_Methods.java +5 -0
  63. data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +19 -7
  64. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/ArrayPacker.java +1 -1
  65. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFloat.java +5 -0
  66. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +55 -11
  67. data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +18 -2
  68. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +8 -5
  69. data/platform/bb/RubyVM/src/j2me/lang/CharacterMe.java +1 -1
  70. data/platform/bb/RubyVM/src/j2me/util/StringParser.java +2 -0
  71. data/platform/bb/build/RubyVM_build.files +1 -0
  72. data/platform/bb/build/bb.rake +21 -2
  73. data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +3 -3
  74. data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +1 -1
  75. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -2
  76. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +15 -16
  77. data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -0
  78. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +58 -0
  79. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +90 -4
  80. data/platform/iphone/Classes/AppManager/AppManager.m +43 -5
  81. data/platform/iphone/Classes/Event/Event.h +2 -0
  82. data/platform/iphone/Classes/Event/Event.m +12 -1
  83. data/platform/iphone/Classes/GeoLocation/LocationController.m +9 -3
  84. data/platform/iphone/Classes/MapView/MapViewController.m +20 -9
  85. data/platform/iphone/Classes/NativeBar.m +27 -0
  86. data/platform/iphone/Classes/Phonebook/phonebook.m +17 -0
  87. data/platform/iphone/Classes/RhoAlert.m +61 -1
  88. data/platform/iphone/Classes/RhoMainView.h +1 -0
  89. data/platform/iphone/Classes/Rhodes.h +2 -0
  90. data/platform/iphone/Classes/Rhodes.m +108 -1
  91. data/platform/iphone/Classes/SimpleMainView.h +4 -0
  92. data/platform/iphone/Classes/SimpleMainView.m +30 -3
  93. data/platform/iphone/Classes/SplashViewController.m +3 -1
  94. data/platform/iphone/Classes/TabbedMainView.h +2 -0
  95. data/platform/iphone/Classes/TabbedMainView.m +63 -11
  96. data/platform/iphone/Classes/rho/net/NetRequestImpl.m +26 -0
  97. data/platform/iphone/Info.plist +12 -1
  98. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
  99. data/platform/iphone/rbuild/iphone.rake +181 -25
  100. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +5 -5
  101. data/platform/shared/common/IRhoThreadImpl.h +1 -1
  102. data/platform/shared/common/PosixThreadImpl.cpp +5 -3
  103. data/platform/shared/common/PosixThreadImpl.h +1 -1
  104. data/platform/shared/common/RhoFilePath.h +11 -0
  105. data/platform/shared/common/RhoNativeViewManager.h +17 -0
  106. data/platform/shared/common/RhoThread.h +1 -1
  107. data/platform/shared/common/RhodesApp.cpp +29 -8
  108. data/platform/shared/common/ThreadQueue.cpp +5 -3
  109. data/platform/shared/common/ThreadQueue.h +2 -1
  110. data/platform/shared/common/app_build_configs.c +25 -0
  111. data/platform/shared/common/app_build_configs.h +11 -0
  112. data/platform/shared/net/AsyncHttp.cpp +5 -5
  113. data/platform/shared/net/CURLNetRequest.cpp +25 -7
  114. data/platform/shared/net/CURLNetRequest.h +2 -1
  115. data/platform/shared/net/HttpServer.cpp +28 -0
  116. data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
  117. data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +26 -1
  118. data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
  119. data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
  120. data/platform/shared/ruby/ext/rho/rhosupport.c +15 -2
  121. data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -2
  122. data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +97 -2
  123. data/platform/shared/ruby/ext/system/system.i +13 -0
  124. data/platform/shared/ruby/ext/system/system_wrap.c +104 -1
  125. data/platform/shared/rubyext/RhoAppAdapter.cpp +7 -0
  126. data/platform/shared/sync/SyncEngine.cpp +43 -3
  127. data/platform/shared/sync/SyncEngine.h +13 -0
  128. data/platform/shared/sync/SyncNotify.cpp +41 -23
  129. data/platform/shared/sync/SyncNotify.h +18 -4
  130. data/platform/shared/sync/SyncSource.cpp +52 -14
  131. data/platform/shared/sync/SyncSource.h +1 -0
  132. data/platform/shared/sync/SyncThread.cpp +29 -9
  133. data/platform/shared/sync/SyncThread.h +4 -2
  134. data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
  135. data/platform/wm/build/build_inf.js +15 -9
  136. data/platform/wm/build/wm.rake +10 -5
  137. data/platform/wm/rhodes/Alert.cpp +10 -0
  138. data/platform/wm/rhodes/Alert.h +3 -3
  139. data/platform/wm/rhodes/MainWindow.cpp +171 -26
  140. data/platform/wm/rhodes/MainWindow.h +23 -1
  141. data/platform/wm/rhodes/MetaHandler.cpp +192 -0
  142. data/platform/wm/rhodes/MetaHandler.h +31 -0
  143. data/platform/wm/rhodes/RhoNativeViewManager.cpp +126 -0
  144. data/platform/wm/rhodes/RhoNativeViewManagerWM.h +20 -0
  145. data/platform/wm/rhodes/Rhodes.cpp +91 -2
  146. data/platform/wm/rhodes/Rhodes.rc +15 -6
  147. data/platform/wm/rhodes/SyncStatusDlg.cpp +32 -0
  148. data/platform/wm/rhodes/SyncStatusDlg.h +29 -0
  149. data/platform/wm/rhodes/resource.h +5 -2
  150. data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +3 -1
  151. data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +1 -1
  152. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +146 -14
  153. data/platform/wm/rhodes/rhodes.vcproj +28 -0
  154. data/rakefile.rb +119 -3
  155. data/res/build-tools/iphonesim/README +58 -0
  156. data/res/build-tools/iphonesim/Source/iPhoneSimulator.h +43 -0
  157. data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +224 -0
  158. data/res/build-tools/iphonesim/Source/main.m +52 -0
  159. data/res/build-tools/iphonesim/Source/nsprintf.h +3 -0
  160. data/res/build-tools/iphonesim/Source/nsprintf.m +42 -0
  161. data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
  162. data/res/build-tools/iphonesim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +124 -0
  163. data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +261 -0
  164. data/res/build-tools/iphonesim/iphonesim_Prefix.pch +7 -0
  165. data/res/generators/rhogen.rb +5 -0
  166. data/res/generators/templates/application/app/layout.erb +7 -13
  167. data/res/generators/templates/application/app/loading.png +0 -0
  168. data/res/generators/templates/application/build.yml +3 -0
  169. data/res/generators/templates/application/icon/icon114.png +0 -0
  170. data/res/generators/templates/application/icon/icon57.png +0 -0
  171. data/res/generators/templates/application/icon/icon72.png +0 -0
  172. data/res/generators/templates/application/public/css/iphone.css +96 -0
  173. data/res/generators/templates/application/public/images/backButton.png +0 -0
  174. data/res/generators/templates/application/public/jqtouch/jqtouch.js +2 -1
  175. data/res/generators/templates/application/rhoconfig.txt +2 -0
  176. data/rhodes.gemspec +1 -1
  177. data/spec/phone_spec/app/spec/array_pack_spec.rb +108 -0
  178. data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
  179. data/spec/phone_spec/app/spec/date_spec.rb +27 -0
  180. data/spec/phone_spec/app/spec/fixtures/classes.rb +91 -0
  181. data/spec/phone_spec/app/spec/lstrip_spec.rb +57 -0
  182. data/spec/phone_spec/app/spec/rho_spec.rb +50 -19
  183. data/spec/phone_spec/app/spec/rhom_object_spec.rb +78 -0
  184. data/spec/phone_spec/app/spec/rstrip_spec.rb +51 -0
  185. data/spec/phone_spec/app/spec/strip_spec.rb +50 -0
  186. data/spec/phone_spec/app/spec/syncengine_spec.rb +46 -3
  187. data/spec/phone_spec/app/spec_runner.rb +6 -0
  188. metadata +34 -4
@@ -9,8 +9,11 @@
9
9
  #include "logging/RhoLog.h"
10
10
  #include "common/RhoConf.h"
11
11
  #include "common/RhodesApp.h"
12
+ #include "common/app_build_configs.h"
12
13
  #import "SplitView/SplittedMainView.h"
13
14
 
15
+
16
+
14
17
  #undef DEFAULT_LOGCATEGORY
15
18
  #define DEFAULT_LOGCATEGORY "Rhodes"
16
19
 
@@ -18,6 +21,7 @@ void rho_geoimpl_init();
18
21
 
19
22
  static BOOL app_created = NO;
20
23
 
24
+
21
25
  @interface RhoActivateTask : NSObject {}
22
26
  + (void)run;
23
27
  @end
@@ -31,7 +35,7 @@ static BOOL app_created = NO;
31
35
 
32
36
  @implementation Rhodes
33
37
 
34
- @synthesize window, player, cookies, signatureDelegate;
38
+ @synthesize window, player, cookies, signatureDelegate, start_parameters;
35
39
  #ifdef __IPHONE_4_0
36
40
  @synthesize eventStore;
37
41
  #endif
@@ -665,14 +669,85 @@ static Rhodes *instance = NULL;
665
669
 
666
670
  #ifdef __IPHONE_3_0
667
671
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
672
+
673
+ NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
674
+
675
+ // store start parameter
676
+ NSString* start_parameter = [NSString stringWithUTF8String:""];
677
+ if (url != nil) {
678
+ NSString* url_str = [url absoluteString];
679
+ if (url_str != nil) {
680
+ NSRange range = [url_str rangeOfString:@":"];
681
+ if ((range.location >= 0) && (range.length > 0)) {
682
+ start_parameter = [url_str substringFromIndex:range.location + 1];
683
+ }
684
+ }
685
+ }
686
+ self.start_parameters = [NSString stringWithUTF8String:[start_parameter UTF8String]];
687
+
688
+
668
689
  [self doStartUp];
669
690
  [self processDoSync:launchOptions];
691
+
692
+ /*
693
+ BOOL rhogallery_only = rho_conf_getBool("rhogallery_only_app");
694
+
695
+ // check for only from gallery app
696
+ if (rhogallery_only) {
697
+ if ([start_parameter compare:@"rhogallery_app"] != NSOrderedSame) {
698
+ NSLog(@"ALERT ! Application should be executed only from RhoGallery application !!!");
699
+ exit(EXIT_SUCCESS);
700
+ }
701
+ }
702
+ */
703
+ const char* security_token = get_app_build_config_item("security_token");
704
+
705
+ if (security_token != NULL) {
706
+ NSString* ns_security_token = [NSString stringWithUTF8String:security_token];
707
+ if ([ns_security_token length] > 0) {
708
+ BOOL can_start = NO;
709
+
710
+ NSString* security_token_key = [NSString stringWithUTF8String:"security_token="];
711
+ NSRange st_range = [start_parameter rangeOfString:security_token_key];
712
+ if (st_range.location >= 0) {
713
+ NSString* tmp = [start_parameter substringFromIndex:(st_range.location + st_range.length)];
714
+ NSRange t_range = [tmp rangeOfString:@","];
715
+ if (t_range.location >= 0) {
716
+ tmp = [tmp substringToIndex:t_range.location];
717
+ }
718
+ t_range = [tmp rangeOfString:@" "];
719
+ if (t_range.location >= 0) {
720
+ tmp = [tmp substringToIndex:t_range.location];
721
+ }
722
+
723
+ // check for app security_token
724
+ if ([tmp compare:ns_security_token] == NSOrderedSame) {
725
+ can_start = YES;
726
+ }
727
+ }
728
+
729
+ if (!can_start) {
730
+ NSLog(@"ALERT ! SECURITY_TOKEN is not valid !!!");
731
+ exit(EXIT_SUCCESS);
732
+ }
733
+ }
734
+ }
735
+
736
+
737
+
670
738
  return NO;
671
739
  }
672
740
  #endif
673
741
 
674
742
  - (void)applicationDidFinishLaunching:(UIApplication *)application {
743
+ self.start_parameters = [NSString stringWithUTF8String:""];
744
+
675
745
  [self doStartUp];
746
+ BOOL rhogallery_only = rho_conf_getBool("rhogallery_only_app");
747
+ if (rhogallery_only) {
748
+ NSLog(@"ALERT ! Application should be executed only from RhoGallery application !!!");
749
+ exit(EXIT_SUCCESS);
750
+ }
676
751
  }
677
752
 
678
753
  #ifdef __IPHONE_3_0
@@ -744,10 +819,42 @@ static Rhodes *instance = NULL;
744
819
  [mainView performSelector:sel];
745
820
  }
746
821
 
822
+ - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
823
+ {
824
+ if (!url) { return NO; }
825
+ /*
826
+ NSString *URLString = [url absoluteString];
827
+ [[NSUserDefaults standardUserDefaults] setObject:URLString forKey:@"url"];
828
+ [[NSUserDefaults standardUserDefaults] synchronize];
829
+
830
+ //NSString* msg = @"handleOpenURL: ";
831
+ //msg = [msg stringByAppendingString:URLString];
832
+
833
+ UIAlertView *alert = [[[UIAlertView alloc]
834
+ initWithTitle:@"handleOpenURL:"
835
+ message:URLString
836
+ delegate:self
837
+ cancelButtonTitle:@"Close"
838
+ otherButtonTitles:nil] autorelease];
839
+
840
+ [alert show];
841
+ */
842
+ return YES;
843
+ }
844
+
845
+
846
+
747
847
  @end
748
848
 
749
849
  // Native functions
750
850
 
851
+ const char* rho_sys_get_start_params() {
852
+ if ([Rhodes sharedInstance].start_parameters == nil) {
853
+ return "";
854
+ }
855
+ return [[Rhodes sharedInstance].start_parameters UTF8String];
856
+ }
857
+
751
858
 
752
859
  void rho_map_location(char* query) {
753
860
  [[Rhodes sharedInstance] mapLocation:[NSString stringWithUTF8String:query]];
@@ -11,6 +11,8 @@
11
11
  #import "RhoViewController.h"
12
12
  #include "RhoNativeViewManagerOC.h"
13
13
 
14
+
15
+
14
16
  @interface SimpleMainView : RhoViewController <RhoMainView, UIWebViewDelegate> {
15
17
 
16
18
  UIWebView *webView;
@@ -20,6 +22,7 @@
20
22
  id<NativeViewOC,NSObject> nativeView;
21
23
  NSString* nativeViewType;
22
24
  UIView* nativeViewView;
25
+ RhoViewController* mTabBarCallback;
23
26
  }
24
27
 
25
28
  @property (nonatomic,retain) UIWebView *webView;
@@ -27,6 +30,7 @@
27
30
  @property (nonatomic,retain) UINavigationBar *navbar;
28
31
  @property (nonatomic,retain) NSString *nativeViewType;
29
32
  @property (nonatomic,retain) UIView *nativeViewView;
33
+ @property (nonatomic,assign) RhoViewController* mTabBarCallback;
30
34
 
31
35
  - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p;
32
36
  - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p toolbar:(NSArray*)items;
@@ -14,6 +14,8 @@
14
14
  #include "common/RhodesApp.h"
15
15
  #include "logging/RhoLog.h"
16
16
 
17
+ #include "TabbedMainView.h"
18
+
17
19
  #undef DEFAULT_LOGCATEGORY
18
20
  #define DEFAULT_LOGCATEGORY "SimpleMainView"
19
21
 
@@ -60,7 +62,7 @@ int rho_sys_get_screen_height();
60
62
 
61
63
  @implementation SimpleMainView
62
64
 
63
- @synthesize webView, toolbar, navbar, nativeViewType, nativeViewView;
65
+ @synthesize webView, toolbar, navbar, nativeViewType, nativeViewView, mTabBarCallback;
64
66
 
65
67
 
66
68
  static BOOL makeHiddenUntilLoadContent = YES;
@@ -178,6 +180,11 @@ static BOOL makeHiddenUntilLoadContent = YES;
178
180
  [tb sizeToFit];
179
181
 
180
182
  CGFloat tbHeight = [tb frame].size.height;
183
+ // hack for do not reduce height of toolbar in Landscape mode
184
+ if (tbHeight < 44) {
185
+ tbHeight = 44;
186
+ }
187
+
181
188
  CGRect tbFrame = CGRectMake(CGRectGetMinX(mainFrame),
182
189
  CGRectGetHeight(mainFrame) - tbHeight,
183
190
  CGRectGetWidth(mainFrame),
@@ -284,6 +291,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
284
291
 
285
292
  - (id)init:(UIView*)p webView:(UIWebView*)w frame:(CGRect)frame toolbar:(NSArray*)items {
286
293
  [self init];
294
+
295
+ self.mTabBarCallback = nil;
287
296
 
288
297
  rootFrame = frame;
289
298
 
@@ -718,13 +727,24 @@ static BOOL makeHiddenUntilLoadContent = YES;
718
727
  navbar.autoresizesSubviews = YES;
719
728
 
720
729
  UIView* root = self.view;
721
- [root addSubview:navbar];
722
- assert([navbar retainCount] == 2);
723
730
 
724
731
  CGRect nFrame = navbar.frame;
732
+
733
+ CGFloat nvHeight = nFrame.size.height;
734
+ // hack for do not reduce height of navbar in Landscape mode
735
+ if (nvHeight < 44) {
736
+ nvHeight = 44;
737
+ }
738
+ nFrame.size.height = nvHeight;
739
+ navbar.frame = nFrame;
740
+
725
741
  CGRect wFrame = [self getContentRect];
726
742
  wFrame.origin.y += nFrame.size.height;
727
743
  wFrame.size.height -= nFrame.size.height;
744
+
745
+ [root addSubview:navbar];
746
+ assert([navbar retainCount] == 2);
747
+
728
748
  [self setContentRect:wFrame];
729
749
  }
730
750
 
@@ -876,4 +896,11 @@ static BOOL makeHiddenUntilLoadContent = YES;
876
896
  }
877
897
  }
878
898
 
899
+ - (void)viewWillAppear:(BOOL)animated {
900
+ if (self.mTabBarCallback != nil) {
901
+ TabbedMainView* tv = (TabbedMainView*)self.mTabBarCallback;
902
+ [tv onViewWillActivate:self];
903
+ }
904
+ }
905
+
879
906
  @end
@@ -153,7 +153,9 @@
153
153
  CGRect frame = myframe;
154
154
  float scales = 1;//[[UIScreen mainScreen] scale];
155
155
  #ifdef __IPHONE_4_0
156
- scales = [[UIScreen mainScreen] scale];
156
+ if ( [[UIScreen mainScreen] respondsToSelector:@selector(scale)] ) {
157
+ scales = [[UIScreen mainScreen] scale];
158
+ }
157
159
  #endif
158
160
 
159
161
  BOOL is_HiResolution = ((frame.size.width*scales) > 500);
@@ -24,4 +24,6 @@
24
24
 
25
25
  - (UIWebView*)getWebView:(int)tab_index;
26
26
 
27
+ - (void)onViewWillActivate:(RhoViewController*)view;
28
+
27
29
  @end
@@ -108,7 +108,10 @@
108
108
  subController.title = label;
109
109
  NSString *imagePath = [[AppManager getApplicationsRootPath] stringByAppendingPathComponent:icon];
110
110
  subController.tabBarItem.image = [UIImage imageWithContentsOfFile:imagePath];
111
- //[subController navigateRedirect:url tab:0];
111
+ subController.tabBarItem.badgeValue = nil;
112
+
113
+ subController.mTabBarCallback = self;
114
+ //[subController navigateRedirect:url tab:0];
112
115
 
113
116
  [tabs addObject:td];
114
117
  [views addObject:subController];
@@ -156,6 +159,9 @@
156
159
  }
157
160
 
158
161
  - (RhoTabBarData*)tabData:(int)index {
162
+ if ((index < 0) || (index >= [tabbarData count])) {
163
+ return nil;
164
+ }
159
165
  return (RhoTabBarData*)[tabbarData objectAtIndex:index];
160
166
  }
161
167
 
@@ -204,22 +210,55 @@
204
210
  }
205
211
 
206
212
  - (void)switchTab:(int)index {
207
- tabindex = index;
208
- tabbar.selectedIndex = tabindex;
213
+ tabbar.selectedIndex = index;
209
214
  [self onSwitchTab];
210
215
  }
211
216
 
217
+ - (void)setTabBadge:(int)index val:(char*)val {
218
+ RAWLOG_INFO2("setTabBadge: %d = %s",index,val);
219
+ if(!strcmp(val,""))
220
+ {
221
+ [self subView:index].tabBarItem.badgeValue = nil;
222
+ }
223
+ else
224
+ {
225
+ [self subView:index].tabBarItem.badgeValue = [NSString stringWithCString:val length:strlen(val)];
226
+ }
227
+ RAWLOG_INFO("returning setTabBadge");
228
+ }
229
+
212
230
  - (void)onSwitchTab {
213
- tabindex = tabbar.selectedIndex;
214
- RhoTabBarData *td = [self tabData:tabindex];
215
- if (!td.loaded || td.reload) {
216
- const char *s = [td.url UTF8String];
217
- rho_rhodesapp_load_url(s);
218
- td.loaded = YES;
219
- }
220
- [[[self subView:tabindex] view] setNeedsDisplay];
231
+ int new_index = tabbar.selectedIndex;
232
+ RhoTabBarData *td = [self tabData:new_index];
233
+ if (td != nil) {
234
+ if (tabindex != new_index) {
235
+ tabindex = new_index;
236
+ if (!td.loaded || td.reload) {
237
+ const char *s = [td.url UTF8String];
238
+ rho_rhodesapp_load_url(s);
239
+ td.loaded = YES;
240
+ }
241
+ [[[self subView:tabindex] view] setNeedsDisplay];
242
+ }
243
+ }
244
+ }
245
+
246
+
247
+ - (void)onSwitchTab:(int)tab_index {
248
+ int new_index = tab_index;
249
+ RhoTabBarData *td = [self tabData:new_index];
250
+ if (td != nil) {
251
+ tabindex = new_index;
252
+ if (!td.loaded || td.reload) {
253
+ const char *s = [td.url UTF8String];
254
+ rho_rhodesapp_load_url(s);
255
+ td.loaded = YES;
256
+ }
257
+ [[[self subView:tabindex] view] setNeedsDisplay];
258
+ }
221
259
  }
222
260
 
261
+
223
262
  - (int)activeTab {
224
263
  return tabindex;
225
264
  }
@@ -240,4 +279,17 @@
240
279
  [[self subView:[self activeTab]] removeNavBar];
241
280
  }
242
281
 
282
+ - (void)onViewWillActivate:(RhoViewController*)view {
283
+ int index = -1;
284
+ int i;
285
+ for (i = 0; i < [tabbar.viewControllers count]; i++) {
286
+ if ([tabbar.viewControllers objectAtIndex:i] == view) {
287
+ index = i;
288
+ }
289
+ }
290
+ if ((index >= 0) && (index != tabindex)) {
291
+ [self onSwitchTab:index];
292
+ }
293
+ }
294
+
243
295
  @end
@@ -76,6 +76,32 @@ VALUE rho_sys_has_network() {
76
76
  return rho_ruby_create_boolean(0);
77
77
  }
78
78
 
79
+ int rho_net_ping_network(const char* szHost)
80
+ {
81
+ RAWLOG_INFO("PING network.");
82
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
83
+
84
+ NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
85
+ NSString *linkString = [[NSString alloc] initWithUTF8String:szHost];
86
+
87
+ [request setURL:[NSURL URLWithString:linkString]];
88
+ [request setTimeoutInterval:10];
89
+
90
+ NSError *error = nil;
91
+ NSHTTPURLResponse *response;
92
+ NSData *returnData = NULL;
93
+ returnData = [ NSURLConnection sendSynchronousRequest: request returningResponse:&response error: &error ];
94
+
95
+ if (!returnData)
96
+ RAWLOG_ERROR2("PING network FAILED. NSError: %d. NSErrorInfo : %s", [error code], [[error localizedDescription] UTF8String]);
97
+ else
98
+ RAWLOG_INFO("PING network SUCCEEDED.");
99
+
100
+ [pool release];
101
+
102
+ return returnData == NULL ? 0 : 1;
103
+ }
104
+
79
105
  int isNetworkAvailableFlags(SCNetworkReachabilityFlags *outFlags)
80
106
  {
81
107
  struct sockaddr_in zeroAddress;
@@ -2,6 +2,17 @@
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
5
+ <key>CFBundleURLTypes</key>
6
+ <array>
7
+ <dict>
8
+ <key>CFBundleURLSchemes</key>
9
+ <array>
10
+ <string>rhodes</string>
11
+ </array>
12
+ <key>CFBundleURLName</key>
13
+ <string>com.rhomobile.rhosyncclient</string>
14
+ </dict>
15
+ </array>
5
16
  <key>CFBundleDevelopmentRegion</key>
6
17
  <string>en</string>
7
18
  <key>CFBundleDisplayName</key>
@@ -27,7 +38,7 @@
27
38
  <key>CFBundleSignature</key>
28
39
  <string>????</string>
29
40
  <key>CFBundleVersion</key>
30
- <string>2.2.4</string>
41
+ <string>2.2.5</string>
31
42
  <key>LSRequiresIPhoneOS</key>
32
43
  <true/>
33
44
  <key>UILaunchImageFile</key>
@@ -70,6 +70,8 @@
70
70
  BDD11ECE113664E700349BE3 /* rhoparams.h in Headers */ = {isa = PBXBuildFile; fileRef = BDD11ECC113664E700349BE3 /* rhoparams.h */; };
71
71
  BDFCB13D112EE2B500AE3724 /* ssl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BDFCB13B112EE2B500AE3724 /* ssl.cpp */; };
72
72
  BDFCB13E112EE2B500AE3724 /* ssl.h in Headers */ = {isa = PBXBuildFile; fileRef = BDFCB13C112EE2B500AE3724 /* ssl.h */; };
73
+ FA5F58DF12ADDA6D00C7613A /* app_build_configs.c in Sources */ = {isa = PBXBuildFile; fileRef = FA5F58DD12ADDA6D00C7613A /* app_build_configs.c */; };
74
+ FA5F58E012ADDA6D00C7613A /* app_build_configs.h in Headers */ = {isa = PBXBuildFile; fileRef = FA5F58DE12ADDA6D00C7613A /* app_build_configs.h */; };
73
75
  /* End PBXBuildFile section */
74
76
 
75
77
  /* Begin PBXFileReference section */
@@ -137,6 +139,8 @@
137
139
  BDFCB13B112EE2B500AE3724 /* ssl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ssl.cpp; path = ../../shared/net/ssl.cpp; sourceTree = SOURCE_ROOT; };
138
140
  BDFCB13C112EE2B500AE3724 /* ssl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ssl.h; path = ../../shared/net/ssl.h; sourceTree = SOURCE_ROOT; };
139
141
  D2AAC046055464E500DB518D /* librholib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = librholib.a; sourceTree = BUILT_PRODUCTS_DIR; };
142
+ FA5F58DD12ADDA6D00C7613A /* app_build_configs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = app_build_configs.c; path = ../../shared/common/app_build_configs.c; sourceTree = SOURCE_ROOT; };
143
+ FA5F58DE12ADDA6D00C7613A /* app_build_configs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = app_build_configs.h; path = ../../shared/common/app_build_configs.h; sourceTree = SOURCE_ROOT; };
140
144
  /* End PBXFileReference section */
141
145
 
142
146
  /* Begin PBXFrameworksBuildPhase section */
@@ -202,6 +206,8 @@
202
206
  5C7162600F8B7DEE0096B6AA /* common */ = {
203
207
  isa = PBXGroup;
204
208
  children = (
209
+ FA5F58DD12ADDA6D00C7613A /* app_build_configs.c */,
210
+ FA5F58DE12ADDA6D00C7613A /* app_build_configs.h */,
205
211
  5C2CE254122AEC87005EDBC4 /* RhoAppAdapter.h */,
206
212
  5C663BE711F3712C005F60AF /* RhodesAppBase.cpp */,
207
213
  5C663BE811F3712C005F60AF /* RhodesAppBase.h */,
@@ -338,6 +344,7 @@
338
344
  5CA2DE9111B01EF000B868D5 /* ThreadQueue.h in Headers */,
339
345
  5C663BEB11F3712C005F60AF /* RhodesAppBase.h in Headers */,
340
346
  5C2CE255122AEC87005EDBC4 /* RhoAppAdapter.h in Headers */,
347
+ FA5F58E012ADDA6D00C7613A /* app_build_configs.h in Headers */,
341
348
  );
342
349
  runOnlyForDeploymentPostprocessing = 0;
343
350
  };
@@ -408,6 +415,7 @@
408
415
  5CEBCFEF11E6FB8700145F4E /* rhoparams.cpp in Sources */,
409
416
  5C663BEA11F3712C005F60AF /* RhodesAppBase.cpp in Sources */,
410
417
  5C2CE15C122ACA9E005EDBC4 /* RhoAppAdapter.cpp in Sources */,
418
+ FA5F58DF12ADDA6D00C7613A /* app_build_configs.c in Sources */,
411
419
  );
412
420
  runOnlyForDeploymentPostprocessing = 0;
413
421
  };