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