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