From b7bfb4006fe30a74df68e8861502169db064577a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf=20Montwe=CC=81?= Date: Mon, 6 Mar 2023 14:56:16 +0100 Subject: [PATCH] Remove unused context property and toMe method --- .../main/java/com/fsck/k9/helper/KoinModule.kt | 2 +- .../java/com/fsck/k9/helper/MessageHelper.kt | 16 ++-------------- .../java/com/fsck/k9/view/MessageHeader.java | 2 +- config/detekt/baseline.xml | 1 - 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/helper/KoinModule.kt b/app/core/src/main/java/com/fsck/k9/helper/KoinModule.kt index 077682470..1a593d386 100644 --- a/app/core/src/main/java/com/fsck/k9/helper/KoinModule.kt +++ b/app/core/src/main/java/com/fsck/k9/helper/KoinModule.kt @@ -7,7 +7,7 @@ import org.koin.dsl.module val helperModule = module { single { ClipboardManager(get()) } - single { MessageHelper.getInstance(get()) } + single { MessageHelper.getInstance() } factory { AndroidKeyStoreDirectoryProvider(context = get()) } factory { get().getSystemService(Context.ALARM_SERVICE) as AlarmManager } single { AlarmManagerCompat(alarmManager = get()) } diff --git a/app/core/src/main/java/com/fsck/k9/helper/MessageHelper.kt b/app/core/src/main/java/com/fsck/k9/helper/MessageHelper.kt index 013883acd..6590118b9 100644 --- a/app/core/src/main/java/com/fsck/k9/helper/MessageHelper.kt +++ b/app/core/src/main/java/com/fsck/k9/helper/MessageHelper.kt @@ -1,12 +1,10 @@ package com.fsck.k9.helper -import android.content.Context import android.text.Spannable import android.text.SpannableString import android.text.SpannableStringBuilder import android.text.TextUtils import android.text.style.ForegroundColorSpan -import com.fsck.k9.Account import com.fsck.k9.CoreResourceProvider import com.fsck.k9.DI import com.fsck.k9.K9.contactNameColor @@ -17,7 +15,6 @@ import com.fsck.k9.mail.Address import java.util.regex.Pattern class MessageHelper private constructor( - private val mContext: Context, private val resourceProvider: CoreResourceProvider, ) { @@ -38,15 +35,6 @@ class MessageHelper private constructor( return SpannableStringBuilder(resourceProvider.contactDisplayNamePrefix()).append(recipients) } - fun toMe(account: Account, toAddrs: List): Boolean { - for (address in toAddrs) { - if (account.isAnIdentity(address!!)) { - return true - } - } - return false - } - companion object { /** * If the number of addresses exceeds this value the addresses aren't @@ -62,10 +50,10 @@ class MessageHelper private constructor( @JvmStatic @Synchronized - fun getInstance(context: Context): MessageHelper? { + fun getInstance(): MessageHelper? { if (sInstance == null) { val resourceProvider = DI.get(CoreResourceProvider::class.java) - sInstance = MessageHelper(context, resourceProvider) + sInstance = MessageHelper(resourceProvider) } return sInstance } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java index 5d91e07a0..fda0376ca 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageHeader.java @@ -70,7 +70,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo super(context, attrs); if (!isInEditMode()) { - messageHelper = MessageHelper.getInstance(getContext()); + messageHelper = MessageHelper.getInstance(); relativeDateTimeFormatter = DI.get(RelativeDateTimeFormatter.class); } } diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml index e4626fce3..01596cb92 100644 --- a/config/detekt/baseline.xml +++ b/config/detekt/baseline.xml @@ -809,7 +809,6 @@ UnusedPrivateMember:Contacts.kt$Contacts$addresses: Array<Address?>? UnusedPrivateMember:ExtraAccountDiscovery.kt$ExtraAccountDiscovery$email: String UnusedPrivateMember:HttpUriParser.kt$HttpUriParser$i - UnusedPrivateMember:MessageHelper.kt$MessageHelper$private val mContext: Context UnusedPrivateMember:MessageListLoader.kt$MessageListLoader$account: Account UnusedPrivateMember:MessageViewFragment.kt$MessageViewFragment$requestKey: String UnusedPrivateMember:NewSetupUiHack.kt$NewSetupUiHack$builder: SettingsListBuilder