-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(in-app-notification): Create NotificationSender to manage notification providers #9415
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
Closed
rafaeltonholo
wants to merge
12
commits into
thunderbird:main
from
rafaeltonholo:feat/9245/create-notification-commands
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
dcc7738
feat: add notification style
rafaeltonholo eda1c49
feat(notification): add InAppNotificationNotifier implementation
rafaeltonholo 0eae34f
feat(notification): add SystemNotificationNotifier implementation
rafaeltonholo 8872707
feat(notification): add notification icon
rafaeltonholo 3477cf8
feat(notification): add notification action
rafaeltonholo 037abbe
fix(preview): composable PreviewWithThemesLightDark render issue caus…
rafaeltonholo 4d7d57b
chore(preview): rename composable PreviewWithThemesLightDark to Previ…
rafaeltonholo e09aff7
feat(design-system): add horizontal divider atom
rafaeltonholo 997b72d
feat(notification): add support for notification actions
rafaeltonholo 59f4c06
feat(debug-settings): add secret debug settings screen
rafaeltonholo c058ca7
chore(notification): add todo comments with follow up tasks
rafaeltonholo adc0b53
chore: update badging
rafaeltonholo 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
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
8 changes: 8 additions & 0 deletions
8
...on/src/main/kotlin/net/thunderbird/app/common/notification/AppCommonNotificationModule.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,8 @@ | ||
| package net.thunderbird.app.common.notification | ||
|
|
||
| import net.thunderbird.feature.notification.api.NotificationIdFactory | ||
| import org.koin.dsl.module | ||
|
|
||
| internal val appCommonNotificationModule = module { | ||
| single<NotificationIdFactory> { LegacyNotificationIdFactory() } | ||
| } |
17 changes: 17 additions & 0 deletions
17
...on/src/main/kotlin/net/thunderbird/app/common/notification/LegacyNotificationIdFactory.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,17 @@ | ||
| package net.thunderbird.app.common.notification | ||
|
|
||
| import com.fsck.k9.notification.NotificationIds | ||
| import net.thunderbird.feature.notification.api.NotificationId | ||
| import net.thunderbird.feature.notification.api.NotificationIdFactory | ||
|
|
||
| // TODO(#9416): Migrate logic from NotificationIds to NotificationIdFactory | ||
| class LegacyNotificationIdFactory : NotificationIdFactory { | ||
| override fun next( | ||
| accountNumber: Int, | ||
| offset: Int, | ||
| ): NotificationId { | ||
| return NotificationId( | ||
| NotificationIds.getBaseNotificationId(accountNumber) + offset, | ||
| ) | ||
| } | ||
| } |
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
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
115 changes: 115 additions & 0 deletions
115
app-ui-catalog/src/main/kotlin/net/thunderbird/ui/catalog/ui/page/atom/items/OtherItems.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,115 @@ | ||
| package net.thunderbird.ui.catalog.ui.page.atom.items | ||
|
|
||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.lazy.grid.LazyGridScope | ||
| import androidx.compose.material3.Slider | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableIntStateOf | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.unit.dp | ||
| import app.k9mail.core.ui.compose.designsystem.atom.divider.HorizontalDivider | ||
| import app.k9mail.core.ui.compose.designsystem.atom.text.TextLabelSmall | ||
| import app.k9mail.core.ui.compose.designsystem.atom.textfield.TextFieldOutlinedSelect | ||
| import app.k9mail.core.ui.compose.theme2.MainTheme | ||
| import kotlinx.collections.immutable.ImmutableMap | ||
| import kotlinx.collections.immutable.persistentMapOf | ||
| import kotlinx.collections.immutable.toImmutableList | ||
| import net.thunderbird.ui.catalog.ui.page.common.list.defaultItemPadding | ||
| import net.thunderbird.ui.catalog.ui.page.common.list.fullSpanItem | ||
| import net.thunderbird.ui.catalog.ui.page.common.list.sectionHeaderItem | ||
| import net.thunderbird.ui.catalog.ui.page.common.list.sectionSubtitleItem | ||
|
|
||
| private const val MAX_HORIZONTAL_DIVIDER_THICKNESS = 25 | ||
| fun LazyGridScope.otherItems() { | ||
| sectionHeaderItem(text = "Others") | ||
|
|
||
| horizontalDivider() | ||
| } | ||
|
|
||
| private fun LazyGridScope.horizontalDivider() { | ||
| sectionSubtitleItem(text = "Horizontal Divider") | ||
| fullSpanItem { | ||
| Column( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .padding(defaultItemPadding()), | ||
| verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.default), | ||
| ) { | ||
| var thickness by remember { mutableIntStateOf(1) } | ||
| val outlineColor = MainTheme.colors.outline | ||
| var color by remember { mutableStateOf(outlineColor) } | ||
| val options = rememberColorOptions() | ||
|
|
||
| TextLabelSmall(text = "Change thickness ($thickness.dp):") | ||
| Slider( | ||
| value = thickness.toFloat(), | ||
| onValueChange = { thickness = it.toInt() }, | ||
| valueRange = 1f..MAX_HORIZONTAL_DIVIDER_THICKNESS.toFloat(), | ||
| steps = MAX_HORIZONTAL_DIVIDER_THICKNESS - 1, | ||
| modifier = Modifier | ||
| .padding(horizontal = MainTheme.spacings.double) | ||
| .align(Alignment.CenterHorizontally), | ||
| ) | ||
|
|
||
| TextLabelSmall(text = "Change divider color:") | ||
| TextFieldOutlinedSelect( | ||
| options = remember(options) { options.keys.toImmutableList() }, | ||
| selectedOption = color, | ||
| onValueChange = { selected -> color = selected }, | ||
| optionToStringTransformation = { color -> options.getValue(color) }, | ||
| ) | ||
|
|
||
| TextLabelSmall(text = "Result:") | ||
| HorizontalDivider( | ||
| thickness = thickness.dp, | ||
| color = color, | ||
| modifier = Modifier | ||
| .padding(vertical = MainTheme.spacings.double), | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| private fun rememberColorOptions(): ImmutableMap<Color, String> { | ||
| val colorScheme = MainTheme.colors | ||
| return remember { | ||
| persistentMapOf( | ||
| colorScheme.primary to "Primary", | ||
| colorScheme.primaryContainer to "Primary Container", | ||
| colorScheme.secondary to "Secondary", | ||
| colorScheme.secondaryContainer to "Secondary Container", | ||
| colorScheme.tertiary to "Tertiary", | ||
| colorScheme.tertiaryContainer to "Tertiary Container", | ||
| colorScheme.error to "Error", | ||
| colorScheme.errorContainer to "Error Container", | ||
| colorScheme.surface to "Surface", | ||
| colorScheme.surfaceContainerLowest to "Surface Container Lowest", | ||
| colorScheme.surfaceContainerLow to "Surface Container Low", | ||
| colorScheme.surfaceContainer to "Surface Container", | ||
| colorScheme.surfaceContainerHigh to "Surface Container High", | ||
| colorScheme.surfaceContainerHighest to "Surface Container Highest", | ||
| colorScheme.inverseSurface to "Inverse Surface", | ||
| colorScheme.inversePrimary to "Inverse Primary", | ||
| colorScheme.outline to "Outline", | ||
| colorScheme.outlineVariant to "Outline Variant", | ||
| colorScheme.surfaceBright to "Surface Bright", | ||
| colorScheme.surfaceDim to "Surface Dim", | ||
| colorScheme.info to "Info", | ||
| colorScheme.infoContainer to "Info Container", | ||
| colorScheme.success to "Success", | ||
| colorScheme.successContainer to "Success Container", | ||
| colorScheme.warning to "Warning", | ||
| colorScheme.warningContainer to "Warning Container", | ||
| ) | ||
| } | ||
| } |
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
14 changes: 14 additions & 0 deletions
14
core/common/src/androidMain/kotlin/net/thunderbird/core/common/CoreCommonModule.android.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,14 @@ | ||
| package net.thunderbird.core.common | ||
|
|
||
| import android.content.Context | ||
| import net.thunderbird.core.common.provider.AndroidContextProvider | ||
| import net.thunderbird.core.common.provider.ContextProvider | ||
| import org.koin.android.ext.koin.androidApplication | ||
| import org.koin.core.module.Module | ||
| import org.koin.dsl.module | ||
|
|
||
| internal actual val platformCoreCommonModule: Module = module { | ||
| single<ContextProvider<Context>> { | ||
| AndroidContextProvider(context = androidApplication()) | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
core/common/src/androidMain/kotlin/net/thunderbird/core/common/io/KmpParcelize.android.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,11 @@ | ||
| package net.thunderbird.core.common.io | ||
|
|
||
| import android.os.Parcelable | ||
| import kotlinx.parcelize.IgnoredOnParcel | ||
| import kotlinx.parcelize.RawValue | ||
|
|
||
| actual typealias KmpParcelable = Parcelable | ||
|
|
||
| actual typealias KmpIgnoredOnParcel = IgnoredOnParcel | ||
|
|
||
| actual typealias KmpRawValue = RawValue |
5 changes: 5 additions & 0 deletions
5
...mon/src/androidMain/kotlin/net/thunderbird/core/common/provider/AndroidContextProvider.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,5 @@ | ||
| package net.thunderbird.core.common.provider | ||
|
|
||
| import android.content.Context | ||
|
|
||
| class AndroidContextProvider(override val context: Context) : ContextProvider<Context> |
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
15 changes: 15 additions & 0 deletions
15
core/common/src/commonMain/kotlin/net/thunderbird/core/common/io/KmpParcelize.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,15 @@ | ||
| package net.thunderbird.core.common.io | ||
|
|
||
| @Target(AnnotationTarget.CLASS) | ||
| @Retention(AnnotationRetention.BINARY) | ||
| annotation class KmpParcelize | ||
|
|
||
| expect interface KmpParcelable | ||
|
|
||
| @Target(AnnotationTarget.PROPERTY) | ||
| @Retention(AnnotationRetention.SOURCE) | ||
| expect annotation class KmpIgnoredOnParcel() | ||
|
|
||
| @Target(AnnotationTarget.TYPE) | ||
| @Retention(AnnotationRetention.BINARY) | ||
| expect annotation class KmpRawValue() |
10 changes: 10 additions & 0 deletions
10
core/common/src/commonMain/kotlin/net/thunderbird/core/common/provider/ContextProvider.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,10 @@ | ||
| package net.thunderbird.core.common.provider | ||
|
|
||
| /** | ||
| * Represents a provider of context. | ||
| * | ||
| * @param TContext The type of context provided. | ||
| */ | ||
| interface ContextProvider<TContext> { | ||
| val context: TContext | ||
| } |
6 changes: 6 additions & 0 deletions
6
core/common/src/jvmMain/kotlin/net/thunderbird/core/common/CoreCommonModule.jvm.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,6 @@ | ||
| package net.thunderbird.core.common | ||
|
|
||
| import org.koin.core.module.Module | ||
| import org.koin.dsl.module | ||
|
|
||
| internal actual val platformCoreCommonModule: Module = module { } |
11 changes: 11 additions & 0 deletions
11
core/common/src/jvmMain/kotlin/net/thunderbird/core/common/io/KmpParcelize.jvm.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,11 @@ | ||
| package net.thunderbird.core.common.io | ||
|
|
||
| actual interface KmpParcelable | ||
|
|
||
| @Target(AnnotationTarget.PROPERTY) | ||
| @Retention(AnnotationRetention.SOURCE) | ||
| actual annotation class KmpIgnoredOnParcel() | ||
|
|
||
| @Target(AnnotationTarget.TYPE) | ||
| @Retention(AnnotationRetention.BINARY) | ||
| actual annotation class KmpRawValue |
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.
This should be
alias(libs.plugins.kotlin.parcelize)