rhodes 5.5.0.3 → 5.5.0.7

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,87 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2016 TAU Technologies, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://tau-technologies.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+
28
+ #import <UIKit/UIKit.h>
29
+ #import <WebKit/WebKit.h>
30
+ #import "RhoWebView.h"
31
+
32
+ @interface RhoWKWebView : NSObject<RhoWebView, WKNavigationDelegate> {
33
+ WKWebView *webview;
34
+ id<RhoWebViewDelegate,NSObject> delegate;
35
+ }
36
+
37
+ @property (nonatomic,retain) WKWebView *webview;
38
+ @property (nonatomic,retain) id<RhoWebViewDelegate,NSObject> delegate;
39
+
40
+ - (id)initWithFrame:(CGRect)frame;
41
+
42
+ - (void) setupDelegate:(id<RhoWebViewDelegate,NSObject>)delegate;
43
+
44
+ - (UIView*)view;
45
+
46
+ - (UIView*)containerView;
47
+
48
+ - (NSString*)currentLocation;
49
+
50
+ // UIWebView
51
+
52
+ - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
53
+
54
+ - (void)loadRequest:(NSURLRequest *)request;
55
+
56
+ - (void)loadHTMLString:(NSString *)string baseURL:(nullable NSURL *)baseURL;
57
+
58
+ - (void)stopLoading;
59
+
60
+ - (void)reload;
61
+
62
+ - (void)goBack;
63
+
64
+ - (void)goForward;
65
+
66
+
67
+
68
+ // WKNavigationDelegate
69
+ // UIWebViewDelegate -> WKNavigationDelegate migrate
70
+ // didFailLoadWithError => didFailNavigation
71
+ // webViewDidFinishLoad => didFinishNavigation
72
+ // webViewDidStartLoad => didStartProvisionalNavigation
73
+ // shouldStartLoadWithRequest => decidePolicyForNavigationAction
74
+
75
+ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;
76
+ //- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler;
77
+ - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation;
78
+ //- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(null_unspecified WKNavigation *)navigation;
79
+ //- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error;
80
+ //- (void)webView:(WKWebView *)webView didCommitNavigation:(null_unspecified WKNavigation *)navigation;
81
+ - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation;
82
+ - (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error;
83
+ //- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler;
84
+
85
+
86
+ @end
87
+
@@ -0,0 +1,187 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2016 TAU Technologies, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://tau-technologies.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+
28
+
29
+ #import "RhoWKWebView.h"
30
+ #import "RhoMainView.h"
31
+ #include "logging/RhoLog.h"
32
+ #include "common/RhoConf.h"
33
+
34
+
35
+ #undef DEFAULT_LOGCATEGORY
36
+ #define DEFAULT_LOGCATEGORY "RhoWKWebView"
37
+
38
+
39
+ @implementation RhoWKWebView
40
+
41
+ @synthesize webview, delegate;
42
+
43
+ - (id)initWithFrame:(CGRect)frame {
44
+ [self init];
45
+ WKWebView* w = [[WKWebView alloc] initWithFrame:frame];
46
+ //w.scalesPageToFit = YES;
47
+ if ( !rho_conf_getBool("WebView.enableBounce") )
48
+ [[w scrollView] setBounces:NO];
49
+ w.userInteractionEnabled = YES;
50
+ w.multipleTouchEnabled = YES;
51
+ w.clipsToBounds = NO;
52
+ //w.dataDetectorTypes = UIDataDetectorTypeNone;
53
+ w.navigationDelegate = self;
54
+ w.autoresizesSubviews = YES;
55
+ //w.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
56
+ w.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
57
+ w.tag = RHO_TAG_WEBVIEW;
58
+ //assert([w retainCount] == 1);
59
+ self.webview = w;
60
+
61
+
62
+
63
+ return self;
64
+ }
65
+
66
+ - (UIView*)view {
67
+ return self.webview;
68
+ }
69
+
70
+ - (NSString*)currentLocation {
71
+ return [webview.URL absoluteString];
72
+ }
73
+
74
+ - (void) setupDelegate:(id<RhoWebViewDelegate,NSObject>)delegate {
75
+ self.delegate = delegate;
76
+ }
77
+
78
+ - (UIView*)containerView {
79
+ return self.webview.scrollView;
80
+ }
81
+
82
+
83
+
84
+
85
+ //UIWebView
86
+
87
+ - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script {
88
+ __block NSString *resultString = nil;
89
+ __block BOOL finished = NO;
90
+
91
+ [webview evaluateJavaScript:script completionHandler:^(id result, NSError *error) {
92
+ if (error == nil) {
93
+ if (result != nil) {
94
+ resultString = [NSString stringWithFormat:@"%@", result];
95
+ }
96
+ } else {
97
+ NSLog(@"WKWebView.evaluateJavaScript error : %@", error.localizedDescription);
98
+ }
99
+ finished = YES;
100
+ }];
101
+
102
+ while (!finished)
103
+ {
104
+ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
105
+ }
106
+
107
+ return resultString;
108
+ }
109
+
110
+ - (void)loadRequest:(NSURLRequest *)request {
111
+ [webview loadRequest:request];
112
+ }
113
+
114
+ - (void)loadHTMLString:(NSString *)string baseURL:(nullable NSURL *)baseURL {
115
+ [webview loadHTMLString:string baseURL:baseURL];
116
+ }
117
+
118
+ - (void)stopLoading {
119
+ [webview stopLoading];
120
+ }
121
+
122
+ - (void)reload {
123
+ [webview reload];
124
+ }
125
+
126
+ - (void)goBack {
127
+ [webview goBack];
128
+ }
129
+
130
+ - (void)goForward {
131
+ [webview goForward];
132
+ }
133
+
134
+
135
+
136
+
137
+ // WKNavigationDelegate
138
+ // UIWebViewDelegate -> WKNavigationDelegate migrate
139
+ // didFailLoadWithError => didFailNavigation
140
+ // webViewDidFinishLoad => didFinishNavigation
141
+ // webViewDidStartLoad => didStartProvisionalNavigation
142
+ // shouldStartLoadWithRequest => decidePolicyForNavigationAction
143
+
144
+ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
145
+
146
+ UIWebViewNavigationType navType = UIWebViewNavigationTypeOther;
147
+ if (navigationAction.navigationType == WKNavigationTypeLinkActivated) {
148
+ navType = UIWebViewNavigationTypeLinkClicked;
149
+ }
150
+ if (navigationAction.navigationType == WKNavigationTypeFormSubmitted) {
151
+ navType = UIWebViewNavigationTypeFormSubmitted;
152
+ }
153
+ if (navigationAction.navigationType == WKNavigationTypeBackForward) {
154
+ navType = UIWebViewNavigationTypeBackForward;
155
+ }
156
+ if (navigationAction.navigationType == WKNavigationTypeReload) {
157
+ navType = UIWebViewNavigationTypeReload;
158
+ }
159
+ if (navigationAction.navigationType == WKNavigationTypeFormResubmitted) {
160
+ navType = UIWebViewNavigationTypeFormResubmitted;
161
+ }
162
+ BOOL result = YES;
163
+ if (delegate != nil) {
164
+ result = [delegate shouldStartLoadWithRequest:self request:navigationAction.request navigationType:navType];
165
+ }
166
+ if (result) {
167
+ decisionHandler(WKNavigationActionPolicyAllow);
168
+ }
169
+ else {
170
+ decisionHandler(WKNavigationActionPolicyCancel);
171
+ }
172
+ }
173
+
174
+ - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation {
175
+ [delegate webViewDidStartLoad:self];
176
+ }
177
+
178
+ - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation {
179
+ [delegate webViewDidFinishLoad:self];
180
+ }
181
+
182
+ - (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
183
+ [delegate didFailLoadWithError:self error:error];
184
+ }
185
+
186
+ @end
187
+
@@ -0,0 +1,72 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2016 TAU Technologies, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://tau-technologies.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #import <UIKit/UIKit.h>
28
+
29
+
30
+ @protocol RhoWebView;
31
+
32
+ @protocol RhoWebViewDelegate <NSObject>
33
+
34
+ @optional
35
+ - (BOOL)shouldStartLoadWithRequest:(id<RhoWebView,NSObject>)webView request:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
36
+ - (void)webViewDidStartLoad:(id<RhoWebView,NSObject>)webView;
37
+ - (void)webViewDidFinishLoad:(id<RhoWebView,NSObject>)webView;
38
+ - (void)didFailLoadWithError:(id<RhoWebView,NSObject>)webView error:(NSError *)error;
39
+
40
+ @end
41
+
42
+
43
+
44
+ @protocol RhoWebView <NSObject>
45
+
46
+
47
+ - (UIView*)view;
48
+
49
+ - (void) setupDelegate:(id<RhoWebViewDelegate,NSObject>)delegate;
50
+
51
+ - (NSString*)currentLocation;
52
+
53
+ - (UIView*)containerView;
54
+
55
+ //UIWebView
56
+
57
+ - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
58
+
59
+ - (void)loadRequest:(NSURLRequest *)request;
60
+
61
+ - (void)loadHTMLString:(NSString *)string baseURL:(nullable NSURL *)baseURL;
62
+
63
+ - (void)stopLoading;
64
+
65
+ - (void)reload;
66
+
67
+ - (void)goBack;
68
+
69
+ - (void)goForward;
70
+
71
+
72
+ @end
@@ -0,0 +1,35 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2016 TAU Technologies, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://tau-technologies.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #import <UIKit/UIKit.h>
28
+ #import "RhoWebView.h"
29
+
30
+ @interface RhoWebViewFabrique : NSObject {
31
+ }
32
+
33
+ + (id<RhoWebView,NSObject>)createRhoWebViewWithFrame:(CGRect)frame;
34
+
35
+ @end
@@ -0,0 +1,87 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2016 TAU Technologies, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://tau-technologies.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ #import "RhoWebViewFabrique.h"
28
+ #import <WebKit/WebKit.h>
29
+
30
+ #import "RhoUIWebView.h"
31
+ #import "RhoWKWebView.h"
32
+
33
+ #import "common/RhoConf.h"
34
+ #include "logging/RhoLog.h"
35
+
36
+ #undef DEFAULT_LOGCATEGORY
37
+ #define DEFAULT_LOGCATEGORY "RhoWebViewFabrique"
38
+
39
+
40
+ @implementation RhoWebViewFabrique
41
+
42
+ + (id<RhoWebView,NSObject>)createRhoWebViewWithFrame:(CGRect)frame {
43
+
44
+ BOOL shouldMakeWkWebView = NO;
45
+ BOOL isDirectRequestActivated = NO;
46
+ BOOL isWKWebViewCLassExist = NO;
47
+ if (rho_conf_is_property_exists("ios_direct_local_requests")!=0) {
48
+ if (rho_conf_getBool("ios_direct_local_requests")!=0 ) {
49
+ isDirectRequestActivated = YES;
50
+ }
51
+ }
52
+ if (rho_conf_is_property_exists("ios_use_WKWebView")!=0) {
53
+ if (rho_conf_getBool("ios_use_WKWebView")!=0 ) {
54
+ shouldMakeWkWebView = YES;
55
+ }
56
+ }
57
+ if (NSClassFromString(@"WKWebView")) {
58
+ isWKWebViewCLassExist = YES;
59
+ }
60
+
61
+ id<RhoWebView,NSObject> webView = nil;
62
+
63
+ if (shouldMakeWkWebView) {
64
+ RAWLOG_INFO("Try to create WKWebView ...");
65
+ if (isDirectRequestActivated) {
66
+ RAWLOG_ERROR("can not make WKWebView because ios_direct_local_requests is ACTIVATED !!!");
67
+ }
68
+ else {
69
+ if (isWKWebViewCLassExist) {
70
+ webView = [[RhoWKWebView alloc] initWithFrame:frame];
71
+ RAWLOG_INFO("WKWebView was created OK !");
72
+ }
73
+ else {
74
+ RAWLOG_ERROR("can not make WKWebView because iOS version < 8.0 - can not find WKWebView class !!!");
75
+ }
76
+ }
77
+ }
78
+ if (webView == nil) {
79
+ RAWLOG_INFO("Try to create UIWebView ...");
80
+ webView = [[RhoUIWebView alloc] initWithFrame:frame];
81
+ RAWLOG_INFO("UIWebView was created OK !");
82
+ }
83
+
84
+ return webView;
85
+ }
86
+
87
+ @end