Remove unused context property and toMe method

This commit is contained in:
Wolf Montwé 2023-03-06 14:56:16 +01:00
parent 9fe1983c1a
commit b7bfb4006f
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
4 changed files with 4 additions and 17 deletions

View file

@ -7,7 +7,7 @@ import org.koin.dsl.module
val helperModule = module {
single { ClipboardManager(get()) }
single { MessageHelper.getInstance(get()) }
single { MessageHelper.getInstance() }
factory<KeyStoreDirectoryProvider> { AndroidKeyStoreDirectoryProvider(context = get()) }
factory { get<Context>().getSystemService(Context.ALARM_SERVICE) as AlarmManager }
single { AlarmManagerCompat(alarmManager = get()) }

View file

@ -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<Address?>): 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
}

View file

@ -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);
}
}

View file

@ -809,7 +809,6 @@
<ID>UnusedPrivateMember:Contacts.kt$Contacts$addresses: Array&lt;Address?&gt;?</ID>
<ID>UnusedPrivateMember:ExtraAccountDiscovery.kt$ExtraAccountDiscovery$email: String</ID>
<ID>UnusedPrivateMember:HttpUriParser.kt$HttpUriParser$i</ID>
<ID>UnusedPrivateMember:MessageHelper.kt$MessageHelper$private val mContext: Context</ID>
<ID>UnusedPrivateMember:MessageListLoader.kt$MessageListLoader$account: Account</ID>
<ID>UnusedPrivateMember:MessageViewFragment.kt$MessageViewFragment$requestKey: String</ID>
<ID>UnusedPrivateMember:NewSetupUiHack.kt$NewSetupUiHack$builder: SettingsListBuilder</ID>