update base URL for QuoteGeneratorApiV2 to use localhost in debug mode
Some checks failed
Build Android App / build (push) Failing after 43s
Some checks failed
Build Android App / build (push) Failing after 43s
This commit is contained in:
@@ -19,7 +19,7 @@ import 'package:path/path.dart' as path;
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:file_saver/file_saver.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
// import 'package:http/http.dart' as http;
|
||||
|
||||
// number formatter for engagement fields
|
||||
class NumberTextInputFormatter extends TextInputFormatter {
|
||||
@@ -1131,7 +1131,7 @@ class _HomePageState extends State<HomePage> {
|
||||
print("Share succesful");
|
||||
|
||||
// Send Discord webhook notifiation
|
||||
_sendShareNotification();
|
||||
// _sendShareNotification();
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
@@ -1139,53 +1139,53 @@ class _HomePageState extends State<HomePage> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _sendShareNotification() async {
|
||||
const webhookUrl = "https://discord.com/api/webhooks/1456729319408664814/p2Ctqi7BijV0c34V-BnB62m6_yjkf72eD64oJyxXaNAcqZNfFm_-bA2uPZg1NTKpVdxp";
|
||||
|
||||
try {
|
||||
final response = await http.post(
|
||||
Uri.parse(webhookUrl),
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: jsonEncode({
|
||||
"content": "Someone just shared a quote from the app! 🎉",
|
||||
"embeds": [
|
||||
{
|
||||
"title": "Quote Shared",
|
||||
"description": formData["content"].isNotEmpty
|
||||
? "\"${formData["content"]}\""
|
||||
: "A quote was shared",
|
||||
"color": 5814783,
|
||||
"fields": [
|
||||
{
|
||||
"name": "User",
|
||||
"value": formData["display_name"].isNotEmpty
|
||||
? "${formData["display_name"]} (@${formData["handle"]})"
|
||||
: "Anonymous",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Timestamp",
|
||||
"value": DateTime.now().toIso8601String(),
|
||||
"inline": true
|
||||
}
|
||||
],
|
||||
"footer": {
|
||||
"text": "QuoteGen App"
|
||||
}
|
||||
}
|
||||
]
|
||||
}),
|
||||
);
|
||||
|
||||
if (response.statusCode == 204 || response.statusCode == 200) {
|
||||
print("Discord notificaton sent successfuly");
|
||||
} else {
|
||||
print("Failed to send Discord notification: ${response.statusCode}");
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error sendin Discord webhook: $e");
|
||||
}
|
||||
}
|
||||
// Future<void> _sendShareNotification() async {
|
||||
// const webhookUrl = "https://discord.com/api/webhooks/1456729319408664814/p2Ctqi7BijV0c34V-BnB62m6_yjkf72eD64oJyxXaNAcqZNfFm_-bA2uPZg1NTKpVdxp";
|
||||
//
|
||||
// try {
|
||||
// final response = await http.post(
|
||||
// Uri.parse(webhookUrl),
|
||||
// headers: {"Content-Type": "application/json"},
|
||||
// body: jsonEncode({
|
||||
// "content": "Someone just shared a quote from the app! 🎉",
|
||||
// "embeds": [
|
||||
// {
|
||||
// "title": "Quote Shared",
|
||||
// "description": formData["content"].isNotEmpty
|
||||
// ? "\"${formData["content"]}\""
|
||||
// : "A quote was shared",
|
||||
// "color": 5814783,
|
||||
// "fields": [
|
||||
// {
|
||||
// "name": "User",
|
||||
// "value": formData["display_name"].isNotEmpty
|
||||
// ? "${formData["display_name"]} (@${formData["handle"]})"
|
||||
// : "Anonymous",
|
||||
// "inline": true
|
||||
// },
|
||||
// {
|
||||
// "name": "Timestamp",
|
||||
// "value": DateTime.now().toIso8601String(),
|
||||
// "inline": true
|
||||
// }
|
||||
// ],
|
||||
// "footer": {
|
||||
// "text": "QuoteGen App"
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// }),
|
||||
// );
|
||||
//
|
||||
// if (response.statusCode == 204 || response.statusCode == 200) {
|
||||
// print("Discord notificaton sent successfuly");
|
||||
// } else {
|
||||
// print("Failed to send Discord notification: ${response.statusCode}");
|
||||
// }
|
||||
// } catch (e) {
|
||||
// print("Error sendin Discord webhook: $e");
|
||||
// }
|
||||
// }
|
||||
|
||||
// load form data from shared preferences
|
||||
Future<void> _loadFormData() async {
|
||||
|
||||
Reference in New Issue
Block a user