Migrate `:core:common` to pure JVM module

The notification icons are now stored in `:core:notifications`.
This forces `:sync:work` to depend on it.
Another solution could be to provide the resource id through Hilt, but it would require more changes.
pull/923/head
Simon Marquis 1 year ago
parent 45743175fb
commit 61c7d71870
No known key found for this signature in database
GPG Key ID: AC8D63F7571DC6D6

@ -14,16 +14,12 @@
* limitations under the License.
*/
plugins {
alias(libs.plugins.nowinandroid.android.library)
alias(libs.plugins.nowinandroid.android.library.jacoco)
alias(libs.plugins.nowinandroid.android.hilt)
}
android {
namespace = "com.google.samples.apps.nowinandroid.core.common"
alias(libs.plugins.nowinandroid.jvm.library)
alias(libs.plugins.nowinandroid.jvm.hilt)
}
dependencies {
implementation(libs.kotlinx.coroutines.core)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.turbine)
}

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest />

@ -28,5 +28,4 @@ dependencies {
implementation(projects.core.common)
compileOnly(platform(libs.androidx.compose.bom))
compileOnly(libs.androidx.compose.runtime)
}

@ -71,9 +71,7 @@ internal class SystemTrayNotifier @Inject constructor(
val newsNotifications = truncatedNewsResources
.map { newsResource ->
createNewsNotification {
setSmallIcon(
com.google.samples.apps.nowinandroid.core.common.R.drawable.core_common_ic_nia_notification,
)
setSmallIcon(R.drawable.core_notifications_ic_nia_notification)
.setContentTitle(newsResource.title)
.setContentText(newsResource.content)
.setContentIntent(newsPendingIntent(newsResource))
@ -88,9 +86,7 @@ internal class SystemTrayNotifier @Inject constructor(
)
setContentTitle(title)
.setContentText(title)
.setSmallIcon(
com.google.samples.apps.nowinandroid.core.common.R.drawable.core_common_ic_nia_notification,
)
.setSmallIcon(R.drawable.core_notifications_ic_nia_notification)
// Build summary info into InboxStyle template.
.setStyle(newsNotificationStyle(truncatedNewsResources, title))
.setGroup(NEWS_NOTIFICATION_GROUP)

@ -34,6 +34,7 @@ dependencies {
implementation(libs.hilt.ext.work)
implementation(projects.core.analytics)
implementation(projects.core.data)
implementation(projects.core.notifications)
prodImplementation(libs.firebase.cloud.messaging)
prodImplementation(platform(libs.firebase.bom))

@ -71,7 +71,7 @@ private fun Context.syncWorkNotification(): Notification {
SYNC_NOTIFICATION_CHANNEL_ID,
)
.setSmallIcon(
com.google.samples.apps.nowinandroid.core.common.R.drawable.core_common_ic_nia_notification,
com.google.samples.apps.nowinandroid.core.notifications.R.drawable.core_notifications_ic_nia_notification,
)
.setContentTitle(getString(R.string.sync_work_notification_title))
.setPriority(NotificationCompat.PRIORITY_DEFAULT)

Loading…
Cancel
Save