Update UploadWorker.kt

This commit is contained in:
2025-10-26 14:14:35 +08:00
parent 79202b49d6
commit af54d5912a
@@ -36,10 +36,9 @@ class UploadWorker(
if (response.status.value in 200..299) {
showUploadSuccessNotification()
Result.success()
} else {
Result.failure()
}
} else Result.failure()
} catch (e: Exception) {
e.printStackTrace()
Result.failure()
}
}
@@ -48,14 +47,8 @@ class UploadWorker(
val notificationManager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channelId = "upload_success_channel"
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
channelId,
"Upload Success",
NotificationManager.IMPORTANCE_DEFAULT
)
notificationManager.createNotificationChannel(channel)
}
notificationManager.createNotificationChannel(
NotificationChannel(channelId, "Upload Success", NotificationManager.IMPORTANCE_DEFAULT))
val notification = NotificationCompat.Builder(applicationContext, channelId)
.setContentTitle("Upload Successful")