From 5865aa445f3e92cb763e644833d968b7ef965580 Mon Sep 17 00:00:00 2001 From: "Florian RICHER (MrDev023)" Date: Sun, 17 Apr 2022 22:32:27 +0200 Subject: [PATCH] Update --- README.md | 2 ++ lib/utils/mailer.dart | 2 +- lib/utils/requests.dart | 4 ++-- lib/widgets/components/stream_element_card.dart | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9efc85b..18cda66 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A new Flutter project. +https://streamlabs.readme.io/docs/alerts + ## Getting Started This project is a starting point for a Flutter application. diff --git a/lib/utils/mailer.dart b/lib/utils/mailer.dart index 73c1f08..09bd007 100644 --- a/lib/utils/mailer.dart +++ b/lib/utils/mailer.dart @@ -100,7 +100,7 @@ class Mailer { MailLoadEvent mailLoadEvent, StreamController streamController) async { final message = customMessages[Random.secure().nextInt(customMessages.length)]; - await Requests.sendAlert(message); + await Requests.sendAlert(message, type: AlertType.host); streamController.add(StreamElement(StreamElementType.alert, message)); } } diff --git a/lib/utils/requests.dart b/lib/utils/requests.dart index 98a0960..35dfff4 100644 --- a/lib/utils/requests.dart +++ b/lib/utils/requests.dart @@ -47,7 +47,7 @@ class Requests { await dio.post('https://streamlabs.com/api/v1.0/token', data: data); if (response.statusCode == HttpStatus.ok) { - jsonDecode(response.data).forEach((key, value) => + response.data.forEach((key, value) => prefs.setString('credentials.$key', value.toString())); Logger.log(LoggerType.info, Requests, 'Authorization success : ${response.data}'); @@ -98,7 +98,7 @@ class Requests { if (response.statusCode == HttpStatus.ok) { Logger.log(LoggerType.info, Requests, - 'Authorization success : ${response.data}'); + 'Authorization success : ${objectMap} ${response.data}'); } else { Logger.log(LoggerType.error, Requests, 'Authorization error : ${response.data} with $data and ${response.requestOptions.headers}'); diff --git a/lib/widgets/components/stream_element_card.dart b/lib/widgets/components/stream_element_card.dart index 5270dd2..249ff30 100644 --- a/lib/widgets/components/stream_element_card.dart +++ b/lib/widgets/components/stream_element_card.dart @@ -48,7 +48,8 @@ class StreamElementCard extends StatelessWidget { IconButton( icon: const Icon(Icons.send), onPressed: () async { - await Requests.sendAlert(streamElement.message); + await Requests.sendAlert(streamElement.message, + type: AlertType.host); }, ), ],