Merge pull request #879 from tatsuyafujisaki/rename-constants

Rename constants
pull/869/merge
Don Turner 1 year ago committed by GitHub
commit 4d0efef3b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,10 +57,10 @@ private interface RetrofitNiaNetworkApi {
): List<NetworkChangeList> ): List<NetworkChangeList>
} }
private const val NiaBaseUrl = BuildConfig.BACKEND_URL private const val NIA_BASE_URL = BuildConfig.BACKEND_URL
/** /**
* Wrapper for data provided from the [NiaBaseUrl] * Wrapper for data provided from the [NIA_BASE_URL]
*/ */
@Serializable @Serializable
private data class NetworkResponse<T>( private data class NetworkResponse<T>(
@ -77,7 +77,7 @@ class RetrofitNiaNetwork @Inject constructor(
) : NiaNetworkDataSource { ) : NiaNetworkDataSource {
private val networkApi = Retrofit.Builder() private val networkApi = Retrofit.Builder()
.baseUrl(NiaBaseUrl) .baseUrl(NIA_BASE_URL)
.callFactory(okhttpCallFactory) .callFactory(okhttpCallFactory)
.addConverterFactory( .addConverterFactory(
networkJson.asConverterFactory("application/json".toMediaType()), networkJson.asConverterFactory("application/json".toMediaType()),

@ -23,11 +23,11 @@ import androidx.navigation.compose.composable
import androidx.navigation.navigation import androidx.navigation.navigation
import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute import com.google.samples.apps.nowinandroid.feature.interests.InterestsRoute
private const val interestsGraphRoutePattern = "interests_graph" private const val INTERESTS_GRAPH_ROUTE_PATTERN = "interests_graph"
const val interestsRoute = "interests_route" const val interestsRoute = "interests_route"
fun NavController.navigateToInterestsGraph(navOptions: NavOptions? = null) { fun NavController.navigateToInterestsGraph(navOptions: NavOptions? = null) {
this.navigate(interestsGraphRoutePattern, navOptions) this.navigate(INTERESTS_GRAPH_ROUTE_PATTERN, navOptions)
} }
fun NavGraphBuilder.interestsGraph( fun NavGraphBuilder.interestsGraph(
@ -35,7 +35,7 @@ fun NavGraphBuilder.interestsGraph(
nestedGraphs: NavGraphBuilder.() -> Unit, nestedGraphs: NavGraphBuilder.() -> Unit,
) { ) {
navigation( navigation(
route = interestsGraphRoutePattern, route = INTERESTS_GRAPH_ROUTE_PATTERN,
startDestination = interestsRoute, startDestination = interestsRoute,
) { ) {
composable(route = interestsRoute) { composable(route = interestsRoute) {

@ -28,8 +28,8 @@ import androidx.work.NetworkType
import com.google.samples.apps.nowinandroid.sync.R import com.google.samples.apps.nowinandroid.sync.R
const val SYNC_TOPIC = "sync" const val SYNC_TOPIC = "sync"
private const val SyncNotificationId = 0 private const val SYNC_NOTIFICATION_ID = 0
private const val SyncNotificationChannelID = "SyncNotificationChannel" private const val SYNC_NOTIFICATION_CHANNEL_ID = "SyncNotificationChannel"
// All sync work needs an internet connectionS // All sync work needs an internet connectionS
val SyncConstraints val SyncConstraints
@ -42,7 +42,7 @@ val SyncConstraints
* run with a foreground service * run with a foreground service
*/ */
fun Context.syncForegroundInfo() = ForegroundInfo( fun Context.syncForegroundInfo() = ForegroundInfo(
SyncNotificationId, SYNC_NOTIFICATION_ID,
syncWorkNotification(), syncWorkNotification(),
) )
@ -53,7 +53,7 @@ fun Context.syncForegroundInfo() = ForegroundInfo(
private fun Context.syncWorkNotification(): Notification { private fun Context.syncWorkNotification(): Notification {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel( val channel = NotificationChannel(
SyncNotificationChannelID, SYNC_NOTIFICATION_CHANNEL_ID,
getString(R.string.sync_notification_channel_name), getString(R.string.sync_notification_channel_name),
NotificationManager.IMPORTANCE_DEFAULT, NotificationManager.IMPORTANCE_DEFAULT,
).apply { ).apply {
@ -68,7 +68,7 @@ private fun Context.syncWorkNotification(): Notification {
return NotificationCompat.Builder( return NotificationCompat.Builder(
this, this,
SyncNotificationChannelID, SYNC_NOTIFICATION_CHANNEL_ID,
) )
.setSmallIcon( .setSmallIcon(
com.google.samples.apps.nowinandroid.core.common.R.drawable.ic_nia_notification, com.google.samples.apps.nowinandroid.core.common.R.drawable.ic_nia_notification,

Loading…
Cancel
Save