From 5b7e327d2ff007c29c6075aca73fb6eb96ffccd4 Mon Sep 17 00:00:00 2001 From: Sean-on-Git Date: Thu, 19 Dec 2024 12:38:24 -0500 Subject: [PATCH] app now sends toast notify when successfully sent to API --- .../java/org/seanandroid/mealieurlshare/ShareActivity.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt b/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt index 7349a06..e96a1ea 100644 --- a/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt +++ b/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt @@ -82,9 +82,11 @@ class ShareActivity : AppCompatActivity() { override fun onResponse(call: Call, response: Response) { isRequestRunning = false if (response.isSuccessful) { - sendNotification("Request successful!") + runOnUiThread { + Toast.makeText(this@ShareActivity, "URL sent to your Mealie API", Toast.LENGTH_SHORT).show() + } } else { - sendNotification("Request failed: ${response.message}") + sendNotification("Request failed: ${response.code} ${response.message}") } finish() } @@ -108,7 +110,7 @@ class ShareActivity : AppCompatActivity() { val notification = NotificationCompat.Builder(this, channelId) .setContentTitle("Mealie URL Share") .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) .build()