weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guris...@apache.org
Subject [11/14] incubator-weex git commit: * [ios] support accessibility magic Tap event
Date Wed, 04 Oct 2017 04:28:14 GMT
* [ios] support accessibility magic Tap event


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ddadd543
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ddadd543
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ddadd543

Branch: refs/heads/release-0.16
Commit: ddadd5434f9eda04592e1cd730ccfa5ca8ed2a08
Parents: cf4dcd9
Author: acton393 <zhangxing610321@gmail.com>
Authored: Mon Oct 2 15:09:01 2017 +0800
Committer: acton393 <zhangxing610321@gmail.com>
Committed: Mon Oct 2 15:09:01 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXComponent_internal.h |  2 ++
 ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m  | 15 ++++++++++++++-
 ios/sdk/WeexSDK/Sources/View/WXView.m                |  9 +++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ddadd543/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
index 5d9b687..f1163a9 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
@@ -72,6 +72,8 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL *needUpdate);
     NSString * _accessibilityHintContent; // hint for the action
     NSString * _testId;// just for auto-test
     
+    BOOL _accessibilityMagicTapEvent;
+    
     /**
      *  PseudoClass
      */

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ddadd543/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
index 6247f07..2c343f4 100644
--- a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
+++ b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
@@ -172,6 +172,7 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     WX_ADD_EVENT(touchmove, addTouchMoveEvent)
     WX_ADD_EVENT(touchend, addTouchEndEvent)
     WX_ADD_EVENT(touchcancel, addTouchCancelEvent)
+    WX_ADD_EVENT(accessibilityMagicTap, addAccessibilityMagicTapEvent)
     
     if(_isListenPseudoTouch) {
         self.touchGesture.listenPseudoTouch = YES;
@@ -200,7 +201,7 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     WX_REMOVE_EVENT(touchmove, removeTouchMoveEvent)
     WX_REMOVE_EVENT(touchend, removeTouchEndEvent)
     WX_REMOVE_EVENT(touchcancel, removeTouchCancelEvent)
-    
+    WX_REMOVE_EVENT(accessibilityMagicTap, removeAccessibilityMagicTapEvent)
     if(_isListenPseudoTouch) {
         self.touchGesture.listenPseudoTouch = NO;
     }
@@ -259,6 +260,18 @@ if ([removeEventName isEqualToString:@#eventName]) {\
     [self checkRemoveTouchGesture];
 }
 
+#pragma mark - Accessibility Event
+
+- (void)addAccessibilityMagicTapEvent
+{
+    _accessibilityMagicTapEvent = YES;
+}
+
+- (void)removeAccessibilityMagicTapEvent
+{
+    _accessibilityMagicTapEvent = NO;
+}
+
 #pragma mark - Click Event
 
 - (void)addClickEvent

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ddadd543/ios/sdk/WeexSDK/Sources/View/WXView.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/View/WXView.m b/ios/sdk/WeexSDK/Sources/View/WXView.m
index 4619ef1..397ece3 100644
--- a/ios/sdk/WeexSDK/Sources/View/WXView.m
+++ b/ios/sdk/WeexSDK/Sources/View/WXView.m
@@ -20,6 +20,7 @@
 #import "WXView.h"
 #import "WXComponent.h"
 #import "WXLayer.h"
+#import "WXComponent_internal.h"
 
 @implementation WXView
 
@@ -61,4 +62,12 @@
     return nil;
 }
 
+- (BOOL)accessibilityPerformMagicTap
+{
+    if (self.wx_component->_accessibilityMagicTapEvent) {
+        [self.wx_component fireEvent:@"accessibilityPerformMagicTap" params:nil];
+    }
+    return [super accessibilityPerformMagicTap];
+}
+
 @end


Mime
View raw message