mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +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;
|
return paths.firstObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FlutterMethodChannel* gitChannel = 0;
|
||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
@ -20,8 +22,8 @@ NSString* GetDirectoryOfType(NSSearchPathDirectory dir) {
|
|||||||
|
|
||||||
FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController;
|
FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController;
|
||||||
|
|
||||||
FlutterMethodChannel* gitChannel = [FlutterMethodChannel
|
gitChannel = [FlutterMethodChannel methodChannelWithName:@"gitjournal.io/git"
|
||||||
methodChannelWithName:@"gitjournal.io/git" binaryMessenger:controller];
|
binaryMessenger:controller];
|
||||||
|
|
||||||
[gitChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
|
[gitChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
|
||||||
NSString *method = [call method];
|
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
|
@end
|
||||||
|
@ -2,6 +2,17 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<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>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
|
Reference in New Issue
Block a user