mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-09 20:12:20 +08:00
Remote Settings: Display the git host
This commit is contained in:
@ -45,6 +45,7 @@ settings:
|
||||
cancel: Cancel
|
||||
title: Git Remote Settings
|
||||
subtitle: Configure where your notes are synced
|
||||
host: Git Host
|
||||
noteMetaData:
|
||||
title: Note Metadata Settings
|
||||
subtitle: Configure how the Note Metadata is saved
|
||||
|
@ -11,6 +11,7 @@
|
||||
- text: "Custom SSH keys with passwords can now be used - #227"
|
||||
- text: "Create new note when clicking on non existing Wiki Link - #240"
|
||||
- text: "Debug Screen: Add a button to easily copy all the logs"
|
||||
- text: "Git Remote Settings: Expose the git host"
|
||||
bugs:
|
||||
- text: "Fix notes not always showing up - #270"
|
||||
|
||||
|
@ -517,6 +517,11 @@ class Repository with ChangeNotifier {
|
||||
await repo.checkout(note.filePath);
|
||||
return note.load();
|
||||
}
|
||||
|
||||
Future<List<GitRemoteConfig>> remoteConfigs() async {
|
||||
var repo = await GitRepository.load(repoPath);
|
||||
return repo.config.remotes;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _copyDirectory(String source, String destination) async {
|
||||
|
@ -28,13 +28,35 @@ class GitRemoteSettingsScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _GitRemoteSettingsScreenState extends State<GitRemoteSettingsScreen> {
|
||||
String remoteHost;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var textTheme = Theme.of(context).textTheme;
|
||||
var settings = Provider.of<Settings>(context);
|
||||
var repo = Provider.of<Repository>(context);
|
||||
|
||||
if (remoteHost == null) {
|
||||
remoteHost = "";
|
||||
repo.remoteConfigs().then((list) {
|
||||
setState(() {
|
||||
if (!mounted) return;
|
||||
remoteHost = list.first.url;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var body = Column(
|
||||
children: <Widget>[
|
||||
if (remoteHost != null && remoteHost.isNotEmpty)
|
||||
Text(
|
||||
tr('settings.gitRemote.host'),
|
||||
style: textTheme.bodyText1,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
if (remoteHost != null && remoteHost.isNotEmpty)
|
||||
ListTile(title: Text(remoteHost)),
|
||||
const SizedBox(height: 16.0),
|
||||
Text(
|
||||
tr('setup.sshKeyUserProvided.public'),
|
||||
style: textTheme.bodyText1,
|
||||
|
Reference in New Issue
Block a user