Skip to content

Commit

Permalink
- try/catch failures on fetching lib data from data source
Browse files Browse the repository at this point in the history
- added new androidx libs
  • Loading branch information
lmj0011 committed Jun 11, 2020
1 parent 2c6152f commit b5db623
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,39 @@ object AndroidXLibraryDataset {
"work-gcm", "work-runtime", "work-runtime-ktx",
"work-rxjava2", "work-rxjava3", "work-testing"
)
),
AndroidXLibrary(
"https://dl.google.com/dl/android/maven2/androidx/startup/group-index.xml",
"https://developer.android.com/jetpack/androidx/releases/startup",
"androidx.startup",
listOf(
"startup-runtime"
)
),
AndroidXLibrary(
"https://dl.google.com/dl/android/maven2/androidx/hilt/group-index.xml",
"https://developer.android.com/jetpack/androidx/releases/hilt",
"androidx.hilt",
listOf(
"hilt-common", "hilt-compiler", "hilt-lifecycle-viewmodel",
"hilt-work"
)
),
AndroidXLibrary(
"https://dl.google.com/dl/android/maven2/androidx/gaming/group-index.xml",
"https://developer.android.com/jetpack/androidx/releases/gaming",
"androidx.gaming",
listOf(
"gaming-frame-pacing", "gaming-performance-tuner"
)
),
AndroidXLibrary(
"https://dl.google.com/dl/android/maven2/androidx/tracing/group-index.xml",
"https://developer.android.com/jetpack/androidx/releases/tracing",
"androidx.tracing",
listOf(
"tracing", "tracing-ktx"
)
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import name.lmj0011.jetpackreleasetracker.database.AndroidXArtifactUpdate
import name.lmj0011.jetpackreleasetracker.helpers.AndroidXLibraryDataset
import name.lmj0011.jetpackreleasetracker.helpers.AndroidXReleasePuller
import name.lmj0011.jetpackreleasetracker.helpers.NotificationHelper
import timber.log.Timber
import java.lang.Exception

class LibrariesViewModel(
val database: AndroidXArtifactDao,
Expand Down Expand Up @@ -137,24 +139,30 @@ class LibrariesViewModel(
val mList = mutableListOf<AndroidXArtifact>()

AndroidXLibraryDataset.data.forEach {
val map = arp.parseFeed(it)

map?.let { thisMap ->
it.artifactNames.forEach { artifactName ->
val key = "${it.packageName}:$artifactName"

thisMap[key]?.let { m ->
val artifact = AndroidXArtifact().apply{
name = key
packageName = it.packageName
releasePageUrl = it.releasePageUrl
latestStableVersion = m["latestStableVersion"].toString()
latestVersion = m["latestVersion"].toString()
try {
val map = arp.parseFeed(it)

map?.let { thisMap ->
it.artifactNames.forEach { artifactName ->
val key = "${it.packageName}:$artifactName"

thisMap[key]?.let { m ->
val artifact = AndroidXArtifact().apply{
name = key
packageName = it.packageName
releasePageUrl = it.releasePageUrl
latestStableVersion = m["latestStableVersion"].toString()
latestVersion = m["latestVersion"].toString()
}
mList.add(artifact)
}
mList.add(artifact)
}
}
} catch(ex: Exception) {
Timber.d("Failed to fetch artifacts from ${it.groupIndexUrl}")
Timber.e(ex)
}

}

return mList
Expand Down

0 comments on commit b5db623

Please sign in to comment.