Update UploadWorker.kt
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user