Skip to content

Commit 711d869

Browse files
authored
Merge pull request #104 from Nexters/fix/login
[FIX] 로그인 관련 예외 처리 추가
2 parents 3cd513a + 5ebe472 commit 711d869

File tree

6 files changed

+53
-30
lines changed

6 files changed

+53
-30
lines changed

app/proguard-rules.pro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,12 @@
2727
# R8 full mode strips generic signatures from return types if not kept.
2828
-if interface * { @retrofit2.http.* public *** *(...); }
2929
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
30+
31+
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
32+
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
33+
-keep,allowobfuscation,allowshrinking class retrofit2.Response
34+
35+
# With R8 full mode generic signatures are stripped for classes that are not
36+
# kept. Suspend functions are wrapped in continuations where the type argument
37+
# is used.
38+
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

build-logic/src/main/kotlin/com/nexters/ilab/android/Config.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ internal object ApplicationConfig {
44
const val MinSdk = 26
55
const val TargetSdk = 34
66
const val CompileSdk = 34
7-
const val VersionCode = 1
8-
const val VersionName = "1.0.0"
7+
const val VersionCode = 3
8+
const val VersionName = "1.0.2"
99
val JavaVersion = org.gradle.api.JavaVersion.VERSION_17
1010
const val JavaVersionAsInt = 17
1111
}

feature/intro/proguard-rules.pro

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
22+
23+
# https://stackoverflow.com/questions/70037537/proguard-missing-classes-detected-while-running-r8-after-adding-package-names-in
24+
-dontwarn java.lang.invoke.StringConcatFactory
25+

feature/intro/src/main/kotlin/com/nexters/ilab/android/feature/intro/IntroScreen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ internal fun IntroRoute(
5050
}
5151
} else {
5252
Timber.d("accessToken 이 유효함")
53+
Timber.d("id: ${tokeninfo?.id}, expiresIn: ${tokeninfo?.expiresIn}, appId: ${tokeninfo?.appId}")
5354
viewModel.autoLoginSuccess()
5455
}
5556
}

feature/intro/src/main/kotlin/com/nexters/ilab/android/feature/intro/viewmodel/IntroViewModel.kt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.orbitmvi.orbit.ContainerHost
1010
import org.orbitmvi.orbit.syntax.simple.intent
1111
import org.orbitmvi.orbit.syntax.simple.postSideEffect
1212
import org.orbitmvi.orbit.viewmodel.container
13+
import timber.log.Timber
1314
import javax.inject.Inject
1415

1516
@HiltViewModel
@@ -24,7 +25,16 @@ class IntroViewModel @Inject constructor(
2425
}
2526

2627
private fun validateToken() = intent {
27-
postSideEffect(IntroSideEffect.ValidateToken)
28+
delay(1000)
29+
viewModelScope.launch {
30+
val accessToken = repository.getAccessToken()
31+
if (accessToken.isNotEmpty()) {
32+
Timber.d("accessToken: $accessToken")
33+
postSideEffect(IntroSideEffect.ValidateToken)
34+
} else {
35+
postSideEffect(IntroSideEffect.AutoLoginFail)
36+
}
37+
}
2838
}
2939

3040
fun autoLoginFail() = intent {
@@ -37,16 +47,4 @@ class IntroViewModel @Inject constructor(
3747
fun autoLoginSuccess() = intent {
3848
postSideEffect(IntroSideEffect.AutoLoginSuccess)
3949
}
40-
41-
private fun getAccessToken() = intent {
42-
viewModelScope.launch {
43-
delay(1000)
44-
val accessToken = repository.getAccessToken()
45-
if (accessToken.isNotEmpty()) {
46-
postSideEffect(IntroSideEffect.AutoLoginSuccess)
47-
} else {
48-
postSideEffect(IntroSideEffect.AutoLoginFail)
49-
}
50-
}
51-
}
5250
}

feature/mypage/src/main/kotlin/com/nexters/ilab/android/feature/mypage/viewmodel/MyPageViewModel.kt

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import org.orbitmvi.orbit.syntax.simple.intent
1515
import org.orbitmvi.orbit.syntax.simple.postSideEffect
1616
import org.orbitmvi.orbit.syntax.simple.reduce
1717
import org.orbitmvi.orbit.viewmodel.container
18-
import timber.log.Timber
1918
import javax.inject.Inject
2019

2120
@HiltViewModel
@@ -77,12 +76,6 @@ class MyPageViewModel @Inject constructor(
7776
}
7877
}
7978

80-
private fun setSelectedMyAlbum(index: Int) = intent {
81-
reduce {
82-
state.copy(selectedMyAlbum = index)
83-
}
84-
}
85-
8679
fun shareMyAlbum() = intent {
8780
viewModelScope.launch {
8881
reduce {
@@ -105,16 +98,13 @@ class MyPageViewModel @Inject constructor(
10598
}
10699

107100
fun onAlbumClick(index: Int) = intent {
108-
Timber.d("before: state.selectedMyAlbum: ${state.selectedMyAlbum}")
109-
setSelectedMyAlbum(index)
110-
Timber.d("selectedIndex: $index")
111-
Timber.d("state.selectedMyAlbum: ${state.selectedMyAlbum}")
112-
Timber.d("MyAlbumImageUrlList: ${state.myAlbumFullImageList[state.selectedMyAlbum].images.map { it.imageUrl }}")
113-
Timber.d("StyleName: ${state.myAlbumFullImageList[state.selectedMyAlbum].images.map { it.imageStyle.name }.first()}")
101+
reduce {
102+
state.copy(selectedMyAlbum = index)
103+
}
114104
postSideEffect(
115105
MyPageSideEffect.NavigateToMyAlbum(
116-
state.myAlbumFullImageList[index].images.map { it.imageUrl },
117-
state.myAlbumFullImageList[index].images.map { it.imageStyle.name }.first(),
106+
state.myAlbumFullImageList[state.selectedMyAlbum].images.map { it.imageUrl },
107+
state.myAlbumFullImageList[state.selectedMyAlbum].images.map { it.imageStyle.name }.first(),
118108
),
119109
)
120110
}

0 commit comments

Comments
 (0)