Track contact usage
This commit is contained in:
parent
01261b422c
commit
bc8d05169d
@ -138,7 +138,7 @@ class SearchableItemVM : ListItemViewModel(), KoinComponent {
|
|||||||
}
|
}
|
||||||
val bundle = options.toBundle()
|
val bundle = options.toBundle()
|
||||||
if (searchable.launch(context, bundle)) {
|
if (searchable.launch(context, bundle)) {
|
||||||
favoritesService.reportLaunch(searchable)
|
reportUsage(searchable)
|
||||||
return true
|
return true
|
||||||
} else if (searchable is Application || searchable is AppShortcut) {
|
} else if (searchable is Application || searchable is AppShortcut) {
|
||||||
favoritesService.reset(searchable)
|
favoritesService.reset(searchable)
|
||||||
@ -168,7 +168,7 @@ class SearchableItemVM : ListItemViewModel(), KoinComponent {
|
|||||||
|
|
||||||
fun launchChild(context: Context, child: SavableSearchable) {
|
fun launchChild(context: Context, child: SavableSearchable) {
|
||||||
if (child.launch(context, null)) {
|
if (child.launch(context, null)) {
|
||||||
favoritesService.reportLaunch(child)
|
reportUsage(child)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,4 +246,8 @@ class SearchableItemVM : ListItemViewModel(), KoinComponent {
|
|||||||
val mapTileServerUrl = locationSearchSettings.tileServer
|
val mapTileServerUrl = locationSearchSettings.tileServer
|
||||||
.map { it ?: LocationSearchSettings.DefaultTileServerUrl }
|
.map { it ?: LocationSearchSettings.DefaultTileServerUrl }
|
||||||
.stateIn(viewModelScope, SharingStarted.Lazily, "")
|
.stateIn(viewModelScope, SharingStarted.Lazily, "")
|
||||||
|
|
||||||
|
fun reportUsage(searchable: SavableSearchable) {
|
||||||
|
favoritesService.reportLaunch(searchable)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -163,6 +163,7 @@ fun ContactItem(
|
|||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
secondaryAction = {
|
secondaryAction = {
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
|
viewModel.reportUsage(contact)
|
||||||
context.tryStartActivity(
|
context.tryStartActivity(
|
||||||
Intent(Intent.ACTION_SENDTO).apply {
|
Intent(Intent.ACTION_SENDTO).apply {
|
||||||
data = Uri.parse("smsto:${it.number}")
|
data = Uri.parse("smsto:${it.number}")
|
||||||
@ -180,6 +181,7 @@ fun ContactItem(
|
|||||||
expandedSection = if (it) 0 else -1
|
expandedSection = if (it) 0 else -1
|
||||||
},
|
},
|
||||||
onContact = {
|
onContact = {
|
||||||
|
viewModel.reportUsage(contact)
|
||||||
context.tryStartActivity(
|
context.tryStartActivity(
|
||||||
Intent(Intent.ACTION_DIAL).apply {
|
Intent(Intent.ACTION_DIAL).apply {
|
||||||
data = Uri.parse("tel:${it.number}")
|
data = Uri.parse("tel:${it.number}")
|
||||||
@ -208,6 +210,7 @@ fun ContactItem(
|
|||||||
expandedSection = if (it) 1 else -1
|
expandedSection = if (it) 1 else -1
|
||||||
},
|
},
|
||||||
onContact = {
|
onContact = {
|
||||||
|
viewModel.reportUsage(contact)
|
||||||
context.tryStartActivity(
|
context.tryStartActivity(
|
||||||
Intent(Intent.ACTION_SENDTO).apply {
|
Intent(Intent.ACTION_SENDTO).apply {
|
||||||
data = Uri.parse("mailto:${it.address}")
|
data = Uri.parse("mailto:${it.address}")
|
||||||
@ -231,6 +234,7 @@ fun ContactItem(
|
|||||||
secondaryAction = if (canNavigate) {
|
secondaryAction = if (canNavigate) {
|
||||||
{
|
{
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
|
viewModel.reportUsage(contact)
|
||||||
context.tryStartActivity(
|
context.tryStartActivity(
|
||||||
Intent(Intent.ACTION_VIEW).apply {
|
Intent(Intent.ACTION_VIEW).apply {
|
||||||
data =
|
data =
|
||||||
@ -254,6 +258,7 @@ fun ContactItem(
|
|||||||
expandedSection = if (it) 2 else -1
|
expandedSection = if (it) 2 else -1
|
||||||
},
|
},
|
||||||
onContact = {
|
onContact = {
|
||||||
|
viewModel.reportUsage(contact)
|
||||||
context.tryStartActivity(
|
context.tryStartActivity(
|
||||||
Intent(Intent.ACTION_VIEW).apply {
|
Intent(Intent.ACTION_VIEW).apply {
|
||||||
data = Uri.parse("geo:0,0?q=${it.address}")
|
data = Uri.parse("geo:0,0?q=${it.address}")
|
||||||
@ -309,6 +314,7 @@ fun ContactItem(
|
|||||||
expandedSection = if (it) 3 + i else -1
|
expandedSection = if (it) 3 + i else -1
|
||||||
},
|
},
|
||||||
onContact = {
|
onContact = {
|
||||||
|
viewModel.reportUsage(contact)
|
||||||
context.tryStartActivity(
|
context.tryStartActivity(
|
||||||
Intent(Intent.ACTION_VIEW).apply {
|
Intent(Intent.ACTION_VIEW).apply {
|
||||||
setDataAndType(
|
setDataAndType(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user