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.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +20 -8
- data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +1 -2
- data/lib/commonAPI/coreapi/ext/system.xml +1 -1
- data/platform/android/build/android.rake +1 -0
- data/platform/iphone/Classes/AppManager/AppManager.m +44 -3
- data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +4 -3
- data/platform/iphone/Classes/NativeView/RhoNativeViewManagerOC.h +1 -1
- data/platform/iphone/Classes/RhoMainView.h +8 -2
- data/platform/iphone/Classes/RhoUIWebView.h +75 -0
- data/platform/iphone/Classes/RhoUIWebView.m +142 -0
- data/platform/iphone/Classes/RhoWKWebView.h +87 -0
- data/platform/iphone/Classes/RhoWKWebView.m +187 -0
- data/platform/iphone/Classes/RhoWebView.h +72 -0
- data/platform/iphone/Classes/RhoWebViewFabrique.h +35 -0
- data/platform/iphone/Classes/RhoWebViewFabrique.m +87 -0
- data/platform/iphone/Classes/Rhodes.m +17 -6
- data/platform/iphone/Classes/Signature.old/SignatureDelegate.m +11 -4
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +3 -4
- data/platform/iphone/Classes/SimpleMainView.h +7 -5
- data/platform/iphone/Classes/SimpleMainView.m +174 -179
- data/platform/iphone/Classes/SplitView/RightViewController.h +2 -2
- data/platform/iphone/Classes/SplitView/RightViewController.m +9 -10
- data/platform/iphone/Classes/SplitView/SplittedMainView.h +2 -3
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +10 -7
- data/platform/iphone/Classes/TabbedMainView.h +2 -1
- data/platform/iphone/Classes/TabbedMainView.m +13 -10
- data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -5
- data/platform/iphone/Classes/WebView.m +1 -1
- data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +40 -3
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/rbuild/iphone.rake +51 -0
- data/platform/shared/common/RhoNativeViewManager.h +9 -9
- data/platform/shared/common/RhodesApp.cpp +13 -1
- data/platform/shared/net/HttpServer.cpp +12 -2
- data/platform/shared/qt/rhodes/ExternalWebView.ui +11 -2
- data/platform/shared/qt/rhodes/QtMainWindow.cpp +9 -7
- data/platform/shared/qt/rhodes/QtMainWindow.ui +13 -4
- data/platform/shared/qt/rhodes/qkineticscroller.cpp +1245 -0
- data/platform/shared/qt/rhodes/qkineticscroller.h +165 -0
- data/platform/shared/qt/rhodes/qkineticscroller_p.h +168 -0
- data/platform/shared/qt/rhodes/qtflickgesture.cpp +696 -0
- data/platform/shared/qt/rhodes/qtflickgesture_p.h +107 -0
- data/platform/shared/qt/rhodes/qtscroller.cpp +2080 -0
- data/platform/shared/qt/rhodes/qtscroller.h +138 -0
- data/platform/shared/qt/rhodes/qtscroller_p.h +205 -0
- data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +350 -0
- data/platform/shared/qt/rhodes/qtscrollerfilter_p.h +110 -0
- data/platform/shared/qt/rhodes/qtscrollerproperties.cpp +412 -0
- data/platform/shared/qt/rhodes/qtscrollerproperties.h +135 -0
- data/platform/shared/qt/rhodes/qtscrollerproperties_p.h +90 -0
- data/platform/shared/qt/rhodes/qtscrollevent.cpp +190 -0
- data/platform/shared/qt/rhodes/qtscrollevent.h +100 -0
- data/platform/shared/qt/rhodes/qtscrollevent_p.h +33 -0
- data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +347 -0
- data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +90 -0
- data/platform/shared/qt/rhodes/qwebviewselectionsuppressor.h +113 -0
- data/platform/shared/qt/rhodes/rhodes.pro +19 -0
- data/res/generators/rhogen.rb +307 -15
- data/res/generators/templates/application/app/Settings/err_sync.erb +12 -6
- data/res/generators/templates/application/app/Settings/home.erb +32 -17
- data/res/generators/templates/application/app/Settings/index.erb +55 -26
- data/res/generators/templates/application/app/Settings/javascript_index.html +111 -0
- data/res/generators/templates/application/app/Settings/javascript_login.html +65 -0
- data/res/generators/templates/application/app/Settings/login.erb +25 -19
- data/res/generators/templates/application/app/Settings/reset.erb +18 -9
- data/res/generators/templates/application/app/Settings/wait.erb +10 -7
- data/res/generators/templates/application/app/index.erb +32 -20
- data/res/generators/templates/application/app/javascript_index.html +66 -0
- data/res/generators/templates/application/app/javascript_index.js +250 -0
- data/res/generators/templates/application/app/layout.erb +12 -67
- data/res/generators/templates/application/javascript_build.yml +41 -0
- data/res/generators/templates/application/javascript_rhoconfig.txt +123 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css +587 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css +6 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css +6757 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css +6 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css.map +1 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg +288 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.js +2377 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.min.js +7 -0
- data/res/generators/templates/application/public/bootstrap-3.3.7/js/npm.js +13 -0
- data/res/generators/templates/application/public/css/style.css +3 -0
- data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.js +4 -0
- data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.map +1 -0
- data/res/generators/templates/application/rhoconfig.txt +16 -0
- data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +4 -0
- data/res/generators/templates/model/edit.erb +22 -21
- data/res/generators/templates/model/index.erb +24 -22
- data/res/generators/templates/model/javascript_edit.html +65 -0
- data/res/generators/templates/model/javascript_index.html +56 -0
- data/res/generators/templates/model/javascript_index.js +83 -0
- data/res/generators/templates/model/javascript_model.js +16 -0
- data/res/generators/templates/model/javascript_new.html +64 -0
- data/res/generators/templates/model/javascript_show.html +66 -0
- data/res/generators/templates/model/new.erb +22 -19
- data/res/generators/templates/model/show.erb +22 -14
- data/res/prebuild_base_app/app/index.erb +31 -18
- data/res/prebuild_base_app/app/layout.erb +11 -56
- data/version +1 -1
- metadata +59 -24
- data/res/generators/templates/application/public/css/android.css +0 -418
- data/res/generators/templates/application/public/css/iphone.css +0 -378
- data/res/generators/templates/application/public/css/jqmobile-patch.css +0 -62
- data/res/generators/templates/application/public/css/re_webkit.css +0 -736
- data/res/generators/templates/application/public/css/re_webkit_flat.css +0 -753
- data/res/generators/templates/application/public/css/windows_mobile.css +0 -327
- data/res/generators/templates/application/public/jqmobile/images/ajax-loader.gif +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.css +0 -3
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.js +0 -10
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.map +0 -1
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.4.5.min.css +0 -3
- data/res/generators/templates/application/public/jqmobile/jquery.mobile.theme-1.4.5.min.css +0 -3
- data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.js +0 -5
- data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.map +0 -1
- data/res/generators/templates/application/public/js/application.js +0 -1
- data/res/generators/templates/application/public/js/jqmobile-patch.js +0 -466
- data/res/generators/templates/application/public/js/syncengine.js +0 -504
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b6a8fe4921a90ac277e6260888c303d0be2894d
|
4
|
+
data.tar.gz: f40242f22db04f9cad0845e3c6c3bd937ca8be79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16e08d6a447f5df244cf071ff824b7b5178cc8ee33002236e4e83b7840e54bc74520ecb958c548c9cbd88a82e39a09e5fada56fa6a21c439ab56b1cd92132429
|
7
|
+
data.tar.gz: 5eaa670bce2d1496314a456f4c651973694002bf4c291e6fb7e4ebd73d3a397fcb5e6249c68c65a8fb6d0189d57a3af197495c20304ce7d4656263543baf5308
|
data/README.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# Current state of Rhomobile solution
|
2
|
+
|
3
|
+
Currently Rhomobile solution supported and improved by TAU Technologies (partner of Zebra Technologies).
|
4
|
+
For questions on commercial support contact [contact mail](mailto:info@tau-technologies.com) or reach out to the [TAU Technologies website](http://www.tau-technologies.com).
|
5
|
+
|
6
|
+
Current actual version is Rhomobile Suite 5.5. [Download RMS 5.5](http://rhomobile.tau-technologies.com/index.html)
|
7
|
+
|
8
|
+
Actual documentation located on [RMS 5.5 documentation](http://docs.tau-technologies.com/en/5.5/home)
|
9
|
+
|
10
|
+
|
1
11
|
# RhoMobile Open Source Documentation
|
2
12
|
|
3
13
|
This page contains links to documentation and source-code repositories for the RhoMobile Suite, which has been released by Zebra Technologies to the open source community.
|
data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java
CHANGED
@@ -37,6 +37,7 @@ import com.rho.notification.INotificationSingleton;
|
|
37
37
|
import com.rhomobile.rhodes.Logger;
|
38
38
|
import com.rhomobile.rhodes.R;
|
39
39
|
import com.rhomobile.rhodes.RhodesActivity;
|
40
|
+
import com.rhomobile.rhodes.RhodesService;
|
40
41
|
import com.rhomobile.rhodes.RhodesApplication;
|
41
42
|
import com.rhomobile.rhodes.api.IMethodResult;
|
42
43
|
import com.rhomobile.rhodes.api.MethodResult;
|
@@ -212,15 +213,26 @@ public class NotificationSingleton implements INotificationSingleton
|
|
212
213
|
|
213
214
|
if (duration != 0)
|
214
215
|
{
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
216
|
+
Context context = null;
|
217
|
+
try {
|
218
|
+
context = RhodesService.getContext();
|
219
|
+
}
|
220
|
+
catch (IllegalStateException e) {
|
221
|
+
context = null;
|
222
|
+
Logger.D(TAG, "Rhodes main Service (com.rhomobile.rhodes.RhodesService) is not run !!!");
|
223
|
+
}
|
224
|
+
if (context != null) {
|
225
|
+
if(vibrator != null) vibrator.cancel();
|
226
|
+
vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
227
|
+
|
228
|
+
if ( duration > 15000 ) {
|
229
|
+
duration = 15000;
|
230
|
+
}
|
231
|
+
vibrator.vibrate(duration > 0 ? duration : 1000);
|
232
|
+
}
|
233
|
+
else {
|
234
|
+
Logger.D(TAG, "Can not vibrate, because can not get Rhodes main Context !!!");
|
221
235
|
}
|
222
|
-
|
223
|
-
vibrator.vibrate(duration > 0 ? duration : 1000);
|
224
236
|
}
|
225
237
|
}
|
226
238
|
|
@@ -138,8 +138,7 @@ namespace rho {
|
|
138
138
|
|
139
139
|
void SystemImplIphone::getPhoneId(rho::apiGenerator::CMethodResult& result)
|
140
140
|
{
|
141
|
-
|
142
|
-
result.set("");
|
141
|
+
getIphoneProperty("phone_id", result);
|
143
142
|
}
|
144
143
|
|
145
144
|
void SystemImplIphone::getDeviceName(rho::apiGenerator::CMethodResult& result)
|
@@ -98,7 +98,7 @@ Be sure to review the [Ruby API Usage](/guide/api_ruby) guide for important info
|
|
98
98
|
</PROPERTY>
|
99
99
|
<PROPERTY name="phoneId" type="STRING" readOnly="true">
|
100
100
|
<DESC>Hardware based ID. It depends on capabilities configured for an application and has to remain same even across application uninstall/install.</DESC>
|
101
|
-
<PLATFORM>WM, CE, Android</PLATFORM>
|
101
|
+
<PLATFORM>WM, CE, iOS, Android</PLATFORM>
|
102
102
|
</PROPERTY>
|
103
103
|
<PROPERTY name="deviceName" type="STRING" readOnly="true">
|
104
104
|
<DESC>Name of device application running on. Examples: '9000' (BB), 'iPhone', 'dream' (Android). In Consumer Android device, name of the Industrial Design along with manufacturer name shall be shown. </DESC>
|
@@ -48,6 +48,8 @@
|
|
48
48
|
#import "common/app_build_configs.h"
|
49
49
|
|
50
50
|
#include <sys/xattr.h>
|
51
|
+
#include <sys/types.h>
|
52
|
+
#include <sys/sysctl.h>
|
51
53
|
|
52
54
|
#undef DEFAULT_LOGCATEGORY
|
53
55
|
#define DEFAULT_LOGCATEGORY "RhodesApp"
|
@@ -419,8 +421,9 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
419
421
|
}
|
420
422
|
}
|
421
423
|
}
|
422
|
-
|
424
|
+
NSLog(@"Create rhodes logging and rhoconfig.txt loading");
|
423
425
|
rho_logconf_Init_with_separate_user_path(rho_native_rhopath(), rho_native_rhopath(), "", rho_native_rhouserpath());
|
426
|
+
NSLog(@"Create rhodes app");
|
424
427
|
rho_rhodesapp_create_with_separate_user_path(rho_native_rhopath(), rho_native_rhouserpath());
|
425
428
|
RAWLOG_INFO("Rhodes started");
|
426
429
|
}
|
@@ -765,6 +768,8 @@ static const double RHO_IPHONE4_PPI = 326.0;
|
|
765
768
|
// http://www.apple.com/ipad/specs/
|
766
769
|
static const double RHO_IPAD_PPI = 132.0;
|
767
770
|
static const double RHO_NEW_IPAD_PPI = 264.0;
|
771
|
+
static const double RHO_IPAD_MINI_PPI = 163.0;
|
772
|
+
static const double RHO_IPAD_MINI_RETINA_PPI = 326.0;
|
768
773
|
|
769
774
|
static float get_scale() {
|
770
775
|
float scales = 1;//[[UIScreen mainScreen] scale];
|
@@ -787,6 +792,24 @@ int rho_sysimpl_get_property_iphone(char* szPropName, NSObject** resValue)
|
|
787
792
|
{
|
788
793
|
if (strcasecmp("platform", szPropName) == 0)
|
789
794
|
{*resValue = [NSString stringWithUTF8String:"APPLE"]; return 1;}
|
795
|
+
else if (strcasecmp("phone_id", szPropName) == 0){
|
796
|
+
NSString* uniqueIdentifier = nil;
|
797
|
+
if( [UIDevice instancesRespondToSelector:@selector(identifierForVendor)] ) {
|
798
|
+
// iOS 6+
|
799
|
+
uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
800
|
+
} else {
|
801
|
+
// before iOS 6, so just generate an identifier and store it
|
802
|
+
uniqueIdentifier = [[NSUserDefaults standardUserDefaults] objectForKey:@"identiferForVendor"];
|
803
|
+
if( !uniqueIdentifier ) {
|
804
|
+
CFUUIDRef uuid = CFUUIDCreate(NULL);
|
805
|
+
uniqueIdentifier = (NSString*)CFUUIDCreateString(NULL, uuid);
|
806
|
+
CFRelease(uuid);
|
807
|
+
[[NSUserDefaults standardUserDefaults] setObject:uniqueIdentifier forKey:@"identifierForVendor"];
|
808
|
+
}
|
809
|
+
}
|
810
|
+
*resValue = uniqueIdentifier;
|
811
|
+
return 1;
|
812
|
+
}
|
790
813
|
else if (strcasecmp("locale", szPropName) == 0)
|
791
814
|
{*resValue = rho_sys_get_locale_iphone(); return 1; }
|
792
815
|
else if (strcasecmp("country", szPropName) == 0) {
|
@@ -835,8 +858,26 @@ int rho_sysimpl_get_property_iphone(char* szPropName, NSObject** resValue)
|
|
835
858
|
strcasecmp("ppi_y", szPropName) == 0) {
|
836
859
|
#ifdef __IPHONE_3_2
|
837
860
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
838
|
-
|
839
|
-
|
861
|
+
|
862
|
+
//Fix DPI issue on Ipad Mini
|
863
|
+
//get the device model name
|
864
|
+
size_t size;
|
865
|
+
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
|
866
|
+
char *machine = malloc(size);
|
867
|
+
sysctlbyname("hw.machine", machine, &size, NULL, 0);
|
868
|
+
NSString *platform = [NSString stringWithUTF8String:machine];
|
869
|
+
free(machine);
|
870
|
+
|
871
|
+
// IPad Mini
|
872
|
+
if([platform isEqualToString:@"iPad2,5"] || [platform isEqualToString:@"iPad2,6"] || [platform isEqualToString:@"iPad2,7"]){
|
873
|
+
*resValue = [NSNumber numberWithDouble:RHO_IPAD_MINI_PPI];
|
874
|
+
}
|
875
|
+
// IPad Mini Retina
|
876
|
+
else if ([platform isEqualToString:@"iPad4,4"] || [platform isEqualToString:@"iPad4,5"] || [platform isEqualToString:@"iPad4,6"] || [platform isEqualToString:@"iPad4,7"] || [platform isEqualToString:@"iPad4,8"] || [platform isEqualToString:@"iPad4,9"] || [platform isEqualToString:@"iPad5,1"] || [platform isEqualToString:@"iPad5,2"]) {
|
877
|
+
*resValue = [NSNumber numberWithDouble:RHO_IPAD_MINI_RETINA_PPI];
|
878
|
+
}
|
879
|
+
else if (get_scale() > 1.2) {
|
880
|
+
*resValue = [NSNumber numberWithDouble:RHO_NEW_IPAD_PPI];
|
840
881
|
}
|
841
882
|
else {
|
842
883
|
*resValue = [NSNumber numberWithDouble:RHO_IPAD_PPI];
|
@@ -269,8 +269,9 @@ static RhoNativeViewManagerOC *instance = NULL;
|
|
269
269
|
[sharedInstance.mProviders removeObjectForKey:viewType];
|
270
270
|
}
|
271
271
|
|
272
|
-
|
273
|
-
|
272
|
+
// UIView* for iPhone - ATTENTION !!! Now method return CONTAINER VIEW for WebView. For UIWebView is [UIWebView scrollView]. For WkWebView is [WKWebView scrollView] !!!
|
273
|
+
+(UIView*)getWebViewObject:(int)tab_index {
|
274
|
+
return [[[[Rhodes sharedInstance] mainView] getRhoWebView:tab_index] containerView];
|
274
275
|
}
|
275
276
|
|
276
277
|
|
@@ -428,7 +429,7 @@ void RhoNativeViewManager::unregisterViewType(const char* viewType) {
|
|
428
429
|
}
|
429
430
|
|
430
431
|
// that function return native object used for display Web content :
|
431
|
-
//
|
432
|
+
// // UIView* for iPhone - ATTENTION !!! Now method return CONTAINER VIEW for WebView. For UIWebView is [UIWebView scrollView]. For WkWebView is [WKWebView scrollView] !!!
|
432
433
|
// jobject for Android - jobect is android.webkit.WebView class type
|
433
434
|
// HWND for Windows Mobile
|
434
435
|
void* RhoNativeViewManager::getWebViewObject(int tab_index) {
|
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
+(void)registerViewType:(NSString*)viewType factory:(id)factory;
|
68
68
|
+(void)unregisterViewType:(NSString*)viewType;
|
69
|
-
+(
|
69
|
+
+(UIView*)getWebViewObject:(int)tab_index;
|
70
70
|
|
71
71
|
+(int)create_native_view:(NSString*)viewType tab_index:(int)tab_index params:(VALUE)params;
|
72
72
|
+(void)navigate_native_view:(int)nv_id message:(NSString*)message;
|
@@ -25,12 +25,18 @@
|
|
25
25
|
*------------------------------------------------------------------------*/
|
26
26
|
|
27
27
|
#import <UIKit/UIKit.h>
|
28
|
+
#import "RhoWebView.h"
|
29
|
+
|
30
|
+
|
31
|
+
#define RHO_TAG_WEBVIEW 1
|
32
|
+
#define RHO_TAG_TOOLBAR 2
|
33
|
+
#define RHO_TAG_NAVBAR 3
|
28
34
|
|
29
35
|
@protocol RhoMainView
|
30
36
|
|
31
37
|
- (UIView*)view;
|
32
38
|
|
33
|
-
- (
|
39
|
+
- (id<RhoWebView,NSObject>)detachRhoWebView;
|
34
40
|
|
35
41
|
- (void)loadHTMLString:(NSString*)data;
|
36
42
|
|
@@ -51,7 +57,7 @@
|
|
51
57
|
- (void)addNavBar:(NSString*)title left:(NSArray*)left right:(NSArray*)right;
|
52
58
|
- (void)removeNavBar;
|
53
59
|
|
54
|
-
- (
|
60
|
+
- (id<RhoWebView,NSObject>)getRhoWebView:(int)tab_index;
|
55
61
|
|
56
62
|
-(void)openNativeView:(UIView*)nv_view tab_index:(int)tab_index;
|
57
63
|
-(void)closeNativeView:(int)tab_index;
|
@@ -0,0 +1,75 @@
|
|
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 RhoUIWebView : NSObject<RhoWebView, UIWebViewDelegate> {
|
31
|
+
UIWebView *webview;
|
32
|
+
id<RhoWebViewDelegate,NSObject> delegate;
|
33
|
+
}
|
34
|
+
|
35
|
+
@property (nonatomic,retain) UIWebView *webview;
|
36
|
+
@property (nonatomic,retain) id<RhoWebViewDelegate,NSObject> delegate;
|
37
|
+
|
38
|
+
- (id)initWithFrame:(CGRect)frame;
|
39
|
+
|
40
|
+
- (void) setupDelegate:(id<RhoWebViewDelegate,NSObject>)delegate;
|
41
|
+
|
42
|
+
- (UIView*)view;
|
43
|
+
|
44
|
+
- (UIView*)containerView;
|
45
|
+
|
46
|
+
- (NSString*)currentLocation;
|
47
|
+
|
48
|
+
// UIWebView
|
49
|
+
|
50
|
+
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
|
51
|
+
|
52
|
+
- (void)loadRequest:(NSURLRequest *)request;
|
53
|
+
|
54
|
+
- (void)loadHTMLString:(NSString *)string baseURL:(nullable NSURL *)baseURL;
|
55
|
+
|
56
|
+
- (void)stopLoading;
|
57
|
+
|
58
|
+
- (void)reload;
|
59
|
+
|
60
|
+
- (void)goBack;
|
61
|
+
|
62
|
+
- (void)goForward;
|
63
|
+
|
64
|
+
|
65
|
+
// UIWebViewDelegate
|
66
|
+
|
67
|
+
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
|
68
|
+
|
69
|
+
- (void)webViewDidStartLoad:(UIWebView *)webView;
|
70
|
+
|
71
|
+
- (void)webViewDidFinishLoad:(UIWebView *)webView;
|
72
|
+
|
73
|
+
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;
|
74
|
+
|
75
|
+
@end
|
@@ -0,0 +1,142 @@
|
|
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 "RhoUIWebView.h"
|
28
|
+
#import "RhoMainView.h"
|
29
|
+
|
30
|
+
#include "logging/RhoLog.h"
|
31
|
+
#include "common/RhoConf.h"
|
32
|
+
|
33
|
+
|
34
|
+
#undef DEFAULT_LOGCATEGORY
|
35
|
+
#define DEFAULT_LOGCATEGORY "RhoUIWebView"
|
36
|
+
|
37
|
+
|
38
|
+
@implementation RhoUIWebView
|
39
|
+
|
40
|
+
@synthesize webview, delegate;
|
41
|
+
|
42
|
+
|
43
|
+
- (id)initWithFrame:(CGRect)frame {
|
44
|
+
[self init];
|
45
|
+
UIWebView* w = [[UIWebView 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.delegate = 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.request mainDocumentURL] 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
|
+
return [webview stringByEvaluatingJavaScriptFromString:script];
|
89
|
+
}
|
90
|
+
|
91
|
+
- (void)loadRequest:(NSURLRequest *)request {
|
92
|
+
[webview loadRequest:request];
|
93
|
+
}
|
94
|
+
|
95
|
+
- (void)loadHTMLString:(NSString *)string baseURL:(nullable NSURL *)baseURL {
|
96
|
+
[webview loadHTMLString:string baseURL:baseURL];
|
97
|
+
}
|
98
|
+
|
99
|
+
- (void)stopLoading {
|
100
|
+
[webview stopLoading];
|
101
|
+
}
|
102
|
+
|
103
|
+
- (void)reload {
|
104
|
+
[webview reload];
|
105
|
+
}
|
106
|
+
|
107
|
+
- (void)goBack {
|
108
|
+
[webview goBack];
|
109
|
+
}
|
110
|
+
|
111
|
+
- (void)goForward {
|
112
|
+
[webview goForward];
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
// UIWebViewDelegate
|
122
|
+
|
123
|
+
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
|
124
|
+
if (delegate != nil) {
|
125
|
+
return [delegate shouldStartLoadWithRequest:self request:request navigationType:navigationType];
|
126
|
+
}
|
127
|
+
return YES;
|
128
|
+
}
|
129
|
+
|
130
|
+
- (void)webViewDidStartLoad:(UIWebView *)webView {
|
131
|
+
[delegate webViewDidStartLoad:self];
|
132
|
+
}
|
133
|
+
|
134
|
+
- (void)webViewDidFinishLoad:(UIWebView *)webView {
|
135
|
+
[delegate webViewDidFinishLoad:self];
|
136
|
+
}
|
137
|
+
|
138
|
+
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
|
139
|
+
[delegate didFailLoadWithError:self error:error];
|
140
|
+
}
|
141
|
+
|
142
|
+
@end
|