Skip to content

Commit a402126

Browse files
authored
wip (#2997)
1 parent 43726b6 commit a402126

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

FlowCrypt/src/main/java/com/flowcrypt/email/api/email/gmail/GmailHistoryHandler.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ object GmailHistoryHandler {
154154
localFolder = localFolder,
155155
threads = uniqueThreadIdList.map { Thread().apply { id = it } },
156156
format = GmailApiHelper.RESPONSE_FORMAT_FULL
157-
)
157+
).run {
158+
takeIf { accountEntity.showOnlyEncrypted != true } ?: filter { it.hasPgpThings }
159+
}
158160

159161
val threadsToBeAdded = gmailThreadInfoList
160162
.filter { it.id !in existingThreadIds }
@@ -274,9 +276,7 @@ object GmailHistoryHandler {
274276
context, accountEntity,
275277
newCandidates.toList(), localFolder
276278
).run {
277-
if (accountEntity.showOnlyEncrypted == true) {
278-
filter { it.hasPgp() }
279-
} else this
279+
takeIf { accountEntity.showOnlyEncrypted != true } ?: filter { it.hasPgp() }
280280
}
281281

282282
val draftIdsMap = if (localFolder.isDrafts) {

FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/workmanager/sync/SyncDraftsWorker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class SyncDraftsWorker(context: Context, params: WorkerParameters) :
7272
label = folderDrafts.fullName,
7373
msgsList = msgs,
7474
isNew = false,
75-
onlyPgpModeEnabled = accountEntity.showOnlyEncrypted ?: false,
75+
onlyPgpModeEnabled = accountEntity.showOnlyEncrypted == true,
7676
draftIdsMap = newDrafts.associateBy({ it.message.id }, { it.id })
7777
)
7878

FlowCrypt/src/main/java/com/flowcrypt/email/service/MessagesNotificationManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class MessagesNotificationManager(context: Context) : CustomNotificationManager(
105105
SharedPreferencesHelper.getString(
106106
PreferenceManager.getDefaultSharedPreferences(context),
107107
Constants.PREF_KEY_MESSAGES_NOTIFICATION_FILTER, ""
108-
)
108+
) || account.showOnlyEncrypted == true
109109

110110
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
111111
prepareAndShowMsgGroup(context, account, localFolder, manager, msgs)
@@ -170,7 +170,7 @@ class MessagesNotificationManager(context: Context) : CustomNotificationManager(
170170
SharedPreferencesHelper.getString(
171171
PreferenceManager.getDefaultSharedPreferences(context),
172172
Constants.PREF_KEY_MESSAGES_NOTIFICATION_FILTER, ""
173-
)
173+
) || account.showOnlyEncrypted == true
174174

175175
if (isEncryptedModeEnabled) {
176176
var isEncryptedMsgFound = false

0 commit comments

Comments
 (0)