Skip to content

Commit e2db5fc

Browse files
Merge pull request #9579 from SttApollo/refactor/common-notification-icon
Add app-specific NotificationIconResourceProvider for K-9 & Thunderbird push notifications
2 parents d3207a5 + 2a4d3cc commit e2db5fc

27 files changed

Lines changed: 196 additions & 22 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package app.k9mail.provider
2+
3+
import app.k9mail.core.android.common.provider.NotificationIconResourceProvider
4+
import app.k9mail.core.ui.legacy.theme2.k9mail.R
5+
6+
class K9AppNotificationIconProvider : NotificationIconResourceProvider {
7+
override val pushNotificationIcon: Int
8+
9+
get() = R.drawable.ic_logo_k9_white
10+
}

app-k9mail/src/main/kotlin/app/k9mail/provider/ProviderModule.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package app.k9mail.provider
22

3+
import app.k9mail.core.android.common.provider.NotificationIconResourceProvider
34
import com.fsck.k9.preferences.FilePrefixProvider
45
import net.thunderbird.core.common.provider.AppNameProvider
56
import net.thunderbird.core.common.provider.BrandNameProvider
@@ -17,4 +18,8 @@ internal val providerModule = module {
1718
single<ThemeProvider> { K9ThemeProvider() }
1819

1920
single<FeatureThemeProvider> { K9FeatureThemeProvider() }
21+
22+
single<NotificationIconResourceProvider> {
23+
K9AppNotificationIconProvider()
24+
}
2025
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package app.k9mail
2+
3+
import app.k9mail.provider.K9AppNotificationIconProvider
4+
import assertk.assertThat
5+
import assertk.assertions.isEqualTo
6+
import kotlin.test.Test
7+
8+
class K9AppNotificationIconProviderTest {
9+
@Test
10+
fun `provides correct K9 notification icon`() {
11+
val provider = K9AppNotificationIconProvider()
12+
val icon = provider.pushNotificationIcon
13+
14+
assertThat(icon)
15+
.isEqualTo(app.k9mail.core.ui.legacy.theme2.k9mail.R.drawable.ic_logo_k9_white)
16+
}
17+
}

app-thunderbird/src/main/kotlin/net/thunderbird/android/provider/ProviderModule.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.thunderbird.android.provider
22

3+
import app.k9mail.core.android.common.provider.NotificationIconResourceProvider
34
import com.fsck.k9.preferences.FilePrefixProvider
45
import net.thunderbird.core.common.provider.AppNameProvider
56
import net.thunderbird.core.common.provider.BrandNameProvider
@@ -17,4 +18,8 @@ internal val providerModule = module {
1718
single<ThemeProvider> { TbThemeProvider() }
1819

1920
single<FeatureThemeProvider> { TbFeatureThemeProvider() }
21+
22+
single<NotificationIconResourceProvider> {
23+
TbAppIconNotificationProvider()
24+
}
2025
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package net.thunderbird.android.provider
2+
3+
import app.k9mail.core.android.common.provider.NotificationIconResourceProvider
4+
5+
class TbAppIconNotificationProvider : NotificationIconResourceProvider {
6+
override val pushNotificationIcon: Int
7+
get() = app.k9mail.core.ui.legacy.theme2.thunderbird.R.drawable.ic_logo_thunderbird_white
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package net.thunderbird.android
2+
3+
import assertk.assertThat
4+
import assertk.assertions.isEqualTo
5+
import net.thunderbird.android.provider.TbAppIconNotificationProvider
6+
import org.junit.Test
7+
8+
class TbAppIconNotificationProviderTest {
9+
@Test
10+
fun `provides correct Thunderbird notification icon`() {
11+
val provider = TbAppIconNotificationProvider()
12+
val icon = provider.pushNotificationIcon
13+
14+
assertThat(icon)
15+
.isEqualTo(app.k9mail.core.ui.legacy.theme2.thunderbird.R.drawable.ic_logo_thunderbird_white)
16+
}
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package app.k9mail.core.android.common.provider
2+
3+
interface NotificationIconResourceProvider {
4+
val pushNotificationIcon: Int
5+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
2+
android:viewportWidth="24"
3+
android:viewportHeight="24"
4+
android:width="24dp"
5+
android:height="24dp">
6+
<group>
7+
<clip-path
8+
android:pathData="M0 0H24V24H0V0Z" />
9+
<path
10+
android:pathData="M3.25781 14.7656V16.4063L6.75893 21.6018C7.04193 22.0924 7.5705 22.4221 8.17984 22.4221H15.8363C16.4457 22.4221 16.9742 22.0924 17.2572 21.6018H17.2588L20.7583 16.4063V14.7656H3.25781Z"
11+
android:strokeColor="#FFFFFF"
12+
android:strokeWidth="0.508942" />
13+
<path
14+
android:pathData="M8.7266 2.73438H7.63281V4.92194H8.7266V2.73438Z"
15+
android:fillColor="#FFFFFF" />
16+
<path
17+
android:pathData="M16.3868 2.73438H15.293V4.92194H16.3868V2.73438Z"
18+
android:fillColor="#FFFFFF" />
19+
<path
20+
android:pathData="M9.82422 1.91412V0.820337C9.82422 0.367277 9.45694 0 9.00388 0L5.72253 0C5.26947 0 4.9022 0.367277 4.9022 0.820337V1.91412C4.9022 2.36718 5.26947 2.73446 5.72253 2.73446L9.00388 2.73446C9.45694 2.73446 9.82422 2.36718 9.82422 1.91412Z"
21+
android:fillColor="#FFFFFF"
22+
android:strokeColor="#FFFFFF"
23+
android:strokeWidth="0.508942"
24+
android:strokeLineCap="round" />
25+
<path
26+
android:pathData="M19.1172 1.91412V0.820337C19.1172 0.367277 18.7499 0 18.2969 0L15.0155 0C14.5624 0 14.1952 0.367277 14.1952 0.820337V1.91412C14.1952 2.36718 14.5624 2.73446 15.0155 2.73446L18.2969 2.73446C18.7499 2.73446 19.1172 2.36718 19.1172 1.91412Z"
27+
android:fillColor="#FFFFFF"
28+
android:strokeColor="#FFFFFF"
29+
android:strokeWidth="0.508942"
30+
android:strokeLineCap="round" />
31+
<path
32+
android:pathData="M3.2615 3.82812C2.35257 3.82812 1.62053 4.55934 1.62053 5.46827V14.7658C1.62053 15.6747 2.35257 16.4067 3.2615 16.4067H20.7614C21.6703 16.4067 22.4023 15.6747 22.4023 14.7658V5.46827C22.4023 4.55934 21.6703 3.82812 20.7614 3.82812H3.2615ZM3.68893 5.62317C3.79298 5.59159 3.9053 5.60262 4.00122 5.65382L12.0114 9.92566L20.0216 5.65382C20.0692 5.62847 20.1212 5.61273 20.1749 5.6075C20.2285 5.60227 20.2826 5.60766 20.3342 5.62335C20.3857 5.63904 20.4336 5.66473 20.4752 5.69896C20.5168 5.73318 20.5513 5.77527 20.5766 5.82281C20.602 5.87035 20.6177 5.92241 20.623 5.97603C20.6282 6.02965 20.6228 6.08378 20.6071 6.13531C20.5914 6.18685 20.5657 6.2348 20.5315 6.2764C20.4973 6.31801 20.4552 6.35247 20.4077 6.37781L12.0114 10.8551L3.61521 6.37781C3.56767 6.35247 3.52558 6.31801 3.49136 6.2764C3.45713 6.2348 3.43144 6.18685 3.41575 6.13531C3.40006 6.08378 3.39467 6.02965 3.3999 5.97603C3.40513 5.92241 3.42087 5.87035 3.44622 5.82281C3.47157 5.77521 3.50605 5.73308 3.5477 5.69883C3.58935 5.66457 3.63734 5.63886 3.68893 5.62317Z"
33+
android:fillColor="#FFFFFF" />
34+
<path
35+
android:pathData="M13.6562 22.1485V20.5078C13.6562 20.0548 13.289 19.6875 12.8359 19.6875H11.1952C10.7422 19.6875 10.3749 20.0548 10.3749 20.5078V22.1485C10.3749 22.6016 10.7422 22.9689 11.1952 22.9689H12.8359C13.289 22.9689 13.6562 22.6016 13.6562 22.1485Z"
36+
android:fillColor="#FFFFFF" />
37+
<path
38+
android:pathData="M12.0118 24.0636C12.9179 24.0636 13.6524 23.329 13.6524 22.4229C13.6524 21.5168 12.9179 20.7822 12.0118 20.7822C11.1056 20.7822 10.3711 21.5168 10.3711 22.4229C10.3711 23.329 11.1056 24.0636 12.0118 24.0636Z"
39+
android:fillColor="#FFFFFF" />
40+
</group>
41+
</vector>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<vector
2+
xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:width="24dp"
4+
android:height="24dp"
5+
android:viewportWidth="1024"
6+
android:viewportHeight="1024"
7+
>
8+
9+
<path
10+
android:fillColor="#fff"
11+
android:fillType="evenOdd"
12+
android:pathData="M452,306.5h0.2c22,-77 118,-114.7 216,-114.7 67.5,0 128.3,21.5 169.9,55.4a249.8,249.8 0,0 0,-72.8 14.5,211.7 211.7,0 0,1 84,55.5 258.7,258.7 0,0 0,-49 -3.7A350,350 0,0 1,512 862c-190.3,0 -350,-159.4 -350,-350 0,-30.1 4,-61.2 11.8,-90.4 2,-6 4.8,-12 8.6,-14.1 4.7,-2.7 9,5.3 9.7,8 5.2,19.2 12,37.8 20.6,55.7 -0.7,-40 16.3,-76.4 39.8,-107.9 15.7,-21 30.2,-40.4 36.9,-96.6 0.4,-3.7 4,-6.4 7.6,-5.3 51,16.7 78.2,101.6 74,172.6h0.2a123.4,123.4 0,0 0,-31.3 82.6c0,138.6 146.5,218.4 271.4,206.3l-2.2,-0.2c-14.2,-1.4 -68.1,-6.7 -105.3,-48.7 -3.5,-4 -9.7,-11 -7,-15.6 2.4,-3.9 8.3,-3.7 12.8,-3.5h2.4c95,0 172.1,-62.8 172.1,-140.4 0,-77.6 -77,-140.4 -172.1,-140.4 -39.1,0 -80.6,12.3 -113,35v-0.5c-9,-27.7 -3,-79.1 53,-102.1ZM553,279.8s1.6,18.2 -16.9,24c-21,6.6 -30.3,-11 -30.3,-11s2.6,-12.2 19.7,-17.9c18.2,-6 27.5,4.9 27.5,4.9Z"
13+
/>
14+
15+
<path
16+
android:fillColor="#fff"
17+
android:fillType="evenOdd"
18+
android:pathData="M492.2,551.9a24,24 0,0 0,33.6 0l113.6,-77.3 -96.9,94.5a48,48 0,0 1,-67 0l-96.9,-94.5 113.6,77.3Z"
19+
/>
20+
21+
</vector>

feature/debug-settings/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ dependencies {
1616
implementation(projects.core.outcome)
1717
implementation(projects.feature.mail.account.api)
1818
implementation(projects.feature.notification.api)
19+
implementation(projects.core.android.common)
1920
}

0 commit comments

Comments
 (0)