Skip to content

Commit

Permalink
Move Account to :legacy:account module
Browse files Browse the repository at this point in the history
  • Loading branch information
wmontwe committed Aug 5, 2024
1 parent 20e5517 commit b7a64f2
Show file tree
Hide file tree
Showing 202 changed files with 276 additions and 268 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app.k9mail.dev

import app.k9mail.backend.demo.DemoBackend
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.backend.BackendFactory
import com.fsck.k9.backend.api.Backend
import com.fsck.k9.mailstore.K9BackendStorageFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.thunderbird.android.dev

import app.k9mail.backend.demo.DemoBackend
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.backend.BackendFactory
import com.fsck.k9.backend.api.Backend
import com.fsck.k9.mailstore.K9BackendStorageFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.viewModelScope
import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract.UseCase.GetOAuthRequestIntent
import app.k9mail.feature.account.oauth.domain.entity.AuthorizationIntentResult
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.preferences.AccountManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package app.k9mail.feature.widget.message.list

import com.fsck.k9.Account.SortType
import app.k9mail.legacy.account.Account.SortType
import com.fsck.k9.search.LocalSearch

internal data class MessageListConfig(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package app.k9mail.feature.widget.message.list

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.controller.MessageReference
import com.fsck.k9.helper.MessageHelper
import com.fsck.k9.mailstore.MessageDetailsAccessor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app.k9mail.feature.widget.message.list

import com.fsck.k9.Account
import com.fsck.k9.Account.SortType
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.account.Account.SortType
import com.fsck.k9.Preferences
import com.fsck.k9.helper.MessageHelper
import com.fsck.k9.mailstore.MessageColumns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.view.View
import android.widget.RemoteViews
import android.widget.RemoteViewsService.RemoteViewsFactory
import androidx.core.content.ContextCompat
import com.fsck.k9.Account.SortType
import app.k9mail.legacy.account.Account.SortType
import com.fsck.k9.K9
import com.fsck.k9.activity.MessageList
import com.fsck.k9.search.LocalSearch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app.k9mail.feature.widget.unread

import android.content.Context
import android.content.Intent
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.Preferences
import com.fsck.k9.activity.MessageList
import com.fsck.k9.controller.MessageCountsProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package app.k9mail.feature.widget.unread

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.controller.SimpleMessagingListener
import com.fsck.k9.mail.Message
import timber.log.Timber
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package app.k9mail.feature.widget.unread

import android.content.Context
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.folder.Folder
import app.k9mail.legacy.folder.FolderType
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isNull
import com.fsck.k9.Account
import com.fsck.k9.CoreResourceProvider
import com.fsck.k9.Preferences
import com.fsck.k9.controller.MessageCounts
Expand Down
4 changes: 3 additions & 1 deletion legacy/account/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ android {
}

dependencies {

implementation(projects.legacy.notification)
implementation(projects.mail.common)
implementation(projects.backend.api)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.fsck.k9
package app.k9mail.legacy.account

import app.k9mail.legacy.account.BaseAccount
import app.k9mail.legacy.account.Identity
import app.k9mail.legacy.notification.NotificationSettings
import com.fsck.k9.backend.api.SyncConfig.ExpungePolicy
import com.fsck.k9.mail.Address
Expand All @@ -15,6 +13,7 @@ const val DEFAULT_VISIBLE_LIMIT = 25
/**
* Account stores all of the settings for a single account defined by the user. Each account is defined by a UUID.
*/
@Suppress("TooManyFunctions")
class Account(
override val uuid: String,
private val isSensitiveDebugLoggingEnabled: () -> Boolean = { false },
Expand Down Expand Up @@ -539,6 +538,7 @@ class Account(
}
}

@Suppress("MagicNumber")
val earliestPollDate: Date?
get() {
val age = maximumPolledMessageAge.takeIf { it >= 0 } ?: return null
Expand Down Expand Up @@ -651,6 +651,7 @@ class Account(
}
}

@Suppress("MagicNumber")
enum class DeletePolicy(@JvmField val setting: Int) {
NEVER(0),
SEVEN_DAYS(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.fsck.k9.account

import android.content.Context
import app.k9mail.feature.settings.import.SettingsImportExternalContract
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.Core
import com.fsck.k9.Preferences
import com.fsck.k9.controller.MessagingController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import app.k9mail.feature.account.common.domain.entity.SpecialFolderOption
import app.k9mail.feature.account.common.domain.entity.SpecialFolderSettings
import app.k9mail.feature.account.setup.AccountSetupExternalContract
import app.k9mail.feature.account.setup.AccountSetupExternalContract.AccountCreator.AccountCreatorResult
import com.fsck.k9.Account.FolderMode
import com.fsck.k9.Account.SpecialFolderSelection
import app.k9mail.legacy.account.Account.FolderMode
import app.k9mail.legacy.account.Account.SpecialFolderSelection
import com.fsck.k9.Core
import com.fsck.k9.Preferences
import com.fsck.k9.controller.MessagingController
Expand All @@ -24,7 +24,7 @@ import com.fsck.k9.mailstore.SpecialLocalFoldersCreator
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import com.fsck.k9.Account as K9Account
import app.k9mail.legacy.account.Account as K9Account

// TODO Move to feature/account/setup
class AccountCreator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import app.k9mail.core.common.mail.Protocols
import app.k9mail.feature.account.common.AccountCommonExternalContract
import app.k9mail.feature.account.common.domain.entity.AccountState
import app.k9mail.feature.account.common.domain.entity.AuthorizationState
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.backends.toImapServerSettings
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.ServerSettings
import com.fsck.k9.preferences.AccountManager
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import com.fsck.k9.Account as K9Account
import app.k9mail.legacy.account.Account as K9Account

class AccountStateLoader(
private val accountManager: AccountManager,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fsck.k9.account

import app.k9mail.core.common.mail.Protocols
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account

object DeletePolicyHelper {
fun getDefaultDeletePolicy(type: String): Account.DeletePolicy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.backends

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.mail.oauth.AuthStateStorage
import com.fsck.k9.preferences.AccountManager

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.fsck.k9.backends

import android.content.Context
import com.fsck.k9.Account
import com.fsck.k9.Account.Expunge
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.account.Account.Expunge
import com.fsck.k9.backend.BackendFactory
import com.fsck.k9.backend.api.Backend
import com.fsck.k9.backend.imap.ImapBackend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.backends

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.mail.ServerSettings
import com.fsck.k9.mail.store.imap.ImapStoreSettings
import com.fsck.k9.mail.store.imap.ImapStoreSettings.autoDetectNamespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.backends

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.backend.BackendFactory
import com.fsck.k9.backend.api.Backend
import com.fsck.k9.backend.pop3.Pop3Backend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.content.Intent
import android.net.Uri
import androidx.core.app.PendingIntentCompat
import app.k9mail.feature.launcher.FeatureLauncherActivity
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.K9
import com.fsck.k9.activity.MessageList
import com.fsck.k9.activity.compose.MessageActions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.fsck.k9.notification

import app.k9mail.core.android.common.contact.ContactRepository
import app.k9mail.core.common.mail.toEmailAddressOrNull
import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.K9
import com.fsck.k9.mail.Flag
import com.fsck.k9.mail.K9MailLib
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.fsck.k9.mail.ConnectionSecurity
import com.fsck.k9.mail.ServerSettings
import kotlinx.coroutines.test.runTest
import org.junit.Test
import com.fsck.k9.Account as K9Account
import app.k9mail.legacy.account.Account as K9Account

class AccountServerSettingsUpdaterTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.fsck.k9.account

import app.k9mail.feature.account.common.domain.entity.AccountState
import app.k9mail.feature.account.common.domain.entity.AuthorizationState
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.account.Identity
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isNull
import com.fsck.k9.Account
import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.ConnectionSecurity
import com.fsck.k9.mail.ServerSettings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.fsck.k9.account

import app.k9mail.core.common.mail.Protocols
import app.k9mail.legacy.account.Account
import assertk.assertFailure
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isInstanceOf
import com.fsck.k9.Account
import org.junit.Test

class DeletePolicyHelperTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.account

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.AccountRemovedListener
import com.fsck.k9.AccountsChangeListener
import com.fsck.k9.preferences.AccountManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
package com.fsck.k9

import app.k9mail.legacy.account.Account
import app.k9mail.legacy.account.Account.Companion.DEFAULT_SORT_ASCENDING
import app.k9mail.legacy.account.Account.Companion.DEFAULT_SORT_TYPE
import app.k9mail.legacy.account.Account.Companion.DEFAULT_SYNC_INTERVAL
import app.k9mail.legacy.account.Account.Companion.NO_OPENPGP_KEY
import app.k9mail.legacy.account.Account.Companion.UNASSIGNED_ACCOUNT_NUMBER
import app.k9mail.legacy.account.Account.DeletePolicy
import app.k9mail.legacy.account.Account.Expunge
import app.k9mail.legacy.account.Account.FolderMode
import app.k9mail.legacy.account.Account.MessageFormat
import app.k9mail.legacy.account.Account.QuoteStyle
import app.k9mail.legacy.account.Account.ShowPictures
import app.k9mail.legacy.account.Account.SortType
import app.k9mail.legacy.account.Account.SpecialFolderSelection
import app.k9mail.legacy.account.Identity
import app.k9mail.legacy.notification.NotificationLight
import app.k9mail.legacy.notification.NotificationSettings
import app.k9mail.legacy.notification.NotificationVibration
import app.k9mail.legacy.notification.VibratePattern
import com.fsck.k9.Account.Companion.DEFAULT_SORT_ASCENDING
import com.fsck.k9.Account.Companion.DEFAULT_SORT_TYPE
import com.fsck.k9.Account.Companion.DEFAULT_SYNC_INTERVAL
import com.fsck.k9.Account.Companion.NO_OPENPGP_KEY
import com.fsck.k9.Account.Companion.UNASSIGNED_ACCOUNT_NUMBER
import com.fsck.k9.Account.DeletePolicy
import com.fsck.k9.Account.Expunge
import com.fsck.k9.Account.FolderMode
import com.fsck.k9.Account.MessageFormat
import com.fsck.k9.Account.QuoteStyle
import com.fsck.k9.Account.ShowPictures
import com.fsck.k9.Account.SortType
import com.fsck.k9.Account.SpecialFolderSelection
import com.fsck.k9.helper.Utility
import com.fsck.k9.mailstore.StorageManager
import com.fsck.k9.preferences.Storage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.fsck.k9

import app.k9mail.legacy.account.Account

fun interface AccountRemovedListener {
fun onAccountRemoved(account: Account)
}
3 changes: 2 additions & 1 deletion legacy/core/src/main/java/com/fsck/k9/K9.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package com.fsck.k9

import android.content.Context
import android.content.SharedPreferences
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.account.Account.SortType
import app.k9mail.legacy.di.DI
import app.k9mail.legacy.di.EarlyInit
import app.k9mail.legacy.di.inject
import com.fsck.k9.Account.SortType
import com.fsck.k9.core.BuildConfig
import com.fsck.k9.mail.K9MailLib
import com.fsck.k9.mailstore.LocalStore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fsck.k9

import app.k9mail.legacy.account.Account
import com.fsck.k9.mail.MailServerDirection
import com.fsck.k9.mail.ssl.LocalKeyStore
import java.security.cert.CertificateException
Expand Down
1 change: 1 addition & 0 deletions legacy/core/src/main/java/com/fsck/k9/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.fsck.k9

import androidx.annotation.GuardedBy
import androidx.annotation.RestrictTo
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.di.DI
import com.fsck.k9.mail.MessagingException
import com.fsck.k9.mailstore.LocalStoreProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.backend

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.backend.api.Backend

interface BackendFactory {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.backend

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.backend.api.Backend
import com.fsck.k9.mail.ServerSettings
import java.util.concurrent.CopyOnWriteArraySet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.controller

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account
import com.fsck.k9.K9
import com.fsck.k9.backend.api.Backend
import com.fsck.k9.controller.MessagingControllerCommands.PendingAppend
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fsck.k9.controller

import com.fsck.k9.Account
import app.k9mail.legacy.account.Account

/**
* Decides whether deleting a message in the app moves it to the trash folder or deletes it immediately.
Expand Down
Loading

0 comments on commit b7a64f2

Please sign in to comment.