Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 53 additions & 18 deletions app/src/main/java/com/darshan/notificity/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
import com.bumptech.glide.integration.compose.GlideImage
import com.bumptech.glide.integration.compose.placeholder
import com.darshan.notificity.analytics.AnalyticsConstants
import com.darshan.notificity.analytics.AnalyticsLogger
import com.darshan.notificity.components.BuyMeACoffee
import com.darshan.notificity.components.ClickableSection
import com.darshan.notificity.components.NotificityAppBar
import com.darshan.notificity.extensions.openUrl
import com.darshan.notificity.analytics.enums.Screen
import com.darshan.notificity.ui.BaseActivity
import com.darshan.notificity.ui.settings.SettingsViewModel
import com.darshan.notificity.ui.theme.NotificityTheme
Expand All @@ -59,8 +58,8 @@ class AboutActivity : BaseActivity() {

private val settingsViewModel: SettingsViewModel by viewModels()

override val screenName: String
get() = AnalyticsConstants.Screens.ABOUT
override val screen: Screen
get() = Screen.ABOUT

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -69,14 +68,30 @@ class AboutActivity : BaseActivity() {
val themeMode by remember { settingsViewModel.themeMode }.collectAsStateWithLifecycle()

NotificityTheme(themeMode = themeMode) {
AboutScreen(onBack = { finish() })
AboutScreen(
onBack = { finish() },
onPrivacyPolicyClicked = {
analyticsManager.app.onPrivacyPolicyClicked()
},
onBuyMeCoffeeClicked = {
analyticsManager.app.onBuyMeCoffeeClicked()
},
onContributorProfileClicked = { name ->
analyticsManager.app.onContributorProfileClicked(name)
}
)
}
}
}
}

@Composable
fun AboutScreen(onBack: () -> Unit) {
fun AboutScreen(
onBack: () -> Unit,
onPrivacyPolicyClicked: () -> Unit,
onBuyMeCoffeeClicked: () -> Unit,
onContributorProfileClicked: (String) -> Unit
) {
val context = LocalContext.current
val scrollState = rememberScrollState()
val showButton by remember {
Expand Down Expand Up @@ -119,7 +134,7 @@ fun AboutScreen(onBack: () -> Unit) {
onClick = {
context.openUrl("https://github.com/darshanpania/Notificity/blob/main/PRIVACY.md")

AnalyticsLogger.onPrivacyPolicyClicked()
onPrivacyPolicyClicked()
})

HorizontalDivider()
Expand All @@ -129,13 +144,24 @@ fun AboutScreen(onBack: () -> Unit) {
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.primary
)
Contributor("Darshan Pania", "i_m_Pania")
Contributor("Shivam Sharma", "ShivamS707")
Contributor("Shrinath Gupta", "gupta_shrinath")
Contributor("William John", "goonerdroid11")
Contributor("Jay Rathod", "zzjjaayy")
Contributor("Avadhut", "mr_whoknows55")
Contributor("Md Anas Shikoh", "ansiili_billi")

val contributors = listOf(
ContributorData("Darshan Pania", "i_m_Pania"),
ContributorData("Shivam Sharma", "ShivamS707"),
ContributorData("Shrinath Gupta", "gupta_shrinath"),
ContributorData("William John", "goonerdroid11"),
ContributorData("Jay Rathod", "zzjjaayy"),
ContributorData("Avadhut", "mr_whoknows55"),
ContributorData("Md Anas Shikoh", "ansiili_billi")
)

contributors.forEach {
Contributor(
it.name,
it.twitterUsername,
onContributorProfileClicked
)
}
}
AnimatedVisibility(
visible = showButton, enter = fadeIn(), exit = fadeOut(),
Expand All @@ -144,16 +170,25 @@ fun AboutScreen(onBack: () -> Unit) {
BuyMeACoffee(onClick = {
context.openUrl(Constants.BUY_ME_A_COFFEE_LINK)

AnalyticsLogger.onBuyMeCoffeeClicked()
onBuyMeCoffeeClicked()
})
}
}
}
}

data class ContributorData(
val name: String,
val twitterUsername: String
)

@OptIn(ExperimentalGlideComposeApi::class)
@Composable
fun Contributor(name: String, twitterUsername: String) {
fun Contributor(
name: String,
twitterUsername: String,
onContributorProfileClicked: (String) -> Unit
) {
val context = LocalContext.current
val twitterProfileUrl = "https://twitter.com/$twitterUsername"
val profilePicUrl = "https://unavatar.io/twitter/$twitterUsername"
Expand All @@ -164,7 +199,7 @@ fun Contributor(name: String, twitterUsername: String) {
.clickable {
context.openUrl(twitterProfileUrl)

AnalyticsLogger.onContributorProfileClicked(name)
onContributorProfileClicked(name)
}
.padding(vertical = 6.dp),
verticalAlignment = Alignment.Companion.CenterVertically,
Expand Down Expand Up @@ -199,5 +234,5 @@ fun Contributor(name: String, twitterUsername: String) {
@Composable
@Preview(showSystemUi = true, showBackground = true)
fun ShowAboutScreen() {
AboutScreen {}
AboutScreen(onBack = {}, onPrivacyPolicyClicked = {}, onBuyMeCoffeeClicked = {}, onContributorProfileClicked = {})
}
3 changes: 0 additions & 3 deletions app/src/main/java/com/darshan/notificity/MyApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package com.darshan.notificity
import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import com.darshan.notificity.analytics.AnalyticsService
import com.darshan.notificity.analytics.FirebaseAnalyticsTracker
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
Expand All @@ -13,7 +11,6 @@ class MyApplication : Application() {
override fun onCreate() {
super.onCreate()

AnalyticsService.init(FirebaseAnalyticsTracker())
createNotificationChannels()
}

Expand Down
19 changes: 12 additions & 7 deletions app/src/main/java/com/darshan/notificity/NotificationsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.darshan.notificity.analytics.AnalyticsConstants
import com.darshan.notificity.analytics.AnalyticsLogger
import com.darshan.notificity.components.EmptyContentState
import com.darshan.notificity.components.SwipeToDelete
import com.darshan.notificity.main.viewmodel.MainViewModel
import com.darshan.notificity.analytics.enums.Screen
import com.darshan.notificity.ui.BaseActivity
import com.darshan.notificity.ui.settings.SettingsViewModel
import com.darshan.notificity.ui.theme.NotificityTheme
Expand All @@ -68,8 +67,8 @@ class NotificationsActivity : BaseActivity() {
private val mainViewModel: MainViewModel by viewModels()
private val settingsViewModel: SettingsViewModel by viewModels()

override val screenName: String
get() = AnalyticsConstants.Screens.NOTIFICATION_LIST
override val screen: Screen
get() = Screen.NOTIFICATION_LIST

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -85,7 +84,10 @@ class NotificationsActivity : BaseActivity() {
NotificationSearchScreen(
appName = appName,
notificationsMap = notificationsMap,
deleteNotification = mainViewModel::deleteNotification
deleteNotification = mainViewModel::deleteNotification,
onNotificationListOpened = { appName, total ->
analyticsManager.app.onNotificationListOpened(appName, total)
}
)
}
}
Expand All @@ -98,6 +100,7 @@ fun NotificationSearchScreen(
appName: String?,
notificationsMap: Map<String, List<NotificationEntity>>,
deleteNotification: (NotificationEntity) -> Unit,
onNotificationListOpened: (String, Int) -> Unit
) {
val dateRangePickerState = rememberDateRangePickerState()
var notificationSearchQuery by remember { mutableStateOf("") }
Expand All @@ -119,7 +122,8 @@ fun NotificationSearchScreen(
notificationsMap = notificationsMap,
searchQuery = notificationSearchQuery,
selectedDateRange = selectedDateRange,
deleteNotification = deleteNotification
deleteNotification = deleteNotification,
onNotificationListOpened = onNotificationListOpened
)
}

Expand Down Expand Up @@ -181,6 +185,7 @@ fun NotificationList(
searchQuery: String,
selectedDateRange: Pair<Long?, Long?>,
deleteNotification: (NotificationEntity) -> Unit,
onNotificationListOpened: (String, Int) -> Unit
) {
// Safely handle the case where appName is null
if (appName == null) {
Expand Down Expand Up @@ -220,7 +225,7 @@ fun NotificationList(
LaunchedEffect(key1 = Unit) {
// LaunchedEffect ensures the logging doesn't rerun on every recomposition but initial composition.
if (filteredNotifications.isNotEmpty()) {
AnalyticsLogger.onNotificationListOpened(appName, filteredNotifications.size)
onNotificationListOpened(appName, filteredNotifications.size)
}
}

Expand Down

This file was deleted.

This file was deleted.

Loading