Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Spotless #7328

Merged
merged 5 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class GenericUriParserTest {
assertUriValid("xmpp:[email protected]?message")
assertUriValid("xmpp:[email protected]?message;subject=Hello%20World")
assertUriValid("xmpp:nasty!%23\$%25()*+,-.;=%3F%5B%5C%5D%5E_%60%7B%7C%[email protected]")
assertUriValid("xmpp:[email protected]/repulsive%20!%23%22\$%25&'()*+,-.%2F:;%3C=%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D~resource")
assertUriValid(
"xmpp:[email protected]/repulsive" +
"%20!%23%22\$%25&'()*+,-.%2F:;%3C=%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D~resource",
)
assertUriValid("xmpp:ji%C5%99i@%C4%8Dechy.example/v%20Praze")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ internal class MigrationTo70(private val db: SQLiteDatabase) {

private fun recreateFoldersTriggers() {
db.execSQL("DROP TRIGGER IF EXISTS delete_folder")
db.execSQL("CREATE TRIGGER delete_folder BEFORE DELETE ON folders BEGIN DELETE FROM messages WHERE old.id = folder_id; END;")
db.execSQL(
"CREATE TRIGGER delete_folder " +
"BEFORE DELETE ON folders " +
"BEGIN " +
"DELETE FROM messages WHERE old.id = folder_id; " +
"END;",
)

db.execSQL("DROP TRIGGER IF EXISTS delete_folder_extra_values")
db.execSQL(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ internal class MigrationTo84(private val db: SQLiteDatabase) {

fun rewriteAddresses() {
val addressSets = db.rawQuery(
"SELECT id, to_list, cc_list, bcc_list, reply_to_list, sender_list FROM messages WHERE empty = 0 AND deleted = 0",
"SELECT id, to_list, cc_list, bcc_list, reply_to_list, sender_list " +
"FROM messages WHERE empty = 0 AND deleted = 0",
null,
).use { cursor ->
cursor.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.fsck.k9.message.AutocryptStatusInteractor
import com.fsck.k9.message.AutocryptStatusInteractor.RecipientAutocryptStatus
import com.fsck.k9.message.CryptoStatus
import com.fsck.k9.view.RecipientSelectView.Recipient
import org.openintents.openpgp.OpenPgpApiManager
import org.openintents.openpgp.OpenPgpApiManager.OpenPgpProviderState

/** This is an immutable object which contains all relevant metadata entered
Expand Down Expand Up @@ -76,10 +75,10 @@ data class ComposeCryptoStatus(
val recipientAddressesAsArray = recipientAddresses.toTypedArray()

private val displayTypeFromProviderError = when (openPgpProviderState) {
OpenPgpApiManager.OpenPgpProviderState.OK -> null
OpenPgpApiManager.OpenPgpProviderState.UNCONFIGURED -> CryptoStatusDisplayType.UNCONFIGURED
OpenPgpApiManager.OpenPgpProviderState.UNINITIALIZED -> CryptoStatusDisplayType.UNINITIALIZED
OpenPgpApiManager.OpenPgpProviderState.ERROR, OpenPgpApiManager.OpenPgpProviderState.UI_REQUIRED -> CryptoStatusDisplayType.ERROR
OpenPgpProviderState.OK -> null
OpenPgpProviderState.UNCONFIGURED -> CryptoStatusDisplayType.UNCONFIGURED
OpenPgpProviderState.UNINITIALIZED -> CryptoStatusDisplayType.UNINITIALIZED
OpenPgpProviderState.ERROR, OpenPgpProviderState.UI_REQUIRED -> CryptoStatusDisplayType.ERROR
}

private val displayTypeFromAutocryptError = when (recipientAutocryptStatusType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ class JmapBackend(
return messageServerIds.associateWith { it }
}

override fun moveMessagesAndMarkAsRead(sourceFolderServerId: String, targetFolderServerId: String, messageServerIds: List<String>): Map<String, String>? {
override fun moveMessagesAndMarkAsRead(
sourceFolderServerId: String,
targetFolderServerId: String,
messageServerIds: List<String>,
): Map<String, String>? {
commandMove.moveMessagesAndMarkAsRead(targetFolderServerId, messageServerIds)
return messageServerIds.associateWith { it }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ inline fun <reified STATE, EVENT, EFFECT> UnidirectionalViewModel<STATE, EVENT,
*/
@Suppress("MaxLineLength")
@Composable
inline fun <reified STATE, EVENT, EFFECT> UnidirectionalViewModel<STATE, EVENT, EFFECT>.observeWithoutEffect(): StateDispatch<STATE, EVENT> {
inline fun <reified STATE, EVENT, EFFECT> UnidirectionalViewModel<STATE, EVENT, EFFECT>.observeWithoutEffect(
// no effect handler
): StateDispatch<STATE, EVENT> {
val collectedState = state.collectAsStateWithLifecycle()
val dispatch: (EVENT) -> Unit = { event(it) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ class BoundaryGeneratorTest {

@Test
fun generateBoundary() {
val random = createRandom(
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 35,
)
val seed = IntRange(0, 28).toList().toIntArray()

val random = createRandom(*seed, 35)

Comment on lines +22 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note (for future changes): I think it's useful when tests are separated into arrange, act, assert blocks. Most of the time this separation can be easily achieved by using an empty line between the blocks. By introducing additional empty lines, this change makes it somewhat harder to figure out at a glance which lines belong to which block.

val boundaryGenerator = BoundaryGenerator(random)

val result = boundaryGenerator.generateBoundary()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,9 +970,12 @@ internal class RealImapFolder(

val encodeFolderName = folderNameCodec.encode(prefixedName)
val escapedFolderName = ImapUtility.encodeString(encodeFolderName)
val canCreateForwardedFlag = canCreateKeywords ||
internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)

val combinedFlags = ImapUtility.combineFlags(
message.flags,
canCreateKeywords || internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED),
canCreateForwardedFlag,
)
val command = String.format(
Locale.US,
Expand Down Expand Up @@ -1101,7 +1104,9 @@ internal class RealImapFolder(
open(OpenMode.READ_WRITE)
checkOpen()

val canCreateForwardedFlag = canCreateKeywords || internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
val canCreateForwardedFlag = canCreateKeywords ||
internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)

try {
val combinedFlags = ImapUtility.combineFlags(flags, canCreateForwardedFlag)
val command = String.format(
Expand All @@ -1123,7 +1128,8 @@ internal class RealImapFolder(
checkOpen()

val uids = messages.map { it.uid.toLong() }.toSet()
val canCreateForwardedFlag = canCreateKeywords || internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
val canCreateForwardedFlag = canCreateKeywords ||
internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
val combinedFlags = ImapUtility.combineFlags(flags, canCreateForwardedFlag)
val commandSuffix = String.format("%sFLAGS.SILENT (%s)", if (value) "+" else "-", combinedFlags)
try {
Expand Down