Contact stuff
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package de.mm20.launcher2.plugin.contracts
|
||||
|
||||
import de.mm20.launcher2.search.contact.CustomContactChannel
|
||||
import de.mm20.launcher2.search.contact.EmailAddress
|
||||
import de.mm20.launcher2.search.contact.PhoneNumber
|
||||
import de.mm20.launcher2.search.contact.PostalAddress
|
||||
|
||||
abstract class ContactPluginContract {
|
||||
object ContactColumns: Columns() {
|
||||
/**
|
||||
* The unique ID of the contact.
|
||||
*/
|
||||
val Id = column<String>("id")
|
||||
|
||||
/**
|
||||
* The display name of the contact.
|
||||
* First name + last name, if applicable.
|
||||
*/
|
||||
val Name = column<String>("name")
|
||||
|
||||
val PhoneNumbers = column<List<PhoneNumber>>("phone_numbers")
|
||||
val EmailAddresses = column<List<EmailAddress>>("email_addresses")
|
||||
val PostalAddresses = column<List<PostalAddress>>("postal_addresses")
|
||||
val ContactChannels = column<List<CustomContactChannel>>("contact_channels")
|
||||
|
||||
val PhotoUri = column<String>("photo_uri")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package de.mm20.launcher2.search.contact
|
||||
|
||||
import android.net.Uri
|
||||
import de.mm20.launcher2.serialization.UriSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class PhoneNumber(
|
||||
val number: String,
|
||||
val type: ContactInfoType = ContactInfoType.Other,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class EmailAddress(
|
||||
val address: String,
|
||||
val type: ContactInfoType = ContactInfoType.Other,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class PostalAddress(
|
||||
val address: String,
|
||||
val type: ContactInfoType = ContactInfoType.Other,
|
||||
)
|
||||
|
||||
/**
|
||||
* Custom contact channel, for example, WhatsApp message, Telegram video call, etc.
|
||||
*/
|
||||
@Serializable
|
||||
data class CustomContactChannel(
|
||||
val label: String,
|
||||
/**
|
||||
* The data URI that is passed to the Intent.
|
||||
*/
|
||||
@Serializable(with = UriSerializer::class) val uri: Uri,
|
||||
/**
|
||||
* Type that is passed to the Intent.
|
||||
*/
|
||||
val mimeType: String,
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
val packageName: String,
|
||||
)
|
||||
|
||||
enum class ContactInfoType {
|
||||
Home,
|
||||
Mobile,
|
||||
Work,
|
||||
Other,
|
||||
}
|
||||
Reference in New Issue
Block a user