diff --git a/app/src/full/java/com/celzero/bravedns/ui/MiscSettingsActivity.kt b/app/src/full/java/com/celzero/bravedns/ui/MiscSettingsActivity.kt index bdb92f731..56ad32576 100644 --- a/app/src/full/java/com/celzero/bravedns/ui/MiscSettingsActivity.kt +++ b/app/src/full/java/com/celzero/bravedns/ui/MiscSettingsActivity.kt @@ -213,7 +213,9 @@ class MiscSettingsActivity : AppCompatActivity(R.layout.activity_misc_settings) !b.settingsActivityAutoStartSwitch.isChecked } - b.settingsActivityAutoStartSwitch.setOnCheckedChangeListener { _: CompoundButton, b: Boolean + b.settingsActivityAutoStartSwitch.setOnCheckedChangeListener { + _: CompoundButton, + b: Boolean -> persistentState.prefAutoStartBootUp = b } @@ -248,6 +250,17 @@ class MiscSettingsActivity : AppCompatActivity(R.layout.activity_misc_settings) showNotificationActionDialog() } + b.settingsActivityAppNotificationPersistentRl.setOnClickListener { + b.settingsActivityAppNotificationPersistentSwitch.isChecked = + !b.settingsActivityAppNotificationPersistentSwitch.isChecked + } + + b.settingsActivityAppNotificationPersistentSwitch.setOnCheckedChangeListener { + _: CompoundButton, + b: Boolean -> + persistentState.persistentNotification = b + } + b.settingsActivityPcapRl.setOnClickListener { enableAfterDelay(TimeUnit.SECONDS.toMillis(1L), b.settingsActivityPcapRl) showPcapOptionsDialog() diff --git a/app/src/full/res/layout/activity_misc_settings.xml b/app/src/full/res/layout/activity_misc_settings.xml index 4fdce82c6..12370a345 100644 --- a/app/src/full/res/layout/activity_misc_settings.xml +++ b/app/src/full/res/layout/activity_misc_settings.xml @@ -722,6 +722,60 @@ android:padding="10dp" /> + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/celzero/bravedns/service/BraveVPNService.kt b/app/src/main/java/com/celzero/bravedns/service/BraveVPNService.kt index 4df9d8334..f949f75c9 100644 --- a/app/src/main/java/com/celzero/bravedns/service/BraveVPNService.kt +++ b/app/src/main/java/com/celzero/bravedns/service/BraveVPNService.kt @@ -1095,6 +1095,11 @@ class BraveVPNService : builder.setSmallIcon(R.drawable.ic_notification_icon).setContentIntent(pendingIntent) builder.color = ContextCompat.getColor(this, getAccentColor(persistentState.theme)) + if (persistentState.persistentNotification) + { + builder.setOngoing(true) + } + // New action button options in the notification // 1. Pause / Resume, Stop action button. // 2. RethinkDNS modes (dns & dns+firewall mode) diff --git a/app/src/main/java/com/celzero/bravedns/service/PersistentState.kt b/app/src/main/java/com/celzero/bravedns/service/PersistentState.kt index 38f7284e7..537056f1e 100644 --- a/app/src/main/java/com/celzero/bravedns/service/PersistentState.kt +++ b/app/src/main/java/com/celzero/bravedns/service/PersistentState.kt @@ -239,6 +239,10 @@ class PersistentState(context: Context) : SimpleKrate(context), KoinComponent { var shouldRequestNotificationPermission by booleanPref("notification_permission_request").withDefault(true) + // make notification persistent + var persistentNotification by + booleanPref("persistent_notification").withDefault(false) + // biometric authentication var biometricAuth by booleanPref("biometric_authentication").withDefault(false) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 39334aeac..31e89d7e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -473,6 +473,9 @@ App Notification Enable notification permission for the app + Persistent Notification + Make the notification persistent + Appearance Dark/light theme