Commit cdf2d449 authored by Jidong Chen's avatar Jidong Chen Committed by GitHub

Merge pull request #117 from alibaba/accessibility_switch_stable

- Accessibility switch 
- xservice_kit 0.0.27
- Some code opt
- Spellings
parents 265080a6 13db5c72
...@@ -8,3 +8,4 @@ ...@@ -8,3 +8,4 @@
build/ build/
pubspec.lock pubspec.lock
.flutter-plugins .flutter-plugins
flutter
/Users/jidong/Documents/FlutterBoost /Users/jidong/Documents/opensource/flutter_boost
\ No newline at end of file \ No newline at end of file
/Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.26 /Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.27
\ No newline at end of file \ No newline at end of file
...@@ -7,21 +7,20 @@ PODS: ...@@ -7,21 +7,20 @@ PODS:
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- flutter_boost (from `/Users/jidong/Documents/FlutterBoost/ios`) - Flutter (from `.symlinks/flutter/ios`)
- xservice_kit (from `/Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.26/ios`) - flutter_boost (from `/Users/jidong/Documents/opensource/flutter_boost/ios`)
- xservice_kit (from `/Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.27/ios`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Flutter
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter:
:path: ".symlinks/flutter/ios"
flutter_boost: flutter_boost:
:path: "/Users/jidong/Documents/FlutterBoost/ios" :path: "/Users/jidong/Documents/opensource/flutter_boost/ios"
xservice_kit: xservice_kit:
:path: "/Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.26/ios" :path: "/Users/jidong/.pub-cache/hosted/pub.dartlang.org/xservice_kit-0.0.27/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: fa617360ba1995d522016bfa59d68df27ac12e02 Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
flutter_boost: 24249d12d924d858cf445a84949484bc08bca000 flutter_boost: 24249d12d924d858cf445a84949484bc08bca000
xservice_kit: a86c64372b3e41e7d8e9b1a0b9139866680f525c xservice_kit: a86c64372b3e41e7d8e9b1a0b9139866680f525c
......
...@@ -200,7 +200,6 @@ ...@@ -200,7 +200,6 @@
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1; CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = E83K84RE26;
}; };
}; };
}; };
...@@ -261,7 +260,7 @@ ...@@ -261,7 +260,7 @@
); );
inputPaths = ( inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/Flutter/Flutter.framework", "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputPaths = ( outputPaths = (
...@@ -449,7 +448,7 @@ ...@@ -449,7 +448,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = E83K84RE26; DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -474,7 +473,7 @@ ...@@ -474,7 +473,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = E83K84RE26; DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
} }
} }
- (BOOL)accessibilityEnable
{
return YES;
}
- (void)closePage:(NSString *)uid animated:(BOOL)animated params:(NSDictionary *)params completion:(void (^)(BOOL))completion - (void)closePage:(NSString *)uid animated:(BOOL)animated params:(NSDictionary *)params completion:(void (^)(BOOL))completion
......
...@@ -14,8 +14,6 @@ environment: ...@@ -14,8 +14,6 @@ environment:
dependencies: dependencies:
xservice_kit: ^0.0.18
flutter: flutter:
sdk: flutter sdk: flutter
......
...@@ -84,6 +84,10 @@ ...@@ -84,6 +84,10 @@
[[_engine lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; [[_engine lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"];
} }
- (void)setAccessibilityEnable:(BOOL)enable
{
self.viewController.accessibilityEnable = enable;
}
@end @end
#endif #endif
...@@ -24,11 +24,14 @@ ...@@ -24,11 +24,14 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "FLBFlutterViewProvider.h" #import "FLBFlutterViewProvider.h"
#import "FLBPlatform.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterEngineOld : NSObject<FLBFlutterViewProvider> @interface FLBFlutterEngineOld : NSObject<FLBFlutterViewProvider>
- (instancetype)initWithPlatform:(id<FLBPlatform>)platform;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#import "FLBFlutterEngineOld.h" #import "FLBFlutterEngineOld.h"
#import "FLBFlutterViewControllerAdaptor.h" #import "FLBFlutterViewControllerAdaptor.h"
#import <objc/runtime.h>
@interface FLBFlutterEngineOld() @interface FLBFlutterEngineOld()
@property (nonatomic,strong) FLBFlutterViewControllerAdaptor *viewController; @property (nonatomic,strong) FLBFlutterViewControllerAdaptor *viewController;
...@@ -31,13 +32,27 @@ ...@@ -31,13 +32,27 @@
@implementation FLBFlutterEngineOld @implementation FLBFlutterEngineOld
- (instancetype)init - (instancetype)initWithPlatform:(id<FLBPlatform>)platform
{ {
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks" #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
if (self = [super init]) { if (self = [super init]) {
Class class = [FLBFlutterViewControllerAdaptor class];
SEL originalSelector = @selector(onAccessibilityStatusChanged:);
SEL swizzledSelector = @selector(fixed_onAccessibilityStatusChanged:);
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
method_exchangeImplementations(originalMethod, swizzledMethod);
_viewController = [FLBFlutterViewControllerAdaptor new]; _viewController = [FLBFlutterViewControllerAdaptor new];
if([platform respondsToSelector:@selector(accessibilityEnable)]){
_viewController.accessibilityEnable = [platform accessibilityEnable];
}else{
_viewController.accessibilityEnable = YES;
}
[_viewController view]; [_viewController view];
Class clazz = NSClassFromString(@"GeneratedPluginRegistrant"); Class clazz = NSClassFromString(@"GeneratedPluginRegistrant");
if (clazz) { if (clazz) {
...@@ -85,4 +100,9 @@ ...@@ -85,4 +100,9 @@
[self.viewController sendOnChannel:channel message:data]; [self.viewController sendOnChannel:channel message:data];
} }
- (void)setAccessibilityEnable:(BOOL)enable
{
self.viewController.accessibilityEnable = enable;
}
@end @end
...@@ -31,6 +31,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -31,6 +31,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)boost_viewDidAppear:(BOOL)animated; - (void)boost_viewDidAppear:(BOOL)animated;
- (void)boost_viewWillDisappear:(BOOL)animated; - (void)boost_viewWillDisappear:(BOOL)animated;
- (void)boost_viewDidDisappear:(BOOL)animated; - (void)boost_viewDidDisappear:(BOOL)animated;
@property (nonatomic,assign) BOOL accessibilityEnable;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#import "FLBFlutterViewControllerAdaptor.h" #import "FLBFlutterViewControllerAdaptor.h"
#import <objc/runtime.h>
@interface FLBFlutterViewControllerAdaptor () @interface FLBFlutterViewControllerAdaptor ()
@end @end
...@@ -31,9 +32,7 @@ ...@@ -31,9 +32,7 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
...@@ -51,12 +50,12 @@ ...@@ -51,12 +50,12 @@
- (void)viewWillDisappear:(BOOL)animated - (void)viewWillDisappear:(BOOL)animated
{ {
[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil]; [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
//miss super call intentionally. //Avoid super call intentionally.
} }
- (void)viewDidDisappear:(BOOL)animated - (void)viewDidDisappear:(BOOL)animated
{ {
//Miss super call intentionally. //Avoid super call intentionally.
[[[UIApplication sharedApplication] keyWindow] endEditing:YES]; [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
} }
...@@ -96,4 +95,11 @@ ...@@ -96,4 +95,11 @@
//Override this to avoid unnecessary splash Screen. //Override this to avoid unnecessary splash Screen.
} }
- (void)fixed_onAccessibilityStatusChanged:(NSNotification*)notification {
if(self.accessibilityEnable){
[self fixed_onAccessibilityStatusChanged:notification];
}
}
@end @end
...@@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
@protocol FLBFlutterViewProvider <NSObject> @protocol FLBFlutterViewProvider <NSObject>
@required @required
- (void)setAccessibilityEnable:(BOOL)enable;
- (BOOL)accessibilityEnable;
- (FlutterViewController *)viewController; - (FlutterViewController *)viewController;
- (void)pause; - (void)pause;
- (void)resume; - (void)resume;
......
...@@ -25,12 +25,14 @@ ...@@ -25,12 +25,14 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "FLBFlutterViewProvider.h" #import "FLBFlutterViewProvider.h"
#import "FLBPlatform.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FLBViewProviderFactory : NSObject @interface FLBViewProviderFactory : NSObject
- (id<FLBFlutterViewProvider>)createViewProvider; - (id<FLBFlutterViewProvider>)createViewProvider;
- (id<FLBFlutterViewProvider>)createViewProviderWithPlatform:(id<FLBPlatform>)platform;
@end @end
......
...@@ -25,11 +25,20 @@ ...@@ -25,11 +25,20 @@
#import "FLBViewProviderFactory.h" #import "FLBViewProviderFactory.h"
#import "FLBFlutterEngine.h" #import "FLBFlutterEngine.h"
#import "FLBFlutterEngineOld.h" #import "FLBFlutterEngineOld.h"
#import "FLBPlatform.h"
@implementation FLBViewProviderFactory @implementation FLBViewProviderFactory
- (id<FLBFlutterViewProvider>)createViewProviderWithPlatform:(id<FLBPlatform>)platform
{
#if RELEASE_1_0
return [FLBFlutterEngine new];
#else
return [[FLBFlutterEngineOld alloc] initWithPlatform:platform];
#endif
}
- (id<FLBFlutterViewProvider>)createViewProvider - (id<FLBFlutterViewProvider>)createViewProvider
{ {
#if RELEASE_1_0 #if RELEASE_1_0
......
...@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong) id<FLBPlatform> platform; @property (nonatomic,strong) id<FLBPlatform> platform;
#pragma mark - Getters #pragma mark - Getters
- (void)setAccessibilityEnable:(BOOL)enable;
+ (FLBFlutterApplication *)sharedApplication; + (FLBFlutterApplication *)sharedApplication;
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform - (void)startFlutterWithPlatform:(id<FLBPlatform>)platform
onStart:(void (^)(FlutterViewController *))callback; onStart:(void (^)(FlutterViewController *))callback;
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
self.platform = platform; self.platform = platform;
self.viewProvider = [[FLBViewProviderFactory new] createViewProvider]; self.viewProvider = [[FLBViewProviderFactory new] createViewProviderWithPlatform:platform];
[self.viewProvider resume]; [self.viewProvider resume];
self.isRendering = YES; self.isRendering = YES;
self.isRunning = YES; self.isRunning = YES;
...@@ -110,8 +110,6 @@ ...@@ -110,8 +110,6 @@
} }
- (BOOL)isTop:(NSString *)pageId - (BOOL)isTop:(NSString *)pageId
{ {
return [_manager.peak isEqual:pageId]; return [_manager.peak isEqual:pageId];
...@@ -142,6 +140,10 @@ ...@@ -142,6 +140,10 @@
[self.viewProvider inactive]; [self.viewProvider inactive];
} }
- (void)setAccessibilityEnable:(BOOL)enable
{
[self.viewProvider setAccessibilityEnable:enable];
}
@end @end
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol FLBPlatform <NSObject> @protocol FLBPlatform <NSObject>
@optional
//Whether to enable accessibility support. Default value is Yes.
- (BOOL)accessibilityEnable;
@required @required
- (void)openPage:(NSString *)name - (void)openPage:(NSString *)name
params:(NSDictionary *)params params:(NSDictionary *)params
......
...@@ -31,6 +31,8 @@ typedef FLBFlutterViewContainer * (^FLBPageBuilder)(NSString *name,NSDictionary ...@@ -31,6 +31,8 @@ typedef FLBFlutterViewContainer * (^FLBPageBuilder)(NSString *name,NSDictionary
@interface FlutterBoostPlugin : NSObject<FlutterPlugin> @interface FlutterBoostPlugin : NSObject<FlutterPlugin>
#pragma mark - Initializer #pragma mark - Initializer
- (void)setAccessibilityEnable:(BOOL)enable;
+ (instancetype)sharedInstance; + (instancetype)sharedInstance;
- (void)startFlutterWithPlatform:(id<FLBPlatform>)platform onStart:(void (^)(FlutterViewController *))callback; - (void)startFlutterWithPlatform:(id<FLBPlatform>)platform onStart:(void (^)(FlutterViewController *))callback;
......
...@@ -101,4 +101,9 @@ ...@@ -101,4 +101,9 @@
[_resultMediator removeHandlerForKey:vcid]; [_resultMediator removeHandlerForKey:vcid];
} }
- (void)setAccessibilityEnable:(BOOL)enable
{
[[FLBFlutterApplication sharedApplication] setAccessibilityEnable:enable];
}
@end @end
...@@ -11,7 +11,7 @@ dependencies: ...@@ -11,7 +11,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
xservice_kit: ^0.0.26 xservice_kit: ^0.0.27
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment