Add contact plugin settings

This commit is contained in:
MM20
2025-04-06 14:10:48 +02:00
parent 02cec92d72
commit ee9312a887
11 changed files with 200 additions and 46 deletions
+2 -1
View File
@@ -849,7 +849,8 @@
<string name="plugin_state_error">This plugin isn\'t working correctly</string>
<string name="plugin_state_setup_required">You need to setup this plugin first</string>
<string name="plugin_action_setup">Set up</string>
<string name="plugin_type_filesearch">File search</string>
<string name="plugin_type_filesearch">Files</string>
<string name="plugin_type_contacts">Contacts</string>
<string name="plugin_type_weather">Weather provider</string>
<string name="plugin_weather_provider_enable">Set as weather provider</string>
<string name="plugin_weather_provider_enabled">Currently set as weather provider</string>
@@ -22,6 +22,13 @@ class ContactSearchSettings internal constructor(private val dataStore: Launcher
}
}
val enabledPlugins: Flow<Set<String>>
get() = dataStore.data.map { it.contactSearchProviders - "local" }
fun setPluginEnabled(authority: String, enabled: Boolean) {
setProviderEnabled(authority, enabled)
}
val callOnTap: Flow<Boolean>
get() = dataStore.data.map { it.contactSearchCallOnTap }.distinctUntilChanged()
@@ -23,7 +23,7 @@ data class PostalAddress(
)
/**
* Custom contact channel, for example, WhatsApp message, Telegram video call, etc.
* Custom contact action, for example, WhatsApp message, Telegram video call, etc.
*/
@Serializable
data class CustomContactAction(
@@ -35,18 +35,33 @@ data class CustomContactAction(
/**
* Type that is passed to the Intent.
*/
val mimeType: String,
val mimeType: String? = null,
/**
* Package name of the app that handles this channel.
* Used to get the app icon, and label, and to group channels by app.
* If the app is not installed, the channel will be ignored.
* Used to get the app icon, and label, and to group actions by app.
* If the app is not installed, the action will be ignored.
*/
val packageName: String,
)
enum class ContactInfoType {
/**
* Home or private number/address.
*/
Home,
/**
* Cell phone number, only applicable for phone numbers.
*/
Mobile,
/**
* Work or business number/address.
*/
Work,
/**
* Other
*/
Other,
}