aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/foundation/e/privacycentralapp/common
diff options
context:
space:
mode:
authorGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2022-12-20 16:26:11 +0000
committerGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2022-12-20 16:26:11 +0000
commit3e73c61bc85afdd4a6253d76344d5da581ba14f7 (patch)
treed9e051a0c14c293eaf666b89e31a7f5356af526d /app/src/main/java/foundation/e/privacycentralapp/common
parentc337df614d91484083f23745525956ec934b171e (diff)
downloadadvanced-privacy-3e73c61bc85afdd4a6253d76344d5da581ba14f7.tar.gz
5538 notifications for fake loc ipscrambling
Diffstat (limited to 'app/src/main/java/foundation/e/privacycentralapp/common')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/common/BootCompletedReceiver.kt41
1 files changed, 2 insertions, 39 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/BootCompletedReceiver.kt b/app/src/main/java/foundation/e/privacycentralapp/common/BootCompletedReceiver.kt
index f43c2cc..d7902ee 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/common/BootCompletedReceiver.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/common/BootCompletedReceiver.kt
@@ -17,57 +17,20 @@
package foundation.e.privacycentralapp.common
-import android.app.NotificationChannel
-import android.app.NotificationManager
-import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
-import androidx.core.app.NotificationCompat
-import foundation.e.privacycentralapp.R
+import foundation.e.privacycentralapp.Notifications
import foundation.e.privacycentralapp.data.repositories.LocalStateRepository
class BootCompletedReceiver : BroadcastReceiver() {
- companion object {
- const val FIRST_BOOT_NOTIFICATION_ID = 10
- }
-
override fun onReceive(context: Context, intent: Intent?) {
if (intent?.action == Intent.ACTION_BOOT_COMPLETED) {
val localStateRepository = LocalStateRepository(context)
if (localStateRepository.firstBoot) {
- showNotification(context)
+ Notifications.showFirstBootNotification(context)
localStateRepository.firstBoot = false
}
}
}
-
- private fun showNotification(context: Context) {
- val channelId = "first_boot_notification"
- val pendingIntent =
- PendingIntent.getActivity(
- context,
- 0,
- context.packageManager.getLaunchIntentForPackage(context.packageName),
- PendingIntent.FLAG_IMMUTABLE
- )
- val notificationBuilder: NotificationCompat.Builder =
- NotificationCompat.Builder(context, channelId)
- .setSmallIcon(R.drawable.ic_notification_logo)
- .setContentTitle(context.getString(R.string.first_notification_title))
- .setAutoCancel(true)
- .setContentIntent(pendingIntent)
- .setStyle(
- NotificationCompat.BigTextStyle()
- .bigText(context.getString(R.string.first_notification_summary))
- )
- val notificationManager =
- context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
-
- val name: CharSequence = "First Boot"
- val importance = NotificationManager.IMPORTANCE_HIGH
- val mChannel = NotificationChannel(channelId, name, importance)
- notificationManager.createNotificationChannel(mChannel)
- notificationManager.notify(FIRST_BOOT_NOTIFICATION_ID, notificationBuilder.build())
- }
}