Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation(projects.feature.mail.account.api)
implementation(projects.feature.migration.provider)
implementation(projects.feature.notification.api)
implementation(projects.feature.notification.impl)
implementation(projects.feature.widget.messageList)

implementation(projects.mail.protocols.imap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.fsck.k9.legacyUiModules
import net.thunderbird.app.common.account.appCommonAccountModule
import net.thunderbird.app.common.core.appCommonCoreModule
import net.thunderbird.app.common.feature.appCommonFeatureModule
import net.thunderbird.app.common.notification.appCommonNotificationModule
import org.koin.core.module.Module
import org.koin.dsl.module

Expand All @@ -18,5 +19,6 @@ val appCommonModule: Module = module {
appCommonAccountModule,
appCommonCoreModule,
appCommonFeatureModule,
appCommonNotificationModule,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package net.thunderbird.app.common.feature
import app.k9mail.feature.launcher.FeatureLauncherExternalContract
import app.k9mail.feature.launcher.di.featureLauncherModule
import net.thunderbird.feature.navigation.drawer.api.NavigationDrawerExternalContract
import net.thunderbird.feature.notification.impl.inject.featureNotificationModule
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module

internal val appCommonFeatureModule = module {
includes(featureLauncherModule)
includes(featureNotificationModule)

factory<FeatureLauncherExternalContract.AccountSetupFinishedLauncher> {
AccountSetupFinishedLauncher(
Expand Down
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() }
}
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,
)
}
}
1 change: 1 addition & 0 deletions app-k9mail/badging/fossRelease-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ uses-permission: name='android.permission.USE_FINGERPRINT'
uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='com.fsck.k9.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
1 change: 1 addition & 0 deletions app-k9mail/badging/fullRelease-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='com.android.vending.BILLING'
uses-permission: name='com.fsck.k9.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
1 change: 1 addition & 0 deletions app-thunderbird/badging/fossBeta-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ uses-permission: name='android.permission.USE_FINGERPRINT'
uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='net.thunderbird.android.beta.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
1 change: 1 addition & 0 deletions app-thunderbird/badging/fossDaily-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ uses-permission: name='android.permission.USE_FINGERPRINT'
uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='net.thunderbird.android.daily.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
1 change: 1 addition & 0 deletions app-thunderbird/badging/fossRelease-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,4 @@ uses-permission: name='android.permission.USE_FINGERPRINT'
uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='net.thunderbird.android.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
1 change: 1 addition & 0 deletions app-thunderbird/badging/fullBeta-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='com.android.vending.BILLING'
uses-permission: name='net.thunderbird.android.beta.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
1 change: 1 addition & 0 deletions app-thunderbird/badging/fullDaily-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='com.android.vending.BILLING'
uses-permission: name='net.thunderbird.android.daily.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
1 change: 1 addition & 0 deletions app-thunderbird/badging/fullRelease-badging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='com.android.vending.BILLING'
uses-permission: name='net.thunderbird.android.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
uses-permission: name='net.thunderbird.permission.POST_IN_APP_NOTIFICATION_PERMISSION'
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.BUTTON
import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.COLOR
import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.ICON
import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.IMAGE
import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.OTHER
import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.SELECTION_CONTROL
import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.TEXT_FIELD
import net.thunderbird.ui.catalog.ui.page.atom.CatalogAtomPage.TYPOGRAPHY
import net.thunderbird.ui.catalog.ui.page.atom.items.buttonItems
import net.thunderbird.ui.catalog.ui.page.atom.items.colorItems
import net.thunderbird.ui.catalog.ui.page.atom.items.iconItems
import net.thunderbird.ui.catalog.ui.page.atom.items.imageItems
import net.thunderbird.ui.catalog.ui.page.atom.items.otherItems
import net.thunderbird.ui.catalog.ui.page.atom.items.selectionControlItems
import net.thunderbird.ui.catalog.ui.page.atom.items.textFieldItems
import net.thunderbird.ui.catalog.ui.page.atom.items.typographyItems
Expand All @@ -40,6 +42,7 @@ fun CatalogAtomContent(
TEXT_FIELD -> textFieldItems()
ICON -> iconItems()
IMAGE -> imageItems()
OTHER -> otherItems()
}
},
onRenderFullScreenPage = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum class CatalogAtomPage(
TEXT_FIELD("TextFields"),
ICON("Icons"),
IMAGE("Images"),
OTHER("Other"),
;

override fun toString(): String {
Expand Down
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",
)
}
}
9 changes: 9 additions & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id(ThunderbirdPlugins.Library.kmp)
id("kotlin-parcelize")
Copy link
Member

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)

}

android {
Expand Down Expand Up @@ -28,4 +29,12 @@ kotlin {
),
)
}

compilerOptions {
freeCompilerArgs.addAll(
"-P",
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=net.thunderbird.core.common.io.KmpParcelize",
"-Xexpect-actual-classes",
)
}
}
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())
}
}
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
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>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import net.thunderbird.core.common.oauth.OAuthConfigurationProvider
import org.koin.core.module.Module
import org.koin.dsl.module

internal expect val platformCoreCommonModule: Module

val coreCommonModule: Module = module {
includes(platformCoreCommonModule)
single<Clock> { Clock.System }

single<OAuthConfigurationProvider> {
Expand Down
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()
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
}
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 { }
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
Loading