Skip to content

Commit

Permalink
Paging 구현 및 Retrofit + Kotlinx-Serialization 으로 migration (#141)
Browse files Browse the repository at this point in the history
* Data, Domain 모듈 내에 paging 의존성 추가

* 장소 조회, 공지 조회 페이징 처리 구현

* Retrofit, kotlinx-serialization 라이브러리 의존성 추가

* Ktor + Moshi -> Retrofit + kotlinx-serialization 으로 migration

Authenticator, Paging 구현

* style check success

* 문의 API UseCase 추가

* Exception 변수 정리

네이밍 변경, 한 파일 내에서 관리
  • Loading branch information
easyhooon authored Oct 31, 2023
1 parent 27fd572 commit 4b7f50c
Show file tree
Hide file tree
Showing 139 changed files with 2,832 additions and 1,343 deletions.
6 changes: 3 additions & 3 deletions app/src/main/kotlin/us/wedemy/eggeum/android/IntroActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class IntroActivity : BaseActivity() {
splashScreen.setOnExitAnimationListener { splashScreenView ->
ObjectAnimator.ofFloat(splashScreenView, View.ALPHA, 1f, 0f).run {
interpolator = LinearInterpolator()
duration = 200L
duration = 500L
doOnEnd { splashScreenView.remove() }
start()
}
Expand All @@ -87,13 +87,13 @@ class IntroActivity : BaseActivity() {
repeatOnStarted {
launch {
viewModel.navigateToLoginEvent.collect {
delay(200L)
delay(500L)
startActivityWithAnimation<LoginActivity>()
}
}
launch {
viewModel.navigateToMainEvent.collect {
delay(200L)
delay(500L)
startActivityWithAnimation<MainActivity>()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class IntroViewModel @Inject constructor(

private fun getAccessToken() {
viewModelScope.launch {
val accessToken = getAccessTokenUseCase.execute()
val accessToken = getAccessTokenUseCase()
if (accessToken.isEmpty()) {
_navigateToLoginEvent.emit(Unit)
} else {
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
alias(libs.plugins.gradle.android.application) apply false
alias(libs.plugins.gradle.android.library) apply false
alias(libs.plugins.google.secrets) apply false
alias(libs.plugins.kotlinx.serialization) apply false
alias(libs.plugins.android.hilt) apply false
alias(libs.plugins.ksp) apply false
}
Expand Down
4 changes: 4 additions & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ plugins {
eggeum("kotlin-explicit-api")
eggeum("test-kotest")
alias(libs.plugins.google.secrets)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.moshix.ir)
}

Expand All @@ -32,7 +33,10 @@ dependencies {
libs.timber,
libs.moshi.core,
libs.moshi.kotlin,
libs.kotlinx.serialization.json,
libs.androidx.paging.runtime,
libs.bundles.ktor.client,
libs.bundles.retrofit,
projects.domain,
)
testImplementation(libs.test.ktor.client.mock)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.data.datasource
package us.wedemy.eggeum.android.data.datasource.login

public interface LoginLocalDataSource {
public suspend fun setAccessToken(accessToken: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.data.datasource
package us.wedemy.eggeum.android.data.datasource.login

import javax.inject.Inject
import us.wedemy.eggeum.android.data.datastore.TokenDataStoreProvider

public class LoginLocalDataSourceProvider @Inject constructor(
public class LoginLocalDataSourceImpl @Inject constructor(
// private val dataStore: TokenDataStore
private val dataStore: TokenDataStoreProvider,
) : LoginLocalDataSource {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Designed and developed by Wedemy 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.data.datasource.login

import us.wedemy.eggeum.android.data.model.login.LoginRequest
import us.wedemy.eggeum.android.data.model.login.LoginResponse
import us.wedemy.eggeum.android.data.model.login.SignUpRequest
import us.wedemy.eggeum.android.data.model.login.SignUpResponse

public interface LoginRemoteDataSource {
public suspend fun login(loginRequest: LoginRequest): LoginResponse?

public suspend fun signUp(signUpRequest: SignUpRequest): SignUpResponse?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Designed and developed by Wedemy 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.data.datasource.login

import javax.inject.Inject
import us.wedemy.eggeum.android.data.model.login.LoginRequest
import us.wedemy.eggeum.android.data.model.login.LoginResponse
import us.wedemy.eggeum.android.data.model.login.SignUpRequest
import us.wedemy.eggeum.android.data.model.login.SignUpResponse
import us.wedemy.eggeum.android.data.service.LoginService
import us.wedemy.eggeum.android.data.util.safeRequest

public class LoginRemoteDataSourceImpl @Inject constructor(
private val service: LoginService,
) : LoginRemoteDataSource {
public override suspend fun login(loginRequest: LoginRequest): LoginResponse? {
return safeRequest {
service.login(loginRequest)
}
}

public override suspend fun signUp(
signUpRequest: SignUpRequest,
): SignUpResponse? {
return safeRequest {
service.signUp(signUpRequest)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Designed and developed by Wedemy 2023.
*
* Licensed under the MIT.
* Please see full license: https://github.com/Wedemy/eggeum-android/blob/main/LICENSE
*/

package us.wedemy.eggeum.android.data.datasource.notice

import androidx.paging.PagingData
import kotlinx.coroutines.flow.Flow
import us.wedemy.eggeum.android.data.model.notice.NoticeResponse

public interface NoticeDataSource {
public suspend fun getNotice(noticeId: Int): NoticeResponse?

public suspend fun getNoticeList(
search: String?,
page: Int?,
size: Int?,
sort: String?,
startDate: String?,
endDate: String?,
): Flow<PagingData<NoticeResponse>>
}
Loading

0 comments on commit 4b7f50c

Please sign in to comment.