rhodes 5.5.0.3 → 5.5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +20 -8
  4. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +1 -2
  5. data/lib/commonAPI/coreapi/ext/system.xml +1 -1
  6. data/platform/android/build/android.rake +1 -0
  7. data/platform/iphone/Classes/AppManager/AppManager.m +44 -3
  8. data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +4 -3
  9. data/platform/iphone/Classes/NativeView/RhoNativeViewManagerOC.h +1 -1
  10. data/platform/iphone/Classes/RhoMainView.h +8 -2
  11. data/platform/iphone/Classes/RhoUIWebView.h +75 -0
  12. data/platform/iphone/Classes/RhoUIWebView.m +142 -0
  13. data/platform/iphone/Classes/RhoWKWebView.h +87 -0
  14. data/platform/iphone/Classes/RhoWKWebView.m +187 -0
  15. data/platform/iphone/Classes/RhoWebView.h +72 -0
  16. data/platform/iphone/Classes/RhoWebViewFabrique.h +35 -0
  17. data/platform/iphone/Classes/RhoWebViewFabrique.m +87 -0
  18. data/platform/iphone/Classes/Rhodes.m +17 -6
  19. data/platform/iphone/Classes/Signature.old/SignatureDelegate.m +11 -4
  20. data/platform/iphone/Classes/Signature/SignatureDelegate.m +3 -4
  21. data/platform/iphone/Classes/SimpleMainView.h +7 -5
  22. data/platform/iphone/Classes/SimpleMainView.m +174 -179
  23. data/platform/iphone/Classes/SplitView/RightViewController.h +2 -2
  24. data/platform/iphone/Classes/SplitView/RightViewController.m +9 -10
  25. data/platform/iphone/Classes/SplitView/SplittedMainView.h +2 -3
  26. data/platform/iphone/Classes/SplitView/SplittedMainView.m +10 -7
  27. data/platform/iphone/Classes/TabbedMainView.h +2 -1
  28. data/platform/iphone/Classes/TabbedMainView.m +13 -10
  29. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -5
  30. data/platform/iphone/Classes/WebView.m +1 -1
  31. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +40 -3
  32. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  33. data/platform/iphone/rbuild/iphone.rake +51 -0
  34. data/platform/shared/common/RhoNativeViewManager.h +9 -9
  35. data/platform/shared/common/RhodesApp.cpp +13 -1
  36. data/platform/shared/net/HttpServer.cpp +12 -2
  37. data/platform/shared/qt/rhodes/ExternalWebView.ui +11 -2
  38. data/platform/shared/qt/rhodes/QtMainWindow.cpp +9 -7
  39. data/platform/shared/qt/rhodes/QtMainWindow.ui +13 -4
  40. data/platform/shared/qt/rhodes/qkineticscroller.cpp +1245 -0
  41. data/platform/shared/qt/rhodes/qkineticscroller.h +165 -0
  42. data/platform/shared/qt/rhodes/qkineticscroller_p.h +168 -0
  43. data/platform/shared/qt/rhodes/qtflickgesture.cpp +696 -0
  44. data/platform/shared/qt/rhodes/qtflickgesture_p.h +107 -0
  45. data/platform/shared/qt/rhodes/qtscroller.cpp +2080 -0
  46. data/platform/shared/qt/rhodes/qtscroller.h +138 -0
  47. data/platform/shared/qt/rhodes/qtscroller_p.h +205 -0
  48. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +350 -0
  49. data/platform/shared/qt/rhodes/qtscrollerfilter_p.h +110 -0
  50. data/platform/shared/qt/rhodes/qtscrollerproperties.cpp +412 -0
  51. data/platform/shared/qt/rhodes/qtscrollerproperties.h +135 -0
  52. data/platform/shared/qt/rhodes/qtscrollerproperties_p.h +90 -0
  53. data/platform/shared/qt/rhodes/qtscrollevent.cpp +190 -0
  54. data/platform/shared/qt/rhodes/qtscrollevent.h +100 -0
  55. data/platform/shared/qt/rhodes/qtscrollevent_p.h +33 -0
  56. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +347 -0
  57. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +90 -0
  58. data/platform/shared/qt/rhodes/qwebviewselectionsuppressor.h +113 -0
  59. data/platform/shared/qt/rhodes/rhodes.pro +19 -0
  60. data/res/generators/rhogen.rb +307 -15
  61. data/res/generators/templates/application/app/Settings/err_sync.erb +12 -6
  62. data/res/generators/templates/application/app/Settings/home.erb +32 -17
  63. data/res/generators/templates/application/app/Settings/index.erb +55 -26
  64. data/res/generators/templates/application/app/Settings/javascript_index.html +111 -0
  65. data/res/generators/templates/application/app/Settings/javascript_login.html +65 -0
  66. data/res/generators/templates/application/app/Settings/login.erb +25 -19
  67. data/res/generators/templates/application/app/Settings/reset.erb +18 -9
  68. data/res/generators/templates/application/app/Settings/wait.erb +10 -7
  69. data/res/generators/templates/application/app/index.erb +32 -20
  70. data/res/generators/templates/application/app/javascript_index.html +66 -0
  71. data/res/generators/templates/application/app/javascript_index.js +250 -0
  72. data/res/generators/templates/application/app/layout.erb +12 -67
  73. data/res/generators/templates/application/javascript_build.yml +41 -0
  74. data/res/generators/templates/application/javascript_rhoconfig.txt +123 -0
  75. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css +587 -0
  76. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css.map +1 -0
  77. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css +6 -0
  78. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css.map +1 -0
  79. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css +6757 -0
  80. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css.map +1 -0
  81. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css +6 -0
  82. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css.map +1 -0
  83. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot +0 -0
  84. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg +288 -0
  85. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf +0 -0
  86. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff +0 -0
  87. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 +0 -0
  88. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.js +2377 -0
  89. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.min.js +7 -0
  90. data/res/generators/templates/application/public/bootstrap-3.3.7/js/npm.js +13 -0
  91. data/res/generators/templates/application/public/css/style.css +3 -0
  92. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.js +4 -0
  93. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.map +1 -0
  94. data/res/generators/templates/application/rhoconfig.txt +16 -0
  95. data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +4 -0
  96. data/res/generators/templates/model/edit.erb +22 -21
  97. data/res/generators/templates/model/index.erb +24 -22
  98. data/res/generators/templates/model/javascript_edit.html +65 -0
  99. data/res/generators/templates/model/javascript_index.html +56 -0
  100. data/res/generators/templates/model/javascript_index.js +83 -0
  101. data/res/generators/templates/model/javascript_model.js +16 -0
  102. data/res/generators/templates/model/javascript_new.html +64 -0
  103. data/res/generators/templates/model/javascript_show.html +66 -0
  104. data/res/generators/templates/model/new.erb +22 -19
  105. data/res/generators/templates/model/show.erb +22 -14
  106. data/res/prebuild_base_app/app/index.erb +31 -18
  107. data/res/prebuild_base_app/app/layout.erb +11 -56
  108. data/version +1 -1
  109. metadata +59 -24
  110. data/res/generators/templates/application/public/css/android.css +0 -418
  111. data/res/generators/templates/application/public/css/iphone.css +0 -378
  112. data/res/generators/templates/application/public/css/jqmobile-patch.css +0 -62
  113. data/res/generators/templates/application/public/css/re_webkit.css +0 -736
  114. data/res/generators/templates/application/public/css/re_webkit_flat.css +0 -753
  115. data/res/generators/templates/application/public/css/windows_mobile.css +0 -327
  116. data/res/generators/templates/application/public/jqmobile/images/ajax-loader.gif +0 -0
  117. data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
  118. data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
  119. data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
  120. data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
  121. data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
  122. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.css +0 -3
  123. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.js +0 -10
  124. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.map +0 -1
  125. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.4.5.min.css +0 -3
  126. data/res/generators/templates/application/public/jqmobile/jquery.mobile.theme-1.4.5.min.css +0 -3
  127. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.js +0 -5
  128. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.map +0 -1
  129. data/res/generators/templates/application/public/js/application.js +0 -1
  130. data/res/generators/templates/application/public/js/jqmobile-patch.js +0 -466
  131. data/res/generators/templates/application/public/js/syncengine.js +0 -504
@@ -659,21 +659,28 @@ static Rhodes *instance = NULL;
659
659
  }
660
660
  }
661
661
 
662
+ - (void)initAppManager {
663
+ NSLog(@"Init appManager");
664
+ appManager = [AppManager instance];
665
+ //Configure AppManager
666
+ [appManager configure];
667
+ }
668
+
662
669
  - (void)doRhoInit {
663
670
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
664
671
  @try {
665
- NSLog(@"Init appManager");
666
- appManager = [AppManager instance];
667
- //Configure AppManager
668
- [appManager configure];
672
+ //NSLog(@"Init appManager");
673
+ //appManager = [AppManager instance];
674
+ ////Configure AppManager
675
+ //[appManager configure];
669
676
 
670
677
  const char *szRootPath = rho_native_rhopath();
671
678
  const char *szUserPath = rho_native_rhouserpath();
672
679
  //NSLog(@"Init logconf");
673
680
  //rho_logconf_Init_with_separate_user_path(szRootPath, szRootPath, "", szUserPath);
674
681
  InitMemoryInfoCollector();
675
- NSLog(@"Create rhodes app");
676
- rho_rhodesapp_create_with_separate_user_path(szRootPath, szUserPath);
682
+ //NSLog(@"Create rhodes app");
683
+ //rho_rhodesapp_create_with_separate_user_path(szRootPath, szUserPath);
677
684
  app_created = YES;
678
685
 
679
686
  rotationLocked = rho_conf_getBool("disable_screen_rotation");
@@ -744,6 +751,8 @@ static void displayStatusChanged(CFNotificationCenterRef center, void *observer,
744
751
  const char *szUserPath = rho_native_rhouserpath();
745
752
  NSLog(@"Init logconf");
746
753
  rho_logconf_Init_with_separate_user_path(szRootPath, szRootPath, "", szUserPath);
754
+
755
+ [self initAppManager];
747
756
 
748
757
  NSLog(@"Create new detached thread for initialization stuff");
749
758
  [NSThread detachNewThreadSelector:@selector(doRhoInit) toTarget:self withObject:nil];
@@ -964,6 +973,8 @@ static void displayStatusChanged(CFNotificationCenterRef center, void *observer,
964
973
  NSLog(@"Rhodes starting application...");
965
974
  rotationLocked = NO;
966
975
 
976
+ [self initAppManager];
977
+
967
978
  NSLog(@"Create new detached thread for initialization stuff");
968
979
  [NSThread detachNewThreadSelector:@selector(doRhoInit) toTarget:self withObject:nil];
969
980
 
@@ -189,10 +189,17 @@ SignatureDelegate* ourSD = nil;
189
189
  signatureInlineView.backgroundColor = [UIColor colorWithWhite:1 alpha:0];
190
190
 
191
191
 
192
- UIWebView* webView = [[[Rhodes sharedInstance] mainView] getWebView:-1];
193
- if (webView != nil) {
194
- UIView* v = webView;//[[webView subviews] objectAtIndex:0];
195
- //UIView* v = [[webView subviews] objectAtIndex:0];
192
+ //UIWebView* webView = [[[Rhodes sharedInstance] mainView] getWebView:-1];
193
+ //if (webView != nil) {
194
+ // UIView* v = webView;//[[webView subviews] objectAtIndex:0];
195
+ // //UIView* v = [[webView subviews] objectAtIndex:0];
196
+ // [v addSubview:signatureInlineView];
197
+ // [v bringSubviewToFront:signatureInlineView];
198
+ // [v setNeedsDisplay];
199
+ //}
200
+
201
+ UIView* v = [[[[Rhodes sharedInstance] mainView] getRhoWebView:-1] containerView];
202
+ if (v != nil) {
196
203
  [v addSubview:signatureInlineView];
197
204
  [v bringSubviewToFront:signatureInlineView];
198
205
  [v setNeedsDisplay];
@@ -250,11 +250,10 @@ SignatureDelegate* ourSD = nil;
250
250
  signatureInlineView.opaque = NO;
251
251
  signatureInlineView.backgroundColor = [UIColor colorWithWhite:1 alpha:0];
252
252
 
253
+
254
+ UIView* v = [[[[Rhodes sharedInstance] mainView] getRhoWebView:-1] containerView];
253
255
 
254
- UIWebView* webView = [[[Rhodes sharedInstance] mainView] getWebView:-1];
255
- if (webView != nil) {
256
- UIView* v = webView;//[[webView subviews] objectAtIndex:0];
257
- //UIView* v = [[webView subviews] objectAtIndex:0];
256
+ if (v != nil) {
258
257
  [v addSubview:signatureInlineView];
259
258
  [v bringSubviewToFront:signatureInlineView];
260
259
  [v setNeedsDisplay];
@@ -25,15 +25,16 @@
25
25
  *------------------------------------------------------------------------*/
26
26
 
27
27
  #import <UIKit/UIKit.h>
28
+ #import "RhoWebView.h"
28
29
  #import "RhoMainView.h"
29
30
  #import "RhoViewController.h"
30
31
  #include "RhoNativeViewManagerOC.h"
31
32
 
32
33
 
33
34
 
34
- @interface SimpleMainView : RhoViewController <RhoMainView, UIWebViewDelegate> {
35
+ @interface SimpleMainView : RhoViewController <RhoMainView, RhoWebViewDelegate> {
35
36
 
36
- UIWebView *webView;
37
+ id<RhoWebView,NSObject> rhoWebView;
37
38
  UIToolbar *toolbar;
38
39
  UINavigationBar *navbar;
39
40
  CGRect rootFrame;
@@ -48,7 +49,7 @@
48
49
  int thisTabIndex;
49
50
  }
50
51
 
51
- @property (nonatomic,retain) UIWebView *webView;
52
+ @property (nonatomic,retain) id<RhoWebView,NSObject> rhoWebView;
52
53
  @property (nonatomic,retain) UIToolbar *toolbar;
53
54
  @property (nonatomic,retain) UINavigationBar *navbar;
54
55
  @property (nonatomic,retain) NSString *nativeViewType;
@@ -63,7 +64,7 @@
63
64
 
64
65
  - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p;
65
66
  - (id)initWithMainView:(id<RhoMainView>)v parent:(UIWindow*)p bar_info:(NSDictionary*)bar_info;
66
- - (id)initWithParentView:(UIView *)p frame:(CGRect)frame webview:(UIWebView*)webview;
67
+ - (id)initWithParentView:(UIView *)p frame:(CGRect)frame rhowebview:(id<RhoWebView,NSObject>)rhowebview;
67
68
  - (id)initWithParentView:(UIView *)p frame:(CGRect)frame;
68
69
  - (id)initWithParentView:(UIView *)p frame:(CGRect)frame web_bkg_color:(UIColor*)web_bkg_color;
69
70
 
@@ -77,7 +78,8 @@
77
78
 
78
79
  -(void)restoreWebView;
79
80
 
80
- - (UIWebView*)getWebView:(int)tab_index;
81
+ - (id<RhoWebView,NSObject>)detachRhoWebView;
82
+ - (id<RhoWebView,NSObject>)getRhoWebView:(int)tab_index;
81
83
 
82
84
  + (void) disableHiddenOnStart;
83
85
  + (void) enableHiddenOnStart;
@@ -27,6 +27,8 @@
27
27
  #import "SimpleMainView.h"
28
28
  #import "AppManager.h"
29
29
  #import "Rhodes.h"
30
+ #import "RhoWebViewFabrique.h"
31
+
30
32
 
31
33
  #include "common/RhoConf.h"
32
34
  #include "common/RhodesApp.h"
@@ -46,9 +48,7 @@
46
48
  #undef DEFAULT_LOGCATEGORY
47
49
  #define DEFAULT_LOGCATEGORY "SimpleMainView"
48
50
 
49
- #define RHO_TAG_WEBVIEW 1
50
- #define RHO_TAG_TOOLBAR 2
51
- #define RHO_TAG_NAVBAR 3
51
+
52
52
 
53
53
  int rho_sys_get_screen_width();
54
54
  int rho_sys_get_screen_height();
@@ -89,7 +89,7 @@ int rho_sys_get_screen_height();
89
89
 
90
90
  @implementation SimpleMainView
91
91
 
92
- @synthesize webView, toolbar, navbar, nativeViewType, nativeViewView, mTabBarCallback, urlBasedNativeView, url_after_set_background, isBackgroundSetted, is_url_after_set_background_redirect, thisTabIndex;
92
+ @synthesize rhoWebView, toolbar, navbar, nativeViewType, nativeViewView, mTabBarCallback, urlBasedNativeView, url_after_set_background, isBackgroundSetted, is_url_after_set_background_redirect, thisTabIndex;
93
93
 
94
94
 
95
95
  static BOOL makeHiddenUntilLoadContent = YES;
@@ -107,14 +107,14 @@ static BOOL makeHiddenUntilLoadContent = YES;
107
107
  if (nativeViewView != nil) {
108
108
  return nativeViewView.bounds;
109
109
  }
110
- return webView.bounds;
110
+ return [rhoWebView view].bounds;
111
111
  }
112
112
 
113
113
  -(CGRect)getContentRect {
114
114
  if (nativeViewView != nil) {
115
115
  return nativeViewView.frame;
116
116
  }
117
- return webView.frame;
117
+ return [rhoWebView view].frame;
118
118
  }
119
119
 
120
120
  -(void)setContentRect:(CGRect)rect {
@@ -122,7 +122,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
122
122
  nativeViewView.frame = rect;
123
123
  return;
124
124
  }
125
- webView.frame = rect;
125
+ [rhoWebView view].frame = rect;
126
126
  }
127
127
 
128
128
  - (UIBarButtonItem*)makeUIBarButtonWithCustomImage:(UIImage*)image name:(NSString*)name target:(id)target action:(SEL)action colored_icon:(BOOL)colored_icon {
@@ -295,7 +295,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
295
295
 
296
296
  NSMutableArray *btns = [NSMutableArray arrayWithCapacity:[items count]];
297
297
 
298
- for(int i = 0, lim = [items count]; i < lim; i++) {
298
+ for(int i = 0, lim = (int)[items count]; i < lim; i++) {
299
299
  NSDictionary* item = (NSDictionary*)[items objectAtIndex:i];
300
300
 
301
301
 
@@ -370,26 +370,12 @@ static BOOL makeHiddenUntilLoadContent = YES;
370
370
  [self setContentRect:wFrame];
371
371
  }
372
372
 
373
- - (UIWebView*)newWebView:(CGRect)frame {
374
- UIWebView *w = [[UIWebView alloc] initWithFrame:frame];
375
- w.scalesPageToFit = YES;
376
- if ( !rho_conf_getBool("WebView.enableBounce") )
377
- [[w scrollView] setBounces:NO];
378
- w.userInteractionEnabled = YES;
379
- w.multipleTouchEnabled = YES;
380
- w.clipsToBounds = NO;
381
- w.dataDetectorTypes = UIDataDetectorTypeNone;
382
- w.delegate = self;
383
- w.autoresizesSubviews = YES;
384
- //w.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
385
- w.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
386
- w.tag = RHO_TAG_WEBVIEW;
387
-
388
- assert([w retainCount] == 1);
373
+ - (id<RhoWebView,NSObject>)newRhoWebView:(CGRect)frame {
374
+ id<RhoWebView,NSObject> w = [RhoWebViewFabrique createRhoWebViewWithFrame:frame];
389
375
  return w;
390
376
  }
391
377
 
392
- - (id)init:(UIView*)p webView:(UIWebView*)w frame:(CGRect)frame bar_info:(NSDictionary*)bar_info web_bkg_color:(UIColor*)web_bkg_color {
378
+ - (id)init:(UIView*)p rhowebview:(id<RhoWebView,NSObject>)w frame:(CGRect)frame bar_info:(NSDictionary*)bar_info web_bkg_color:(UIColor*)web_bkg_color {
393
379
  [self init];
394
380
 
395
381
  self.mTabBarCallback = nil;
@@ -409,15 +395,19 @@ static BOOL makeHiddenUntilLoadContent = YES;
409
395
  self.view.backgroundColor = web_bkg_color;
410
396
  }
411
397
 
412
- assert(!webView || [webView retainCount] == 2);
413
- [webView removeFromSuperview];
414
- assert(!webView || [webView retainCount] == 1);
415
- self.webView = nil;
416
- webView = w;
398
+ //assert(!webView || [webView retainCount] == 2);
399
+ //[webView removeFromSuperview];
400
+ [[w view] removeFromSuperview];
401
+
402
+ //assert(!webView || [webView retainCount] == 1);
403
+ self.rhoWebView = nil;
404
+ rhoWebView = w;
417
405
  //Assertion Failed, fix for ios9 app crashed
418
406
  //assert(!webView || [webView retainCount] == 1);
419
- if (!webView)
420
- webView = [self newWebView:frame];
407
+ if (rhoWebView == nil) {
408
+ rhoWebView = [self newRhoWebView:frame];
409
+ }
410
+ [rhoWebView setupDelegate:self];
421
411
  //Assertion Failed, fix for ios9 app crashed
422
412
  //assert(webView && [webView retainCount] == 1);
423
413
 
@@ -443,17 +433,13 @@ static BOOL makeHiddenUntilLoadContent = YES;
443
433
  #endif
444
434
 
445
435
 
446
- webView.frame = wFrame;
447
-
448
-
449
-
436
+ [rhoWebView view].frame = wFrame;
450
437
 
451
-
452
- webView.autoresizesSubviews = YES;
453
- webView.autoresizingMask = /*UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin |*/ UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
438
+ [rhoWebView view].autoresizesSubviews = YES;
439
+ [rhoWebView view].autoresizingMask = /*UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin |*/ UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
454
440
 
455
441
  if (web_bkg_color != nil) {
456
- self.webView.backgroundColor = web_bkg_color;
442
+ [self.rhoWebView view].backgroundColor = web_bkg_color;
457
443
  int cr = (int)(CGColorGetComponents([web_bkg_color CGColor])[0] * 255);
458
444
  int cg = (int)(CGColorGetComponents([web_bkg_color CGColor])[1] * 255);
459
445
  int cb = (int)(CGColorGetComponents([web_bkg_color CGColor])[2] * 255);
@@ -463,7 +449,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
463
449
  //webView.hidden = YES;
464
450
  [self setWebBackgroundColor:c];
465
451
 
466
- assert([webView retainCount] == 1);
452
+ //assert([webView retainCount] == 1);
467
453
 
468
454
 
469
455
  UIView* bkg_v = [[UIView alloc] initWithFrame:wFrame];
@@ -473,7 +459,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
473
459
 
474
460
  }
475
461
  else {
476
- [root addSubview:webView];
462
+ [root addSubview:[rhoWebView view]];
477
463
  //Assertion Failed, fix for ios9 app crashed
478
464
  //assert([webView retainCount] == 2);
479
465
  }
@@ -599,11 +585,11 @@ static BOOL makeHiddenUntilLoadContent = YES;
599
585
  }
600
586
 
601
587
  - (id)initWithParentView:(UIView *)p frame:(CGRect)frame bar_info:(NSDictionary*)bar_info {
602
- return [self init:p webView:nil frame:frame bar_info:bar_info web_bkg_color:nil];
588
+ return [self init:p rhowebview:nil frame:frame bar_info:bar_info web_bkg_color:nil];
603
589
  }
604
590
 
605
591
  - (id)initWithParentView:(UIView *)p frame:(CGRect)frame bar_info:(NSDictionary*)bar_info web_bkg_color:(UIColor*)web_bkg_color {
606
- return [self init:p webView:nil frame:frame bar_info:bar_info web_bkg_color:web_bkg_color];
592
+ return [self init:p rhowebview:nil frame:frame bar_info:bar_info web_bkg_color:web_bkg_color];
607
593
  }
608
594
 
609
595
  - (id)initWithParentView:(UIView *)p frame:(CGRect)frame {
@@ -618,8 +604,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
618
604
  return [self initWithMainView:v parent:p bar_info:nil];
619
605
  }
620
606
 
621
- - (id)initWithParentView:(UIView *)p frame:(CGRect)frame webview:(UIWebView*)webview {
622
- id result = [self init:p webView:webview frame:frame bar_info:nil web_bkg_color:nil];
607
+ - (id)initWithParentView:(UIView *)p frame:(CGRect)frame rhowebview:(id<RhoWebView,NSObject>)rhowebview {
608
+ id result = [self init:p rhowebview:rhowebview frame:frame bar_info:nil web_bkg_color:nil];
623
609
  return result;
624
610
  }
625
611
 
@@ -628,8 +614,11 @@ static BOOL makeHiddenUntilLoadContent = YES;
628
614
  CGRect frame = [[v view] frame];
629
615
  frame.origin.x = 0;
630
616
  //UIWebView *w = (UIWebView*)[Rhodes subviewWithTag:RHO_TAG_WEBVIEW ofView:[v view]];
631
- UIWebView *w = [v detachWebView];
632
- id result = [self init:p webView:w frame:frame bar_info:bar_info web_bkg_color:nil];
617
+ //UIWebView *w = [v detachWebView];
618
+
619
+ id<RhoWebView,NSObject> w = [v detachRhoWebView];
620
+
621
+ id result = [self init:p rhowebview:w frame:frame bar_info:bar_info web_bkg_color:nil];
633
622
  return result;
634
623
  }
635
624
 
@@ -648,12 +637,12 @@ static BOOL makeHiddenUntilLoadContent = YES;
648
637
  if (nativeView) {
649
638
  [root addSubview:[nativeView getView]];
650
639
  }
651
- else if (webView) {
652
- [root addSubview:webView];
653
- webView.delegate = self;
640
+ else if (rhoWebView != nil) {
641
+ [root addSubview:[rhoWebView view]];
642
+ [rhoWebView setupDelegate:self];
654
643
  }
655
644
  assert(!nativeView || [nativeView retainCount] == 2);
656
- assert(!webView || [webView retainCount] == 2);
645
+ //assert(!webView || [webView retainCount] == 2);
657
646
  if (toolbar)
658
647
  [root addSubview:toolbar];
659
648
  assert(!toolbar || [toolbar retainCount] == 2);
@@ -665,16 +654,16 @@ static BOOL makeHiddenUntilLoadContent = YES;
665
654
  - (void)viewDidUnload {
666
655
  [super viewDidUnload];
667
656
  //assert(!nativeView || [nativeView retainCount] == 1);
668
- assert(!webView || [webView retainCount] == 1);
657
+ //assert(!webView || [webView retainCount] == 1);
669
658
  assert(!toolbar || [toolbar retainCount] == 1);
670
659
  assert(!navbar || [navbar retainCount] == 1);
671
660
  }
672
661
 
673
662
  - (void)dealloc {
674
- webView.delegate = nil;
663
+ [rhoWebView setupDelegate:nil];
675
664
  nativeView = nil;
676
665
  nativeViewView = nil;
677
- self.webView = nil;
666
+ self.rhoWebView = nil;
678
667
  self.toolbar = nil;
679
668
  self.navbar = nil;
680
669
  [super dealloc];
@@ -707,13 +696,12 @@ static BOOL makeHiddenUntilLoadContent = YES;
707
696
  [self reload:0];
708
697
  }
709
698
 
710
-
711
- - (UIWebView*)detachWebView {
699
+ - (id<RhoWebView,NSObject>)detachRhoWebView {
712
700
  [self restoreWebView];
713
- UIWebView *w = [webView retain];
714
- [w removeFromSuperview];
715
- webView.delegate = nil;
716
- self.webView = nil;
701
+ id<RhoWebView,NSObject> w = [rhoWebView retain];
702
+ [[w view] removeFromSuperview];
703
+ [rhoWebView setupDelegate:nil];
704
+ self.rhoWebView = nil;
717
705
 
718
706
  //Assertion Failed, fix for ios9 app crashed
719
707
  //assert(w && [w retainCount] == 1);
@@ -727,16 +715,16 @@ static BOOL makeHiddenUntilLoadContent = YES;
727
715
  int cB = (bkg_color & 0xFF);
728
716
  UIColor* bc = [UIColor colorWithRed:( ((float)(cR)) / 255.0) green:(((float)(cG)) / 255.0) blue:(((float)(cB)) / 255.0) alpha:1.0];
729
717
 
730
- self.webView.backgroundColor = bc;
718
+ [self.rhoWebView view].backgroundColor = bc;
731
719
  //self.view.backgroundColor = bc;
732
720
 
733
721
  //NSString* datas = [NSString stringWithFormat:@"<body bgcolor=\"#%6X\"></body>", bkg_color];
734
- NSString* datas = [NSString stringWithFormat:@"<body><script type=\"text/javascript\">document.body.style.backgroundColor = \"#%6X\";</script></body>", bkg_color];
722
+ //NSString* datas = [NSString stringWithFormat:@"<body><script type=\"text/javascript\">document.body.style.backgroundColor = \"#%6X\";</script></body>", bkg_color];
735
723
 
736
724
 
737
725
  //[self loadHTMLString:datas];
738
726
  NSString* jscode = [NSString stringWithFormat:@"document.body.style.backgroundColor = \"#%6X\";", bkg_color];
739
- [self.webView stringByEvaluatingJavaScriptFromString:jscode];
727
+ [self.rhoWebView stringByEvaluatingJavaScriptFromString:jscode];
740
728
 
741
729
  //self.webView.hidden = YES;
742
730
  }
@@ -744,8 +732,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
744
732
 
745
733
  - (void)loadHTMLString:(NSString *)data {
746
734
  [self restoreWebView];
747
- [webView stopLoading];
748
- [webView loadHTMLString:data baseURL:[NSURL URLWithString:@""]];
735
+ [rhoWebView stopLoading];
736
+ [rhoWebView loadHTMLString:data baseURL:[NSURL URLWithString:@""]];
749
737
  }
750
738
 
751
739
  - (void)back:(int)index {
@@ -757,7 +745,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
757
745
  //}
758
746
  //else {
759
747
  [[SignatureDelegate getSharedInstance] hideSignatureInlineView];
760
- [webView goBack];
748
+ [rhoWebView goBack];
761
749
  //}
762
750
  }
763
751
 
@@ -765,7 +753,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
765
753
  if ((nativeViewView != nil) && (self.urlBasedNativeView == YES)) {
766
754
  [self restoreWebView];
767
755
  }
768
- [webView goForward];
756
+ [rhoWebView goForward];
769
757
  }
770
758
 
771
759
  - (NSString*)encodeUrl:(NSString*)url {
@@ -792,9 +780,12 @@ static BOOL makeHiddenUntilLoadContent = YES;
792
780
  [nativeViewView removeFromSuperview];
793
781
  nativeViewView = nil;
794
782
 
795
- webView.frame = rect;
796
- [root addSubview:webView];
783
+ [rhoWebView view].frame = rect;
784
+ [root addSubview:[rhoWebView view]];
785
+
786
+ //[[rhoWebView view] setNeedsDisplay];
797
787
  }
788
+ [rhoWebView setupDelegate:self];
798
789
  if (nativeView != nil) {
799
790
  [RhoNativeViewManagerOC destroyNativeView:nativeView];
800
791
  nativeView = nil;
@@ -805,8 +796,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
805
796
  -(void)openNativeView:(UIView*)nv_view tab_index:(int)tab_index {
806
797
  nativeViewView = nv_view;
807
798
  if (nativeViewView != nil) {
808
- CGRect rect = [webView frame];
809
- [webView removeFromSuperview];
799
+ CGRect rect = [[rhoWebView view] frame];
800
+ [[rhoWebView view] removeFromSuperview];
810
801
  nativeViewView.frame = rect;
811
802
  nativeViewView.autoresizesSubviews = YES;
812
803
  nativeViewView.clipsToBounds = NO;
@@ -856,8 +847,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
856
847
  // replace webView with NativeView
857
848
  nativeViewView = [nativeView getView];
858
849
  if (nativeViewView != nil) {
859
- CGRect rect = [webView frame];
860
- [webView removeFromSuperview];
850
+ CGRect rect = [[rhoWebView view] frame];
851
+ [[rhoWebView view] removeFromSuperview];
861
852
  nativeViewView.frame = rect;
862
853
  //w.userInteractionEnabled = YES;
863
854
  //w.multipleTouchEnabled = YES;
@@ -890,8 +881,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
890
881
  }
891
882
 
892
883
  - (void)loadRequestToWebView:(NSURLRequest*)request {
893
- [webView stopLoading];
894
- [webView loadRequest:request];
884
+ [rhoWebView stopLoading];
885
+ [rhoWebView loadRequest:request];
895
886
  //[request release];
896
887
  }
897
888
 
@@ -971,8 +962,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
971
962
  [nativeViewView setNeedsDisplay];
972
963
  }
973
964
  else {
974
- [webView stopLoading];
975
- [webView reload];
965
+ [rhoWebView stopLoading];
966
+ [rhoWebView reload];
976
967
  }
977
968
  }
978
969
 
@@ -984,17 +975,17 @@ static BOOL makeHiddenUntilLoadContent = YES;
984
975
  [self.view.superview bringSubviewToFront:self.view];
985
976
  }
986
977
  RAWLOG_INFO1("Executing JS: %s", [js UTF8String]);
987
- [webView stringByEvaluatingJavaScriptFromString:js];
978
+ [rhoWebView stringByEvaluatingJavaScriptFromString:js];
988
979
  }
989
980
 
990
981
  - (NSString*)currentLocation:(int)index {
991
- return [[webView.request mainDocumentURL] absoluteString];
982
+ return [rhoWebView currentLocation];
992
983
  }
993
984
 
994
985
  #define CUR_URL_DICT_KEY @"CUR_URL_DICT_KEY"
995
986
 
996
987
  -(void) get_current_url_command:(NSMutableDictionary*)dict {
997
- NSString* res = [webView stringByEvaluatingJavaScriptFromString:@"window.location.href"];
988
+ NSString* res = [rhoWebView stringByEvaluatingJavaScriptFromString:@"window.location.href"];
998
989
  //NSString* res = [[webView.request mainDocumentURL] absoluteString];
999
990
  [dict setValue:res forKey:CUR_URL_DICT_KEY];
1000
991
  }
@@ -1015,8 +1006,8 @@ static BOOL makeHiddenUntilLoadContent = YES;
1015
1006
  return 0;
1016
1007
  }
1017
1008
 
1018
- - (UIWebView*)getWebView:(int)tab_index {
1019
- return webView;
1009
+ - (id<RhoWebView,NSObject>)getRhoWebView:(int)tab_index {
1010
+ return rhoWebView;
1020
1011
  }
1021
1012
 
1022
1013
 
@@ -1044,7 +1035,7 @@ static BOOL makeHiddenUntilLoadContent = YES;
1044
1035
  #ifdef __IPHONE_7_0
1045
1036
  nFrame.origin.y = wFrame.origin.y;
1046
1037
  #endif
1047
- nFrame.size.width = webView.bounds.size.width;
1038
+ nFrame.size.width = [rhoWebView view].bounds.size.width;
1048
1039
  navbar.frame = nFrame;
1049
1040
 
1050
1041
  wFrame.origin.y += nFrame.size.height;
@@ -1108,10 +1099,10 @@ static BOOL makeHiddenUntilLoadContent = YES;
1108
1099
  }
1109
1100
 
1110
1101
 
1111
- // UIWebViewDelegate imlementation
1112
1102
 
1113
- - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
1114
- navigationType:(UIWebViewNavigationType)navigationType {
1103
+
1104
+ - (BOOL)shouldStartLoadWithRequest:(id<RhoWebView,NSObject>)webView request:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
1105
+
1115
1106
  NSURL *url = [request URL];
1116
1107
  if (!url)
1117
1108
  return NO;
@@ -1132,29 +1123,29 @@ static BOOL makeHiddenUntilLoadContent = YES;
1132
1123
  #if defined(RHO_NO_RUBY_API)
1133
1124
  if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"] && ![scheme isEqualToString:@"file"])
1134
1125
  #else
1135
- if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"] && ![scheme isEqualToString:@"file"])
1126
+ if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"] && ![scheme isEqualToString:@"file"])
1136
1127
  #endif
1137
- external = YES;
1138
- else {
1139
- NSString *ps = [url query];
1140
- NSArray *parameters = [ps componentsSeparatedByString:@"&"];
1141
- for (int i = 0, lim = [parameters count]; i < lim; ++i) {
1142
- NSString *param = [parameters objectAtIndex:i];
1143
- NSArray *nv = [param componentsSeparatedByString:@"="];
1144
- int size = [nv count];
1145
- if (size == 0 || size > 2)
1146
- continue;
1147
- NSString *name = [nv objectAtIndex:0];
1148
- NSString *value = nil;
1149
- if (size == 2)
1150
- value = [nv objectAtIndex:1];
1151
-
1152
- if ([name isEqualToString:@"rho_open_target"] && [value isEqualToString:@"_blank"]) {
1153
- external = YES;
1154
- break;
1128
+ external = YES;
1129
+ else {
1130
+ NSString *ps = [url query];
1131
+ NSArray *parameters = [ps componentsSeparatedByString:@"&"];
1132
+ for (int i = 0, lim = [parameters count]; i < lim; ++i) {
1133
+ NSString *param = [parameters objectAtIndex:i];
1134
+ NSArray *nv = [param componentsSeparatedByString:@"="];
1135
+ int size = [nv count];
1136
+ if (size == 0 || size > 2)
1137
+ continue;
1138
+ NSString *name = [nv objectAtIndex:0];
1139
+ NSString *value = nil;
1140
+ if (size == 2)
1141
+ value = [nv objectAtIndex:1];
1142
+
1143
+ if ([name isEqualToString:@"rho_open_target"] && [value isEqualToString:@"_blank"]) {
1144
+ external = YES;
1145
+ break;
1146
+ }
1155
1147
  }
1156
1148
  }
1157
- }
1158
1149
 
1159
1150
  if (external) {
1160
1151
  // This is not http url so try to open external application for it
@@ -1171,110 +1162,114 @@ static BOOL makeHiddenUntilLoadContent = YES;
1171
1162
  //}
1172
1163
  [[SignatureDelegate getSharedInstance] hideSignatureInlineView];
1173
1164
  return YES;
1165
+
1174
1166
  }
1175
1167
 
1176
- - (void)webViewDidStartLoad:(UIWebView *)webview {
1168
+ - (void)webViewDidStartLoad:(id<RhoWebView,NSObject>)webView {
1177
1169
  // TODO
1178
1170
  //[self active];
1179
1171
  PROF_START("BROWSER_PAGE");
1180
1172
  }
1181
1173
 
1182
- - (void)webViewDidFinishLoad:(UIWebView *)webview {
1174
+ - (void)webViewDidFinishLoad:(id<RhoWebView,NSObject>)webView {
1183
1175
  // Disable default context menu on touch
1184
- [webview stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout = \"none\";"];
1185
-
1176
+ [rhoWebView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTouchCallout = \"none\";"];
1177
+
1186
1178
  PROF_STOP("BROWSER_PAGE");
1187
1179
 
1188
1180
  // Set empty application cache. Otherwise memory used by UIWebView increased rapidly
1189
1181
  // and finally application got out of memory
1190
1182
  NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
1191
- [NSURLCache setSharedURLCache:sharedCache];
1192
- [sharedCache release];
1193
-
1194
- if (self.view.hidden) {
1195
- [[Rhodes sharedInstance] hideSplash];
1196
- self.view.hidden = NO;
1197
- [self.view.superview bringSubviewToFront:self.view];
1183
+ [NSURLCache setSharedURLCache:sharedCache];
1184
+ [sharedCache release];
1185
+
1186
+ if (self.view.hidden) {
1187
+ [[Rhodes sharedInstance] hideSplash];
1188
+ self.view.hidden = NO;
1189
+ [self.view.superview bringSubviewToFront:self.view];
1190
+ }
1191
+ if (self.nativeViewView == nil) {
1192
+ if ([[self.rhoWebView view] superview] == nil) {
1193
+ [self.view addSubview:[self.rhoWebView view]];
1194
+ }
1195
+ if ([self.rhoWebView view].hidden) {
1196
+ [self.rhoWebView view].hidden = NO;
1197
+ [[self.rhoWebView view].superview bringSubviewToFront:[self.rhoWebView view]];
1198
+ }
1198
1199
  }
1199
- if (self.nativeViewView == nil) {
1200
- if ([self.webView superview] == nil) {
1201
- [self.view addSubview:self.webView];
1202
- }
1203
- if (self.webView.hidden) {
1204
- self.webView.hidden = NO;
1205
- [self.webView.superview bringSubviewToFront:self.webView];
1206
- }
1207
- }
1208
-
1209
- if (!self.isBackgroundSetted) {
1210
- self.isBackgroundSetted = YES;
1211
- if (self.url_after_set_background != nil) {
1212
- if (self.is_url_after_set_background_redirect) {
1213
- [self navigateRedirect:url_after_set_background tab:0];
1214
- }
1215
- else {
1216
- [self navigate:url_after_set_background tab:0];
1217
- }
1218
- }
1219
- }
1220
- self.url_after_set_background = nil;
1200
+
1201
+ if (!self.isBackgroundSetted) {
1202
+ self.isBackgroundSetted = YES;
1203
+ if (self.url_after_set_background != nil) {
1204
+ if (self.is_url_after_set_background_redirect) {
1205
+ [self navigateRedirect:url_after_set_background tab:0];
1206
+ }
1207
+ else {
1208
+ [self navigate:url_after_set_background tab:0];
1209
+ }
1210
+ }
1211
+ }
1212
+ self.url_after_set_background = nil;
1221
1213
 
1222
1214
 
1223
1215
  NSString* jscode = [NSString stringWithFormat:@"window['__rhoJsVmID']='%@'", [NSNumber numberWithInt:self.thisTabIndex]];
1224
1216
  //[self executeJs:@"alert('hello')" tab:self.thisTabIndex];
1225
1217
  [self executeJs:jscode tab:self.thisTabIndex];
1226
1218
  //[self executeJs:@"alert(window['__rhoJsVmID'])" tab:self.thisTabIndex];
1227
-
1228
1219
 
1229
1220
 
1230
- // TODO
1231
- /*
1232
- [self inactive];
1233
-
1234
- if ([webView canGoBack]) {
1235
- backBtn.enabled = YES;
1236
- } else {
1237
- backBtn.enabled = NO;
1238
- }
1239
- if ([webView canGoForward]) {
1240
- forwardBtn.enabled = YES;
1241
- } else {
1242
- forwardBtn.enabled = NO;
1243
- }
1244
-
1245
- //NSString* location = [webview stringByEvaluatingJavaScriptFromString:@"location.href"];
1246
- //rho_rhodesapp_keeplastvisitedurl( [location cStringUsingEncoding:[NSString defaultCStringEncoding]] );
1247
-
1248
- if ([actionTarget respondsToSelector:@selector(hideSplash)])
1249
- [actionTarget performSelectorOnMainThread:@selector(hideSplash) withObject:nil waitUntilDone:NO];
1250
- */
1251
- }
1252
-
1253
- - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
1254
-
1255
- PROF_STOP("BROWSER_PAGE");
1221
+
1222
+ // TODO
1223
+ // [self inactive];
1224
+ //
1225
+ // if ([webView canGoBack]) {
1226
+ // backBtn.enabled = YES;
1227
+ // } else {
1228
+ // backBtn.enabled = NO;
1229
+ // }
1230
+ // if ([webView canGoForward]) {
1231
+ // forwardBtn.enabled = YES;
1232
+ // } else {
1233
+ // forwardBtn.enabled = NO;
1234
+ // }
1235
+ //
1236
+ // //NSString* location = [webview stringByEvaluatingJavaScriptFromString:@"location.href"];
1237
+ // //rho_rhodesapp_keeplastvisitedurl( [location cStringUsingEncoding:[NSString defaultCStringEncoding]] );
1238
+ //
1239
+ // if ([actionTarget respondsToSelector:@selector(hideSplash)])
1240
+ // [actionTarget performSelectorOnMainThread:@selector(hideSplash) withObject:nil waitUntilDone:NO];
1241
+
1242
+ }
1256
1243
 
1244
+ - (void)didFailLoadWithError:(id<RhoWebView,NSObject>)webView error:(NSError *)error {
1245
+
1246
+ PROF_STOP("BROWSER_PAGE");
1247
+
1257
1248
  NSString* info = [error localizedDescription];
1258
1249
  NSString* reason = [error localizedFailureReason];
1259
1250
  RAWLOG_INFO2("WebView FAIL load with error: [%s] , reason: [%s]", [info UTF8String], [reason UTF8String]);
1260
1251
 
1261
- if (self.view.hidden) {
1262
- [[Rhodes sharedInstance] hideSplash];
1263
- self.view.hidden = NO;
1264
- [self.view.superview bringSubviewToFront:self.view];
1252
+ if (self.view.hidden) {
1253
+ [[Rhodes sharedInstance] hideSplash];
1254
+ self.view.hidden = NO;
1255
+ [self.view.superview bringSubviewToFront:self.view];
1265
1256
  }
1266
- if ([self.webView superview] == nil) {
1267
- [self.view addSubview:self.webView];
1268
- }
1269
- if (self.webView.hidden) {
1270
- self.webView.hidden = NO;
1271
- [self.webView.superview bringSubviewToFront:self.webView];
1257
+ if ([[self.rhoWebView view] superview] == nil) {
1258
+ [self.view addSubview:[self.rhoWebView view]];
1272
1259
  }
1273
- self.isBackgroundSetted = YES;
1274
- self.url_after_set_background = nil;
1260
+ if ([self.rhoWebView view].hidden) {
1261
+ [self.rhoWebView view].hidden = NO;
1262
+ [[self.rhoWebView view].superview bringSubviewToFront:[self.rhoWebView view]];
1263
+ }
1264
+ self.isBackgroundSetted = YES;
1265
+ self.url_after_set_background = nil;
1275
1266
 
1276
1267
  }
1277
1268
 
1269
+
1270
+
1271
+
1272
+
1278
1273
  - (void)viewWillAppear:(BOOL)animated {
1279
1274
  if (self.mTabBarCallback != nil) {
1280
1275
  TabbedMainView* tv = (TabbedMainView*)self.mTabBarCallback;