mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
ios: Make oAuth callback urls work
I'm getting some exceptions in the middle, but it still seems to work.
This commit is contained in:
@ -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<UIApplicationOpenURLOptionsKey, id> *)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
|
||||
|
@ -2,6 +2,17 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>io.gitjournal.gitjournal</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>gitjournal</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
Reference in New Issue
Block a user