You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/23 08:10:32 UTC
[04/18] incubator-weex git commit: * [android] modify
border-android.png
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index a7d042e..b7a522a 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -69,8 +69,8 @@
CGPoint _lastContentOffset;
CGPoint _lastScrollEventFiredOffset;
BOOL _scrollable;
- BOOL _alwaysScrollableVertical;
- BOOL _alwaysScrollableHorizontal;
+ NSString * _alwaysScrollableVertical;
+ NSString * _alwaysScrollableHorizontal;
// vertical & horizontal
WXScrollDirection _scrollDirection;
@@ -119,10 +119,13 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
_lastScrollEventFiredOffset = CGPointMake(0, 0);
_scrollDirection = attributes[@"scrollDirection"] ? [WXConvert WXScrollDirection:attributes[@"scrollDirection"]] : WXScrollDirectionVertical;
_showScrollBar = attributes[@"showScrollbar"] ? [WXConvert BOOL:attributes[@"showScrollbar"]] : YES;
- // default value is NO;
- _alwaysScrollableVertical = attributes[@"alwaysScrollableVertical"]?[WXConvert BOOL:attributes[@"alwaysScrollableVertical"]] : NO;
- // default value is NO;
- _alwaysScrollableHorizontal = attributes[@"alwaysScrollableHorizontal"]?[WXConvert BOOL:attributes[@"alwaysScrollableHorizontal"]] : NO;
+
+ if (attributes[@"alwaysScrollableVertical"]) {
+ _alwaysScrollableVertical = [WXConvert NSString:attributes[@"alwaysScrollableVertical"]];
+ }
+ if (attributes[@"alwaysScrollableHorizontal"]) {
+ _alwaysScrollableHorizontal = [WXConvert NSString:attributes[@"alwaysScrollableHorizontal"]];
+ }
_pagingEnabled = attributes[@"pagingEnabled"] ? [WXConvert BOOL:attributes[@"pagingEnabled"]] : NO;
_loadMoreOffset = attributes[@"loadmoreoffset"] ? [WXConvert WXPixelType:attributes[@"loadmoreoffset"] scaleFactor:self.weexInstance.pixelScaleFactor] : 0;
_loadmoreretry = attributes[@"loadmoreretry"] ? [WXConvert NSUInteger:attributes[@"loadmoreretry"]] : 0;
@@ -162,8 +165,12 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
scrollView.showsHorizontalScrollIndicator = _showScrollBar;
scrollView.scrollEnabled = _scrollable;
scrollView.pagingEnabled = _pagingEnabled;
- scrollView.alwaysBounceHorizontal = _alwaysScrollableHorizontal;
- scrollView.alwaysBounceVertical = _alwaysScrollableVertical;
+ if (_alwaysScrollableHorizontal) {
+ scrollView.alwaysBounceHorizontal = [WXConvert BOOL:_alwaysScrollableHorizontal];
+ }
+ if (_alwaysScrollableVertical) {
+ scrollView.alwaysBounceVertical = [WXConvert BOOL:_alwaysScrollableVertical];
+ }
if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) {
// now use the runtime to forbid the contentInset being Adjusted.
// here we add a category for scoller component view class compatible for new API,
@@ -232,13 +239,13 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
((UIScrollView *)self.view).scrollEnabled = _scrollable;
}
if (attributes[@"alwaysScrollableHorizontal"]) {
- _alwaysScrollableHorizontal = [WXConvert BOOL:attributes[@"alwaysScrollableHorizontal"]];
- ((UIScrollView*)self.view).alwaysBounceHorizontal = _alwaysScrollableHorizontal;
+ _alwaysScrollableHorizontal = [WXConvert NSString:attributes[@"alwaysScrollableHorizontal"]];
+ ((UIScrollView*)self.view).alwaysBounceHorizontal = [WXConvert BOOL:_alwaysScrollableHorizontal];
}
if (attributes[@"alwaysScrollableVertical"]) {
- _alwaysScrollableVertical = [WXConvert BOOL:attributes[@"alwaysScrollableVertical"]];
- ((UIScrollView*)self.view).alwaysBounceVertical = _alwaysScrollableVertical;
+ _alwaysScrollableVertical = [WXConvert NSString:attributes[@"alwaysScrollableVertical"]];
+ ((UIScrollView*)self.view).alwaysBounceVertical = [WXConvert BOOL:_alwaysScrollableVertical];
}
if (attributes[@"offsetAccuracy"]) {
_offsetAccuracy = [WXConvert WXPixelType:attributes[@"offsetAccuracy"] scaleFactor:self.weexInstance.pixelScaleFactor];
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m
index f66bd11..792d4c9 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXWebComponent.m
@@ -200,6 +200,9 @@ WX_EXPORT_METHOD(@selector(goForward))
NSMutableDictionary *data = [self baseInfo];
[data setObject:[error localizedDescription] forKey:@"errorMsg"];
[data setObject:[NSString stringWithFormat:@"%ld", (long)error.code] forKey:@"errorCode"];
+ if(error.userInfo && ![error.userInfo[NSURLErrorFailingURLStringErrorKey] hasPrefix:@"http"]){
+ return;
+ }
[self fireEvent:@"error" params:data];
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
index a72e556..fb0c0b3 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
@@ -22,6 +22,8 @@
#import "WXConvert.h"
#import "WXUtility.h"
#import "WXComponent_internal.h"
+#import "UIBezierPath+Weex.h"
+#import "WXRoundedRect.h"
@implementation WXComponent (BoxShadow)
@@ -81,15 +83,20 @@
if (!boxShadow) {
return;
}
+ WXRoundedRect *borderRect = [[WXRoundedRect alloc] initWithRect:self.view.bounds topLeft:_borderTopLeftRadius topRight:_borderTopRightRadius bottomLeft:_borderBottomLeftRadius bottomRight:_borderBottomRightRadius];
+ // here is computed radii, do not use original style
+ WXRadii *radii = borderRect.radii;
+ CGFloat topLeft = radii.topLeft, topRight = radii.topRight, bottomLeft = radii.bottomLeft, bottomRight = radii.bottomRight;
+ UIBezierPath *shadowPath = [UIBezierPath wx_bezierPathWithRoundedRect:self.view.bounds topLeft:topLeft topRight:topRight bottomLeft:bottomLeft bottomRight:bottomRight];
if (boxShadow.isInset) {
if (boxShadow.innerLayer) {
boxShadow.innerLayer.frame = self.view.bounds;
if (![boxShadow.innerLayer superlayer] ){
+ self.view.layer.masksToBounds = YES;
[self.view.layer addSublayer:boxShadow.innerLayer];
}
}
} else {
- UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds];
self.view.layer.masksToBounds = NO;
self.view.layer.shadowColor = boxShadow.shadowColor.CGColor;
self.view.layer.shadowOffset = boxShadow.shadowOffset;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
index e86221d..fbd62b9 100644
--- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
+++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
@@ -37,6 +37,7 @@
#import "WXLog.h"
#import "WXUtility.h"
#import "WXExtendCallNativeManager.h"
+#import "WXExceptionUtils.h"
@implementation WXSDKEngine
@@ -230,7 +231,9 @@
WX_MONITOR_PERF_START(WXPTInitalizeSync)
if (!script || script.length <= 0) {
- WX_MONITOR_FAIL(WXMTJSFramework, WX_ERR_JSFRAMEWORK_LOAD, @"framework loading is failure!");
+ NSMutableString *errMsg = [NSMutableString stringWithFormat:@"[WX_KEY_EXCEPTION_SDK_INIT_JSFM_INIT_FAILED] script don't exist:%@",script];
+ [WXExceptionUtils commitCriticalExceptionRT:@"WX_KEY_EXCEPTION_SDK_INIT" errCode:[NSString stringWithFormat:@"%d", WX_KEY_EXCEPTION_SDK_INIT] function:@"initSDKEnvironment" exception:errMsg extParams:nil];
+ WX_MONITOR_FAIL(WXMTJSFramework, WX_ERR_JSFRAMEWORK_LOAD, errMsg);
return;
}
static dispatch_once_t onceToken;
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h b/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
index 38b1e2b..e47cb1c 100644
--- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
+++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKError.h
@@ -51,5 +51,11 @@ typedef NS_ENUM(int, WXSDKErrCode)
WX_ERR_NOT_CONNECTED_TO_INTERNET = -2205,
WX_ERR_CANCEL = -2204,
WX_ERR_DOWNLOAD_END = -2299,
+
+ WX_KEY_EXCEPTION_SDK_INIT = -9000,
+ WX_KEY_EXCEPTION_INVOKE = -9100,
+ WX_KEY_EXCEPTION_JS_DOWNLOAD =-9200,
+ WX_KEY_EXCEPTION_DOM = -9300,
+ WX_KEY_EXCEPTION_WXBRIDGE=-9400,
};
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.h b/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.h
new file mode 100644
index 0000000..c0bcf4b
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.h
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#import <Foundation/Foundation.h>
+#import "WXJSExceptionInfo.h"
+
+@interface WXExceptionUtils : NSObject
+
++ (void)commitCriticalExceptionRT:(NSString *)instanceId errCode:(NSString *)errCode function:(NSString *)function exception:(NSString *)exception extParams:(NSDictionary *)extParams;
+
++ (void)commitCriticalExceptionRT:(WXJSExceptionInfo*)jsExceptionInfo;
+@end
+
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.m b/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.m
new file mode 100644
index 0000000..0ed7297
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Monitor/WXExceptionUtils.m
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#import "WXExceptionUtils.h"
+#import "WXJSExceptionProtocol.h"
+#import "WXHandlerFactory.h"
+#import "WXSDKEngine.h"
+#import "WXSDKError.h"
+#import "WXJSExceptionInfo.h"
+#import "WXUtility.h"
+#import "WXSDKManager.h"
+
+
+@implementation WXExceptionUtils
+
++ (void)commitCriticalExceptionRT:(NSString *)instanceId errCode:(NSString *)errCode function:(NSString *)function exception:(NSString *)exception extParams:(NSDictionary *)extParams{
+ NSString *bundleUrlCommit = @"BundleUrlDefault";
+ NSString *instanceIdCommit = @"InstanceIdDefalut";
+
+ if(![WXUtility isBlankString:instanceId]){
+ instanceIdCommit = instanceId;
+ WXSDKInstance * instance = [WXSDKManager instanceForID:instanceId];
+ if(instance){
+ bundleUrlCommit = [instance.scriptURL absoluteString]?:bundleUrlCommit;
+ }else if([instanceIdCommit hasPrefix:@"WX_KEY_EXCEPTION"]){
+ bundleUrlCommit = instanceId;
+ }
+ }
+
+ WXJSExceptionInfo * jsExceptionInfo = [[WXJSExceptionInfo alloc] initWithInstanceId:instanceIdCommit bundleUrl:bundleUrlCommit errorCode:errCode functionName:function exception:exception userInfo: [extParams mutableCopy]];
+ [WXExceptionUtils commitCriticalExceptionRT:jsExceptionInfo];
+}
+
++ (void)commitCriticalExceptionRT:(WXJSExceptionInfo *)jsExceptionInfo{
+ id<WXJSExceptionProtocol> jsExceptionHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXJSExceptionProtocol)];
+ if ([jsExceptionHandler respondsToSelector:@selector(onJSException:)]) {
+ [jsExceptionHandler onJSException:jsExceptionInfo];
+ }
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/28dd9f3b/ios/sdk/WeexSDK/Sources/WeexSDK.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/WeexSDK.h b/ios/sdk/WeexSDK/Sources/WeexSDK.h
index 3bbc3ea..562cfa8 100644
--- a/ios/sdk/WeexSDK/Sources/WeexSDK.h
+++ b/ios/sdk/WeexSDK/Sources/WeexSDK.h
@@ -53,6 +53,7 @@
#import "WXIndicatorComponent.h"
#import "WXImgLoaderProtocol.h"
#import "WXExtendCallNativeProtocol.h"
+#import "WXExceptionUtils.h"
#import "WXEventModuleProtocol.h"
#import "WXErrorView.h"
#import "WXDefine.h"