package expo.modules.contacts.next.intents import android.content.ContentValues import android.net.Uri import expo.modules.kotlin.activityresult.AppContextActivityResultCaller import expo.modules.kotlin.activityresult.AppContextActivityResultLauncher class ContactIntentDelegate { private lateinit var editContactLauncher: AppContextActivityResultLauncher private lateinit var addContactLauncher: AppContextActivityResultLauncher private lateinit var pickContactLauncher: AppContextActivityResultLauncher suspend fun AppContextActivityResultCaller.registerContactContracts() { editContactLauncher = registerForActivityResult(EditContactContract()) addContactLauncher = registerForActivityResult(AddContactContract()) pickContactLauncher = registerForActivityResult(PickContactContract()) } suspend fun launchEditContact(lookupKeyUri: Uri) = editContactLauncher.launch(EditContactInput(lookupKeyUri)) suspend fun launchAddContact(contentValues: List) = addContactLauncher.launch(AddContactInput(contentValues)) suspend fun launchPickContact() = pickContactLauncher.launch(PickContactInput()) }