-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: configure notification actions #10301
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
Open
harshad1
wants to merge
30
commits into
thunderbird:main
Choose a base branch
from
harshad1:configure_notification_actions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,425
−218
Open
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
67591fe
Working system
harshad1 8dfa32e
Changing multi-message delete option, adding files
harshad1 cf756cb
Wording
harshad1 93f7534
Format fixes
harshad1 df61390
No drag divider
harshad1 d639bcf
Drag behavior updates
harshad1 cfcc6fc
Added star, moved options to common source of truth
harshad1 8f30fa8
Accessability
harshad1 4ca60d3
Merge branch 'main' into configure_notification_actions
harshad1 e92f230
Merge remote-tracking branch 'upstream/main' into configure_notificat…
harshad1 79737ee
Added files
harshad1 e8ccdb6
Fixes for tests
harshad1 8485cef
Using standard spacings and dispose strategy
harshad1 5e83c51
Removed old changes
harshad1 c9971e8
Updated for single source of order truth
harshad1 dd3de9d
Merge branch 'main' into configure_notification_actions
harshad1 f1c6358
Unified to list handling directly
harshad1 b7ee310
initial move to full compose
harshad1 0c259e6
Revert to recycler
harshad1 847c769
Initial working compose dragger
harshad1 8bb05e1
Split the control
harshad1 cb6fedd
Pure compose drag ui
harshad1 d3867a1
Tweaked the controller
harshad1 70cae11
Merge remote-tracking branch 'upstream/main' into configure_notificat…
harshad1 062d742
Cleaner swipe
harshad1 8d8bd3a
cleanups
harshad1 3ac43eb
Fixing and reorganizing to address lint issues
harshad1 8f27f4d
Merge branch 'main' into configure_notification_actions
harshad1 b69b273
multiple message delete option re-added
harshad1 95a2ae5
Fix test check
harshad1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...rc/commonMain/kotlin/net/thunderbird/core/common/notification/NotificationActionTokens.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package net.thunderbird.core.common.notification | ||
|
|
||
| /** | ||
| * Token strings used to persist notification action ordering. | ||
| */ | ||
| object NotificationActionTokens { | ||
| const val REPLY = "reply" | ||
| const val MARK_AS_READ = "mark_as_read" | ||
| const val DELETE = "delete" | ||
| const val STAR = "star" | ||
| const val ARCHIVE = "archive" | ||
| const val SPAM = "spam" | ||
|
|
||
| val DEFAULT_ORDER: List<String> = listOf(REPLY, MARK_AS_READ, DELETE, STAR, ARCHIVE, SPAM) | ||
|
|
||
| fun parseOrder(raw: String): List<String> { | ||
| return raw | ||
| .split(',') | ||
| .map { it.trim() } | ||
| .filter { it.isNotEmpty() } | ||
| } | ||
|
|
||
| fun serializeOrder(tokens: List<String>): String = tokens.joinToString(separator = ",") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
legacy/core/src/main/java/com/fsck/k9/notification/NotificationActionIntents.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| package com.fsck.k9.notification | ||
|
|
||
| import android.content.Context | ||
| import android.content.Intent | ||
| import app.k9mail.legacy.message.controller.MessageReference | ||
| import com.fsck.k9.controller.MessageReferenceHelper | ||
| import net.thunderbird.core.android.account.LegacyAccountDto | ||
|
|
||
| internal const val ACTION_MARK_AS_READ = "ACTION_MARK_AS_READ" | ||
| internal const val ACTION_DELETE = "ACTION_DELETE" | ||
| internal const val ACTION_ARCHIVE = "ACTION_ARCHIVE" | ||
| internal const val ACTION_SPAM = "ACTION_SPAM" | ||
| internal const val ACTION_STAR = "ACTION_STAR" | ||
| internal const val ACTION_DISMISS = "ACTION_DISMISS" | ||
| internal const val EXTRA_ACCOUNT_UUID = "accountUuid" | ||
| internal const val EXTRA_MESSAGE_REFERENCE = "messageReference" | ||
| internal const val EXTRA_MESSAGE_REFERENCES = "messageReferences" | ||
|
|
||
| object NotificationActionIntents { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved several functions here from NotificationActionService.kt as having them there exceeded the maximum functions lint rule |
||
| fun createMarkMessageAsReadIntent(context: Context, messageReference: MessageReference): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_MARK_AS_READ | ||
| putExtra(EXTRA_ACCOUNT_UUID, messageReference.accountUuid) | ||
| putExtra(EXTRA_MESSAGE_REFERENCES, arrayListOf(messageReference.toIdentityString())) | ||
| } | ||
| } | ||
|
|
||
| fun createMarkAllAsReadIntent( | ||
| context: Context, | ||
| accountUuid: String, | ||
| messageReferences: List<MessageReference>, | ||
| ): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_MARK_AS_READ | ||
| putExtra(EXTRA_ACCOUNT_UUID, accountUuid) | ||
| putExtra( | ||
| EXTRA_MESSAGE_REFERENCES, | ||
| MessageReferenceHelper.toMessageReferenceStringList(messageReferences), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| fun createDismissMessageIntent(context: Context, messageReference: MessageReference): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_DISMISS | ||
| putExtra(EXTRA_ACCOUNT_UUID, messageReference.accountUuid) | ||
| putExtra(EXTRA_MESSAGE_REFERENCE, messageReference.toIdentityString()) | ||
| } | ||
| } | ||
|
|
||
| fun createDismissAllMessagesIntent(context: Context, account: LegacyAccountDto): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_DISMISS | ||
| putExtra(EXTRA_ACCOUNT_UUID, account.uuid) | ||
| } | ||
| } | ||
|
|
||
| fun createDeleteMessageIntent(context: Context, messageReference: MessageReference): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_DELETE | ||
| putExtra(EXTRA_ACCOUNT_UUID, messageReference.accountUuid) | ||
| putExtra(EXTRA_MESSAGE_REFERENCES, arrayListOf(messageReference.toIdentityString())) | ||
| } | ||
| } | ||
|
|
||
| fun createDeleteAllMessagesIntent( | ||
| context: Context, | ||
| accountUuid: String, | ||
| messageReferences: List<MessageReference>, | ||
| ): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_DELETE | ||
| putExtra(EXTRA_ACCOUNT_UUID, accountUuid) | ||
| putExtra( | ||
| EXTRA_MESSAGE_REFERENCES, | ||
| MessageReferenceHelper.toMessageReferenceStringList(messageReferences), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| fun createArchiveMessageIntent(context: Context, messageReference: MessageReference): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_ARCHIVE | ||
| putExtra(EXTRA_ACCOUNT_UUID, messageReference.accountUuid) | ||
| putExtra(EXTRA_MESSAGE_REFERENCES, arrayListOf(messageReference.toIdentityString())) | ||
| } | ||
| } | ||
|
|
||
| fun createArchiveAllIntent( | ||
| context: Context, | ||
| account: LegacyAccountDto, | ||
| messageReferences: List<MessageReference>, | ||
| ): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_ARCHIVE | ||
| putExtra(EXTRA_ACCOUNT_UUID, account.uuid) | ||
| putExtra( | ||
| EXTRA_MESSAGE_REFERENCES, | ||
| MessageReferenceHelper.toMessageReferenceStringList(messageReferences), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| fun createMarkMessageAsSpamIntent(context: Context, messageReference: MessageReference): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_SPAM | ||
| putExtra(EXTRA_ACCOUNT_UUID, messageReference.accountUuid) | ||
| putExtra(EXTRA_MESSAGE_REFERENCE, messageReference.toIdentityString()) | ||
| } | ||
| } | ||
|
|
||
| fun createMarkMessageAsStarIntent(context: Context, messageReference: MessageReference): Intent { | ||
| return Intent(context, NotificationActionService::class.java).apply { | ||
| action = ACTION_STAR | ||
| putExtra(EXTRA_ACCOUNT_UUID, messageReference.accountUuid) | ||
| putExtra(EXTRA_MESSAGE_REFERENCES, arrayListOf(messageReference.toIdentityString())) | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single source of truth for default order