GitHostSetup: Automatically open the correct url

This is a behaviour that got lost during the refactor.
This commit is contained in:
Vishesh Handa
2019-02-13 21:02:33 +01:00
parent 6a8f8f4044
commit 5452fc0a78
2 changed files with 9 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import 'gitlab.dart';
export 'githost.dart'; export 'githost.dart';
enum GitHostType { enum GitHostType {
Unknown,
GitHub, GitHub,
GitLab, GitLab,
Custom, Custom,

View File

@ -38,7 +38,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
PageChoice2.Unknown, PageChoice2.Unknown,
]; ];
GitHostType _gitHostType; GitHostType _gitHostType = GitHostType.Unknown;
var _gitCloneUrl = ""; var _gitCloneUrl = "";
String gitCloneErrorMessage = ""; String gitCloneErrorMessage = "";
@ -122,6 +122,8 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
onDone: (GitHostSetupType setupType) { onDone: (GitHostSetupType setupType) {
if (setupType == GitHostSetupType.Manual) { if (setupType == GitHostSetupType.Manual) {
setState(() { setState(() {
_launchCreateRepoPage();
_pageCount = pos + 2; _pageCount = pos + 2;
_pageChoice[2] = PageChoice2.Manual; _pageChoice[2] = PageChoice2.Manual;
_nextPage(); _nextPage();
@ -333,11 +335,13 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
} }
} }
void _launchCreateRepoPage(GitHostType hostType) async { void _launchCreateRepoPage() async {
assert(_gitHostType != GitHostType.Unknown);
try { try {
if (hostType == GitHostType.GitHub) { if (_gitHostType == GitHostType.GitHub) {
await launch("https://github.com/new"); await launch("https://github.com/new");
} else if (hostType == GitHostType.GitLab) { } else if (_gitHostType == GitHostType.GitLab) {
await launch("https://gitlab.com/projects/new"); await launch("https://gitlab.com/projects/new");
} }
} catch (err, stack) { } catch (err, stack) {