Updated on 2026-08-14
This commit is contained in:
parent
330ae73357
commit
e7efe7b76a
4636 changed files with 234864 additions and 63507 deletions
1
features/push-notifications/api/.gitignore
vendored
Normal file
1
features/push-notifications/api/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
18
features/push-notifications/api/build.gradle.kts
Normal file
18
features/push-notifications/api/build.gradle.kts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
plugins {
|
||||
alias(deps.plugins.android.library)
|
||||
alias(deps.plugins.kotlin.android)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.tangem.features.pushnotifications.api"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
/** AndroidX */
|
||||
implementation(deps.androidx.fragment.ktx)
|
||||
|
||||
/** Core */
|
||||
implementation(projects.core.analytics.models)
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.tangem.features.pushnotifications.api.analytics
|
||||
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.core.analytics.models.AnalyticsParam
|
||||
|
||||
sealed class PushNotificationAnalyticEvents(
|
||||
event: String,
|
||||
params: Map<String, String> = mapOf(),
|
||||
) : AnalyticsEvent(category = "Push", event = event, params = params) {
|
||||
|
||||
data class ButtonAllow(
|
||||
val source: AnalyticsParam.ScreensSources,
|
||||
) : PushNotificationAnalyticEvents(
|
||||
event = "Button - Allow",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source.value,
|
||||
),
|
||||
)
|
||||
|
||||
data class ButtonCancel(
|
||||
val source: AnalyticsParam.ScreensSources,
|
||||
) : PushNotificationAnalyticEvents(
|
||||
event = "Button - Cancel",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source.value,
|
||||
),
|
||||
)
|
||||
|
||||
data class ButtonLater(
|
||||
val source: AnalyticsParam.ScreensSources,
|
||||
) : PushNotificationAnalyticEvents(
|
||||
event = "Button - Later",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source.value,
|
||||
),
|
||||
)
|
||||
|
||||
data class PermissionStatus(
|
||||
val isAllowed: Boolean,
|
||||
) : PushNotificationAnalyticEvents(
|
||||
event = "Permission Status",
|
||||
params = mapOf(
|
||||
AnalyticsParam.STATE to if (isAllowed) "Allow" else "Cancel",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.tangem.features.pushnotifications.api.navigation
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
|
||||
interface PushNotificationsRouter {
|
||||
|
||||
fun entryFragment(): Fragment
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.tangem.features.pushnotifications.api.utils
|
||||
|
||||
import android.Manifest
|
||||
import android.os.Build
|
||||
import androidx.annotation.ChecksSdkIntAtLeast
|
||||
|
||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.TIRAMISU)
|
||||
private val isRequirePushPermission = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
|
||||
|
||||
val PUSH_PERMISSION = if (isRequirePushPermission) {
|
||||
Manifest.permission.POST_NOTIFICATIONS
|
||||
} else {
|
||||
"android.permission.POST_NOTIFICATIONS"
|
||||
}
|
||||
|
||||
fun getPushPermissionOrNull() = if (isRequirePushPermission) {
|
||||
Manifest.permission.POST_NOTIFICATIONS
|
||||
} else {
|
||||
null
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue