From 0ad3a9e2e6f82de149f94b10a92138f6b13530bb Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Fri, 11 Oct 2019 16:42:23 +0200 Subject: [PATCH] OAuthLaunch: Ignore Platform exceptions The OAuthFlow doesn't work properly in ios, for now lets just ignore these exceptions as short of forking the url_launcher, I see no other way of fixing this. If the Flutter team can release a fix in a week or so, then I'll just wait, otherwise I'll probably just fork the url_launcher and close the FSafariViewController on receiving an error. It wouldn't be a proper fix, but it will work around the issue. https://github.com/flutter/flutter/issues/30642 --- lib/screens/githostsetup_autoconfigure.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/screens/githostsetup_autoconfigure.dart b/lib/screens/githostsetup_autoconfigure.dart index 5e50a438..83915d3f 100644 --- a/lib/screens/githostsetup_autoconfigure.dart +++ b/lib/screens/githostsetup_autoconfigure.dart @@ -1,6 +1,8 @@ import 'package:fimber/fimber.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:function_types/function_types.dart'; + import 'package:gitjournal/analytics.dart'; import 'package:gitjournal/apis/git.dart'; import 'package:gitjournal/apis/githost_factory.dart'; @@ -37,7 +39,7 @@ class GitHostSetupAutoConfigureState extends State { super.initState(); } - void _startAutoConfigure() { + void _startAutoConfigure() async { Fimber.d("Starting autoconfigure"); setState(() { _configuringStarted = true; @@ -94,7 +96,14 @@ class GitHostSetupAutoConfigureState extends State { } widget.onDone(repo.cloneUrl); }); - gitHost.launchOAuthScreen(); + + try { + await gitHost.launchOAuthScreen(); + } on PlatformException catch (e, stack) { + print("LaunchOAuthScreen: Caught platform exception: " + e.toString()); + print(stack); + print("Ignoring it, since I don't know what else to do"); + } } on GitHostException catch (e) { _handleGitHostException(e); }