use @JvmStatic instead of Companion reference, code style

This commit is contained in:
Vincent Breitmoser 2018-11-28 22:05:49 +01:00
parent 825f06b1f3
commit 4c295e2f1b
3 changed files with 15 additions and 12 deletions

View file

@ -44,6 +44,7 @@ data class AutocryptDraftStateHeader(val isEncrypt: Boolean,
const val VALUE_YES = "yes";
@JvmStatic
fun fromCryptoStatus(cryptoStatus: CryptoStatus): AutocryptDraftStateHeader {
if (cryptoStatus.isSignOnly) {
return AutocryptDraftStateHeader(false, true, cryptoStatus.isReplyToEncrypted,

View file

@ -129,7 +129,7 @@ public class PgpMessageBuilder extends MessageBuilder {
private void addDraftStateHeader() {
AutocryptDraftStateHeader autocryptDraftStateHeader =
AutocryptDraftStateHeader.Companion.fromCryptoStatus(cryptoStatus);
AutocryptDraftStateHeader.fromCryptoStatus(cryptoStatus);
currentProcessedMimeMessage.setHeader(AutocryptDraftStateHeader.AUTOCRYPT_DRAFT_STATE_HEADER,
autocryptDraftStateHeader.toHeaderValue());
}

View file

@ -15,16 +15,18 @@ import org.openintents.openpgp.OpenPgpApiManager.OpenPgpProviderState
* during email composition to apply cryptographic operations before sending
* or saving as draft.
*/
data class ComposeCryptoStatus(private val openPgpProviderState: OpenPgpProviderState,
override val openPgpKeyId: Long?,
val recipientAddresses: List<String>,
override val isPgpInlineModeEnabled: Boolean,
override val isSenderPreferEncryptMutual: Boolean,
override val isReplyToEncrypted: Boolean,
override val isEncryptAllDrafts: Boolean,
override val isEncryptSubject: Boolean,
private val cryptoMode: CryptoMode,
private val recipientAutocryptStatus: RecipientAutocryptStatus? = null) : CryptoStatus {
data class ComposeCryptoStatus(
private val openPgpProviderState: OpenPgpProviderState,
override val openPgpKeyId: Long?,
val recipientAddresses: List<String>,
override val isPgpInlineModeEnabled: Boolean,
override val isSenderPreferEncryptMutual: Boolean,
override val isReplyToEncrypted: Boolean,
override val isEncryptAllDrafts: Boolean,
override val isEncryptSubject: Boolean,
private val cryptoMode: CryptoMode,
private val recipientAutocryptStatus: RecipientAutocryptStatus? = null
) : CryptoStatus {
constructor(openPgpProviderState: OpenPgpProviderState,
openPgpKeyId: Long?,
@ -143,7 +145,7 @@ data class ComposeCryptoStatus(private val openPgpProviderState: OpenPgpProvider
isPgpInlineModeEnabled = isPgpInlineModeEnabled,
isSenderPreferEncryptMutual = isSenderPreferEncryptMutual,
isReplyToEncrypted = isReplyToEncrypted,
isEncryptAllDrafts= isEncryptAllDrafts,
isEncryptAllDrafts = isEncryptAllDrafts,
isEncryptSubject = isEncryptSubject,
recipientAddresses = recipientAddresses,
recipientAutocryptStatus = recipientAutocryptStatusType