updated URL and catch HTTP errors

This commit is contained in:
Kai 2024-10-30 15:07:29 -05:00
parent 77a558dbe5
commit bf1a6b7d0a
No known key found for this signature in database

View file

@ -558,15 +558,19 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
UIDialogs.Action("Cancel", { }, UIDialogs.ActionStyle.NONE),
UIDialogs.Action("Upload", {
GlobalScope.launch(Dispatchers.IO) {
val url = "https://logs.grayjay.app/subscriptions"
val url = "https://data.grayjay.app/donate-subscription-list"
val client = ManagedHttpClient();
val headers = hashMapOf(
"Content-Type" to "application/json"
)
val response = client.post(url, json, headers)
// if it failed retry one time
if (!response.isOk) {
client.post(url, json, headers)
try {
val response = client.post(url, json, headers)
// if it failed retry one time
if (!response.isOk) {
client.post(url, json, headers)
}
} catch (e: Exception) {
Logger.i(TAG, "Failed to submit subscription list.", e)
}
}
}, UIDialogs.ActionStyle.PRIMARY)