add custom headers on setup

This commit is contained in:
zlshames
2024-11-13 08:34:22 -05:00
parent a7e74a06be
commit 6957dc149d
2 changed files with 15 additions and 3 deletions

View File

@ -101,7 +101,7 @@ Future<bool> showCustomHeadersDialog(BuildContext context) async {
),
TextButton(
child: Text("OK", style: context.theme.textTheme.bodyLarge!.copyWith(color: context.theme.colorScheme.primary)),
onPressed: () {
onPressed: () async {
final map = <String, String>{};
keyControllers.forEachIndexed((index, element) {
final keyController = element;
@ -111,7 +111,7 @@ Future<bool> showCustomHeadersDialog(BuildContext context) async {
}
});
ss.settings.customHeaders.value = map;
ss.settings.save();
await ss.settings.saveOne('customHeaders');
http.onInit();
Navigator.of(context).pop(true);
}

View File

@ -49,7 +49,7 @@ class _ServerCredentialsState extends OptimizedState<ServerCredentials> {
title: "Server Connection",
subtitle: kIsWeb || kIsDesktop
? "Enter your server URL and password to access your messages."
: "We've created a QR code on your server that you can scan with your phone for easy setup.\n\nAlternatively, you can manually input your URL and password.",
: "We've created a QR code on your server that you can scan with your phone for easy setup.\nAlternatively, you can manually input your URL and password.",
contentWrapper: (child) => AnimatedSize(
duration: const Duration(milliseconds: 200),
child: !showLoginButtons && context.isPhone ? const SizedBox.shrink() : child,
@ -187,6 +187,18 @@ class _ServerCredentialsState extends OptimizedState<ServerCredentials> {
),
),
if (token != null) const SizedBox(height: 10),
Container(
height: 40,
padding: const EdgeInsets.all(2),
child: TextButton(
onPressed: () async {
await showCustomHeadersDialog(context);
},
child: Text("Enter Custom Headers",
style: context.theme.textTheme.bodyLarge!.apply(color: context.theme.colorScheme.primary)),
),
),
const SizedBox(height: 10),
if (token != null)
Container(
decoration: BoxDecoration(