Skip to content

Commit

Permalink
Merge pull request #7961 from thunderbird/move-message-list-widget-to…
Browse files Browse the repository at this point in the history
…-feature-module

Move message list widget to feature module
  • Loading branch information
wmontwe authored Jun 20, 2024
2 parents a1e5ae8 + 23943cb commit b0e55f9
Show file tree
Hide file tree
Showing 156 changed files with 561 additions and 187 deletions.
2 changes: 1 addition & 1 deletion app-k9mail/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ dependencies {

implementation(projects.app.core)
implementation(projects.app.ui.legacy)
implementation(projects.app.ui.messageListWidget)

implementation(projects.feature.widget.messageList)
implementation(projects.feature.widget.unread)

implementation(libs.androidx.work.runtime)
Expand Down
16 changes: 16 additions & 0 deletions app-k9mail/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@

</provider>

<!-- This component is disabled by default (if possible). It will be enabled programmatically if necessary. -->
<!-- IMPORTANT: The component name must be `com.fsck.k9.widget.list.MessageListWidgetProvider` and can't be changed. -->
<receiver
android:name="com.fsck.k9.widget.list.MessageListWidgetProvider"
android:icon="@drawable/message_list_widget_preview"
android:label="@string/mail_list_widget_text"
android:enabled="@bool/home_screen_widgets_enabled"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/message_list_widget_info" />
</receiver>

<!-- This component is disabled by default (if possible). It will be enabled programmatically if necessary. -->
<!-- IMPORTANT: The component name must be `com.fsck.k9.provider.UnreadWidgetProvider` and can't be changed. -->
<receiver
Expand Down
7 changes: 3 additions & 4 deletions app-k9mail/src/main/kotlin/app/k9mail/K9KoinModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import app.k9mail.core.common.oauth.OAuthConfigurationFactory
import app.k9mail.core.common.provider.AppNameProvider
import app.k9mail.dev.developmentModuleAdditions
import app.k9mail.feature.launcher.FeatureLauncherExternalContract.FeatureThemeProvider
import app.k9mail.feature.widget.unread.UnreadWidgetClassProvider
import app.k9mail.provider.K9AppNameProvider
import app.k9mail.provider.K9FeatureThemeProvider
import app.k9mail.widget.appWidgetModule
import com.fsck.k9.AppConfig
import com.fsck.k9.BuildConfig
import com.fsck.k9.activity.LauncherShortcuts
Expand All @@ -19,15 +19,14 @@ import org.koin.core.qualifier.named
import org.koin.dsl.module

val appModule = module {
includes(appWidgetModule)

single(named("ClientInfoAppName")) { BuildConfig.CLIENT_INFO_APP_NAME }
single(named("ClientInfoAppVersion")) { BuildConfig.VERSION_NAME }
single<AppConfig> { appConfig }
single<OAuthConfigurationFactory> { K9OAuthConfigurationFactory() }
single<AppNameProvider> { K9AppNameProvider(androidContext()) }
single<FeatureThemeProvider> { K9FeatureThemeProvider() }
single<UnreadWidgetClassProvider> {
UnreadWidgetClassProvider { UnreadWidgetProvider::class.java }
}

developmentModuleAdditions()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.k9mail.widget

import app.k9mail.feature.widget.message.list.MessageListWidgetConfig
import com.fsck.k9.widget.list.MessageListWidgetProvider

class K9MessageListWidgetConfig : MessageListWidgetConfig {
override val providerClass = MessageListWidgetProvider::class.java
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.k9mail.widget

import app.k9mail.feature.widget.unread.UnreadWidgetConfig
import com.fsck.k9.provider.UnreadWidgetProvider

class K9UnreadWidgetConfig : UnreadWidgetConfig {
override val providerClass = UnreadWidgetProvider::class.java
}
10 changes: 10 additions & 0 deletions app-k9mail/src/main/kotlin/app/k9mail/widget/KoinModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package app.k9mail.widget

import app.k9mail.feature.widget.message.list.MessageListWidgetConfig
import app.k9mail.feature.widget.unread.UnreadWidgetConfig
import org.koin.dsl.module

val appWidgetModule = module {
single<MessageListWidgetConfig> { K9MessageListWidgetConfig() }
single<UnreadWidgetConfig> { K9UnreadWidgetConfig() }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.fsck.k9.widget.list

import app.k9mail.feature.widget.message.list.BaseMessageListWidgetProvider

/**
* IMPORTANT: The fully qualified name for this class must be
* `com.fsck.k9.widget.list.MessageListWidgetProvider`.
* Otherwise widgets created with older versions of the app using a different name
* will stop working or disappear.
*/
class MessageListWidgetProvider : BaseMessageListWidgetProvider()
2 changes: 1 addition & 1 deletion app-thunderbird/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ dependencies {

implementation(projects.app.core)
implementation(projects.app.ui.legacy)
implementation(projects.app.ui.messageListWidget)

implementation(projects.feature.widget.messageList)
implementation(projects.feature.widget.unread)

implementation(libs.androidx.work.runtime)
Expand Down
16 changes: 16 additions & 0 deletions app-thunderbird/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@

</provider>

<!-- This component is disabled by default (if possible). It will be enabled programmatically if necessary. -->
<!-- IMPORTANT: The component name must be `net.thunderbird.android.widget.provider.MessageListWidgetProvider` and can't be changed. -->
<receiver
android:name="net.thunderbird.android.widget.provider.MessageListWidgetProvider"
android:icon="@drawable/message_list_widget_preview"
android:label="@string/mail_list_widget_text"
android:enabled="@bool/home_screen_widgets_enabled"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/message_list_widget_info" />
</receiver>

<!-- This component is disabled by default (if possible). It will be enabled programmatically if necessary. -->
<!-- IMPORTANT: The component name and can't be changed and always must be:
`net.thunderbird.android.widget.provider.UnreadWidgetProvider`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,29 @@ package net.thunderbird.android
import app.k9mail.core.common.oauth.OAuthConfigurationFactory
import app.k9mail.core.common.provider.AppNameProvider
import app.k9mail.feature.launcher.FeatureLauncherExternalContract.FeatureThemeProvider
import app.k9mail.feature.widget.unread.UnreadWidgetClassProvider
import com.fsck.k9.AppConfig
import com.fsck.k9.activity.LauncherShortcuts
import com.fsck.k9.activity.MessageCompose
import com.fsck.k9.widget.list.MessageListWidgetProvider
import net.thunderbird.android.auth.ThunderbirdOAuthConfigurationFactory
import net.thunderbird.android.dev.developmentModuleAdditions
import net.thunderbird.android.provider.TbAppNameProvider
import net.thunderbird.android.provider.TbFeatureThemeProvider
import net.thunderbird.android.widget.appWidgetModule
import net.thunderbird.android.widget.provider.MessageListWidgetProvider
import net.thunderbird.android.widget.provider.UnreadWidgetProvider
import org.koin.android.ext.koin.androidContext
import org.koin.core.qualifier.named
import org.koin.dsl.module

val appModule = module {
includes(appWidgetModule)

single(named("ClientInfoAppName")) { BuildConfig.CLIENT_INFO_APP_NAME }
single(named("ClientInfoAppVersion")) { BuildConfig.VERSION_NAME }
single<AppConfig> { appConfig }
single<OAuthConfigurationFactory> { ThunderbirdOAuthConfigurationFactory() }
single<AppNameProvider> { TbAppNameProvider(androidContext()) }
single<FeatureThemeProvider> { TbFeatureThemeProvider() }
single<UnreadWidgetClassProvider> {
UnreadWidgetClassProvider { UnreadWidgetProvider::class.java }
}

developmentModuleAdditions()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.thunderbird.android.widget

import app.k9mail.feature.widget.message.list.MessageListWidgetConfig
import app.k9mail.feature.widget.unread.UnreadWidgetConfig
import org.koin.dsl.module

val appWidgetModule = module {
single<MessageListWidgetConfig> { TbMessageListWidgetConfig() }
single<UnreadWidgetConfig> { TbUnreadWidgetConfig() }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package net.thunderbird.android.widget

import app.k9mail.feature.widget.message.list.MessageListWidgetConfig
import net.thunderbird.android.widget.provider.MessageListWidgetProvider

class TbMessageListWidgetConfig : MessageListWidgetConfig {
override val providerClass = MessageListWidgetProvider::class.java
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package net.thunderbird.android.widget

import app.k9mail.feature.widget.unread.UnreadWidgetConfig
import net.thunderbird.android.widget.provider.UnreadWidgetProvider

class TbUnreadWidgetConfig : UnreadWidgetConfig {
override val providerClass = UnreadWidgetProvider::class.java
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.thunderbird.android.widget.provider

import app.k9mail.feature.widget.message.list.BaseMessageListWidgetProvider

/**
* IMPORTANT: The fully qualified name for this class must be
* `net.thunderbird.android.widget.provider.MessageListWidgetProvider`.
* Otherwise widgets created with older versions of the app using a different name
* will stop working or disappear.
*/
class MessageListWidgetProvider : BaseMessageListWidgetProvider()
3 changes: 2 additions & 1 deletion app/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {

dependencies {
implementation(projects.app.ui.legacy)
implementation(projects.app.ui.messageListWidget)
implementation(projects.app.core)
implementation(projects.app.storage)
implementation(projects.app.cryptoOpenpgp)
Expand All @@ -17,7 +16,9 @@ dependencies {
implementation(projects.feature.account.setup)
implementation(projects.feature.account.edit)
implementation(projects.feature.settings.import)

implementation(projects.feature.widget.unread)
implementation(projects.feature.widget.messageList)

implementation(libs.androidx.appcompat)
implementation(libs.androidx.core.ktx)
Expand Down
15 changes: 0 additions & 15 deletions app/common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,6 @@
</intent-filter>
</activity>

<!-- This component is disabled by default (if possible). It will be enabled programmatically if necessary. -->
<receiver
android:name="com.fsck.k9.widget.list.MessageListWidgetProvider"
android:icon="@drawable/message_list_widget_preview"
android:label="@string/mail_list_widget_text"
android:enabled="@bool/home_screen_widgets_enabled"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/message_list_widget_info" />
</receiver>

<!-- This component is disabled by default. It will be enabled programmatically if necessary. -->
<receiver
android:name="com.fsck.k9.controller.push.BootCompleteReceiver"
Expand Down
2 changes: 1 addition & 1 deletion app/common/src/main/java/com/fsck/k9/CommonApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.fsck.k9
import android.app.Application
import android.content.res.Configuration
import android.content.res.Resources
import app.k9mail.ui.widget.list.MessageListWidgetManager
import app.k9mail.feature.widget.message.list.MessageListWidgetManager
import com.fsck.k9.controller.MessagingController
import com.fsck.k9.job.WorkManagerConfigurationProvider
import com.fsck.k9.notification.NotificationChannelManager
Expand Down
4 changes: 1 addition & 3 deletions app/common/src/main/java/com/fsck/k9/CommonKoinModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.fsck.k9
import app.k9mail.core.featureflag.FeatureFlagFactory
import app.k9mail.core.featureflag.FeatureFlagProvider
import app.k9mail.core.featureflag.InMemoryFeatureFlagProvider
import app.k9mail.feature.widget.message.list.messageListWidgetModule
import app.k9mail.feature.widget.unread.UnreadWidgetUpdateListener
import app.k9mail.feature.widget.unread.unreadWidgetModule
import app.k9mail.ui.widget.list.messageListWidgetModule
import com.fsck.k9.account.newAccountModule
import com.fsck.k9.backends.backendsModule
import com.fsck.k9.controller.ControllerExtension
Expand All @@ -18,7 +18,6 @@ import com.fsck.k9.preferences.K9StoragePersister
import com.fsck.k9.preferences.StoragePersister
import com.fsck.k9.resources.resourcesModule
import com.fsck.k9.storage.storageModule
import com.fsck.k9.widget.list.messageListWidgetConfigModule
import org.koin.core.qualifier.named
import org.koin.dsl.module

Expand All @@ -43,7 +42,6 @@ val commonAppModule = module {

val commonAppModules = listOf(
commonAppModule,
messageListWidgetConfigModule,
messageListWidgetModule,
unreadWidgetModule,
notificationModule,
Expand Down

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions app/ui/legacy/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,7 @@
<string name="crypto_no_provider_button">اذهب للاعدادات </string>
<string name="mail_list_widget_text">قائمة رسائل K-9</string>
<!--Displayed in the the message list widget when the app hasn't had a chance to send content to it yet-->
<string name="message_list_widget_initializing">يُحمل…</string>
<!--Might be displayed in the message list widget when the list is scrolled and new data can't be fetched fast enough-->
<string name="message_list_widget_list_item_loading">يُحمل…</string>
<string name="openpgp_enabled_error_title">التعمية غير ممكنة</string>
<string name="openpgp_enabled_error_msg">بعض المستلمين المحددين لا يدعمون هذه الميزة! </string>
<string name="enable_encryption">تنشيط التعمية</string>
Expand Down
2 changes: 0 additions & 2 deletions app/ui/legacy/src/main/res/values-be/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,7 @@
<string name="crypto_no_provider_button">Перайсці ў налады</string>
<string name="mail_list_widget_text">Лісты K-9</string>
<!--Displayed in the the message list widget when the app hasn't had a chance to send content to it yet-->
<string name="message_list_widget_initializing">Загрузка…</string>
<!--Might be displayed in the message list widget when the list is scrolled and new data can't be fetched fast enough-->
<string name="message_list_widget_list_item_loading">Загрузка…</string>
<string name="openpgp_enabled_error_title">Зашыфраваць немагчыма</string>
<string name="openpgp_enabled_error_msg">Некаторыя з гэтых адрасатаў не падтрымліваюць такую функцыю!</string>
<string name="enable_encryption">Уключыць шыфраванне</string>
Expand Down
2 changes: 0 additions & 2 deletions app/ui/legacy/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,7 @@
<string name="crypto_no_provider_button">Към настройки</string>
<string name="mail_list_widget_text">K-9 списък със собщения</string>
<!--Displayed in the the message list widget when the app hasn't had a chance to send content to it yet-->
<string name="message_list_widget_initializing">Зареждане…</string>
<!--Might be displayed in the message list widget when the list is scrolled and new data can't be fetched fast enough-->
<string name="message_list_widget_list_item_loading">Зареждане…</string>
<string name="openpgp_enabled_error_title">Криптирането е невъзможно</string>
<string name="openpgp_enabled_error_msg">Някои от избраните получатели не поддържат тази функция!</string>
<string name="enable_encryption">Включване на криптирането</string>
Expand Down
2 changes: 0 additions & 2 deletions app/ui/legacy/src/main/res/values-br/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -737,9 +737,7 @@
<string name="crypto_no_provider_button">Mont d\'an arventennoù</string>
<string name="mail_list_widget_text">Roll kemennadennoù K-9</string>
<!--Displayed in the the message list widget when the app hasn't had a chance to send content to it yet-->
<string name="message_list_widget_initializing">O kargañ…</string>
<!--Might be displayed in the message list widget when the list is scrolled and new data can't be fetched fast enough-->
<string name="message_list_widget_list_item_loading">O kargañ…</string>
<string name="openpgp_enabled_error_title">N’eo ket posupl enrinegañ</string>
<string name="openpgp_enabled_error_msg">Ul lodenn eus an degemererien ne skoront ket ar c’heweriuster-mañ!</string>
<string name="enable_encryption">Gweredekaat an enrinegañ</string>
Expand Down
2 changes: 0 additions & 2 deletions app/ui/legacy/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,7 @@
<string name="crypto_no_provider_button">Ves a la configuració</string>
<string name="mail_list_widget_text">Llista de missatges del K-9</string>
<!--Displayed in the the message list widget when the app hasn't had a chance to send content to it yet-->
<string name="message_list_widget_initializing">S\'està carregant…</string>
<!--Might be displayed in the message list widget when the list is scrolled and new data can't be fetched fast enough-->
<string name="message_list_widget_list_item_loading">S\'està carregant…</string>
<string name="openpgp_enabled_error_title">Encriptació no possible</string>
<string name="openpgp_enabled_error_msg">Alguns dels destinataris seleccionats no admeten aquesta característica!</string>
<string name="enable_encryption">Habilita l\'encriptació</string>
Expand Down
2 changes: 0 additions & 2 deletions app/ui/legacy/src/main/res/values-co/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@
<string name="locked_attach_unencrypted">Sta parte ùn hè stata micca cifrata è puderia ùn esse sicura.</string>
<string name="messageview_decrypt_cancelled">A dicifratura hè stata abbandunata.</string>
<string name="account_settings_crypto_hide_sign_only_off">Tutte e segnature seranu affissate</string>
<string name="message_list_widget_initializing">Caricamentu…</string>
<string name="openpgp_description_text1">A cifratura di i messaghji assicureghja ch’elli pudenu esse letti solu da u destinatariu, è da altrunimu.</string>
<string name="openpgp_enabled_error_disable">Disattivà a cifratura</string>
<string name="openpgp_encryption">Cifratura OpenPGP</string>
Expand Down Expand Up @@ -807,7 +806,6 @@
<string name="messageview_decrypt_retry">Pruvà torna</string>
<string name="messageview_decrypt_incomplete">U messaghju cifratu deve esse scaricatu per pudè esse dicifratu.</string>
<string name="error_sign_only_no_encryption">A cifratura hè indispunibule in u modu « sign-only » !</string>
<string name="message_list_widget_list_item_loading">Caricamentu…</string>
<string name="account_settings_crypto_prefer_encrypt">Modu mutuale di cifratura autumatica</string>
<string name="dialog_autocrypt_mutual_description_2">S’è u speditore è i destinatarii attivanu u modu mutuale, a cifratura serà attivata in modu predefinitu.</string>
<string name="dialog_openkeychain_info_title">Alcuna appiecazione OpenPGP ùn hè installata</string>
Expand Down
2 changes: 0 additions & 2 deletions app/ui/legacy/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,7 @@
<string name="crypto_no_provider_button">Přejít do nastavení</string>
<string name="mail_list_widget_text">Seznam zpráv K-9</string>
<!--Displayed in the the message list widget when the app hasn't had a chance to send content to it yet-->
<string name="message_list_widget_initializing">Načítání…</string>
<!--Might be displayed in the message list widget when the list is scrolled and new data can't be fetched fast enough-->
<string name="message_list_widget_list_item_loading">Načítání…</string>
<string name="openpgp_enabled_error_title">Šifrování není možné</string>
<string name="openpgp_enabled_error_msg">Někteří ze zvolených příjemců nepodporují tuto funkci!</string>
<string name="enable_encryption">Zapnout šifrování</string>
Expand Down
Loading

0 comments on commit b0e55f9

Please sign in to comment.