Skip to content

Commit

Permalink
Upgrade gradle version and increase SDK versions
Browse files Browse the repository at this point in the history
  • Loading branch information
khoi-nguyen-2359 committed Aug 27, 2024
1 parent e33cb74 commit b97d696
Show file tree
Hide file tree
Showing 158 changed files with 1,393 additions and 7,244 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ android {
buildFeatures {
viewBinding true
compose true
buildConfig true
}

composeOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package akio.apps.myrun.feature.configurator

import akio.apps.myrun.BuildConfig
import akio.apps.myrun.R
import akio.apps.myrun.feature.core.AppNotificationChannel
import android.annotation.SuppressLint
import android.app.Notification
import android.app.PendingIntent
import android.content.Context
Expand All @@ -17,11 +16,8 @@ object ConfiguratorFacade {
"akio.apps.myrun.feature.configurator.ConfiguratorActivity"
private val NOTIFICATION_ID = AppNotificationChannel.Debug.nextNotificationStaticId()

@SuppressLint("MissingPermission")
fun notifyInDebugMode(context: Context) {
if (BuildConfig.BUILD_TYPE != "debug") {
return
}

val notMan = NotificationManagerCompat.from(context)
val activityClass = try {
Class.forName(CONFIGURATOR_ACTIVITY_NAME)
Expand All @@ -41,7 +37,7 @@ object ConfiguratorFacade {
.setDefaults(Notification.DEFAULT_ALL)
.setOngoing(true)
.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.ic_run_circle)
.setSmallIcon(akio.apps.myrun.feature.core.R.drawable.ic_run_circle)
.build()

notMan.notify(NOTIFICATION_ID, notification)
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/akio/apps/myrun/MyRunApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MyRunApp :
}

private fun initPlacesSdk() {
Places.initialize(applicationContext, getString(R.string.google_direction_api_key))
Places.initialize(applicationContext, getString(akio.apps.myrun.data.location.R.string.google_direction_api_key))
}

override fun onStart(owner: LifecycleOwner) {
Expand Down Expand Up @@ -123,9 +123,7 @@ class MyRunApp :
.setMinimumLoggingLevel(android.util.Log.DEBUG)
.build()
} else {
Configuration.Builder()
.setMinimumLoggingLevel(android.util.Log.ERROR)
.build()
Configuration.Builder().build()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package akio.apps.myrun.feature.main.ui

import akio.apps.myrun.R
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.feature.core.ktx.px2dp
import akio.apps.myrun.feature.core.navigation.HomeTabNavDestination
Expand All @@ -13,6 +13,7 @@ import akio.apps.myrun.feature.feed.ui.ActivityFeedComposable
import akio.apps.myrun.feature.main.HomeTabViewModel
import akio.apps.myrun.feature.main.di.DaggerHomeTabComponent
import akio.apps.myrun.feature.userstats.ui.CurrentUserStatsComposable
import android.annotation.SuppressLint
import android.app.Application
import androidx.annotation.StringRes
import androidx.compose.animation.EnterTransition
Expand Down Expand Up @@ -151,6 +152,7 @@ private fun rememberViewModel(): HomeTabViewModel {
}
}

@SuppressLint("UnrememberedMutableState")
@Composable
private fun rememberFabState(currentTabEntry: NavBackStackEntry?): HomeTabFabState {
val systemBarBottomDp = WindowInsets.systemBars.getBottom(LocalDensity.current).px2dp.dp
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/akio/apps/myrun/log/MyDebugTree.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package akio.apps.myrun.log
import akio.apps.myrun.MyRunApp
import akio.apps.myrun.R
import akio.apps.myrun.feature.core.AppNotificationChannel
import android.annotation.SuppressLint
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
Expand All @@ -29,12 +30,13 @@ class MyDebugTree(private val application: MyRunApp) : Timber.DebugTree() {
FirebaseCrashlytics.getInstance().sendUnsentReports()
}

@SuppressLint("MissingPermission")
private fun notifyExceptionReport(cause: Throwable) {
val stackTrace = cause.stackTraceToString()
val notification = NotificationCompat.Builder(application, AppNotificationChannel.Debug.id)
.setContentTitle("A ${cause::class.simpleName} was recorded.")
.setContentText(stackTrace)
.setSmallIcon(R.drawable.ic_run_circle)
.setSmallIcon(akio.apps.myrun.feature.core.R.drawable.ic_run_circle)
.build()
NotificationManagerCompat.from(application)
.notify(System.currentTimeMillis().toInt(), notification)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package akio.apps.myrun.feature.configurator

import android.content.Context

object ConfiguratorFacade {
@Suppress("UNUSED_PARAMETER")
fun notifyInDebugMode(context: Context) {
// not enabled in release build
}
}
4 changes: 2 additions & 2 deletions app_versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ project.ext {
versionCode = 2_04_01
appId = "akio.apps.myrun"
minSdk = 21
targetSdk = 33
compileSdk = 33
targetSdk = 34
compileSdk = 34
}
5 changes: 0 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ buildscript {
repositories {
google()
mavenCentral()
//noinspection JcenterRepositoryObsolete
jcenter()
}

dependencies {
Expand All @@ -16,7 +14,6 @@ buildscript {
classpath(libs.playservices.plugin)
classpath(libs.firebase.crashlytics.plugin)
classpath(libs.firebase.perf.plugin)
classpath(libs.buildtimetracker)
classpath(libs.kotlinserialization.plugin)
}
}
Expand All @@ -25,8 +22,6 @@ allprojects {
repositories {
google()
mavenCentral()
//noinspection JcenterRepositoryObsolete
jcenter()

maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
Expand Down
2 changes: 1 addition & 1 deletion data/activity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.play.services)

implementation(libs.tcxzpot)
implementation(project(":libs:routeparser"))

implementation(libs.dagger)
ksp(libs.daggercompiler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,7 @@ interface ExternalAppDataModule {
object Providers {
@Provides
@JvmStatic
fun okHttpClient(): OkHttpClient.Builder {
val builder = OkHttpClient.Builder()
if (BuildConfig.DEBUG) {
val logger = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
builder.addInterceptor(logger)
}

return builder
}
fun okHttpClient(): OkHttpClient.Builder = OkHttpClient.Builder()

@Provides
@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ interface LocationDataModule {
@JvmStatic
fun googleDirectionApi(): GoogleMapDirectionApi {
val okHttpClientBuilder = OkHttpClient.Builder()
if (BuildConfig.DEBUG) {
val logger = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
okHttpClientBuilder.addInterceptor(logger)
}
val okHttpClient = okHttpClientBuilder.build()

val retrofit = Retrofit.Builder()
Expand Down
1 change: 1 addition & 0 deletions feature/activity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {

buildFeatures {
compose true
buildConfig true
}

composeOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package akio.apps.myrun.feature.activitydetail
import akio.apps.myrun.base.di.NamedIoDispatcher
import akio.apps.myrun.domain.activity.ExportTempTcxFileUsecase
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.activitydetail.di.DaggerActivityExportFeatureComponent
import akio.apps.myrun.feature.core.AppNotificationChannel
import akio.apps.myrun.feature.core.ktx.getParcelableExtraExt
Expand Down Expand Up @@ -98,7 +99,7 @@ class ActivityExportService : Service() {
} else {
Notification.Builder(this, AppNotificationChannel.General.id)
}
.setSmallIcon(R.drawable.ic_run_circle)
.setSmallIcon(coreR.drawable.ic_run_circle)
.setContentTitle(getString(R.string.activity_export_progress_notification_title))
.setContentText(notificationContentText)
.setProgress(/* max = */0, /* progress = */0, /* indeterminate = */true)
Expand Down Expand Up @@ -145,11 +146,11 @@ class ActivityExportService : Service() {
)
val action = NotificationCompat.Action(
/* icon = */ null,
/* title = */ getString(R.string.action_retry),
/* title = */ getString(coreR.string.action_retry),
/* intent = */ pendingIntent
)
val notification = NotificationCompat.Builder(this, AppNotificationChannel.General.id)
.setSmallIcon(R.drawable.ic_run_circle)
.setSmallIcon(coreR.drawable.ic_run_circle)
.setContentTitle(getString(R.string.activity_export_error_notification_title))
.setContentText(activityDescription)
.addAction(action)
Expand Down Expand Up @@ -187,7 +188,7 @@ class ActivityExportService : Service() {
pendingIntentFlag
)
val notification = NotificationCompat.Builder(this, AppNotificationChannel.General.id)
.setSmallIcon(R.drawable.ic_run_circle)
.setSmallIcon(coreR.drawable.ic_run_circle)
.setContentTitle(activityDescription)
.setContentText(getString(R.string.activity_export_success_notification_title))
.setContentIntent(pendingIntent)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package akio.apps.myrun.feature.activitydetail

import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.BitmapUtils.createDrawableBitmap
import akio.apps.myrun.feature.core.ktx.dp2px
import akio.apps.myrun.feature.core.ktx.getColorCompat
Expand Down Expand Up @@ -57,7 +58,7 @@ internal class ActivityRouteMapActivity : AppCompatActivity(R.layout.activity_ac
}
}
map.setMapStyle(
MapStyleOptions.loadRawResourceStyle(this, R.raw.google_map_styles)
MapStyleOptions.loadRawResourceStyle(this, coreR.raw.google_map_styles)
)
with(map.uiSettings) {
isMyLocationButtonEnabled = false
Expand All @@ -71,7 +72,7 @@ internal class ActivityRouteMapActivity : AppCompatActivity(R.layout.activity_ac
private fun drawStartStopMarker() {
val startMarkerBitmap = createDrawableBitmap(
context = this,
drawableResId = R.drawable.ic_start_marker
drawableResId = coreR.drawable.ic_start_marker
)
if (startMarkerBitmap != null) {
val startMarker = MarkerOptions()
Expand All @@ -83,7 +84,7 @@ internal class ActivityRouteMapActivity : AppCompatActivity(R.layout.activity_ac

val stopMarkerBitmap = createDrawableBitmap(
context = this,
drawableResId = R.drawable.ic_stop_marker
drawableResId = coreR.drawable.ic_stop_marker
)
if (stopMarkerBitmap != null) {
val stopMarker = MarkerOptions()
Expand All @@ -99,7 +100,7 @@ internal class ActivityRouteMapActivity : AppCompatActivity(R.layout.activity_ac
.jointType(JointType.ROUND)
.startCap(RoundCap())
.endCap(RoundCap())
.color(getColorCompat(R.color.route_tracking_polyline))
.color(getColorCompat(coreR.color.route_tracking_polyline))
.width(3.dp2px)
map.addPolyline(mapPolyline)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package akio.apps.myrun.feature.activitydetail.ui
import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.user.api.model.MeasureSystem
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.activitydetail.ActivityDetailViewModel
import akio.apps.myrun.feature.activitydetail.ActivityRouteMapActivity
import akio.apps.myrun.feature.activitydetail.di.DaggerActivityDetailFeatureComponent
Expand Down Expand Up @@ -344,7 +345,7 @@ private fun ShareActionMenu(onClickExportFile: () -> Unit) {
) {
Text(
text = stringResource(
id = R.string.activity_share_menu_item_export_file
id = coreR.string.activity_share_menu_item_export_file
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.activity.api.model.RunningActivityModel
import akio.apps.myrun.domain.activity.ActivityDateTimeFormatter
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.ui.UserAvatarImage
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -36,8 +37,8 @@ internal fun ActivityInfoHeaderView(
) = Column(
modifier = Modifier
.padding(
vertical = dimensionResource(id = R.dimen.common_item_vertical_padding),
horizontal = dimensionResource(id = R.dimen.common_item_horizontal_padding)
vertical = dimensionResource(id = coreR.dimen.common_item_vertical_padding),
horizontal = dimensionResource(id = coreR.dimen.common_item_horizontal_padding)
)
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Expand Down Expand Up @@ -69,7 +70,7 @@ private fun ActivityNameText(activityDetail: BaseActivityModel) = Text(
text = activityDetail.name,
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp, end = dimensionResource(id = R.dimen.common_item_horizontal_padding)),
.padding(top = 8.dp, end = dimensionResource(id = coreR.dimen.common_item_horizontal_padding)),
fontWeight = FontWeight.Bold,
style = MaterialTheme.typography.h6
)
Expand All @@ -84,11 +85,11 @@ private fun ActivityTimeAndPlaceText(
Timber.d("making startTimeText")
when (activityFormattedStartTime) {
is ActivityDateTimeFormatter.Result.WithinToday -> context.getString(
R.string.item_activity_time_today,
coreR.string.item_activity_time_today,
activityFormattedStartTime.formattedValue
)
is ActivityDateTimeFormatter.Result.WithinYesterday -> context.getString(
R.string.item_activity_time_yesterday,
coreR.string.item_activity_time_yesterday,
activityFormattedStartTime.formattedValue
)
is ActivityDateTimeFormatter.Result.FullDateTime ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.user.api.model.MeasureSystem
import akio.apps.myrun.data.user.api.model.UserFollowSuggestion
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.ktx.px2dp
import akio.apps.myrun.feature.core.launchcatching.launchCatching
import akio.apps.myrun.feature.core.ui.AppColors
Expand Down Expand Up @@ -267,7 +268,7 @@ private fun ActivityFeedEmptyMessage(modifier: Modifier = Modifier) = Box(
text = stringResource(R.string.splash_welcome_text),
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(horizontal = dimensionResource(R.dimen.common_page_horizontal_padding)),
.padding(horizontal = dimensionResource(coreR.dimen.common_page_horizontal_padding)),
color = colorResource(R.color.activity_feed_instruction_text),
fontSize = 30.sp,
fontStyle = FontStyle.Italic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import akio.apps.myrun.data.activity.api.model.AthleteInfo
import akio.apps.myrun.data.activity.api.model.BaseActivityModel
import akio.apps.myrun.data.activity.api.model.RunningActivityModel
import akio.apps.myrun.feature.activity.R
import akio.apps.myrun.feature.core.R as coreR
import akio.apps.myrun.feature.core.ui.modifyIf
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
Expand Down Expand Up @@ -36,7 +37,7 @@ internal fun ActivityRouteImage(
.data(data = activity.routeImage)
.size(imageWidth, imageHeight)
.crossfade(200)
.placeholder(R.color.placeholder)
.placeholder(coreR.color.placeholder)
.build()
)
Image(
Expand Down
Loading

0 comments on commit b97d696

Please sign in to comment.