2020-10-06 07:53:07 +02:00
|
|
|
import 'dart:convert';
|
2022-09-17 14:35:45 +02:00
|
|
|
|
2020-10-06 07:53:07 +02:00
|
|
|
import 'package:flutter/widgets.dart';
|
2021-02-03 05:04:41 +01:00
|
|
|
import 'package:flutter_gen/gen_l10n/S.dart';
|
2020-10-06 07:53:07 +02:00
|
|
|
import 'package:git_touch/models/auth.dart';
|
|
|
|
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
|
|
|
import 'package:git_touch/widgets/blob_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
class GtStatusScreen extends StatelessWidget {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return RefreshStatefulScaffold<String>(
|
2021-05-16 09:16:35 +02:00
|
|
|
title: Text(AppLocalizations.of(context)!.giteaStatus),
|
2020-10-06 14:52:40 +02:00
|
|
|
fetch: () async {
|
2020-10-06 07:53:07 +02:00
|
|
|
final auth = context.read<AuthModel>();
|
|
|
|
final res = await Future.wait([
|
|
|
|
auth.fetchGitea('/version'),
|
|
|
|
auth.fetchGitea('/settings/attachment'),
|
|
|
|
auth.fetchGitea('/settings/api'),
|
|
|
|
auth.fetchGitea('/settings/repository'),
|
|
|
|
auth.fetchGitea('/settings/ui'),
|
|
|
|
]);
|
2022-09-06 18:28:12 +02:00
|
|
|
return const JsonEncoder.withIndent(' ').convert({
|
2020-10-06 07:53:07 +02:00
|
|
|
...res[0],
|
|
|
|
'attachment': res[1],
|
|
|
|
'api': res[2],
|
|
|
|
'repository': res[3],
|
|
|
|
'ui': res[4],
|
|
|
|
});
|
|
|
|
},
|
|
|
|
bodyBuilder: (jsonStr, _) {
|
|
|
|
return BlobView('0.json', text: jsonStr);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|