summaryrefslogtreecommitdiff
path: root/core/src/main/java
diff options
context:
space:
mode:
authorGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2023-10-11 16:36:02 +0000
committerGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2023-10-11 16:36:02 +0000
commit95e68cbbe748f81af1113753c5b99929e3db9ea2 (patch)
tree776b2e1fb3d5c16a48beb1c947eef887b2475db8 /core/src/main/java
parent41c0e48498979ec8310961e40c89aa6b3c0d8e0f (diff)
epic18: Trackers control on standalone app (without Ipscrambling).
Diffstat (limited to 'core/src/main/java')
-rw-r--r--core/src/main/java/foundation/e/advancedprivacy/core/utils/NotificationsHelper.kt35
-rw-r--r--core/src/main/java/foundation/e/advancedprivacy/domain/entities/FeatureServiceState.kt21
-rw-r--r--core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationChannels.kt27
-rw-r--r--core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationContent.kt27
-rw-r--r--core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/PermissionsPrivacyModuleBase.kt (renamed from core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/APermissionsPrivacyModule.kt)2
5 files changed, 111 insertions, 1 deletions
diff --git a/core/src/main/java/foundation/e/advancedprivacy/core/utils/NotificationsHelper.kt b/core/src/main/java/foundation/e/advancedprivacy/core/utils/NotificationsHelper.kt
new file mode 100644
index 0000000..29721b0
--- /dev/null
+++ b/core/src/main/java/foundation/e/advancedprivacy/core/utils/NotificationsHelper.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2023 MURENA SAS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+package foundation.e.advancedprivacy.core.utils
+
+import android.content.Context
+import androidx.core.app.NotificationCompat
+import foundation.e.advancedprivacy.domain.entities.NotificationContent
+
+fun notificationBuilder(
+ context: Context,
+ content: NotificationContent
+): NotificationCompat.Builder {
+ val builder = NotificationCompat.Builder(context, content.channelId)
+ .setSmallIcon(content.icon)
+ .setPriority(NotificationCompat.PRIORITY_LOW)
+ .setContentTitle(context.getString(content.title))
+ .setStyle(NotificationCompat.BigTextStyle().bigText(context.getString(content.description)))
+ content.pendingIntent?.let { builder.setContentIntent(it) }
+
+ return builder
+}
diff --git a/core/src/main/java/foundation/e/advancedprivacy/domain/entities/FeatureServiceState.kt b/core/src/main/java/foundation/e/advancedprivacy/domain/entities/FeatureServiceState.kt
new file mode 100644
index 0000000..6bfecbb
--- /dev/null
+++ b/core/src/main/java/foundation/e/advancedprivacy/domain/entities/FeatureServiceState.kt
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2023 MURENA SAS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+package foundation.e.advancedprivacy.domain.entities
+
+enum class FeatureServiceState {
+ OFF, ON, STARTING, STOPPING
+}
diff --git a/core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationChannels.kt b/core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationChannels.kt
new file mode 100644
index 0000000..4458e1d
--- /dev/null
+++ b/core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationChannels.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2023 MURENA SAS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+package foundation.e.advancedprivacy.domain.entities
+
+const val CHANNEL_FIRST_BOOT = "first_boot_notification"
+const val CHANNEL_FAKE_LOCATION_FLAG = "fake_location_flag"
+const val CHANNEL_IPSCRAMBLING_FLAG = "ipscrambling_flag"
+const val CHANNEL_TRACKER_FLAG = "tracker_flag"
+
+const val NOTIFICATION_FIRST_BOOT = 1000
+const val NOTIFICATION_FAKE_LOCATION_FLAG = NOTIFICATION_FIRST_BOOT + 1
+const val NOTIFICATION_IPSCRAMBLING_FLAG = NOTIFICATION_FAKE_LOCATION_FLAG + 1
+const val NOTIFICATION_TRACKER_FLAG = NOTIFICATION_IPSCRAMBLING_FLAG + 1
diff --git a/core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationContent.kt b/core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationContent.kt
new file mode 100644
index 0000000..44b508d
--- /dev/null
+++ b/core/src/main/java/foundation/e/advancedprivacy/domain/entities/NotificationContent.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2023 MURENA SAS
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+package foundation.e.advancedprivacy.domain.entities
+
+import android.app.PendingIntent
+
+data class NotificationContent(
+ val channelId: String,
+ val icon: Int,
+ val title: Int,
+ val description: Int,
+ val pendingIntent: PendingIntent?
+)
diff --git a/core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/APermissionsPrivacyModule.kt b/core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/PermissionsPrivacyModuleBase.kt
index 78f424b..27ba17f 100644
--- a/core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/APermissionsPrivacyModule.kt
+++ b/core/src/main/java/foundation/e/advancedprivacy/externalinterfaces/permissions/PermissionsPrivacyModuleBase.kt
@@ -37,7 +37,7 @@ import foundation.e.advancedprivacy.domain.entities.ProfileType
* versions of the module.
* @param context an Android context, to retrieve packageManager for example.
*/
-abstract class APermissionsPrivacyModule(protected val context: Context) : IPermissionsPrivacyModule {
+abstract class PermissionsPrivacyModuleBase(protected val context: Context) : IPermissionsPrivacyModule {
companion object {
private const val TAG = "PermissionsModule"