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"; const val VALUE_YES = "yes";
@JvmStatic
fun fromCryptoStatus(cryptoStatus: CryptoStatus): AutocryptDraftStateHeader { fun fromCryptoStatus(cryptoStatus: CryptoStatus): AutocryptDraftStateHeader {
if (cryptoStatus.isSignOnly) { if (cryptoStatus.isSignOnly) {
return AutocryptDraftStateHeader(false, true, cryptoStatus.isReplyToEncrypted, return AutocryptDraftStateHeader(false, true, cryptoStatus.isReplyToEncrypted,

View file

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

View file

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