Updated on 2026-08-14

This commit is contained in:
Tangem 2025-03-11 18:55:37 +03:00
parent 330ae73357
commit e7efe7b76a
4636 changed files with 234864 additions and 63507 deletions

View file

@ -0,0 +1 @@
/build

View 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)
}

View file

@ -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",
),
)
}

View file

@ -0,0 +1,8 @@
package com.tangem.features.pushnotifications.api.navigation
import androidx.fragment.app.Fragment
interface PushNotificationsRouter {
fun entryFragment(): Fragment
}

View file

@ -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
}