Skip to content

Commit

Permalink
Migrate :core:common to pure JVM module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SimonMarquis committed Dec 22, 2023
1 parent 4574317 commit 61c7d71
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 32 deletions.
10 changes: 3 additions & 7 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
17 changes: 0 additions & 17 deletions core/common/src/main/AndroidManifest.xml

This file was deleted.

1 change: 0 additions & 1 deletion core/notifications/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ dependencies {
implementation(projects.core.common)

compileOnly(platform(libs.androidx.compose.bom))
compileOnly(libs.androidx.compose.runtime)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions sync/work/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 61c7d71

Please sign in to comment.