mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #2524 from collinjackson/google_signin
Allow third-party services to listen to openURL on iOS (needed for Google Sign-In)
This commit is contained in:
commit
b8151a8d9b
@ -7,6 +7,7 @@ import("//sky/engine/bindings/bindings.gni")
|
||||
declare_args() {
|
||||
enable_gcm = false
|
||||
enable_firebase = false
|
||||
enable_google_sign_in = false
|
||||
}
|
||||
|
||||
group("sky") {
|
||||
@ -48,4 +49,8 @@ group("sky") {
|
||||
if (enable_gcm) {
|
||||
deps += [ "//third_party/gcm:gcm" ]
|
||||
}
|
||||
|
||||
if (enable_google_sign_in) {
|
||||
deps += [ "//third_party/google_sign_in" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Flutter Dynamic Services Loader
|
||||
===============================
|
||||
|
||||
Third party service implementations are packaged as dylibs. Each dylib implementation needs to import just one file (`dynamic_service_dylib.h`) and implement `FlutterServicePerform` to provide the service implementation. In order to build the dylib, the build step needs the `//sky/services/dynamic:dylib` GN rule.
|
||||
Third party service implementations are packaged as dylibs. Each dylib implementation needs to import just one file (`dynamic_service_dylib.h`) and implement `FlutterServicePerform` to provide the service implementation. In order to build the dylib, the build step needs the `//sky/services/dynamic:sdk_lib` GN rule.
|
||||
|
||||
@ -58,4 +58,25 @@ NSURL* URLForSwitch(const char* name) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Use the NSNotificationCenter to notify services when we're opened with URLs.
|
||||
// TODO(jackson): Revisit this API once we have more services using URLs to make
|
||||
// it more typed and less brittle
|
||||
- (BOOL)application:(UIApplication *)app
|
||||
openURL:(NSURL *)url
|
||||
sourceApplication:(NSString *)sourceApplication
|
||||
annotation:(id)annotation
|
||||
{
|
||||
NSDictionary *dict = [@{
|
||||
@"handled": [NSMutableDictionary dictionary],
|
||||
@"url": url,
|
||||
@"sourceApplication": sourceApplication,
|
||||
} mutableCopy];
|
||||
if (annotation != nil)
|
||||
[dict setValue:annotation forKey:@"annotation"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"openURL"
|
||||
object:self
|
||||
userInfo:dict];
|
||||
BOOL handled = ((NSNumber *)dict[@"handled"][@"value"]).boolValue;
|
||||
return handled;
|
||||
}
|
||||
@end
|
||||
|
||||
@ -97,6 +97,7 @@ def to_gn_args(args):
|
||||
|
||||
gn_args['enable_firebase'] = args.enable_firebase
|
||||
gn_args['enable_gcm'] = args.enable_gcm
|
||||
gn_args['enable_google_sign_in'] = args.enable_google_sign_in
|
||||
gn_args['use_glfw'] = args.use_glfw
|
||||
|
||||
return gn_args
|
||||
@ -126,6 +127,7 @@ def parse_args(args):
|
||||
|
||||
parser.add_argument('--enable-firebase', action='store_true', default=False)
|
||||
parser.add_argument('--enable-gcm', action='store_true', default=False)
|
||||
parser.add_argument('--enable-google-sign-in', action='store_true', default=False)
|
||||
parser.add_argument('--use-glfw', action='store_true', default=False)
|
||||
|
||||
return parser.parse_args(args)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user