alexstyl / contactstore

A modern, strongly-typed contacts API for Android.
https://alexstyl.github.io/contactstore
Apache License 2.0
440 stars 15 forks source link

Allow consumers to specify the account the new contacts will be inserted into #54

Closed alexstyl closed 2 years ago

alexstyl commented 2 years ago

This PR introduces the option to specify an InternetAccount in which new contacts will be saved into. All data items inserted in the initial contact will also be stored in the specified InternetAccount

Example of usage:

val account = InternetAccount("test@test.com", "test.com")
        store.execute {
            insert(account) {
                phone("555", PhoneNumberMobile)
                mail("555@mail.com", LocationHome)
                event(dayOfMonth = 1, month = 1, year = 2021, DateBirthday)
                postalAddress(
                    street = "Somestreet",
                    poBox = "12345",
                    neighborhood = "Hood",
                    city = "City",
                    region = "",
                    postCode = "",
                    country = "",
                    label = LocationHome
                )
                webAddress(Uri.parse("https://acme.corp"), Label.WebsiteHomePage)
                imAddress(
                    address = "ImAddress",
                    protocol = "protocol",
                    label = LocationHome
                )
                relation(name = "Person", label = Label.PhoneNumberAssistant)
                sipAddress(address = "123", label = LocationHome)
            }
        }