2020-04-16 15:44:53 +00:00
|
|
|
/*
|
2022-02-28 15:15:59 +00:00
|
|
|
* Copyright (c) 2022 Proton AG
|
2021-03-17 11:33:06 +00:00
|
|
|
*
|
2022-02-28 15:15:59 +00:00
|
|
|
* This file is part of Proton Mail.
|
2021-03-17 11:33:06 +00:00
|
|
|
*
|
2022-02-28 15:15:59 +00:00
|
|
|
* Proton Mail is free software: you can redistribute it and/or modify
|
2020-04-16 15:44:53 +00:00
|
|
|
* 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
|
|
|
*
|
2022-02-28 15:15:59 +00:00
|
|
|
* Proton Mail is distributed in the hope that it will be useful,
|
2020-04-16 15:44:53 +00:00
|
|
|
* 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
|
2022-02-28 15:15:59 +00:00
|
|
|
* along with Proton Mail. If not, see https://www.gnu.org/licenses/.
|
2020-04-16 15:44:53 +00:00
|
|
|
*/
|
|
|
|
package ch.protonmail.android.activities.messageDetails.details
|
|
|
|
|
|
|
|
import android.view.View
|
2021-03-17 14:54:52 +00:00
|
|
|
import ch.protonmail.android.data.local.ContactDatabase
|
2022-03-10 09:43:31 +00:00
|
|
|
import ch.protonmail.android.details.presentation.ui.MessageDetailsActivity
|
2021-03-18 09:47:58 +00:00
|
|
|
import ch.protonmail.android.utils.extensions.app
|
2020-04-16 15:44:53 +00:00
|
|
|
import ch.protonmail.android.utils.ui.RecipientDropDownClickListener
|
|
|
|
|
2021-03-18 09:47:58 +00:00
|
|
|
internal class RecipientContextMenuFactory(
|
|
|
|
private val context: MessageDetailsActivity
|
2021-07-16 07:43:03 +00:00
|
|
|
) : Function1<String, View.OnClickListener> {
|
2020-04-16 15:44:53 +00:00
|
|
|
|
2021-03-18 09:47:58 +00:00
|
|
|
override fun invoke(email: String): View.OnClickListener {
|
|
|
|
val app = context.app
|
|
|
|
val contactsDatabase = ContactDatabase.getInstance(app, app.userManager.requireCurrentUserId()).getDao()
|
|
|
|
return RecipientDropDownClickListener(context, contactsDatabase, email)
|
|
|
|
}
|
2020-04-16 15:44:53 +00:00
|
|
|
}
|