app now sends toast notify when successfully sent to API

This commit is contained in:
Sean 2024-12-19 12:38:24 -05:00
parent 97920d571e
commit 5b7e327d2f

View file

@ -82,9 +82,11 @@ class ShareActivity : AppCompatActivity() {
override fun onResponse(call: Call, response: Response) { override fun onResponse(call: Call, response: Response) {
isRequestRunning = false isRequestRunning = false
if (response.isSuccessful) { if (response.isSuccessful) {
sendNotification("Request successful!") runOnUiThread {
Toast.makeText(this@ShareActivity, "URL sent to your Mealie API", Toast.LENGTH_SHORT).show()
}
} else { } else {
sendNotification("Request failed: ${response.message}") sendNotification("Request failed: ${response.code} ${response.message}")
} }
finish() finish()
} }
@ -108,7 +110,7 @@ class ShareActivity : AppCompatActivity() {
val notification = NotificationCompat.Builder(this, channelId) val notification = NotificationCompat.Builder(this, channelId)
.setContentTitle("Mealie URL Share") .setContentTitle("Mealie URL Share")
.setContentText(message) .setContentText(message)
.setSmallIcon(R.drawable.baseline_error_24) // Replace with your notification icon .setSmallIcon(R.mipmap.mealie_upload_round) // Replace with your notification icon
.setAutoCancel(true) .setAutoCancel(true)
.build() .build()