2020-04-16 15:44:53 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Proton Technologies AG
|
2021-03-17 11:33:06 +00:00
|
|
|
*
|
2020-04-16 15:44:53 +00:00
|
|
|
* This file is part of ProtonMail.
|
2021-03-17 11:33:06 +00:00
|
|
|
*
|
2020-04-16 15:44:53 +00:00
|
|
|
* ProtonMail is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2021-03-17 11:33:06 +00:00
|
|
|
*
|
2020-04-16 15:44:53 +00:00
|
|
|
* ProtonMail is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2021-03-17 11:33:06 +00:00
|
|
|
*
|
2020-04-16 15:44:53 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with ProtonMail. If not, see https://www.gnu.org/licenses/.
|
|
|
|
*/
|
|
|
|
package ch.protonmail.android.activities.contactDetails
|
|
|
|
|
|
|
|
import android.os.AsyncTask
|
|
|
|
import ch.protonmail.android.api.models.room.contacts.FullContactDetails
|
2021-03-17 11:33:06 +00:00
|
|
|
import ch.protonmail.android.data.local.ContactsDao
|
2020-04-16 15:44:53 +00:00
|
|
|
|
2020-11-12 16:53:02 +00:00
|
|
|
class ExtractFullContactDetailsTask(
|
2021-03-17 11:33:06 +00:00
|
|
|
private val contactsDao: ContactsDao,
|
2020-11-12 16:53:02 +00:00
|
|
|
private val contactId: String,
|
|
|
|
private val callback: (FullContactDetails?) -> Unit
|
|
|
|
) : AsyncTask<Void, Void, FullContactDetails>() {
|
2020-04-16 15:44:53 +00:00
|
|
|
|
2020-11-12 16:53:02 +00:00
|
|
|
override fun doInBackground(vararg voids: Void): FullContactDetails? {
|
2021-03-17 11:33:06 +00:00
|
|
|
return contactsDao.findFullContactDetailsById(contactId)
|
2020-11-12 16:53:02 +00:00
|
|
|
}
|
2020-04-16 15:44:53 +00:00
|
|
|
|
2020-11-12 16:53:02 +00:00
|
|
|
override fun onPostExecute(fullContactDetails: FullContactDetails?) {
|
|
|
|
callback(fullContactDetails)
|
|
|
|
}
|
2020-04-16 15:44:53 +00:00
|
|
|
}
|