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

#278 [refactor] deprecated된 함수 수정 및 네트워크 에러 분기처리 #279

Merged
merged 34 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d23dfb5
#278 [build] serialization 버전 업그레이드
2zerozu Oct 29, 2023
8d87928
#278 [build] glide 의존성 제거
2zerozu Oct 29, 2023
90062a2
#278 [build] okhttp3 의존성 업그레이드 및 bom 제거
2zerozu Oct 31, 2023
8f13494
#278 [chore] ktlint 적용
2zerozu Nov 2, 2023
64a4bf9
#278 [feat] camera required true로 수정
2zerozu Nov 2, 2023
cc82cf4
#278 [refactor] 이미지 리소스 사용하는 바인딩어댑터 함수명 수정
2zerozu Nov 3, 2023
fd80174
#278 [fix] 불필요한 어노테이션 제거
2zerozu Nov 5, 2023
672e955
#278 [fix] DEPRECATION 어노테이션 추가
2zerozu Nov 7, 2023
ba0bd6e
#278 [refactor] parcelable 확장함수 수정
2zerozu Nov 27, 2023
cc3d8d5
#278 [feat] serializable 확장함수 구현
2zerozu Nov 10, 2023
ee4226f
#278 [refactor] parcelable, serializable 확장함수 적용
2zerozu Nov 11, 2023
a29c458
#278 [refactor] binding adapter에 있는 glide를 coil로 대체
2zerozu Nov 12, 2023
358def2
#278 [refactor] parcelable 확장함수 적용
2zerozu Nov 14, 2023
df2d48a
#278 [refactor] transition 확장함수 적용
2zerozu Nov 15, 2023
edcbdc2
#278 [fix] 바코드 deprecated 된 함수 개선
2zerozu Nov 16, 2023
e106e7c
#278 [fix] PickModifyViewModel preListAState, selectItemIdList 접근제한자 수정
2zerozu Nov 17, 2023
10c7547
#278 [feat] activityTransition import 추가
2zerozu Nov 18, 2023
8d266ea
#278 [refactor] ktlint
2zerozu Nov 19, 2023
fce48a3
#278 [feat] getScreenSize 확장함수 구현
2zerozu Nov 20, 2023
6022103
#278 [feat] getScreenSize 확장함수 적용
2zerozu Nov 21, 2023
1324263
#278 [refactor] 권한 변수명 수정
2zerozu Nov 22, 2023
3fe1591
#278 [fix] BarcodeAnalyser analyze 함수 SuppressLint를 OptIn으로 수정
2zerozu Nov 26, 2023
c1b94a3
#278 [refactor] BarcodeAnalyzer 클래스명 수정
2zerozu Nov 27, 2023
e44d503
#278 [feat] 강제업데이트 액티비티명 수정
2zerozu Dec 13, 2023
31523c6
#278 [feat] 강제업데이트 로직 수정
2zerozu Dec 13, 2023
b4d8d46
#278 [refactor] 뒤로가기 버튼 클릭하는 로직 확장함수 구현
2zerozu Nov 29, 2023
d5c0243
#278 [refactor] 강제업데이트버전 로직 수정
2zerozu Nov 30, 2023
706e935
#278 [feat] 스플래시 스테이트 저장하는 로직 수정
2zerozu Dec 1, 2023
50bc9d2
#278 [refactor] 사용자검색뷰 collect 함수명 수정
2zerozu Dec 2, 2023
9d42312
#278 [refactor] 네트워크에러 확장함수 수정
2zerozu Dec 3, 2023
389edc7
#278 [chore] 린트 수정
2zerozu Dec 4, 2023
ddfdef4
#278 [chore] ktlint
2zerozu Dec 5, 2023
43e3e69
#278 [chore] ktlint
2zerozu Dec 7, 2023
1248dde
#278 [fix] 애니메이션 트랜지션 버전대응
2zerozu Dec 8, 2023
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
9 changes: 2 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'dagger.hilt.android.plugin'
id 'kotlin-parcelize'
id "org.jlleitschuh.gradle.ktlint" version "10.3.0"
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.20'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.0'
id 'com.google.gms.google-services'
}

Expand Down Expand Up @@ -59,10 +59,6 @@ android {

dependencies {

// glide
implementation 'com.github.bumptech.glide:glide:4.13.2'
kapt 'com.github.bumptech.glide:compiler:4.13.2'

// hilt
implementation 'com.google.dagger:hilt-android:2.48.1'
kapt 'com.google.dagger:hilt-compiler:2.48.1'
Expand All @@ -84,8 +80,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'

// network
implementation 'com.squareup.okhttp3:logging-interceptor:4.11.0'
implementation(platform('com.squareup.okhttp3:okhttp-bom:4.11.0'))
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0'

Expand Down
13 changes: 8 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

<uses-feature
android:name="android.hardware.camera"
android:required="false" />
android:required="true" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<uses-permission
Expand All @@ -34,9 +36,10 @@
android:theme="@style/Theme.PeekabookAOS"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity android:name=".presentation.forceUpdate.ForceUpdateActivity"
<activity
android:name=".presentation.forceUpdate.ForcedUpdateActivity"
android:exported="false"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait" />
<activity
android:name=".presentation.profileModify.ProfileModifyActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.sopt.peekabookaos.data.entity.response

import kotlinx.serialization.Serializable

@Serializable
data class ForcedUpdateResponse(
val imageUrl: String,
val androidForceVersion: String,
val text: String
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.sopt.peekabookaos.data.repository

import com.sopt.peekabookaos.data.source.local.LocalPrefDataSource
import com.sopt.peekabookaos.data.source.local.LocalSplashDataSource
import com.sopt.peekabookaos.data.source.local.LocalSignedUpDataSource
import com.sopt.peekabookaos.data.source.local.LocalTokenDataSource
import com.sopt.peekabookaos.data.source.remote.AuthDataSource
import com.sopt.peekabookaos.domain.entity.SplashState
import com.sopt.peekabookaos.domain.entity.Token
import com.sopt.peekabookaos.domain.repository.AuthRepository
import javax.inject.Inject
Expand All @@ -13,7 +12,7 @@ class AuthRepositoryImpl @Inject constructor(
private val authDataSource: AuthDataSource,
private val localTokenDataSource: LocalTokenDataSource,
private val localPrefDataSource: LocalPrefDataSource,
private val localSplashDataSource: LocalSplashDataSource
private val localSignedUpDataSource: LocalSignedUpDataSource
) : AuthRepository {
override suspend fun postLogin(socialPlatform: String): Result<Token> =
kotlin.runCatching { authDataSource.postLogin(socialPlatform) }.map { response ->
Expand All @@ -28,15 +27,10 @@ class AuthRepositoryImpl @Inject constructor(
localTokenDataSource.refreshToken = refreshToken
}

override fun setSplashState(splashState: SplashState) {
localSplashDataSource.splashState = splashState.toString()
}

override fun getSplashState(): SplashState {
return SplashState.valueOf(localSplashDataSource.splashState)
}
override fun clearLocalPref() = localPrefDataSource.clearLocalPref()

override fun clearLocalPref() {
localPrefDataSource.clearLocalPref()
override fun getSignedUp(): Boolean = localSignedUpDataSource.isSignedUp
override fun setSignedUp() {
localSignedUpDataSource.isSignedUp = true
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.sopt.peekabookaos.data.repository

import com.sopt.peekabookaos.data.source.remote.ForcedUpdateDataSource
import com.sopt.peekabookaos.domain.entity.ForcedUpdate
import com.sopt.peekabookaos.domain.entity.UpdateInformation
import com.sopt.peekabookaos.domain.entity.Version
import com.sopt.peekabookaos.domain.repository.ForcedUpdateRepository
import javax.inject.Inject

class ForcedUpdateRepositoryImpl @Inject constructor(
private val forcedUpdateDataSource: ForcedUpdateDataSource
) : ForcedUpdateRepository {
override suspend fun hasForceUpdateVersion(
currentVersion: String
): Result<ForcedUpdate> = kotlin.runCatching {
forcedUpdateDataSource.getForcedUpdateVersion()
}.map { response ->
val (imageUrl, androidForceVersion, text) = requireNotNull(response.data)
if (Version.of(androidForceVersion).greaterThan(Version.of(currentVersion))) {
return@map ForcedUpdate.Need(UpdateInformation(imageUrl, text))
} else {
return@map ForcedUpdate.None
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.sopt.peekabookaos.data.service

import com.sopt.peekabookaos.data.entity.BaseResponse
import com.sopt.peekabookaos.data.entity.response.ForcedUpdateResponse
import retrofit2.http.GET

interface ForcedUpdateService {
@GET("user/v1/version")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍👍

suspend fun getVersion(): BaseResponse<ForcedUpdateResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.sopt.peekabookaos.data.source.local

import android.content.SharedPreferences
import androidx.core.content.edit
import javax.inject.Inject

class LocalSignedUpDataSource @Inject constructor(
private val prefs: SharedPreferences
) {
var isSignedUp: Boolean
set(value) = prefs.edit { putBoolean(SIGNED_UP, value) }
get() = prefs.getBoolean(SIGNED_UP, false)

companion object {
private const val SIGNED_UP = "signed up"
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.sopt.peekabookaos.data.source.remote

import com.sopt.peekabookaos.data.entity.BaseResponse
import com.sopt.peekabookaos.data.entity.response.ForcedUpdateResponse
import com.sopt.peekabookaos.data.service.ForcedUpdateService
import javax.inject.Inject

class ForcedUpdateDataSource @Inject constructor(
private val forcedUpdateService: ForcedUpdateService
) {
suspend fun getForcedUpdateVersion(): BaseResponse<ForcedUpdateResponse> =
forcedUpdateService.getVersion()
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.sopt.peekabookaos.data.repository.AuthRepositoryImpl
import com.sopt.peekabookaos.data.repository.BlockRepositoryImpl
import com.sopt.peekabookaos.data.repository.BookRepositoryImpl
import com.sopt.peekabookaos.data.repository.DetailRepositoryImpl
import com.sopt.peekabookaos.data.repository.ForceUpdateRepositoryImpl
import com.sopt.peekabookaos.data.repository.ForcedUpdateRepositoryImpl
import com.sopt.peekabookaos.data.repository.MyPageRepositoryImpl
import com.sopt.peekabookaos.data.repository.NaverRepositoryImpl
import com.sopt.peekabookaos.data.repository.NotificationRepositoryImpl
Expand All @@ -18,7 +18,7 @@ import com.sopt.peekabookaos.domain.repository.AuthRepository
import com.sopt.peekabookaos.domain.repository.BlockRepository
import com.sopt.peekabookaos.domain.repository.BookRepository
import com.sopt.peekabookaos.domain.repository.DetailRepository
import com.sopt.peekabookaos.domain.repository.ForceUpdateRepository
import com.sopt.peekabookaos.domain.repository.ForcedUpdateRepository
import com.sopt.peekabookaos.domain.repository.MyPageRepository
import com.sopt.peekabookaos.domain.repository.NaverRepository
import com.sopt.peekabookaos.domain.repository.NotificationRepository
Expand Down Expand Up @@ -118,6 +118,6 @@ abstract class RepositoryModule {
@Binds
@Singleton
abstract fun bindToForceUpdateRepository(
forceUpdateRepositoryImpl: ForceUpdateRepositoryImpl
): ForceUpdateRepository
forceUpdateRepositoryImpl: ForcedUpdateRepositoryImpl
): ForcedUpdateRepository
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.sopt.peekabookaos.data.service.AuthService
import com.sopt.peekabookaos.data.service.BlockService
import com.sopt.peekabookaos.data.service.BookService
import com.sopt.peekabookaos.data.service.DetailService
import com.sopt.peekabookaos.data.service.ForceUpdateService
import com.sopt.peekabookaos.data.service.ForcedUpdateService
import com.sopt.peekabookaos.data.service.MyPageService
import com.sopt.peekabookaos.data.service.NaverService
import com.sopt.peekabookaos.data.service.NotificationService
Expand All @@ -22,7 +22,6 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import retrofit2.create

@Module
@InstallIn(SingletonComponent::class)
Expand Down Expand Up @@ -80,6 +79,6 @@ object RetrofitServiceModule {
retrofit.create(ReportService::class.java)

@Provides
fun providesForceUpdateService(@PeekaType retrofit: Retrofit): ForceUpdateService =
retrofit.create(ForceUpdateService::class.java)
fun providesForceUpdateService(@PeekaType retrofit: Retrofit): ForcedUpdateService =
retrofit.create(ForcedUpdateService::class.java)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.sopt.peekabookaos.domain.entity

sealed class ForcedUpdate {
data object None : ForcedUpdate()
data class Need(val updateInformation: UpdateInformation) : ForcedUpdate()
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.sopt.peekabookaos.domain.entity

sealed class SplashUiState {
data object Idle : SplashUiState()
data object Error : SplashUiState()
data object ShowSplash : SplashUiState()
data object CanStartOnboarding : SplashUiState()
data object CanStartMain : SplashUiState()
data class ForceUpdate(val data: UpdateInformation) : SplashUiState()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.sopt.peekabookaos.domain.entity

import android.os.Parcelable
import kotlinx.parcelize.Parcelize

@Parcelize
data class UpdateInformation(
val imageUrl: String = "",
val text: String = ""
) : Parcelable
25 changes: 17 additions & 8 deletions app/src/main/java/com/sopt/peekabookaos/domain/entity/Version.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
package com.sopt.peekabookaos.domain.entity

import android.os.Parcelable
import kotlinx.parcelize.Parcelize
class Version private constructor(
private val major: Int,
private val minor: Int
) {

@Parcelize
data class Version(
val imageUrl: String = "",
val androidForceVersion: String = "",
val versionText: String = ""
) : Parcelable
fun greaterThan(other: Version): Boolean = other.major < major || other.minor < minor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean 을 반환하는 경우는 isGreaterThan처럼 보통 쓴다고 알고 있는데 혹시 어떤가요!?

Copy link
Contributor Author

@2zerozu 2zerozu Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean 을 반환하는 경우는 isGreaterThan처럼 보통 쓴다고 알고 있는데 혹시 어떤가요!?

모든 boolean에 is 접두사를 붙일 필요는 없어요!
greaterThan이 ~보다 크다 라는 뜻의 함수로 쓰인 거라 greaterThan(cutrentVersion)이라면 현재 버전보다 높다(false라면 낮다)이기 때문에 boolean이라 예상 가능해보입니다
isGreaterThan이라면 is가 불용어가 될 거 같아용


companion object {
private const val VERSION_SPLIT_SIGN = "."
private const val MAJOR_POSITION = 0
private const val MINOR_POSITION = 1
fun of(version: String) = version.split(VERSION_SPLIT_SIGN).map {
it.toInt()
}.let {
Version(it[MAJOR_POSITION], it[MINOR_POSITION])
}
}
}

This file was deleted.

This file was deleted.

Loading
Loading