Menyesuaikan

This commit is contained in:
202310715297 RAIHAN ARIQ MUZAKKI 2025-11-20 21:08:33 +07:00
parent b26ebf147a
commit 366074187a
3 changed files with 17 additions and 14 deletions

View File

@ -0,0 +1,4 @@
kotlin version: 2.0.21
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
1. Kotlin compile daemon is ready

View File

@ -68,9 +68,9 @@ fun MyApp() {
) )
listOf( listOf(
"Kebakaran", "Banjir", "Tsunami", "Gunung Meletus", "\uD83D\uDD25 Kebakaran", "\uFE0F Banjir", "\uD83C\uDF0A Tsunami", "\uD83C\uDF0B Gunung Meletus",
"Gempa Bumi", "Huru hara", "Binatang Buas", "\uD83C\uDF0F Gempa Bumi", "\uD83D\uDC7F Huru hara", "\uD83D\uDC0D Binatang Buas",
"Radiasi Nuklir", "Biohazard" "\uFE0F Radiasi Nuklir", "\uFE0F Biohazard"
).forEach { condition -> ).forEach { condition ->
Row( Row(
modifier = Modifier modifier = Modifier
@ -159,15 +159,15 @@ fun sendNotification(condition: String, report: String, onResult: (String) -> Un
// Mapping kondisi → emoji/tag // Mapping kondisi → emoji/tag
val tagMapping = mapOf( val tagMapping = mapOf(
"Kebakaran" to "fire", "\uD83D\uDD25 Kebakaran" to "fire",
"Banjir" to "ocean", "\uFE0F Banjir" to "cloud_with_lightning_and_rain",
"Tsunami" to "ocean", "\uD83C\uDF0A Tsunami" to "ocean",
"Gunung Meletus" to "volcano", "\uD83C\uDF0B Gunung Meletus" to "volcano",
"Gempa Bumi" to "earth_asia", "\uD83C\uDF0F Gempa Bumi" to "earth_asia",
"Huru hara" to "imp", "\uD83D\uDC7F Huru hara" to "imp",
"Binatang Buas" to "snake", "\uD83D\uDC0D Binatang Buas" to "snake",
"Radiasi Nuklir" to "radioactive", "\uFE0F Radiasi Nuklir" to "radioactive",
"Biohazard" to "biohazard" "\uFE0F Biohazard" to "biohazard"
) )
// Bersihkan kondisi: trim + filter // Bersihkan kondisi: trim + filter
@ -183,7 +183,7 @@ fun sendNotification(condition: String, report: String, onResult: (String) -> Un
val emojiTags = selectedList.mapNotNull { tagMapping[it] } val emojiTags = selectedList.mapNotNull { tagMapping[it] }
// Tambahkan default tag: alert + warning // Tambahkan default tag: alert + warning
val finalTags = listOf("Alert", "Warning") + emojiTags val finalTags = listOf("Alert") + emojiTags
val finalReport = "Kondisi: $cleanConditionText\nCatatan: ${report.substringAfter("Catatan:")}" val finalReport = "Kondisi: $cleanConditionText\nCatatan: ${report.substringAfter("Catatan:")}"
val requestBody = RequestBody.create( val requestBody = RequestBody.create(
@ -194,7 +194,6 @@ fun sendNotification(condition: String, report: String, onResult: (String) -> Un
.url(url) .url(url)
.addHeader("Title", "Alert") .addHeader("Title", "Alert")
.addHeader("Priority", "urgent") .addHeader("Priority", "urgent")
.addHeader("Tags", "alert warning,radioactive")
.addHeader("Tags", finalTags.joinToString(",")) .addHeader("Tags", finalTags.joinToString(","))
.post(requestBody) .post(requestBody)
.build() .build()

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB