Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api request 가 특정 시점 이후 호출되지 않는 이슈 해결 #117

Merged
merged 15 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ android {

buildTypes {
getByName("debug") {
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
"proguard-debug.pro"
)
applicationIdSuffix = ".dev"
manifestPlaceholders += mapOf(
"appName" to "@string/app_name_dev"
Expand Down Expand Up @@ -59,8 +63,10 @@ dependencies {
coreLibraryDesugaring(libs.desugar.jdk)
implementations(
projects.core.data,
projects.core.datastore,
projects.core.designsystem,
projects.core.domain,
projects.core.network,
projects.core.ui,
projects.feature.complete,
projects.feature.home,
Expand Down
9 changes: 9 additions & 0 deletions app/proguard-debug.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@
-dontobfuscate #난독화를 수행하지 않도록 함
-keepattributes SoureFile,LineNumberTable #소스파일, 라인 정보 유지
# End: Debug ProGuard rules

# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
9 changes: 9 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ tasks.register("clean", type = Delete::class) {
}

tasks.register("bundleRelease", type = Exec::class) {
commandLine(project.rootDir.resolve("gradlew"), "bundle")
workingDir = project.rootDir
commandLine(project.rootDir.resolve("gradlew"), "bundle")
workingDir = project.rootDir
}

tasks.register("release") {
Expand Down
9 changes: 4 additions & 5 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
bandalart("android-library")
bandalart("android-hilt")
alias(libs.plugins.google.secrets)
alias(libs.plugins.kotlinx.serialization)
}

Expand All @@ -20,9 +19,13 @@ android {
dependencies {
implementations(
projects.core.domain,
projects.core.datastore,
projects.core.network,
libs.kotlinx.serialization.json,
libs.androidx.datastore.preferences,
libs.bundles.ktor.client,
libs.bundles.retrofit,
libs.bundles.okhttp,
libs.timber,
)
}
Expand All @@ -32,7 +35,3 @@ tasks.withType<KotlinCompile> {
freeCompilerArgs = freeCompilerArgs + listOf("-opt-in=kotlin.ExperimentalStdlibApi")
}
}

secrets {
defaultPropertiesFileName = "secrets.properties"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package com.nexters.bandalart.android.core.data.di

import com.nexters.bandalart.android.core.data.repository.BandalartRepositoryImpl
import com.nexters.bandalart.android.core.data.repository.GuestLoginTokenRepositoryImpl
import com.nexters.bandalart.android.core.data.repository.ServerHealthCheckRepositoryImpl
import com.nexters.bandalart.android.core.domain.repository.BandalartRepository
import com.nexters.bandalart.android.core.domain.repository.GuestLoginTokenRepository
import com.nexters.bandalart.android.core.domain.repository.ServerHealthCheckRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand All @@ -22,11 +20,11 @@ internal abstract class RepositoryModule {
guestLoginTokenRepositoryImpl: GuestLoginTokenRepositoryImpl,
): GuestLoginTokenRepository

@Binds
@Singleton
abstract fun bindServerHealthCheckRepository(
serverHealthCheckRepositoryImpl: ServerHealthCheckRepositoryImpl,
): ServerHealthCheckRepository
// @Binds
// @Singleton
// abstract fun bindServerHealthCheckRepository(
// serverHealthCheckRepositoryImpl: ServerHealthCheckRepositoryImpl,
// ): ServerHealthCheckRepository

@Binds
@Singleton
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.nexters.bandalart.android.core.data.di

import com.nexters.bandalart.android.core.data.service.BandalartService
import com.nexters.bandalart.android.core.data.service.GuestLoginService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import retrofit2.Retrofit

@Module
@InstallIn(SingletonComponent::class)
internal object ServiceModule {

@Singleton
@Provides
internal fun provideBandalartService(retrofit: Retrofit): BandalartService {
return retrofit.create(BandalartService::class.java)
}

@Singleton
@Provides
internal fun provideGuestLoginService(retrofit: Retrofit): GuestLoginService {
return retrofit.create(GuestLoginService::class.java)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.nexters.bandalart.android.core.data.local.datasource

import com.nexters.bandalart.android.core.data.datasource.CompletedBandalartKeyDataSource
import com.nexters.bandalart.android.core.data.local.DataStoreProvider
import com.nexters.bandalart.android.core.datastore.DataStoreProvider
import javax.inject.Inject

internal class CompletedBandalartKeyDataStoreImpl @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.nexters.bandalart.android.core.data.local.datasource

import com.nexters.bandalart.android.core.data.datasource.GuestLoginLocalDataSource
import com.nexters.bandalart.android.core.data.local.DataStoreProvider
import com.nexters.bandalart.android.core.datastore.DataStoreProvider
import javax.inject.Inject

internal class GuestLoginLocalDataSourceImpl @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.nexters.bandalart.android.core.data.local.datasource

import com.nexters.bandalart.android.core.data.datasource.RecentBandalartKeyDataSource
import com.nexters.bandalart.android.core.data.local.DataStoreProvider
import com.nexters.bandalart.android.core.datastore.DataStoreProvider
import javax.inject.Inject

internal class RecentBandalartKeyDataSourceImpl @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,65 @@ import com.nexters.bandalart.android.core.data.model.bandalart.UpdateBandalartEm
import com.nexters.bandalart.android.core.data.model.bandalart.UpdateBandalartMainCellRequest
import com.nexters.bandalart.android.core.data.model.bandalart.UpdateBandalartSubCellRequest
import com.nexters.bandalart.android.core.data.model.bandalart.UpdateBandalartTaskCellRequest
import com.nexters.bandalart.android.core.data.service.BandalartService
import com.nexters.bandalart.android.core.data.util.extension.safeRequest
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.request.delete
import io.ktor.client.request.get
import io.ktor.client.request.patch
import io.ktor.client.request.post
import io.ktor.client.request.setBody
import javax.inject.Inject

internal class BandalartRemoteDataSourceImpl @Inject constructor(
private val client: HttpClient,
// private val client: HttpClient,
private val service: BandalartService,
) : BandalartRemoteDataSource {
override suspend fun createBandalart(): BandalartResponse? {
return client.safeRequest {
post("v1/bandalarts").body()
// return client.safeRequest {
// post("v1/bandalarts").body()
// }
return safeRequest {
service.createBandalart()
}
}

override suspend fun getBandalartList(): List<BandalartDetailResponse>? {
return client.safeRequest {
get("v1/bandalarts").body()
// return client.safeRequest {
// get("v1/bandalarts").body()
// }
return safeRequest {
service.getBandalartList()
}
}

override suspend fun getBandalartDetail(bandalartKey: String): BandalartDetailResponse? {
return client.safeRequest {
get("v1/bandalarts/$bandalartKey").body()
// return client.safeRequest {
// get("v1/bandalarts/$bandalartKey").body()
// }
return safeRequest {
service.getBandalartDetail(bandalartKey)
}
}

override suspend fun deleteBandalart(bandalartKey: String) {
client.safeRequest {
delete("v1/bandalarts/$bandalartKey")
// client.safeRequest {
// delete("v1/bandalarts/$bandalartKey")
// }
safeRequest {
service.deleteBandalart(bandalartKey)
}
}

override suspend fun getBandalartMainCell(bandalartKey: String): BandalartCellResponse? {
return client.safeRequest {
get("v1/bandalarts/$bandalartKey/cells").body()
// return client.safeRequest {
// get("v1/bandalarts/$bandalartKey/cells").body()
// }
return safeRequest {
service.getBandalartMainCell(bandalartKey)
}
}

override suspend fun getBandalartCell(bandalartKey: String, cellKey: String): BandalartCellResponse? {
return client.safeRequest {
get("v1/bandalarts/$bandalartKey/cells/$cellKey").body()
// return client.safeRequest {
// get("v1/bandalarts/$bandalartKey/cells/$cellKey").body()
// }
return safeRequest {
service.getBandalartCell(bandalartKey, cellKey)
}
}

Expand All @@ -63,10 +76,13 @@ internal class BandalartRemoteDataSourceImpl @Inject constructor(
cellKey: String,
updateBandalartMainCellRequest: UpdateBandalartMainCellRequest,
) {
client.safeRequest {
patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
setBody(updateBandalartMainCellRequest)
}
// client.safeRequest {
// patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
// setBody(updateBandalartMainCellRequest)
// }
// }
safeRequest {
service.updateBandalartMainCell(bandalartKey, cellKey, updateBandalartMainCellRequest)
}
}

Expand All @@ -75,10 +91,13 @@ internal class BandalartRemoteDataSourceImpl @Inject constructor(
cellKey: String,
updateBandalartSubCellRequest: UpdateBandalartSubCellRequest,
) {
client.safeRequest {
patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
setBody(updateBandalartSubCellRequest)
}
// client.safeRequest {
// patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
// setBody(updateBandalartSubCellRequest)
// }
// }
safeRequest {
service.updateBandalartSubCell(bandalartKey, cellKey, updateBandalartSubCellRequest)
}
}

Expand All @@ -87,10 +106,13 @@ internal class BandalartRemoteDataSourceImpl @Inject constructor(
cellKey: String,
updateBandalartTaskCellRequest: UpdateBandalartTaskCellRequest,
) {
client.safeRequest {
patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
setBody(updateBandalartTaskCellRequest)
}
// client.safeRequest {
// patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
// setBody(updateBandalartTaskCellRequest)
// }
// }
safeRequest {
service.updateBandalartTaskCell(bandalartKey, cellKey, updateBandalartTaskCellRequest)
}
}

Expand All @@ -99,22 +121,31 @@ internal class BandalartRemoteDataSourceImpl @Inject constructor(
cellKey: String,
updateBandalartEmojiRequest: UpdateBandalartEmojiRequest,
) {
client.safeRequest {
patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
setBody(updateBandalartEmojiRequest)
}
// client.safeRequest {
// patch("v1/bandalarts/$bandalartKey/cells/$cellKey") {
// setBody(updateBandalartEmojiRequest)
// }
// }
safeRequest {
service.updateBandalartEmoji(bandalartKey, cellKey, updateBandalartEmojiRequest)
}
}

override suspend fun deleteBandalartCell(bandalartKey: String, cellKey: String) {
client.safeRequest {
delete("v1/bandalarts/$bandalartKey/cells/$cellKey")
// client.safeRequest {
// delete("v1/bandalarts/$bandalartKey/cells/$cellKey")
// }
safeRequest {
service.deleteBandalartCell(bandalartKey, cellKey)
}
}

override suspend fun shareBandalart(bandalartKey: String): BandalartShareResponse? {
return client.safeRequest {
post("v1/bandalarts/$bandalartKey/shares").body()
// return client.safeRequest {
// post("v1/bandalarts/$bandalartKey/shares").body()
// }
return safeRequest {
service.shareBandalart(bandalartKey)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ package com.nexters.bandalart.android.core.data.remote.datasource

import com.nexters.bandalart.android.core.data.datasource.GuestLoginRemoteDataSource
import com.nexters.bandalart.android.core.data.model.GuestLoginTokenResponse
import com.nexters.bandalart.android.core.data.service.GuestLoginService
import com.nexters.bandalart.android.core.data.util.extension.safeRequest
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.request.post
import javax.inject.Inject

internal class GuestLoginRemoteDataSourceImpl @Inject constructor(
private val client: HttpClient,
private val service: GuestLoginService,
// private val client: HttpClient,
) : GuestLoginRemoteDataSource {
override suspend fun createGuestLoginToken(): GuestLoginTokenResponse? {
return client.safeRequest {
post("v1/users/guests").body()
// return client.safeRequest {
// post("v1/users/guests").body()
// }
return safeRequest {
service.createGuestLoginToken()
}
}
}
Loading