Skip to content

Commit

Permalink
Setup initial Notification structure
Browse files Browse the repository at this point in the history
  • Loading branch information
gunishjain committed Nov 18, 2024
1 parent e189cc2 commit 9f7e546
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.gunishjain.grabbit.internal

import com.gunishjain.grabbit.utils.NotificationConst

data class NotificationConfig(
val enabled: Boolean = NotificationConst.DEFAULT_VALUE_NOTIFICATION_ENABLED,
val channelName: String = NotificationConst.DEFAULT_VALUE_NOTIFICATION_CHANNEL_NAME,
val channelDescription: String = NotificationConst.DEFAULT_VALUE_NOTIFICATION_CHANNEL_DESCRIPTION,
val showSpeed: Boolean = true,
val showSize: Boolean = true,
val smallIcon: Int
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.gunishjain.grabbit.internal.notifications

import android.content.Context
import android.os.Build
import com.gunishjain.grabbit.internal.NotificationConfig

class DownloadNotificationManager(
private val context: Context,
private val notificationConfig: NotificationConfig,
private val requestId: Int,
private val fileName: String
) {

init {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel()
}

}

private fun createNotificationChannel() {
TODO("Not yet implemented")
}

//Need to add code for notification builder
//NEED to Implement sending notifications based on status



}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ class DownloadWorker(
//Define Notification Manager here

override suspend fun doWork(): Result {
TODO("Not yet implemented")

val downloadId = inputData.getInt("downloadId", -1) // we will get input data from Download Manager
if (downloadId == -1) return Result.failure()



//call Notification Manager and implement Download Task Here



return Result.success()

}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.gunishjain.grabbit.utils

object NotificationConst {

const val KEY_NOTIFICATION_CHANNEL_NAME = "key_notification_channel_name"
const val DEFAULT_VALUE_NOTIFICATION_CHANNEL_NAME = "File Download"
const val NOTIFICATION_CHANNEL_ID = "download_channel"
const val DEFAULT_VALUE_NOTIFICATION_ENABLED = false
const val KEY_NOTIFICATION_ID = "key_notification_id"
const val DEFAULT_VALUE_NOTIFICATION_CHANNEL_DESCRIPTION = "Notify File Download Status"




}

0 comments on commit 9f7e546

Please sign in to comment.