mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
GitHostSetup: Automatically open the correct url
This is a behaviour that got lost during the refactor.
This commit is contained in:
@ -5,6 +5,7 @@ import 'gitlab.dart';
|
|||||||
export 'githost.dart';
|
export 'githost.dart';
|
||||||
|
|
||||||
enum GitHostType {
|
enum GitHostType {
|
||||||
|
Unknown,
|
||||||
GitHub,
|
GitHub,
|
||||||
GitLab,
|
GitLab,
|
||||||
Custom,
|
Custom,
|
||||||
|
@ -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) {
|
||||||
|
Reference in New Issue
Block a user