diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m index b6e6a102..0dadb66d 100644 --- a/ios/Runner/AppDelegate.m +++ b/ios/Runner/AppDelegate.m @@ -12,6 +12,8 @@ NSString* GetDirectoryOfType(NSSearchPathDirectory dir) { return paths.firstObject; } +static FlutterMethodChannel* gitChannel = 0; + @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -20,8 +22,8 @@ NSString* GetDirectoryOfType(NSSearchPathDirectory dir) { FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController; - FlutterMethodChannel* gitChannel = [FlutterMethodChannel - methodChannelWithName:@"gitjournal.io/git" binaryMessenger:controller]; + gitChannel = [FlutterMethodChannel methodChannelWithName:@"gitjournal.io/git" + binaryMessenger:controller]; [gitChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { NSString *method = [call method]; @@ -440,4 +442,17 @@ bool handleError(FlutterResult result, int err) { } } +- (BOOL)application:(UIApplication *)app + openURL:(NSURL *)url + options:(NSDictionary *)options { + NSLog(@"openUrl called with url %@", url); + for (NSString *key in [options allKeys]) { + NSLog(@". %@: %@", key, [options objectForKey:key]); + } + + NSDictionary *args = @{@"URL": [url absoluteString]}; + [gitChannel invokeMethod:@"onURL" arguments:args]; + + return true; +} @end diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 2a0f9c56..30a138d4 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,6 +2,17 @@ + CFBundleURLTypes + + + CFBundleURLName + io.gitjournal.gitjournal + CFBundleURLSchemes + + gitjournal + + + CFBundleDevelopmentRegion en CFBundleDisplayName