diff --git a/app/core/src/main/java/com/fsck/k9/K9.kt b/app/core/src/main/java/com/fsck/k9/K9.kt index 9e176d6cd0faba1121e36f14b7a17ce03d5c50da..d6543a22ac7d4246089d9f03621a22f26302dbff 100644 --- a/app/core/src/main/java/com/fsck/k9/K9.kt +++ b/app/core/src/main/java/com/fsck/k9/K9.kt @@ -155,7 +155,7 @@ object K9 : EarlyInit { @JvmStatic var isConfirmMarkAllRead = true - @JvmStatic + @JvmStatic var notificationQuickDeleteBehaviour = NotificationQuickDelete.ALWAYS @JvmStatic @@ -375,7 +375,7 @@ object K9 : EarlyInit { k9Language = storage.getString("language", "") - appTheme = AppTheme.FOLLOW_SYSTEM //storage.getEnum("theme", AppTheme.FOLLOW_SYSTEM) + appTheme = AppTheme.FOLLOW_SYSTEM // storage.getEnum("theme", AppTheme.FOLLOW_SYSTEM) messageViewTheme = storage.getEnum("messageViewTheme", SubTheme.USE_GLOBAL) messageComposeTheme = storage.getEnum("messageComposeTheme", SubTheme.USE_GLOBAL) @@ -523,7 +523,6 @@ object K9 : EarlyInit { ALWAYS, NEVER, WHEN_CHECKED_AUTO_SYNC } - /** * Controls behaviour of delete button in notifications. */ diff --git a/app/core/src/main/java/com/fsck/k9/Preferences.kt b/app/core/src/main/java/com/fsck/k9/Preferences.kt index 549d59e7f973ed156e14bdf639b7b7624bc8c2ec..0bcc7aad5772296d370ef6e9e50766f7b4ffdc7b 100644 --- a/app/core/src/main/java/com/fsck/k9/Preferences.kt +++ b/app/core/src/main/java/com/fsck/k9/Preferences.kt @@ -3,6 +3,7 @@ package com.fsck.k9 import android.content.Context import androidx.annotation.GuardedBy import androidx.annotation.RestrictTo +import com.fsck.k9.helper.sendBlockingSilently import com.fsck.k9.mail.MessagingException import com.fsck.k9.mailstore.LocalStoreProvider import com.fsck.k9.preferences.AccountManager @@ -23,7 +24,6 @@ import kotlinx.coroutines.flow.buffer import kotlinx.coroutines.flow.callbackFlow import kotlinx.coroutines.flow.flowOn import timber.log.Timber -import com.fsck.k9.helper.sendBlockingSilently class Preferences internal constructor( private val storagePersister: StoragePersister, diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessageCountsProvider.kt b/app/core/src/main/java/com/fsck/k9/controller/MessageCountsProvider.kt index 1d3764ce6a9be5a81eabd873fb01cf33f71380f4..3ac2bdb8e323a12622c0ee5868a677118dcaf138 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessageCountsProvider.kt +++ b/app/core/src/main/java/com/fsck/k9/controller/MessageCountsProvider.kt @@ -62,4 +62,4 @@ internal class DefaultMessageCountsProvider( MessageCounts(0, 0) } } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/controller/NotificationState.kt b/app/core/src/main/java/com/fsck/k9/controller/NotificationState.kt index f9878abfb020bc99b3b797d9852695a41c258cff..32306f5b25379b6df311dd7cdb8dd87967239b31 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/NotificationState.kt +++ b/app/core/src/main/java/com/fsck/k9/controller/NotificationState.kt @@ -3,4 +3,4 @@ package com.fsck.k9.controller class NotificationState { @get:JvmName("wasNotified") var wasNotified: Boolean = false -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushController.kt b/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushController.kt index 9688b95db8336277f963eda610f3f1a09411a361..c735c20bc6787ac251b3db3b37785739cc8f3d39 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushController.kt +++ b/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushController.kt @@ -7,13 +7,12 @@ import com.fsck.k9.backend.BackendManager import com.fsck.k9.backend.api.BackendPusher import com.fsck.k9.backend.api.BackendPusherCallback import com.fsck.k9.controller.MessagingController -import com.fsck.k9.mailstore.FolderRepositoryManager +import com.fsck.k9.mailstore.FolderRepository import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.cancel import kotlinx.coroutines.flow.collect -import com.fsck.k9.mailstore.FolderRepository import kotlinx.coroutines.launch import timber.log.Timber @@ -101,4 +100,4 @@ internal class AccountPushController( account.folderPushMode = FolderMode.NONE preferences.saveAccount(account) } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushControllerFactory.kt b/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushControllerFactory.kt index edadccbda4080b1aaff59675adcfb889878e7931..7091496d69ae22a5b744dcc7443cc79cf806bfbf 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushControllerFactory.kt +++ b/app/core/src/main/java/com/fsck/k9/controller/push/AccountPushControllerFactory.kt @@ -1,9 +1,9 @@ package com.fsck.k9.controller.push import com.fsck.k9.Account +import com.fsck.k9.Preferences import com.fsck.k9.backend.BackendManager import com.fsck.k9.controller.MessagingController -import com.fsck.k9.Preferences import com.fsck.k9.mailstore.FolderRepository internal class AccountPushControllerFactory( diff --git a/app/core/src/main/java/com/fsck/k9/mailstore/AutoExpandFolderBackendFoldersRefreshListener.kt b/app/core/src/main/java/com/fsck/k9/mailstore/AutoExpandFolderBackendFoldersRefreshListener.kt index e59b592b9081e1a039fe155bcfe6861cdd0d9a9f..a0d09d1328c244c0f66c4e29a365156206ef71e7 100644 --- a/app/core/src/main/java/com/fsck/k9/mailstore/AutoExpandFolderBackendFoldersRefreshListener.kt +++ b/app/core/src/main/java/com/fsck/k9/mailstore/AutoExpandFolderBackendFoldersRefreshListener.kt @@ -6,7 +6,7 @@ import com.fsck.k9.Preferences /** * Update an Account's auto-expand folder after the folder list has been refreshed. */ -class AutoExpandFolderBackendFoldersRefreshListener( +class AutoExpandFolderBackendFoldersRefreshListener( private val preferences: Preferences, private val account: Account, private val folderRepository: FolderRepository diff --git a/app/core/src/main/java/com/fsck/k9/mailstore/FolderRepository.kt b/app/core/src/main/java/com/fsck/k9/mailstore/FolderRepository.kt index 4629003a5a612e08507170d173af98eeda1dee21..0708e24fc39f2a612a144ed8823cc1d3a65cbac3 100644 --- a/app/core/src/main/java/com/fsck/k9/mailstore/FolderRepository.kt +++ b/app/core/src/main/java/com/fsck/k9/mailstore/FolderRepository.kt @@ -2,6 +2,10 @@ package com.fsck.k9.mailstore import com.fsck.k9.Account import com.fsck.k9.Account.FolderMode +import com.fsck.k9.DI +import com.fsck.k9.controller.MessagingController +import com.fsck.k9.controller.SimpleMessagingListener +import com.fsck.k9.helper.sendBlockingSilently import com.fsck.k9.mail.FolderClass import com.fsck.k9.preferences.AccountManager import kotlinx.coroutines.CoroutineDispatcher @@ -17,16 +21,12 @@ import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map import com.fsck.k9.mail.FolderType as RemoteFolderType -import com.fsck.k9.DI -import com.fsck.k9.controller.MessagingController -import com.fsck.k9.controller.SimpleMessagingListener -import com.fsck.k9.helper.sendBlockingSilently @OptIn(ExperimentalCoroutinesApi::class) class FolderRepository( private val messageStoreManager: MessageStoreManager, private val accountManager: AccountManager, - private val account: Account, + // private val account: Account, private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO ) { private val sortForDisplay = diff --git a/app/core/src/main/java/com/fsck/k9/mailstore/LocalMessage.java b/app/core/src/main/java/com/fsck/k9/mailstore/LocalMessage.java index ca429acffc8818298d7de1b30232347376c0d45a..2d2c2b95d2cf7507be37a70de0fd13324fb13747 100644 --- a/app/core/src/main/java/com/fsck/k9/mailstore/LocalMessage.java +++ b/app/core/src/main/java/com/fsck/k9/mailstore/LocalMessage.java @@ -24,7 +24,7 @@ import com.fsck.k9.mail.internet.AddressHeaderBuilder; import com.fsck.k9.mail.internet.MimeMessage; import com.fsck.k9.mail.message.MessageHeaderParser; import com.fsck.k9.mailstore.LockableDatabase.DbCallback; -import com.fsck.k9.mailstore.LockableDatabase.WrappedException; +//import com.fsck.k9.mailstore.LockableDatabase.WrappedException; import com.fsck.k9.message.extractors.PreviewResult.PreviewType; import timber.log.Timber; diff --git a/app/core/src/main/java/com/fsck/k9/message/extractors/BasicPartInfoExtractor.kt b/app/core/src/main/java/com/fsck/k9/message/extractors/BasicPartInfoExtractor.kt index d8b2d830cedeaecec90189e1dd15a28cdf4411f8..6992a87a4a1bd344786e1e913afb5fd74f76f898 100644 --- a/app/core/src/main/java/com/fsck/k9/message/extractors/BasicPartInfoExtractor.kt +++ b/app/core/src/main/java/com/fsck/k9/message/extractors/BasicPartInfoExtractor.kt @@ -4,7 +4,6 @@ import com.fsck.k9.mail.Part import com.fsck.k9.mail.internet.MimeParameterDecoder import com.fsck.k9.mail.internet.MimeUtility import com.fsck.k9.mail.internet.MimeValue -import java.util.Locale private const val FALLBACK_NAME = "noname" diff --git a/app/core/src/main/java/com/fsck/k9/message/html/UriMatcher.kt b/app/core/src/main/java/com/fsck/k9/message/html/UriMatcher.kt index 4051fb352159e6e19d0c6d41d355e303156c0123..dd19edb4b3dc5411fa35c31e8d1c0645ef0f0a48 100644 --- a/app/core/src/main/java/com/fsck/k9/message/html/UriMatcher.kt +++ b/app/core/src/main/java/com/fsck/k9/message/html/UriMatcher.kt @@ -1,7 +1,5 @@ package com.fsck.k9.message.html -import java.util.Locale - object UriMatcher { private val SUPPORTED_URIS = run { val httpUriParser = HttpUriParser() diff --git a/app/core/src/main/java/com/fsck/k9/notification/BaseNotifications.kt b/app/core/src/main/java/com/fsck/k9/notification/BaseNotifications.kt index 5e3c61f58e75aa2556224c0ba1e1933c6f3e3410..01c09b185ba62be2e6ceaebe4af461657c62c530 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/BaseNotifications.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/BaseNotifications.kt @@ -57,4 +57,4 @@ internal abstract class BaseNotifications( protected open fun createBigTextStyle(builder: NotificationCompat.Builder?): NotificationCompat.BigTextStyle { return NotificationCompat.BigTextStyle(builder) } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/notification/CertificateErrorNotifications.kt b/app/core/src/main/java/com/fsck/k9/notification/CertificateErrorNotifications.kt index aebd29d12aee9a8b25d4063d663cbf75854d3555..36d99a872f87f533b7eee192a0163e5d9ac9921c 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/CertificateErrorNotifications.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/CertificateErrorNotifications.kt @@ -56,4 +56,4 @@ internal open class CertificateErrorNotifications( private val notificationManager: NotificationManagerCompat get() = notificationHelper.getNotificationManager() -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/notification/DeviceNotifications.kt b/app/core/src/main/java/com/fsck/k9/notification/DeviceNotifications.kt index 5a6315be3d486a6ce93727cee5115dc9fe67317d..98b0357a860de5f491354887d86eac23f78f256c 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/DeviceNotifications.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/DeviceNotifications.kt @@ -1,12 +1,10 @@ package com.fsck.k9.notification -import android.app.KeyguardManager import android.app.Notification -import android.content.Context import androidx.core.app.NotificationCompat import com.fsck.k9.Account import com.fsck.k9.K9 -import com.fsck.k9.K9.NotificationHideSubject +// import com.fsck.k9.K9.NotificationHideSubject import com.fsck.k9.K9.NotificationQuickDelete import com.fsck.k9.notification.NotificationGroupKeys.getGroupKey import com.fsck.k9.notification.NotificationIds.getNewMailSummaryNotificationId @@ -23,9 +21,9 @@ internal open class DeviceNotifications( val unreadMessageCount = notificationData.unreadMessageCount val builder = when { - isPrivacyModeActive -> { - createSimpleSummaryNotification(account, unreadMessageCount) - } +// isPrivacyModeActive -> { +// createSimpleSummaryNotification(account, unreadMessageCount) +// } notificationData.isSingleMessageNotification -> { val holder = notificationData.holderForLatestNotification createBigTextStyleSummaryNotification(account, holder) @@ -62,14 +60,14 @@ internal open class DeviceNotifications( val newMailText = resourceProvider.newMailTitle() val unreadMessageCountText = resourceProvider.newMailUnreadMessageCount(unreadMessageCount, accountName) val notificationId = getNewMailSummaryNotificationId(account) - val contentIntent = actionCreator.createViewFolderListPendingIntent(account, notificationId) + // val contentIntent = actionCreator.createViewFolderListPendingIntent(account, notificationId) return createAndInitializeNotificationBuilder(account) .setNumber(unreadMessageCount) .setTicker(newMailText) .setContentTitle(unreadMessageCountText) .setContentText(newMailText) - .setContentIntent(contentIntent) + // .setContentIntent(contentIntent) } private fun createBigTextStyleSummaryNotification( @@ -194,17 +192,16 @@ internal open class DeviceNotifications( builder.addAction(icon, title, replyToMessagePendingIntent) } - private val isPrivacyModeActive: Boolean - get() { - val keyguardService = context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager - val privacyModeAlwaysEnabled = K9.notificationHideSubject === NotificationHideSubject.ALWAYS - val privacyModeEnabledWhenLocked = K9.notificationHideSubject === NotificationHideSubject.WHEN_LOCKED - val screenLocked = keyguardService.inKeyguardRestrictedInputMode() - return privacyModeAlwaysEnabled || privacyModeEnabledWhenLocked && screenLocked - } +// private val isPrivacyModeActive: Boolean +// get() { +// val keyguardService = context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager +// val privacyModeAlwaysEnabled = K9.notificationHideSubject === NotificationHideSubject.ALWAYS +// val privacyModeEnabledWhenLocked = K9.notificationHideSubject === NotificationHideSubject.WHEN_LOCKED +// val screenLocked = keyguardService.inKeyguardRestrictedInputMode() +// return privacyModeAlwaysEnabled || privacyModeEnabledWhenLocked && screenLocked +// } protected open fun createInboxStyle(builder: NotificationCompat.Builder?): NotificationCompat.InboxStyle { return NotificationCompat.InboxStyle(builder) } } - diff --git a/app/core/src/main/java/com/fsck/k9/notification/LockScreenNotification.kt b/app/core/src/main/java/com/fsck/k9/notification/LockScreenNotification.kt index f13e21f3150e661c8f011fd65799b3270a6aca37..f1702ad525f5e4ed113aacab2242ef1803203cc2 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/LockScreenNotification.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/LockScreenNotification.kt @@ -80,4 +80,4 @@ internal class LockScreenNotification( companion object { const val MAX_NUMBER_OF_SENDERS_IN_LOCK_SCREEN_NOTIFICATION = 5 } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationActionCreator.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationActionCreator.kt index 851cfec33f8071eda9d8927eccf5a51e64ae64b6..426ded2b4cd457c6ddd7d401766513edb1fcb382 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationActionCreator.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationActionCreator.kt @@ -14,6 +14,8 @@ interface NotificationActionCreator { notificationId: Int ): PendingIntent + fun createViewFolderListPendingIntent(account: Account, notificationId: Int): PendingIntent + fun createDismissAllMessagesPendingIntent(account: Account, notificationId: Int): PendingIntent fun createDismissMessagePendingIntent( @@ -54,4 +56,3 @@ interface NotificationActionCreator { fun createMarkMessageAsSpamPendingIntent(messageReference: MessageReference, notificationId: Int): PendingIntent } - diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationActionService.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationActionService.kt index a91bf70439edc0da6a3eac738d2c40cd595d2011..3f6ddaac7c6c538ae73b4cc4c5c0a8ae68ac2512 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationActionService.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationActionService.kt @@ -56,8 +56,17 @@ class NotificationActionService : Service() { } } +// private fun deleteMessages(intent: Intent) { +// Timber.i("NotificationActionService deleting messages") +// messagingController.deleteMessages(messageReferences) +// } + private fun deleteMessages(intent: Intent) { Timber.i("NotificationActionService deleting messages") + + val messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES) + val messageReferences = MessageReferenceHelper.toMessageReferenceList(messageReferenceStrings) + messagingController.deleteMessages(messageReferences) } @@ -229,4 +238,3 @@ class NotificationActionService : Service() { } } } - diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationContent.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationContent.kt index 715317387c264f6bac0e2727b816f9b55c8a1f06..ed791dc41b570c522fc87a89cabcb5c1f8b4682d 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationContent.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationContent.kt @@ -9,4 +9,4 @@ internal class NotificationContent( val preview: CharSequence, val summary: CharSequence, val isStarred: Boolean -) \ No newline at end of file +) diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationController.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationController.kt index 4fa4c0c4f4b2a56606166f57c2ef76cc4f24afa0..ee0be2c380b07120974cf3d18823e008e343d74f 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationController.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationController.kt @@ -72,4 +72,4 @@ class NotificationController internal constructor( fun clearNewMailNotifications(account: Account) { newMailNotifications.clearNewMailNotifications(account) } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt index c153ed9cd30c98446549f964e3bc0cb6abfad9e3..9efb9c2d21dd9ea2c7830202fdbdfabbad5ef7c4 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationData.kt @@ -148,4 +148,4 @@ internal class NotificationData(val account: Account, private val initialUnreadM const val MAX_NUMBER_OF_MESSAGES_FOR_SUMMARY_NOTIFICATION = 5 const val MAX_NUMBER_OF_STACKED_NOTIFICATIONS = 8 } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationGroupKeys.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationGroupKeys.kt index 8aa3255f660680dc4fe9aab3b2a1874e0ed3e292..14c150cd27f39c63ef98ac34177ba43f828bbfa8 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationGroupKeys.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationGroupKeys.kt @@ -9,4 +9,4 @@ object NotificationGroupKeys { fun getGroupKey(account: Account): String { return NOTIFICATION_GROUP_KEY_PREFIX + account.accountNumber } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationHelper.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationHelper.kt index e8045884ff0ca3d87647321aee0c418863d71dee..62d693c33855b6acd2c218086499840bab13eefe 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationHelper.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationHelper.kt @@ -35,7 +35,7 @@ class NotificationHelper( if (vibrationPattern != null) { builder.setVibrate(vibrationPattern) } - }else { + } else { builder.setNotificationSilent() } diff --git a/app/core/src/main/java/com/fsck/k9/notification/NotificationHolder.kt b/app/core/src/main/java/com/fsck/k9/notification/NotificationHolder.kt index d89293576465bad98eaf4d1827076209628d9b49..d60dfb635abc9e7a971f02bb8c8c96e585f49b29 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/NotificationHolder.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/NotificationHolder.kt @@ -3,4 +3,4 @@ package com.fsck.k9.notification internal class NotificationHolder( val notificationId: Int, val content: NotificationContent -) \ No newline at end of file +) diff --git a/app/core/src/main/java/com/fsck/k9/notification/SendFailedNotifications.kt b/app/core/src/main/java/com/fsck/k9/notification/SendFailedNotifications.kt index 176704aa1b4920ebd4ec2ed1d7463081222a7198..02e67eb7a33309fa08b9aa13d988d7153d3556dc 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/SendFailedNotifications.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/SendFailedNotifications.kt @@ -15,6 +15,9 @@ internal class SendFailedNotifications( val text = ExceptionHelper.getRootCauseMessage(exception) val notificationId = NotificationIds.getSendFailedNotificationId(account) +// val folderListPendingIntent = actionBuilder.createViewFolderListPendingIntent( +// account, notificationId +// ) val folderListPendingIntent = actionBuilder.createViewFolderListPendingIntent( account, notificationId ) diff --git a/app/core/src/main/java/com/fsck/k9/notification/SyncNotifications.kt b/app/core/src/main/java/com/fsck/k9/notification/SyncNotifications.kt index 4905b23d5ec7da898a83c3a4a7bdc6a8e0eed03a..415cb4b2572c2a4e3e75ee3e725e44041376b61f 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/SyncNotifications.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/SyncNotifications.kt @@ -121,7 +121,7 @@ internal class SyncNotifications( notificationManager.notify(notificationId, notificationBuilder.build()) } - + fun clearFetchingMailNotification(account: Account) { val notificationId = NotificationIds.getFetchingMailNotificationId(account) notificationManager.cancel(notificationId) diff --git a/app/core/src/main/java/com/fsck/k9/notification/WearNotifications.kt b/app/core/src/main/java/com/fsck/k9/notification/WearNotifications.kt index b6df3fe506c0d61c3066963770ce63159a874de1..e456081639479aca6ed3b1cbfd430fa20fa60ce9 100644 --- a/app/core/src/main/java/com/fsck/k9/notification/WearNotifications.kt +++ b/app/core/src/main/java/com/fsck/k9/notification/WearNotifications.kt @@ -67,7 +67,7 @@ internal open class WearNotifications( val action = actionCreator.createDeleteAllPendingIntent(account, messageReferences, notificationId) val deleteAction = NotificationCompat.Action.Builder(icon, title, action).build() - wearableExtender.addAction(deleteAction); + wearableExtender.addAction(deleteAction) wearableExtender.addAction(deleteAction) } @@ -229,4 +229,4 @@ internal open class WearNotifications( protected open fun createMessagingController(): MessagingController { return MessagingController.getInstance(context) } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/power/TracingPowerManager.kt b/app/core/src/main/java/com/fsck/k9/power/TracingPowerManager.kt index 9b410baebeea6a53f078f5f860128cf743f34f45..da69412dea9946b851a7d1f0434e67cad60dd9a8 100644 --- a/app/core/src/main/java/com/fsck/k9/power/TracingPowerManager.kt +++ b/app/core/src/main/java/com/fsck/k9/power/TracingPowerManager.kt @@ -46,7 +46,6 @@ class TracingPowerManager private constructor(context: Context) : PowerManager { startTime = SystemClock.elapsedRealtime() } - this.timeout = timeout } @@ -109,4 +108,4 @@ class TracingPowerManager private constructor(context: Context) : PowerManager { return TracingPowerManager(appContext) } } -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/preferences/KoinModule.kt b/app/core/src/main/java/com/fsck/k9/preferences/KoinModule.kt index b7e1ee3e861c01eadb6d94fd475d1a5c7e6a12e1..8d1ca4c88a633ac335888327a37734678521a2b3 100644 --- a/app/core/src/main/java/com/fsck/k9/preferences/KoinModule.kt +++ b/app/core/src/main/java/com/fsck/k9/preferences/KoinModule.kt @@ -22,4 +22,4 @@ val preferencesModule = module { coroutineScope = get(named("AppCoroutineScope")) ) } bind GeneralSettingsManager::class -} \ No newline at end of file +} diff --git a/app/core/src/main/java/com/fsck/k9/preferences/ServerTypeConverter.kt b/app/core/src/main/java/com/fsck/k9/preferences/ServerTypeConverter.kt index 7f2c77eb3f234db2fdd86445242993b15ccba6d3..9d64def8b3dbe7be3f969c19572faa67accc43d6 100644 --- a/app/core/src/main/java/com/fsck/k9/preferences/ServerTypeConverter.kt +++ b/app/core/src/main/java/com/fsck/k9/preferences/ServerTypeConverter.kt @@ -1,7 +1,5 @@ package com.fsck.k9.preferences -import java.util.Locale - object ServerTypeConverter { @JvmStatic fun toServerSettingsType(exportType: String): String = exportType.lowercase() diff --git a/app/core/src/main/java/com/fsck/k9/preferences/SettingsExporter.kt b/app/core/src/main/java/com/fsck/k9/preferences/SettingsExporter.kt index 35db0adecfde78b63a9c88b1a4437ffc07556589..d0e56370e6016a5b09089aaa75c97dca2f42aae5 100644 --- a/app/core/src/main/java/com/fsck/k9/preferences/SettingsExporter.kt +++ b/app/core/src/main/java/com/fsck/k9/preferences/SettingsExporter.kt @@ -210,7 +210,7 @@ class SettingsExporter( } } - val folderRepository = folderRepositoryManager.getFolderRepository(account) + // val folderRepository = folderRepositoryManager.getFolderRepository(account) writeFolderNameSettings(account, folderRepository, serializer) serializer.endTag(null, SETTINGS_ELEMENT) diff --git a/app/core/src/test/java/com/fsck/k9/message/IdentityHeaderBuilderTest.kt b/app/core/src/test/java/com/fsck/k9/message/IdentityHeaderBuilderTest.kt index 6cefafcdee154f26302d6b5f3c0ec2ededd6157f..2be6075663d483c2f0daaf0a17703bfd3f99f70f 100644 --- a/app/core/src/test/java/com/fsck/k9/message/IdentityHeaderBuilderTest.kt +++ b/app/core/src/test/java/com/fsck/k9/message/IdentityHeaderBuilderTest.kt @@ -53,4 +53,4 @@ class IdentityHeaderBuilderTest : RobolectricTest() { ): Identity { return Identity(description, name, email, signature, signatureUse, replyTo) } -} \ No newline at end of file +} diff --git a/app/core/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.kt b/app/core/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.kt index 51faec84211d5ef9fbb092173f0cf11ab3631f2c..774ccd606723fdffde954744a07d3a4b3683a7fd 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/AuthenticationErrorNotificationsTest.kt @@ -104,4 +104,4 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() { return contentIntent } } -} \ No newline at end of file +} diff --git a/app/core/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.kt b/app/core/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.kt index 869b91218a6e50840a4db1509e29734b0901ba8e..20bbfd3ebba019d0390cc32b89652a0faf490bcf 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/CertificateErrorNotificationsTest.kt @@ -101,4 +101,4 @@ class CertificateErrorNotificationsTest : RobolectricTest() { return contentIntent } } -} \ No newline at end of file +} diff --git a/app/core/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.kt b/app/core/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.kt index cd8d7c60c5834caec93b8fbc13131cbe5a5dfb01..e2e15fdf00f3076dbc76b61a2902736fb7819c97 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/LockScreenNotificationTest.kt @@ -96,7 +96,7 @@ class LockScreenNotificationTest : RobolectricTest() { verify(publicBuilder).setSmallIcon(resourceProvider.iconNewMail) verify(publicBuilder).setNumber(UNREAD_MESSAGE_COUNT) verify(publicBuilder).setContentTitle("$NEW_MESSAGE_COUNT new messages") - verify(builder).setPublicVersion(publicBuilder.build()); + verify(builder).setPublicVersion(publicBuilder.build()) verify(publicBuilder).setContentText( "alice@example.com, Bob , \"Peter Lustig\" " ) @@ -178,4 +178,3 @@ class LockScreenNotificationTest : RobolectricTest() { return NotificationContent(messageReference, sender, "irrelevant", "irrelevant", "irrelevant", false) } } - diff --git a/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.kt b/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.kt index e41b1c94bd3a5acee54bda7b6de5cec8eb8245f2..dd23ae05f03917f671cb6322545dab068ea1441f 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/NewMailNotificationsTest.kt @@ -7,13 +7,11 @@ import com.fsck.k9.K9RobolectricTest import com.fsck.k9.controller.MessageReference import com.fsck.k9.mailstore.LocalMessage import org.junit.Test -import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.ArgumentMatchers.anyInt import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.kotlin.doReturn -import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.stubbing import org.mockito.kotlin.whenever @@ -228,104 +226,100 @@ class NewMailNotificationsTest : K9RobolectricTest() { whenAddingContentReturn(content, AddNotificationResult.newNotification(holder)) newMailNotifications.addNewMailNotification(account, message, 3, silent = false) - newMailNotifications.clearNewMa + newMailNotifications.clearNewMailNotifications(account) + verify(notificationManager).cancel(notificationId) + verify(notificationManager).cancel(NotificationIds.getNewMailSummaryNotificationId(account)) } -} -ilNotifications(account) -verify(notificationManager).cancel(notificationId) -verify(notificationManager).cancel(NotificationIds.getNewMailSummaryNotificationId(account)) -} - -private fun createAccount(): Account { - return mock { - on { accountNumber } doReturn ACCOUNT_NUMBER + private fun createAccount(): Account { + return mock { + on { accountNumber } doReturn ACCOUNT_NUMBER + } } -} -private fun createLocalMessage(): LocalMessage = mock() + private fun createLocalMessage(): LocalMessage = mock() -private fun createNotificationContent(): NotificationContent { - val messageReference = MessageReference("irrelevant", 1, "irrelevant", null) - return NotificationContent(messageReference, "irrelevant", "irrelevant", "irrelevant", "irrelevant", false) -} + private fun createNotificationContent(): NotificationContent { + val messageReference = MessageReference("irrelevant", 1, "irrelevant", null) + return NotificationContent(messageReference, "irrelevant", "irrelevant", "irrelevant", "irrelevant", false) + } -private fun createNotificationHolder(content: NotificationContent, index: Int): NotificationHolder { - val notificationId = NotificationIds.getNewMailStackedNotificationId(account, index) - return NotificationHolder(notificationId, content) -} + private fun createNotificationHolder(content: NotificationContent, index: Int): NotificationHolder { + val notificationId = NotificationIds.getNewMailStackedNotificationId(account, index) + return NotificationHolder(notificationId, content) + } -private fun createNotificationManager(): NotificationManagerCompat = mock() + private fun createNotificationManager(): NotificationManagerCompat = mock() -private fun createNotificationHelper(notificationManager: NotificationManagerCompat): NotificationHelper { - return mock { - on { getNotificationManager() } doReturn notificationManager + private fun createNotificationHelper(notificationManager: NotificationManagerCompat): NotificationHelper { + return mock { + on { getNotificationManager() } doReturn notificationManager + } } -} -private fun createNotificationContentCreator(): NotificationContentCreator = mock() + private fun createNotificationContentCreator(): NotificationContentCreator = mock() -private fun addToNotificationContentCreator(message: LocalMessage, content: NotificationContent) { - stubbing(contentCreator) { - on { createFromMessage(account, message) } doReturn content + private fun addToNotificationContentCreator(message: LocalMessage, content: NotificationContent) { + stubbing(contentCreator) { + on { createFromMessage(account, message) } doReturn content + } } -} -private fun createDeviceNotifications(): DeviceNotifications = mock() + private fun createDeviceNotifications(): DeviceNotifications = mock() -private fun addToDeviceNotifications(notificationToReturn: Notification) { - stubbing(deviceNotifications) { - on { - buildSummaryNotification(eq(account), eq(newMailNotifications.notificationData), anyBoolean()) - } doReturn notificationToReturn + private fun addToDeviceNotifications(notificationToReturn: Notification) { + stubbing(deviceNotifications) { + on { + buildSummaryNotification(eq(account), eq(newMailNotifications.notificationData), anyBoolean()) + } doReturn notificationToReturn + } } -} -private fun createNotification(): Notification = mock() + private fun createNotification(): Notification = mock() -private fun createWearNotifications(): WearNotifications = mock() + private fun createWearNotifications(): WearNotifications = mock() -private fun createMessageReference(number: Int): MessageReference { - return MessageReference("account", 1, number.toString(), null) -} + private fun createMessageReference(number: Int): MessageReference { + return MessageReference("account", 1, number.toString(), null) + } -private fun addToWearNotifications(notificationHolder: NotificationHolder, notificationToReturn: Notification) { - whenever(wearNotifications.buildStackedNotification(account, notificationHolder)) - .thenReturn(notificationToReturn) -} + private fun addToWearNotifications(notificationHolder: NotificationHolder, notificationToReturn: Notification) { + whenever(wearNotifications.buildStackedNotification(account, notificationHolder)) + .thenReturn(notificationToReturn) + } -private fun whenAddingContentReturn(content: NotificationContent, result: AddNotificationResult) { - val notificationData = newMailNotifications.notificationData - val newCount = notificationData.newMessagesCount + 1 - stubbing(notificationData) { - on { addNotificationContent(content) } doReturn result - on { newMessagesCount } doReturn newCount + private fun whenAddingContentReturn(content: NotificationContent, result: AddNotificationResult) { + val notificationData = newMailNotifications.notificationData + val newCount = notificationData.newMessagesCount + 1 + stubbing(notificationData) { + on { addNotificationContent(content) } doReturn result + on { newMessagesCount } doReturn newCount + } } -} -private fun whenRemovingContentReturn(messageReference: MessageReference, result: RemoveNotificationResult) { - stubbing(newMailNotifications.notificationData) { - on { removeNotificationForMessage(messageReference) } doReturn result + private fun whenRemovingContentReturn(messageReference: MessageReference, result: RemoveNotificationResult) { + stubbing(newMailNotifications.notificationData) { + on { removeNotificationForMessage(messageReference) } doReturn result + } } -} -private fun setActiveNotificationIds(vararg notificationIds: Int) { - stubbing(newMailNotifications.notificationData) { - on { getActiveNotificationIds() } doReturn notificationIds + private fun setActiveNotificationIds(vararg notificationIds: Int) { + stubbing(newMailNotifications.notificationData) { + on { getActiveNotificationIds() } doReturn notificationIds + } } -} -internal class TestNewMailNotifications( - notificationHelper: NotificationHelper, - contentCreator: NotificationContentCreator, - messageSummaryNotifications: MessageSummaryNotifications, - singleMessageNotifications: SingleMessageNotifications -) : NewMailNotifications( - notificationHelper, contentCreator, messageSummaryNotifications, singleMessageNotifications -) { - val notificationData = mock() - override fun createNotificationData(account: Account, unreadMessageCount: Int): NotificationData { - return notificationData + internal class TestNewMailNotifications( + notificationHelper: NotificationHelper, + contentCreator: NotificationContentCreator, + messageSummaryNotifications: MessageSummaryNotifications, + singleMessageNotifications: SingleMessageNotifications + ) : NewMailNotifications( + notificationHelper, contentCreator, messageSummaryNotifications, singleMessageNotifications + ) { + val notificationData = mock() + override fun createNotificationData(account: Account, unreadMessageCount: Int): NotificationData { + return notificationData + } } } -} diff --git a/app/core/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.kt b/app/core/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.kt index 17a5aceebb2e10aa7b41c9681fe027c9069943dd..b4efe2f3af58074b754af35f9d300372bdc01d4a 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/NotificationContentCreatorTest.kt @@ -158,4 +158,3 @@ class NotificationContentCreatorTest : RobolectricTest() { } } } - diff --git a/app/core/src/test/java/com/fsck/k9/notification/NotificationDataTest.kt b/app/core/src/test/java/com/fsck/k9/notification/NotificationDataTest.kt index 989048e5f8801250d527cc7bb421b6bfe51a81dd..a52d15627cf260c169790d85a69678596c1105f7 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/NotificationDataTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/NotificationDataTest.kt @@ -283,4 +283,4 @@ class NotificationDataTest : RobolectricTest() { val messageReference = createMessageReference("42") return NotificationContent(messageReference, "", "", "", "", true) } -} \ No newline at end of file +} diff --git a/app/core/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.kt b/app/core/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.kt index d36a830a23a0d701030a20c0e59f882c70246492..80c9e72a97bbf53e35bee445687697286482bd50 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/SendFailedNotificationsTest.kt @@ -83,4 +83,4 @@ class SendFailedNotificationsTest : RobolectricTest() { on { createViewFolderListPendingIntent(any(), anyInt()) } doReturn contentIntent } } -} \ No newline at end of file +} diff --git a/app/core/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.kt b/app/core/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.kt index dfe118fe209e692a9bfb7f8270c29a585a6830f6..b97bd0dc1bf374bb7977122fec9170210b377357 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/SyncNotificationsTest.kt @@ -89,7 +89,6 @@ class SyncNotificationsTest : RobolectricTest() { verify(builder).setVisibility(NotificationCompat.VISIBILITY_PUBLIC) } - @Test fun testClearSendFailedNotification() { val notificationId = getFetchingMailNotificationId(account) @@ -135,4 +134,4 @@ class SyncNotificationsTest : RobolectricTest() { on { name } doReturn FOLDER_NAME } } -} \ No newline at end of file +} diff --git a/app/core/src/test/java/com/fsck/k9/notification/WearNotificationsTest.kt b/app/core/src/test/java/com/fsck/k9/notification/WearNotificationsTest.kt index 624d9157e5667c48130dd6f0452e947ddd115cda..6d9a2fdc4917e3f584cd598b00d5db100dd7b5b0 100644 --- a/app/core/src/test/java/com/fsck/k9/notification/WearNotificationsTest.kt +++ b/app/core/src/test/java/com/fsck/k9/notification/WearNotificationsTest.kt @@ -309,4 +309,4 @@ class WearNotificationsTest : RobolectricTest() { return messagingController } } -} \ No newline at end of file +} diff --git a/app/core/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.kt b/app/core/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.kt index d29f4cd9f9ecdd75b51c87d8aff215d783119b5b..b92e017ba347e0ca4f0e637474d8893e2b3d7fe2 100644 --- a/app/core/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.kt +++ b/app/core/src/test/java/com/fsck/k9/preferences/SettingsExporterTest.kt @@ -2,10 +2,10 @@ package com.fsck.k9.preferences import com.fsck.k9.K9RobolectricTest import com.fsck.k9.Preferences +import com.fsck.k9.mailstore.FolderRepository import java.io.ByteArrayOutputStream import org.jdom2.Document import org.jdom2.input.SAXBuilder -import com.fsck.k9.mailstore.FolderRepository import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Assert.assertNull diff --git a/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt b/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt index 02f56374ff9447ea1f14fdd4c950a2de72e9d497..0098b96e468d38b506cb0ea82f36c08c77af6d4b 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/backends/WebDavBackendFactory.kt @@ -8,7 +8,6 @@ import com.fsck.k9.mail.ssl.TrustManagerFactory import com.fsck.k9.mail.store.webdav.DraftsFolderProvider import com.fsck.k9.mail.store.webdav.WebDavStore import com.fsck.k9.mail.transport.WebDavTransport - import com.fsck.k9.mailstore.FolderRepository import com.fsck.k9.mailstore.K9BackendStorageFactory @@ -33,4 +32,4 @@ class WebDavBackendFactory( folderRepository.getFolderServerId(account, draftsFolderId) ?: error("Couldn't find local Drafts folder") } } -} \ No newline at end of file +} diff --git a/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationActionCreator.kt b/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationActionCreator.kt index 3ad48b74763e5edff0fc8c63dc6fe46a9081d83f..ce5bb48dd8f6f4e1366729287d31dcdc793563df 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationActionCreator.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationActionCreator.kt @@ -233,4 +233,4 @@ internal class K9NotificationActionCreator( return if (messageReferences.all { it.folderId == folderId }) folderId else null } -} \ No newline at end of file +} diff --git a/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationStrategy.kt b/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationStrategy.kt index e9146434dd7a38629df5c4d6e9cc47bfe15b622d..37630d5e9d7ce53d36d3d8886f5353d097bee02b 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationStrategy.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/notification/K9NotificationStrategy.kt @@ -4,12 +4,12 @@ import com.fsck.k9.Account import com.fsck.k9.K9 import com.fsck.k9.helper.Contacts import com.fsck.k9.mail.Flag +import com.fsck.k9.mail.K9MailLib +import com.fsck.k9.mail.Message import com.fsck.k9.mailstore.LocalFolder import com.fsck.k9.mailstore.LocalFolder.isModeMismatch import com.fsck.k9.mailstore.LocalMessage import timber.log.Timber -import com.fsck.k9.mail.K9MailLib -import com.fsck.k9.mail.Message class K9NotificationStrategy(private val contacts: Contacts) : NotificationStrategy { diff --git a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/KoinModule.kt b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/KoinModule.kt index 8eb8d42c188cd2fb0a51ea8a0cb864cede2feb84..1cae6a4fde663232db1c709eca35535b489733c2 100644 --- a/app/k9mail/src/main/java/com/fsck/k9/widget/unread/KoinModule.kt +++ b/app/k9mail/src/main/java/com/fsck/k9/widget/unread/KoinModule.kt @@ -17,4 +17,4 @@ val unreadWidgetModule = module { single { UnreadWidgetUpdater(context = get()) } single { UnreadWidgetUpdateListener(unreadWidgetUpdater = get()) } single { UnreadWidgetMigrations(accountRepository = get(), folderRepository = get()) } -} \ No newline at end of file +} diff --git a/app/k9mail/src/main/res/values/themes.xml b/app/k9mail/src/main/res/values/themes.xml index 3d9a2729b7f1a752c257b657506cf28f88ba6fd9..becc4383ee63f95d2675850a82ae71c91f63dde0 100644 --- a/app/k9mail/src/main/res/values/themes.xml +++ b/app/k9mail/src/main/res/values/themes.xml @@ -50,7 +50,7 @@ @lineageos.platform:drawable/ic_star_filled @lineageos.platform:drawable/ic_star @drawable/ic_opened_envelope - @lineageos.platform:@drawable/ic_mark_new + @drawable/ic_mark_new @drawable/ic_magnify_cloud @lineageos.platform:drawable/ic_add @drawable/ic_arrow_up_down @@ -169,7 +169,7 @@ @lineageos.platform:drawable/ic_star_filled @lineageos.platform:drawable/ic_star @drawable/ic_opened_envelope - @lineageos.platform:drawable/ic_mark_new + @drawable/ic_mark_new @drawable/ic_magnify_cloud @lineageos.platform:drawable/ic_add @drawable/ic_arrow_up_down diff --git a/app/k9mail/src/test/java/com/fsck/k9/widget/unread/UnreadWidgetDataProviderTest.kt b/app/k9mail/src/test/java/com/fsck/k9/widget/unread/UnreadWidgetDataProviderTest.kt index c68eb93cf705c1a9498b290b65598f2a0211afba..e701181fb1c0bf8143d118dda24a6fd60bc462e7 100644 --- a/app/k9mail/src/test/java/com/fsck/k9/widget/unread/UnreadWidgetDataProviderTest.kt +++ b/app/k9mail/src/test/java/com/fsck/k9/widget/unread/UnreadWidgetDataProviderTest.kt @@ -101,7 +101,6 @@ class UnreadWidgetDataProviderTest : AppRobolectricTest() { on { getDefaultFolder(account) } doReturn FOLDER_ID } - fun createFolderRepository(): FolderRepository { return mock { on { getFolder(account, FOLDER_ID) } doReturn FOLDER diff --git a/app/storage/src/main/java/com/fsck/k9/storage/messages/DatabaseOperations.kt b/app/storage/src/main/java/com/fsck/k9/storage/messages/DatabaseOperations.kt index 2aff1365c1316adac9a7a919c8261a2c8229d0eb..1558190c6b4f66fd1a10e1047a29112ec3629632 100644 --- a/app/storage/src/main/java/com/fsck/k9/storage/messages/DatabaseOperations.kt +++ b/app/storage/src/main/java/com/fsck/k9/storage/messages/DatabaseOperations.kt @@ -1,6 +1,5 @@ package com.fsck.k9.storage.messages - import com.fsck.k9.mailstore.LockableDatabase import com.fsck.k9.mailstore.StorageManager import timber.log.Timber @@ -38,4 +37,4 @@ internal class DatabaseOperations( Timber.i("After compaction size = %d", getSize()) } -} \ No newline at end of file +} diff --git a/app/storage/src/main/java/com/fsck/k9/storage/messages/RetrieveFolderOperations.kt b/app/storage/src/main/java/com/fsck/k9/storage/messages/RetrieveFolderOperations.kt index 37e5e49cae4c733b81d7b138356cc67955a24a59..08c5eaebf147a07948d0ed52bc1b546544e06c75 100644 --- a/app/storage/src/main/java/com/fsck/k9/storage/messages/RetrieveFolderOperations.kt +++ b/app/storage/src/main/java/com/fsck/k9/storage/messages/RetrieveFolderOperations.kt @@ -1,6 +1,7 @@ package com.fsck.k9.storage.messages import android.database.Cursor +import androidx.core.database.getLongOrNull import com.fsck.k9.Account.FolderMode import com.fsck.k9.helper.map import com.fsck.k9.mail.FolderClass @@ -10,7 +11,6 @@ import com.fsck.k9.mailstore.FolderMapper import com.fsck.k9.mailstore.LockableDatabase import com.fsck.k9.mailstore.MoreMessages import com.fsck.k9.mailstore.toFolderType -import androidx.core.database.getLongOrNull internal class RetrieveFolderOperations(private val lockableDatabase: LockableDatabase) { fun getFolder(folderId: Long, mapper: FolderMapper): T? { diff --git a/app/storage/src/main/java/com/fsck/k9/storage/messages/SaveMessageOperations.kt b/app/storage/src/main/java/com/fsck/k9/storage/messages/SaveMessageOperations.kt index 827644bfcc9df3891009e37d146e8805ab5a3324..49080c0507355de7b2ea6ec183f7dc27b3aef599 100644 --- a/app/storage/src/main/java/com/fsck/k9/storage/messages/SaveMessageOperations.kt +++ b/app/storage/src/main/java/com/fsck/k9/storage/messages/SaveMessageOperations.kt @@ -28,7 +28,6 @@ import java.io.FileInputStream import java.io.FileOutputStream import java.io.IOException import java.io.InputStream -import java.util.Locale import java.util.Stack import java.util.UUID import org.apache.commons.io.IOUtils diff --git a/app/storage/src/main/java/com/fsck/k9/storage/messages/ThreadMessageOperations.kt b/app/storage/src/main/java/com/fsck/k9/storage/messages/ThreadMessageOperations.kt index cb503dd65ad0f4754b32a39bef2559311da12547..52544b1f4b4fc9b2ea569170b5caacbabd9ee584 100644 --- a/app/storage/src/main/java/com/fsck/k9/storage/messages/ThreadMessageOperations.kt +++ b/app/storage/src/main/java/com/fsck/k9/storage/messages/ThreadMessageOperations.kt @@ -5,7 +5,6 @@ import android.database.sqlite.SQLiteDatabase import com.fsck.k9.helper.Utility import com.fsck.k9.mail.Message import com.fsck.k9.mail.message.MessageHeaderParser -import java.util.Locale internal class ThreadMessageOperations { diff --git a/app/storage/src/main/java/com/fsck/k9/storage/migrations/MigrationTo80.kt b/app/storage/src/main/java/com/fsck/k9/storage/migrations/MigrationTo80.kt index 3cc4cc30c34d618ffed99877f730e85363b6d6e0..c435d9ead49f9714e232022db17aa6b825fbf0f0 100644 --- a/app/storage/src/main/java/com/fsck/k9/storage/migrations/MigrationTo80.kt +++ b/app/storage/src/main/java/com/fsck/k9/storage/migrations/MigrationTo80.kt @@ -9,4 +9,4 @@ internal class MigrationTo80(private val db: SQLiteDatabase) { fun rewriteLastUpdatedColumn() { db.execSQL("UPDATE folders SET last_updated = NULL WHERE last_updated = 0") } -} \ No newline at end of file +} diff --git a/app/testing/src/main/java/com/fsck/k9/testing/MockHelper.kt b/app/testing/src/main/java/com/fsck/k9/testing/MockHelper.kt index 3334063d6182a7723b74f2142d627a6a28097814..17e9e6986e5e593d195b2ed95a3aa6377e9b1e8b 100644 --- a/app/testing/src/main/java/com/fsck/k9/testing/MockHelper.kt +++ b/app/testing/src/main/java/com/fsck/k9/testing/MockHelper.kt @@ -20,4 +20,4 @@ object MockHelper { inline fun mockBuilder(stubbing: KStubbing.(T) -> Unit = {}): T { return mockBuilder(T::class.java).apply { KStubbing(this).stubbing(this) } } -} \ No newline at end of file +} diff --git a/app/ui/base/build.gradle b/app/ui/base/build.gradle index eb7661cc2e74d5d3034427adf2ba9b481376ff15..d3d54778f632a0dc34fd6929ac215f169ce13cea 100644 --- a/app/ui/base/build.gradle +++ b/app/ui/base/build.gradle @@ -14,6 +14,7 @@ dependencies { implementation "androidx.biometric:biometric:${versions.androidxBiometric}" implementation "com.jakewharton.timber:timber:${versions.timber}" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}" + } android { @@ -38,4 +39,5 @@ android { kotlinOptions { jvmTarget = kotlinJvmVersion } + } diff --git a/app/ui/base/src/main/res/color/star_color.xml b/app/ui/base/src/main/res/color/star_color.xml index 63583273b80eaaa76baf7748d04e9cbf1c1ba338..807e52c6f83a9db72e71bdce2136cd7b6519ab2a 100644 --- a/app/ui/base/src/main/res/color/star_color.xml +++ b/app/ui/base/src/main/res/color/star_color.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/ui/base/src/main/res/values/styles.xml b/app/ui/base/src/main/res/values/styles.xml index 72ac1768599686230cd9a4cfe7e38bb990d4bff5..59b27f6b194589ee73c81a489daae098a54cde79 100644 --- a/app/ui/base/src/main/res/values/styles.xml +++ b/app/ui/base/src/main/res/values/styles.xml @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt index 5d5e51f81bfb5972e1644f3c71a8808b7b557597..dd334d0125233910875633db517c01d34bff8594 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt @@ -390,7 +390,6 @@ open class MessageList : noThreading = launchData.noThreading messageReference = launchData.messageReference - return true } @@ -1165,7 +1164,6 @@ open class MessageList : } } - fun setActionBarTitle(title: String, subtitle: String? = null) { actionBar.title = title actionBar.subtitle = subtitle diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.kt index f88fc6f3f0313fd199c04778e5f2e2e51781bb72..99e4d8e7d19ac959d9ef562e60ad19ad0184a976 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientMvpView.kt @@ -214,7 +214,6 @@ class RecipientMvpView(private val activity: MessageCompose) : View.OnFocusChang fun setRecipientExpanderVisibility(visible: Boolean) { val childToDisplay = if (visible) VIEW_INDEX_BCC_EXPANDER_VISIBLE else VIEW_INDEX_BCC_EXPANDER_HIDDEN - if (recipientExpanderContainer.displayedChild != childToDisplay) { recipientExpanderContainer.displayedChild = childToDisplay } @@ -379,10 +378,21 @@ class RecipientMvpView(private val activity: MessageCompose) : View.OnFocusChang bccView.setLoaderManager(loaderManager) } +// enum class CryptoStatusDisplayType(val childIdToDisplay: Int) { +// UNCONFIGURED(VIEW_INDEX_HIDDEN), +// UNINITIALIZED(VIEW_INDEX_HIDDEN), +// SIGN_ONLY(R.id.crypto_status_disabled), +// ENABLED_TRUSTED(R.id.crypto_status_trusted), +// AVAILABLE(R.id.crypto_status_disabled), +// ERROR(R.id.crypto_status_error); +// } enum class CryptoStatusDisplayType(val childIdToDisplay: Int) { UNCONFIGURED(VIEW_INDEX_HIDDEN), UNINITIALIZED(VIEW_INDEX_HIDDEN), SIGN_ONLY(R.id.crypto_status_disabled), + UNAVAILABLE(VIEW_INDEX_HIDDEN), + ENABLED(R.id.crypto_status_enabled), + ENABLED_ERROR(R.id.crypto_status_error), ENABLED_TRUSTED(R.id.crypto_status_trusted), AVAILABLE(R.id.crypto_status_disabled), ERROR(R.id.crypto_status_error); diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt index 7cffd00c61f7243c7d75b88efa7ac02aaa409c29..909c2017a79df3d2bb76bbb1064d596e02a336a3 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.kt @@ -256,7 +256,6 @@ class RecipientPresenter( this.alwaysBccAddresses = alwaysBccAddresses if (alwaysBccAddresses.isEmpty()) return - object : RecipientLoader(context, account.openPgpProvider, *alwaysBccAddresses) { override fun deliverResult(result: List?) { val recipientArray = result!!.toTypedArray() @@ -564,7 +563,6 @@ class RecipientPresenter( return } - if (currentCryptoMode == CryptoMode.SIGN_ONLY) { recipientMvpView.showErrorIsSignOnly() return @@ -584,7 +582,7 @@ class RecipientPresenter( } else { onCryptoModeChanged(CryptoMode.CHOICE_ENABLED) if (showGotIt) { - recipientMvpView.showOpenPgpEncryptExplanationDialog(); + recipientMvpView.showOpenPgpEncryptExplanationDialog() recipientMvpView.showOpenPgpEncryptExplanationDialog() } } @@ -692,8 +690,6 @@ class RecipientPresenter( return true } - - return false } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToPresenter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToPresenter.kt index 63099f0995b908c6b244415a1e8ca3461b3459b4..983ceecce7dbf4e5db66bcf6eeb3767d72703fdf 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToPresenter.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToPresenter.kt @@ -5,7 +5,6 @@ import com.fsck.k9.Identity import com.fsck.k9.mail.Address import com.fsck.k9.mail.Message - private const val STATE_KEY_REPLY_TO_SHOWN = "com.fsck.k9.activity.compose.ReplyToPresenter.replyToShown" class ReplyToPresenter(private val view: ReplyToView) { @@ -20,7 +19,6 @@ class ReplyToPresenter(private val view: ReplyToView) { } } - fun getAddresses(): Array
{ return view.getAddresses() } diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToView.kt b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToView.kt index 2ddb9402d4f63c0582e01dd65fac48e035dacd52..76297080e585b7aef131c9abd7cf1e393a4285b3 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToView.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/activity/compose/ReplyToView.kt @@ -122,4 +122,4 @@ class ReplyToView(activity: MessageCompose) : View.OnClickListener { replyToView.addTextChangedListener(textWatcher) } } -} \ No newline at end of file +} diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactLetterExtractor.kt b/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactLetterExtractor.kt index 3d6e29b44bcfe6b87741f48f684024f08dcdb7e3..3b387a678ac622f0008d215bab205d3de6547805 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactLetterExtractor.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/contacts/ContactLetterExtractor.kt @@ -1,7 +1,6 @@ package com.fsck.k9.contacts import com.fsck.k9.mail.Address -import java.util.Locale class ContactLetterExtractor { fun extractContactLetter(address: Address): String { diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt index 631035cbf60b6d2c73bb0eef843645d092ca6908..e336ed3628c062ba9be218d004ce2c38ac10834d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/K9Drawer.kt @@ -4,7 +4,6 @@ import android.annotation.SuppressLint import android.content.Context import android.content.res.ColorStateList import android.content.res.Resources -import android.graphics.PorterDuff import android.graphics.drawable.Drawable import android.net.Uri import android.os.Bundle @@ -18,7 +17,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.fsck.k9.Account import com.fsck.k9.K9 import com.fsck.k9.activity.MessageList -import com.fsck.k9.controller.MessageCounts import com.fsck.k9.controller.MessagingController import com.fsck.k9.controller.SimpleMessagingListener import com.fsck.k9.mailstore.DisplayFolder @@ -28,7 +26,9 @@ import com.fsck.k9.ui.account.AccountsViewModel import com.fsck.k9.ui.account.DisplayAccount import com.fsck.k9.ui.base.Theme import com.fsck.k9.ui.base.ThemeManager +import com.fsck.k9.ui.folders.DisplayUnifiedInbox import com.fsck.k9.ui.folders.FolderIconProvider +import com.fsck.k9.ui.folders.FolderList import com.fsck.k9.ui.folders.FolderNameFormatter import com.fsck.k9.ui.folders.FoldersViewModel import com.fsck.k9.ui.settings.SettingsActivity @@ -56,8 +56,6 @@ import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.core.component.KoinComponent import org.koin.core.component.inject import org.koin.core.parameter.parametersOf -import com.fsck.k9.ui.folders.FolderList -import com.fsck.k9.ui.folders.DisplayUnifiedInbox private const val UNREAD_SYMBOL = "\u2B24" private const val STARRED_SYMBOL = "\u2605" @@ -137,7 +135,6 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K } } - accountsViewModel.displayAccountsLiveData.observeNotNull(parent) { accounts -> setAccounts(accounts) } @@ -374,7 +371,7 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K folderList.unifiedInbox?.let { unifiedInbox -> val unifiedInboxItem = PrimaryDrawerItem().apply { - //THERE BEFORE iconRes = getResId(R.attr.iconUnifiedInbox) + // THERE BEFORE iconRes = getResId(R.attr.iconUnifiedInbox) iconRes = R.drawable.ic_inbox_multiple identifier = DRAWER_ID_UNIFIED_INBOX nameRes = R.string.integrated_inbox_title @@ -385,7 +382,6 @@ class K9Drawer(private val parent: MessageList, savedInstanceState: Bundle?) : K badgeText = text badgeStyle = folderBadgeStyle } - } sliderView.addItems(unifiedInboxItem) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/AccountImageLoader.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/AccountImageLoader.kt index 5097a21bad88610ee7e1b34aa572a9f5cc726aef..1db03ec74de2418f371f165460870c90f0b8a171 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/AccountImageLoader.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/AccountImageLoader.kt @@ -34,4 +34,4 @@ class AccountImageLoader(private val accountFallbackImageProvider: AccountFallba block(this) } } -} \ No newline at end of file +} diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/DisplayAccount.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/DisplayAccount.kt index 982a5af3f860ffab071ea386470cbc6a5b8491a6..ef0e30b9d52f5bb9174b749566b3f48a918aba7e 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/DisplayAccount.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/account/DisplayAccount.kt @@ -1,10 +1,9 @@ package com.fsck.k9.ui.account import com.fsck.k9.Account -import com.fsck.k9.controller.MessageCounts data class DisplayAccount( val account: Account, val unreadMessageCount: Int, val starredMessageCount: Int -) \ No newline at end of file +) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderViewModel.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderViewModel.kt index 2007ba05c91d8ee70f8fe8e31f0bf3475250a39f..7b1d1a49c8d0d4d3924fab515a922d92192cfae6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderViewModel.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/choosefolder/ChooseFolderViewModel.kt @@ -35,4 +35,4 @@ class ChooseFolderViewModel(private val folderRepository: FolderRepository) : Vi } } -private data class DisplayMode(val account: Account, val displayMode: FolderMode) \ No newline at end of file +private data class DisplayMode(val account: Account, val displayMode: FolderMode) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FoldersViewModel.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FoldersViewModel.kt index 7a42b42da69d2e1da533d1870ae9bb68d2a03f41..87e9256dda0ae97678ac5e1ae60ddfddd2299eeb 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FoldersViewModel.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/FoldersViewModel.kt @@ -1,25 +1,24 @@ package com.fsck.k9.ui.folders import androidx.lifecycle.LiveData -import androidx.lifecycle.MediatorLiveData import androidx.lifecycle.ViewModel -import com.fsck.k9.Account -import com.fsck.k9.mailstore.DisplayFolder import androidx.lifecycle.asLiveData import androidx.lifecycle.viewModelScope +import com.fsck.k9.Account +import com.fsck.k9.K9 +import com.fsck.k9.controller.MessageCountsProvider +import com.fsck.k9.mailstore.DisplayFolder import com.fsck.k9.mailstore.FolderRepository +import com.fsck.k9.search.SearchAccount +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf -import kotlinx.coroutines.launch import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map -import com.fsck.k9.search.SearchAccount -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.Dispatchers -import com.fsck.k9.K9 -import com.fsck.k9.controller.MessageCountsProvider +import kotlinx.coroutines.launch @OptIn(ExperimentalCoroutinesApi::class) class FoldersViewModel( @@ -73,4 +72,4 @@ data class FolderList( data class DisplayUnifiedInbox( val unreadMessageCount: Int, val starredMessageCount: Int -) \ No newline at end of file +) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/KoinModule.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/KoinModule.kt index c7f6e029d3d52b2983db89110965755c684038af..083b6c82742ebdbff0194cefd25be0c52318bdf3 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/KoinModule.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/folders/KoinModule.kt @@ -8,4 +8,4 @@ val foldersUiModule = module { single { FolderNameFormatterFactory() } factory { (context: Context) -> FolderNameFormatter(context.resources) } viewModel { FoldersViewModel(folderRepository = get(), messageCountsProvider = get()) } -} \ No newline at end of file +} diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/FolderSettingsDataStore.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/FolderSettingsDataStore.kt index d6938b94c80387718e4a62ad76b1c2715bfc96a7..4775b493a9e1733084947a2c1b9893a41c7970dc 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/FolderSettingsDataStore.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/FolderSettingsDataStore.kt @@ -1,19 +1,19 @@ package com.fsck.k9.ui.managefolders import androidx.preference.PreferenceDataStore +import com.fsck.k9.Account import com.fsck.k9.mail.FolderClass import com.fsck.k9.mailstore.FolderDetails import com.fsck.k9.mailstore.FolderRepository import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope -import com.fsck.k9.Account import kotlinx.coroutines.launch class FolderSettingsDataStore( private val folderRepository: FolderRepository, - private var folder: FolderDetails, - private val account: Account + private val account: Account, + private var folder: FolderDetails ) : PreferenceDataStore() { private val saveScope = CoroutineScope(GlobalScope.coroutineContext + Dispatchers.IO) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersViewModel.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersViewModel.kt index 4c898ef8be2ff168c46f920cd87f7da85d19ca42..8b0d310cd2ae838d93c664912d61885e712085da 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersViewModel.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/managefolders/ManageFoldersViewModel.kt @@ -11,4 +11,4 @@ class ManageFoldersViewModel(private val folderRepository: FolderRepository) : V fun getFolders(account: Account): LiveData> { return folderRepository.getDisplayFoldersFlow(account).asLiveData() } -} \ No newline at end of file +} diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt index 35363db1406cb9297d6893554d878687eb60e4db..6721ba79acbeb206aee514b6d1f1797b121f254d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt @@ -409,4 +409,4 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr PreferenceFragmentCompat.ARG_PREFERENCE_ROOT to rootKey ) } -} \ No newline at end of file +} diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsViewModel.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsViewModel.kt index dc1c2c44b5fa55c946bb69f41c3e8b28e1f7ea60..8214b2615e0417144e9c72e0ff9f7c1b682beec6 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsViewModel.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsViewModel.kt @@ -70,7 +70,6 @@ class AccountSettingsViewModel( foldersLiveData.value = remoteFolderInfo } } - } private fun getAutomaticSpecialFolders(folders: List): Map { return mapOf( diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageCryptoDisplayStatus.kt b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageCryptoDisplayStatus.kt index 68269f64124fd0710d88af3824faf69b927864b0..4e157fd63c58f8a4541059c18677b1220d960522 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageCryptoDisplayStatus.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/view/MessageCryptoDisplayStatus.kt @@ -1,4 +1,4 @@ -package com.fsck.k9.view; +package com.fsck.k9.view import androidx.annotation.AttrRes import androidx.annotation.DrawableRes @@ -322,4 +322,4 @@ enum class MessageCryptoDisplayStatus( } } } -} \ No newline at end of file +} diff --git a/app/ui/legacy/src/main/res/drawable/btn_check_star.xml b/app/ui/legacy/src/main/res/drawable/btn_check_star.xml index 339bb252837165e0634daf2ded1dc805e41f9175..a1176e5a08a903fb0732386fd42c0c63a7f89e3f 100644 --- a/app/ui/legacy/src/main/res/drawable/btn_check_star.xml +++ b/app/ui/legacy/src/main/res/drawable/btn_check_star.xml @@ -1,5 +1,6 @@ - - + + + diff --git a/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.kt b/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.kt index a6fbaa8b9bf607256be70280827a15b7ff5c909e..6d9400cec35e30575c2e4ed216b48f2f3c46255e 100644 --- a/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.kt +++ b/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/RecipientPresenterTest.kt @@ -278,7 +278,6 @@ class RecipientPresenterTest : K9RobolectricTest() { assertThat(Robolectric.getBackgroundThreadScheduler().runOneTask()).isTrue() } - private fun setupCryptoProvider(autocryptStatusResult: RecipientAutocryptStatus) { stubbing(account) { on { openPgpProvider } doReturn CRYPTO_PROVIDER diff --git a/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/ReplyToPresenterTest.kt b/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/ReplyToPresenterTest.kt index 2dec377f39a0048bb208935e5d3725bff07bb8d8..ae60ab5020b299db52a0e4487d99ee1a8c505d49 100644 --- a/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/ReplyToPresenterTest.kt +++ b/app/ui/legacy/src/test/java/com/fsck/k9/activity/compose/ReplyToPresenterTest.kt @@ -4,10 +4,8 @@ import android.os.Bundle import com.fsck.k9.Identity import com.fsck.k9.K9RobolectricTest import com.fsck.k9.mail.Address - import com.google.common.truth.Truth.assertThat import org.junit.Test - import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock import org.mockito.kotlin.never @@ -119,7 +117,6 @@ class ReplyToPresenterTest : K9RobolectricTest() { on { isVisible } doReturn false } - replyToPresenter.onNonRecipientFieldFocused() verify(view, never()).isVisible = false @@ -134,4 +131,4 @@ class ReplyToPresenterTest : K9RobolectricTest() { replyToPresenter.onNonRecipientFieldFocused() verify(view, never()).isVisible = false } -} \ No newline at end of file +} diff --git a/app/ui/legacy/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.kt b/app/ui/legacy/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.kt index b0f96c5daecf76c0c96cc2dd39b3363cc84d6b5a..3e05048bb0f770972ba737d98a7fb643e2d49726 100644 --- a/app/ui/legacy/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.kt +++ b/app/ui/legacy/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.kt @@ -46,11 +46,11 @@ import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.eq import org.mockito.ArgumentMatchers.same -import org.mockito.Mockito.`when` import org.mockito.Mockito.mock import org.mockito.Mockito.spy import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions +import org.mockito.Mockito.`when` import org.mockito.kotlin.anyOrNull import org.openintents.openpgp.OpenPgpApiManager.OpenPgpProviderState import org.openintents.openpgp.OpenPgpError diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt index e5c664041f94558a501d516ee6004c0566cca670..96c68da54ee006477e0fbb861818963f9f5ae51d 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapBackendPusher.kt @@ -249,4 +249,4 @@ internal class ImapBackendPusher( updateFolders() } -} \ No newline at end of file +} diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapFolderPusher.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapFolderPusher.kt index 75aa2ed86a57c96ef699b0bfa17b14d8ec307862..d26296d02787d723972ce9555a6d9f1f5d0e30bc 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapFolderPusher.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapFolderPusher.kt @@ -51,7 +51,6 @@ class ImapFolderPusher( folderIdler?.stop() } - private fun runPushLoop() { val wakeLock = powerManager.newWakeLock("ImapFolderPusher-$accountName-$folderServerId") wakeLock.acquire() @@ -98,4 +97,4 @@ class ImapFolderPusher( private fun performInitialSync() { callback.onPushEvent(folderServerId) } -} \ No newline at end of file +} diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapPusherCallback.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapPusherCallback.kt index 76f5ecac98d847598f2d26d5f0802de1bdb0f625..642668e62c46199057da98ab99953a6078e8062d 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapPusherCallback.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapPusherCallback.kt @@ -4,4 +4,4 @@ interface ImapPusherCallback { fun onPushEvent(folderServerId: String) fun onPushError(folderServerId: String, exception: Exception) fun onPushNotSupported() -} \ No newline at end of file +} diff --git a/build.gradle b/build.gradle index 5a48090a36b562c38999d9ba0a5b67be1536d669..cbd493fab0af9ab2a5caa83c35e17aeef68811e1 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ buildscript { 'mockitoKotlin': '3.1.0', 'truth': '1.1.2', - 'ktlint': '0.40.0' + 'ktlint': '0.43.2' ] javaVersion = JavaVersion.VERSION_1_8 @@ -65,7 +65,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:4.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" - classpath "org.jlleitschuh.gradle:ktlint-gradle:10.0.0" + classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.0" } } diff --git a/mail/common/src/main/java/com/fsck/k9/mail/MimeType.kt b/mail/common/src/main/java/com/fsck/k9/mail/MimeType.kt index 4d02bdcf12162888c718ab452d4fafd649ffeea3..33122ad0f69163bca5f5512da0467e5b932f81b0 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/MimeType.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/MimeType.kt @@ -1,7 +1,5 @@ package com.fsck.k9.mail -import java.util.Locale - class MimeType private constructor( val type: String, val subtype: String diff --git a/mail/common/src/main/java/com/fsck/k9/mail/ServerSettings.kt b/mail/common/src/main/java/com/fsck/k9/mail/ServerSettings.kt index 893699e906b0cbc6d23606d1dcb39d42fca16f89..d73a2aadaff7762677d6d0cfc1b1cb93be0bc113 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/ServerSettings.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/ServerSettings.kt @@ -1,7 +1,5 @@ package com.fsck.k9.mail -import java.util.Locale - /** * Container for incoming or outgoing server settings */ diff --git a/mail/common/src/main/java/com/fsck/k9/mail/internet/FormatFlowedHelper.kt b/mail/common/src/main/java/com/fsck/k9/mail/internet/FormatFlowedHelper.kt index 6ebe5c4c9942433714a1083c1a25404259abbf3d..65efd9c394c762a908d865217011ffe858b7776f 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/internet/FormatFlowedHelper.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/internet/FormatFlowedHelper.kt @@ -1,7 +1,5 @@ package com.fsck.k9.mail.internet -import java.util.Locale - internal object FormatFlowedHelper { private const val TEXT_PLAIN = "text/plain" private const val HEADER_PARAM_FORMAT = "format" @@ -21,7 +19,6 @@ internal object FormatFlowedHelper { val delSpParameter = mimeValue.parameters[HEADER_PARAM_DELSP]?.lowercase() - return FormatFlowedResult(isFormatFlowed = true, isDelSp = delSpParameter == HEADER_DELSP_YES) } diff --git a/mail/common/src/main/java/com/fsck/k9/mail/internet/MessageIdGenerator.kt b/mail/common/src/main/java/com/fsck/k9/mail/internet/MessageIdGenerator.kt index a365ee2d4c047a20862c800e7ff8f0a786d756f9..286a6431fd042ee170f9b28b4b6751a5d28e9a98 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/internet/MessageIdGenerator.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/internet/MessageIdGenerator.kt @@ -2,7 +2,6 @@ package com.fsck.k9.mail.internet import com.fsck.k9.mail.Address import com.fsck.k9.mail.Message -import java.util.Locale import java.util.UUID class MessageIdGenerator(private val uuidGenerator: UuidGenerator) { @@ -31,4 +30,4 @@ class K9UuidGenerator : UuidGenerator { // We use upper case here to match Apple Mail Message-ID format (for privacy) return UUID.randomUUID().toString().uppercase() } -} \ No newline at end of file +} diff --git a/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeExtensions.kt b/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeExtensions.kt index a0e58e3d4e480d544f8d15045cc9e4825abacb5c..093a57cbfaf1ec95306526e2f94df0c3fc858768 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeExtensions.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeExtensions.kt @@ -60,4 +60,3 @@ internal fun Char.isAText() = isALPHA() || isDIGIT() || this in ATEXT_SPECIAL // RFC 5322: Printable US-ASCII characters not including "[", "]", or "\" // dtext = %d33-90 / %d94-126 / obs-dtext internal fun Char.isDText() = code.let { it in 33..90 || it in 94..126 } - diff --git a/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeParameterDecoder.kt b/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeParameterDecoder.kt index be5c39845bc23d8bc3ffd733acd1ecf73174a5fd..7dcf29a6d6a35cfe3097cd7716c2373a38b52d12 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeParameterDecoder.kt +++ b/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeParameterDecoder.kt @@ -2,7 +2,6 @@ package com.fsck.k9.mail.internet import java.nio.charset.Charset import java.nio.charset.IllegalCharsetNameException -import java.util.Locale import okio.Buffer private typealias Parameters = Map diff --git a/mail/common/src/test/java/com/fsck/k9/mail/internet/FormatFlowedHelperTest.kt b/mail/common/src/test/java/com/fsck/k9/mail/internet/FormatFlowedHelperTest.kt index 7099e534bd9b97ec0fa3a1e55aa1f13f235667d5..145292db7d609dd9fe1e3c88ef364143008f6238 100644 --- a/mail/common/src/test/java/com/fsck/k9/mail/internet/FormatFlowedHelperTest.kt +++ b/mail/common/src/test/java/com/fsck/k9/mail/internet/FormatFlowedHelperTest.kt @@ -55,4 +55,3 @@ class FormatFlowedHelperTest { assertThat(result.isDelSp).isFalse() } } -