mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-01 12:23:44 +08:00
HostSetup: Remove the remote if setup closed without completion
This commit is contained in:
@ -382,7 +382,10 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
|||||||
child: const Icon(Icons.arrow_back, size: 32.0),
|
child: const Icon(Icons.arrow_back, size: 32.0),
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
),
|
),
|
||||||
onTap: () => Navigator.of(context).pop(),
|
onTap: () {
|
||||||
|
_removeRemote();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -399,12 +402,28 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_removeRemote();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
child: scaffold,
|
child: scaffold,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _removeRemote() async {
|
||||||
|
var repo = Provider.of<Repository>(context, listen: false);
|
||||||
|
var basePath = repo.gitBaseDirectory;
|
||||||
|
|
||||||
|
var repoPath = p.join(basePath, widget.repoFolderName);
|
||||||
|
|
||||||
|
try {
|
||||||
|
var repo = await GitRepository.load(repoPath);
|
||||||
|
await repo.removeRemote(widget.remoteName);
|
||||||
|
} on Exception catch (e, stacktrace) {
|
||||||
|
Log.e("Failed to remove remote", ex: e, stacktrace: stacktrace);
|
||||||
|
logExceptionWarning(e, stacktrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _nextPage() {
|
void _nextPage() {
|
||||||
pageController.nextPage(
|
pageController.nextPage(
|
||||||
duration: 200.milliseconds,
|
duration: 200.milliseconds,
|
||||||
|
Reference in New Issue
Block a user