-
Notifications
You must be signed in to change notification settings - Fork 0
๐ :: (#34) Google OAuth ๊ตฌํ #115
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
Merged
Merged
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
b8c9663
:sparkles: :: add auth data
yeongun130 df63498
:memo: :: add version
yeongun130 96ecaac
:memo: :: add auth navigation
yeongun130 f75771e
:memo: :: add permission
yeongun130 580f341
:sparkles: :: add auth DataStore
yeongun130 ba18632
:memo: :: add onClick
yeongun130 4978d30
:memo: :: add string check role
yeongun130 afb9742
:sparkles: :: add auth usecase
yeongun130 54734be
:sparkles: :: add exception
yeongun130 221cd41
:sparkles: :: add auth model
yeongun130 a08084b
:sparkles: :: add auth network
yeongun130 593b478
:sparkles: :: add login
yeongun130 6225c34
:memo: :: add hilt ์ด๋
ธํ
์ด์
yeongun130 28e3934
:recycler: :: scope ์์
yeongun130 74d669b
:recycle: :: modify url scope
yeongun130 818ebc1
:memo: :: add common module
yeongun130 5f968cb
:memo: :: modify intent filtter
yeongun130 927c907
:memo: :: modify files
yeongun130 85a5da6
:fire: :: delete import
yeongun130 0bce90f
:memo: :: add role check
yeongun130 a7248c0
:memo: :: add common module
yeongun130 bb69cd2
:memo: :: login ์์ฒญ ๋ฐฉ์ ๋ณ๊ฒฝ
yeongun130 88b33e7
:lipstick: :: add button onclick
yeongun130 cbaced3
:memo: :: add strings
yeongun130 50d1bc2
:listick: :: publishing roleCheckScreen
yeongun130 d02723f
:memo: :: modify function name
yeongun130 e9bb30b
:sparkle: :: add user role check
yeongun130 6e42435
:sparkle: :: google oauth
yeongun130 39d7155
:bug: :: Fix Conflict
Chaejongin12 0bd77db
:twisted_rightwards_arrows: :: Stash Commit
Chaejongin12 00902b2
๐ฅ:: FeatureConvention data, dataStore ์์กด์ฑ ์ญ
Chaejongin12 b4061e2
๐ฅ:: Kotlin์ด ์๋ Java Build Package์์ Error๋ฅผ ์ผ๊ธฐํ๋ ํ์ผ๋ค ์ ๋ถ ์ญ์
Chaejongin12 58f1ed5
๐ฅ:: feature:login build.gradle.kts BuildConfig getํจ์ ์ญ
Chaejongin12 d02ba12
๐ฅ:: LoginRequest ์ญ์
Chaejongin12 3e471bc
โจ:: BuildConfig Hilt์ ๋ฑ๋กํ์ฌ ์ ์ธํด ์ฌ์ฉ ์ฌ์ฉํ๊ฒ ํ
Chaejongin12 e848151
โจ:: Local Auth์์
Chaejongin12 da55bcf
:bug: :: ksp -> implementation์ผ๋ก ksp์๋ฌ fix
Chaejongin12 17ed1be
:bug: :: Conflict Fix
Chaejongin12 5956027
โจ:: google-services.json ์ถ๊ฐ
Chaejongin12 9329a1f
โจ:: LoginResponse ์ฒ๋ฆฌ๋ฅผ ์ํ LoginUiState ์ถ๊ฐ
Chaejongin12 4dff910
โจ:: LoginResponseModel ์์ฑ
Chaejongin12 23c740a
โจ:: LoginResponseMapper ์์ฑ
Chaejongin12 3c4222f
โจ:: LoginResponse Moshi ์ง๋ ฌํ ์ถ๊ฐ
Chaejongin12 7230590
โจ:: LoginRequestModel ์์ฑ
Chaejongin12 22ff254
โจ:: LoginRequestMapper ์์ฑ
Chaejongin12 cc2db79
โจ:: MainActivity GoogleSignIn ํจ์ ์ถ๊ฐ ๋ฐ app ๋ฆฌํจํค์ง
Chaejongin12 e202f41
โจ:: app ๋ด๋ถ file ๋ฆฌํจํค์ง
Chaejongin12 4f57712
โจ:: LoginRequest ์์ฑ
Chaejongin12 7e1b911
๐ฅ:: ์ค๋ณต๋ enum ๊ด๋ฆฌ ํจํค์ง ์ญ์
Chaejongin12 8ced411
๐ฅ:: sessions ์ญ์
Chaejongin12 2014057
๐ฅ:: LoginActivity ์ญ์
Chaejongin12 fe05c84
๐ฅ:: ๊ตฌ๋ฒ์ MainActivity ์ญ์
Chaejongin12 391d22c
๐ฅ:: ๊ตฌ๋ฒ์ MainActivity ์ญ์
Chaejongin12 6190fac
๐ฅ:: ๊ตฌ๋ฒ์ TopLevelDestination ์ญ์
Chaejongin12 64f4ae5
๐:: conflict ์๋ฌ ํด๊ฒฐ
Chaejongin12 f04ddc3
โป๏ธ:: ์ค๋ณต Authority ์ญ์ ์ ๋ฐ๋ฅธ import ๋ณ๊ฒฝ
Chaejongin12 f176c2c
โป๏ธ:: ์ค๋ณต Authority ์ญ์ ์ ๋ฐ๋ฅธ import ๋ณ๊ฒฝ
Chaejongin12 b4ca573
โป๏ธ:: SaveTokenUseCase ํ๋ผ๋ฏธํฐ LoginResponseModel๋ก ํ์
๋ณ๊ฒฝ
Chaejongin12 8e75021
โป๏ธ:: LoginTeacherUseCase ํ๋ผ๋ฏธํฐ, ๋ฆฌํด Model๋ก ํ์
๋ณ๊ฒฝ
Chaejongin12 7bfe154
โป๏ธ:: LoginStudentUseCase ํ๋ผ๋ฏธํฐ, ๋ฆฌํด Model๋ก ํ์
๋ณ๊ฒฝ
Chaejongin12 25d52a4
โป๏ธ:: LoginNavigation ๋ค์ด๋ฐ ๋ฐ ๋ค๋น๊ฒ์ด์
๋์ ๋ก์ง ์์
Chaejongin12 f6f244b
โป๏ธ:: AuthRepository ํ๋ผ๋ฏธํฐ, ๋ฆฌํด dto ์ ์ฉ
Chaejongin12 cada931
โป๏ธ:: AuthRepository ํ๋ผ๋ฏธํฐ, ๋ฆฌํด dto ์ ์ฉ
Chaejongin12 3033230
โป๏ธ:: ViewModel Login ๊ด๋ จ ํจ์ app๋ชจ๋ ๋จ ์ ๊ทผ์ ์ํด ์ ๊ทผ์ ์ด ํด์ ๋ฐ UiState ์
Chaejongin12 94ec5ef
๐ฅ:: MissionResponse ๋ถํ์ํ import์ญ์
Chaejongin12 65329ef
๐ฅ:: CreateMissionScreen ๋ถํ์ํ import์ญ์
Chaejongin12 2365323
โป๏ธ:: ViewModel ํ๋ ์ ๊ทผ์ ์ด ๋ฐ UiState ์ ์ฉ
Chaejongin12 c7c847d
โป๏ธ:: AndroidManifest ํ์ผ Google API Console๊ณผ์ ํจํค์ง ์ด๋ฆ ๋๊ธฐํ ๋ฐ LoginActiviโฆ
Chaejongin12 ae095d5
โป๏ธ:: AndroidApplicationConventionPlugin ํ์ผ Google API Console๊ณผ์ ํจํค์ง ์ดโฆ
Chaejongin12 590b259
๐ฅ:: build.gradles.kts ๋ถํ์ํ import๋ฌธ ์ญ์
Chaejongin12 5f914ee
โป๏ธ:: google service version ์
๊ทธ๋ ์ด๋
Chaejongin12 6ed2051
โป๏ธ:: ์ง๋ ฌํ ๋ฌธ์ ํด๊ฒฐ์ ์ํด KotlinJsonAdapterFactory ์ถ๊ฐ
Chaejongin12 fa67ca4
โป๏ธ:: RoleCheckScreen isTeacher, isStudent Boolean ๊ฐ ์ค์ ๋ก์ง์ผ๋ก ๋ณ
Chaejongin12 88436f3
โป๏ธ:: RoleCheckScreen isTeacher, isStudent Boolean ๊ฐ ์ค์ ๋ก์ง์ผ๋ก ๋ณ๊ฒฝ
Chaejongin12 8287603
โจ:: LoginScreen GoogleOAuth ๊ธฐ๋ฅ ๊ตฌ
Chaejongin12 5363b18
๏ธ๐ฅ:: AuthDataSourceImpl ๊ฐํ ์ญ์
Chaejongin12 19c9053
โจ:: app๋จ build.gradle.kts google service dependencies ์ถ๊ฐ
Chaejongin12 432e390
โจ:: core/data๋จ build.gradle.kts moshi ์ถ๊ฐ
Chaejongin12 e228c08
โจ:: core/network๋จ build.gradle.kts moshi ์ถ๊ฐ
Chaejongin12 afcea9c
:bug: :: conflict fix
Chaejongin12 154dd92
โป๏ธ:: Event, errorHandling common๋ชจ๋๋ก import
Chaejongin12 cde5fbd
๐ฅ:: MainActivity ๋ก๊ทธ ์ญ
Chaejongin12 72de909
๐ฅ:: AuthViewModel Login ํจ์ ๋ก๊ทธ ์ญ์
Chaejongin12 fdbd9c2
โป๏ธ:: network gradle getApiKey ํจ์ null ์ฒดํฌ
Chaejongin12 4bad5d7
๐ฅ:: AndroidManifest DEFAULT, BROWSABLE category ํ๊ทธ ์ญ์
Chaejongin12 b8d98fa
๐ฅ:: GoogleButtonClickEvent Log ์ญ
Chaejongin12 d6f85c6
๐ฅ:: GoogleLogin Success Log ์ญ์
Chaejongin12 dc5c094
โป๏ธ:: LogoutUseCase kotlin ์ ๊ทผ ์ถ๊ฐ
Chaejongin12 398a183
โป๏ธ:: LogoutUseCase kotlin ์ ๊ทผ ์ถ๊ฐ
Chaejongin12 3d179ab
โป๏ธ:: LoginResponseMapper this ์ ๊ทผ ์ถ๊ฐ
Chaejongin12 328c0b2
โป๏ธ:: LoginResponse ๋ง์ง๋ง ํ๋ , ์ถ๊ฐ
Chaejongin12 0fa43ff
โป๏ธ:: LoginRequest ๋ง์ง๋ง ํ๋ , ์ถ๊ฐ
Chaejongin12 8800de7
โป๏ธ:: Authority ๋ง์ง๋ง ํ๋ , ์ถ๊ฐ
Chaejongin12 2585147
โป๏ธ:: MainActivity Toast ์์ฑ ์ makeToast ํจ์ ์ฌ์ฉ์ ์ํด ์์กด์ฑ ์ถ๊ฐ ๋ฐ makeToast์
Chaejongin12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,29 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "322299804217", | ||
"project_id": "stack-knowledge-v2", | ||
"storage_bucket": "stack-knowledge-v2.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:322299804217:android:e15d7c6ad9b47cc65e2be8", | ||
"android_client_info": { | ||
"package_name": "com.kdn.stack_knowledge" | ||
} | ||
}, | ||
"oauth_client": [], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyBxMjD7Mg9vzfBiuZVBzyR12Ubr-uEZ_hQ" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
This file contains hidden or 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
121 changes: 121 additions & 0 deletions
121
app/src/main/java/com/kdn/stack_knowledge/MainActivity.kt
This file contains hidden or 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,121 @@ | ||
package com.kdn.stack_knowledge | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import android.widget.Toast | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.OnBackPressedCallback | ||
import androidx.activity.compose.setContent | ||
import androidx.activity.result.contract.ActivityResultContracts | ||
import androidx.activity.viewModels | ||
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi | ||
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner | ||
import com.example.common.toast.makeToast | ||
import com.google.android.gms.auth.api.signin.GoogleSignIn | ||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount | ||
import com.google.android.gms.auth.api.signin.GoogleSignInClient | ||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions | ||
import com.google.android.gms.common.api.ApiException | ||
import com.google.android.gms.common.api.Scope | ||
import com.google.android.gms.tasks.Task | ||
import com.stackknowledge.design_system.theme.StackKnowledgeAndroidTheme | ||
import com.stackknowledge.login.viewmodel.AuthViewModel | ||
import com.kdn.stack_knowledge.ui.StackKnowledgeApp | ||
import com.stackknowledge.user.R | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import remote.request.auth.LoginRequestModel | ||
import javax.inject.Inject | ||
import javax.inject.Named | ||
|
||
@AndroidEntryPoint | ||
class MainActivity : ComponentActivity() { | ||
|
||
@Inject | ||
@Named("GOOGLE_CLIENT_ID") | ||
lateinit var googleClientId: String | ||
|
||
@Inject | ||
@Named("SCOPE") | ||
lateinit var scope: String | ||
|
||
private val viewModel by viewModels<AuthViewModel>() | ||
|
||
private val googleSignInClient: GoogleSignInClient by lazy { getGoogleClient() } | ||
|
||
private val googleSignInLauncher = | ||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> | ||
val task: Task<GoogleSignInAccount> = | ||
GoogleSignIn.getSignedInAccountFromIntent(result.data) | ||
handleGoogleSignInResult(task) | ||
} | ||
|
||
private var doubleBackToExitPressedOnce = false | ||
|
||
private var backPressedTimestamp = 0L | ||
|
||
private val onBackPressedCallback = object : OnBackPressedCallback(true) { | ||
override fun handleOnBackPressed() { | ||
controlTheStackWhenBackPressed() | ||
} | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class) | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
this.onBackPressedDispatcher.addCallback(this, onBackPressedCallback) | ||
setContent { | ||
CompositionLocalProvider(LocalViewModelStoreOwner provides this) { | ||
StackKnowledgeAndroidTheme { _, _ -> | ||
StackKnowledgeApp( | ||
windowSizeClass = calculateWindowSizeClass(this@MainActivity), | ||
onLoginButtonClick = { | ||
googleSocialLogin() | ||
} | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun controlTheStackWhenBackPressed() { | ||
val currentTime = System.currentTimeMillis() | ||
if (doubleBackToExitPressedOnce && currentTime - backPressedTimestamp <= 2000) { | ||
finishAffinity() | ||
} else { | ||
doubleBackToExitPressedOnce = true | ||
backPressedTimestamp = currentTime | ||
makeToast(this, getString(R.string.close_app), Toast.LENGTH_SHORT) | ||
} | ||
} | ||
|
||
private fun googleSocialLogin() { | ||
googleSignInClient.signOut().addOnCompleteListener { | ||
val signInIntent = googleSignInClient.signInIntent | ||
googleSignInLauncher.launch(signInIntent) | ||
} | ||
} | ||
|
||
private fun getGoogleClient(): GoogleSignInClient { | ||
val googleSignInOptions = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | ||
.requestScopes(Scope(scope)) | ||
.requestServerAuthCode(googleClientId) | ||
.requestEmail() | ||
.build() | ||
|
||
return GoogleSignIn.getClient(this@MainActivity, googleSignInOptions) | ||
} | ||
|
||
private fun handleGoogleSignInResult(task: Task<GoogleSignInAccount>) { | ||
val account = task.getResult(ApiException::class.java) | ||
|
||
with(viewModel) { | ||
if (isStudent.value) { | ||
loginStudent(body = LoginRequestModel(code = account.serverAuthCode.toString())) | ||
} else { | ||
loginTeacher(body = LoginRequestModel(code = account.serverAuthCode.toString())) | ||
} | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...ackknowledge/StackKnowledgeApplication.kt โ ...ck_knowledge/StackKnowledgeApplication.kt
This file contains hidden or 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,7 +1,7 @@ | ||
package com.stackknowledge | ||
package com.kdn.stack_knowledge | ||
|
||
import android.app.Application | ||
import dagger.hilt.android.HiltAndroidApp | ||
|
||
@HiltAndroidApp | ||
class StackKnowledgeApplication : Application() | ||
class StackKnowledgeApplication : Application() |
This file contains hidden or 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
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/kdn/stack_knowledge/navigation/TopLevelDestination.kt
This file contains hidden or 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.kdn.stack_knowledge.navigation | ||
|
||
enum class TopLevelDestination { | ||
ROLE_CHECK, | ||
} |
This file contains hidden or 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
13 changes: 7 additions & 6 deletions
13
...om/stackknowledge/ui/StackKnowledgeApp.kt โ ...n/stack_knowledge/ui/StackKnowledgeApp.kt
This file contains hidden or 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,21 +1,22 @@ | ||
package com.stackknowledge.ui | ||
package com.kdn.stack_knowledge.ui | ||
|
||
import androidx.compose.material3.windowsizeclass.WindowSizeClass | ||
import androidx.compose.runtime.Composable | ||
import com.stackknowledge.design_system.theme.StackKnowledgeAndroidTheme | ||
import com.stackknowledge.navigation.StackKnowledgeNavHost | ||
import com.kdn.stack_knowledge.navigation.StackKnowledgeNavHost | ||
|
||
@Composable | ||
fun StackKnowledgeApp( | ||
windowSizeClass: WindowSizeClass, | ||
appState: StackKnowledgeAppState = rememberStackKnowledgeAppState( | ||
windowSizeClass = windowSizeClass | ||
), | ||
onLoginButtonClick: () -> Unit = {}, | ||
) { | ||
StackKnowledgeAndroidTheme { _, _ -> | ||
StackKnowledgeNavHost( | ||
appState = appState, | ||
//startDestination = "" <- auth ์์ ํ์ ์ถ๊ฐ | ||
) | ||
StackKnowledgeNavHost( | ||
appState = appState, | ||
onLoginButtonClick = onLoginButtonClick | ||
) | ||
} | ||
} |
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.