-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Nexters/feature/kakao-login
[FEAT] [#17] 카카오 소셜 로그인을 통한 엑세스 토큰 및 및 유저 정보 받아오는 파트 구현
- Loading branch information
Showing
18 changed files
with
220 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/src/main/kotlin/com/nexters/ilab/android/initializer/KakaoSdkInitializer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.nexters.ilab.android.initializer | ||
|
||
import android.content.Context | ||
import androidx.startup.Initializer | ||
import com.kakao.sdk.common.KakaoSdk | ||
import com.nexters.ilab.android.BuildConfig | ||
|
||
class KakaoSDKInitializer : Initializer<Unit> { | ||
|
||
override fun create(context: Context) { | ||
KakaoSdk.init(context, BuildConfig.KAKAO_NATIVE_APP_KEY) | ||
} | ||
|
||
override fun dependencies(): List<Class<out Initializer<*>>> { | ||
return emptyList() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<resources> | ||
<string name="app_name">I\'Lab</string> | ||
<string name="app_name_dev">I\'Lab.dev</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ dependencies { | |
implementations( | ||
libs.androidx.core, | ||
libs.timber, | ||
libs.kakao.auth, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile | ||
|
||
# https://stackoverflow.com/questions/70037537/proguard-missing-classes-detected-while-running-r8-after-adding-package-names-in | ||
-dontwarn java.lang.invoke.StringConcatFactory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
feature/login/src/main/kotlin/com/nexters/ilab/android/feature/login/LoginSideEffect.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.nexters.ilab.android.feature.login | ||
|
||
import com.nexters.ilab.android.core.common.UiText | ||
|
||
sealed interface LoginSideEffect { | ||
data object KakaoLogin : LoginSideEffect | ||
data object LoginSuccess : LoginSideEffect | ||
data class ShowToast(val message: UiText) : LoginSideEffect | ||
} |
5 changes: 5 additions & 0 deletions
5
feature/login/src/main/kotlin/com/nexters/ilab/android/feature/login/LoginState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.nexters.ilab.android.feature.login | ||
|
||
data class LoginState( | ||
val isLoading: Boolean = false, | ||
) |
30 changes: 29 additions & 1 deletion
30
feature/login/src/main/kotlin/com/nexters/ilab/android/feature/login/LoginViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
package com.nexters.ilab.android.feature.login | ||
|
||
import androidx.lifecycle.ViewModel | ||
import com.nexters.ilab.android.core.common.UiText | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import org.orbitmvi.orbit.ContainerHost | ||
import org.orbitmvi.orbit.syntax.simple.intent | ||
import org.orbitmvi.orbit.syntax.simple.postSideEffect | ||
import org.orbitmvi.orbit.syntax.simple.reduce | ||
import org.orbitmvi.orbit.viewmodel.container | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class LoginViewModel @Inject constructor() : ViewModel() | ||
class LoginViewModel @Inject constructor() : ViewModel(), ContainerHost<LoginState, LoginSideEffect> { | ||
|
||
override val container = container<LoginState, LoginSideEffect>(LoginState()) | ||
|
||
fun onLoginButtonClick() = intent { | ||
postSideEffect(LoginSideEffect.KakaoLogin) | ||
} | ||
|
||
fun kakaoLogin() = intent { | ||
reduce { | ||
state.copy(isLoading = true) | ||
} | ||
// TODO repository function call | ||
reduce { | ||
state.copy(isLoading = false) | ||
} | ||
postSideEffect(LoginSideEffect.LoginSuccess) | ||
} | ||
|
||
fun setErrorMessage(message: UiText) = intent { | ||
postSideEffect(LoginSideEffect.ShowToast(message)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.