-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/#77 #77
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
base: develop
Are you sure you want to change the base?
Feature/#77 #77
Changes from all commits
0029a46
6899aae
2c81209
421c914
e71fb39
886ca5e
b89fa77
b458144
7873d51
ba5758a
cbcfd3d
18d2ac8
3295ea2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,98 @@ | ||
| package com.example.linku_android | ||
|
|
||
| import android.content.Intent | ||
| import android.os.Bundle | ||
| import android.util.Log | ||
| import androidx.activity.ComponentActivity | ||
| import androidx.activity.compose.setContent | ||
| import androidx.core.view.WindowCompat | ||
| import androidx.core.view.WindowInsetsCompat | ||
| import androidx.core.view.WindowInsetsControllerCompat | ||
| import androidx.hilt.navigation.compose.hiltViewModel | ||
| import com.example.core.model.SystemBarMode | ||
| import com.example.core.system.SystemBarController | ||
| import com.example.linku_android.deeplink.extractSocialDeepLinkData | ||
| import dagger.hilt.android.AndroidEntryPoint | ||
|
|
||
| import com.example.linku_android.deeplink.SocialDeepLinkBus | ||
| @AndroidEntryPoint | ||
| class MainActivity : ComponentActivity() { | ||
| class MainActivity : ComponentActivity(), SystemBarController { | ||
| private var currentSystemBarMode: SystemBarMode? = null | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
|
|
||
|
|
||
|
|
||
| intent?.data?.let { Log.d("DEEPLINK", "onCreate uri = $it") } | ||
|
|
||
| WindowCompat.setDecorFitsSystemWindows(window, false) | ||
| // μ±μ΄ κΊΌμ§ μνμμ λ₯λ§ν¬λ‘ μ€νλ κ²½μ° | ||
| intent?.let { handleDeepLinkIntent(it) } | ||
| //WindowCompat.setDecorFitsSystemWindows(window, false) | ||
| //enableEdgeToEdge() | ||
| // μ΅μ΄ μ€ν λ₯λ§ν¬ | ||
| setContent { | ||
| MainApp( | ||
| viewModel = hiltViewModel() | ||
| viewModel = hiltViewModel(), | ||
|
|
||
|
|
||
| ) | ||
| } | ||
| } | ||
|
|
||
| override fun onNewIntent(intent: Intent) { | ||
| super.onNewIntent(intent) | ||
| setIntent(intent) | ||
|
|
||
| // μ± μ€ν μ€ λ₯λ§ν¬ λ€μ΄μ¨ κ²½μ° | ||
| handleDeepLinkIntent(intent) | ||
| } | ||
|
|
||
| private fun handleDeepLinkIntent(intent: Intent) { | ||
| val uri = intent.data ?: return | ||
|
|
||
| when (uri.host) { | ||
| "auth" -> { | ||
| val data = extractSocialDeepLinkData(intent) ?: return | ||
| Log.d("DEEPLINK", "μμ λ‘κ·ΈμΈ λ₯λ§ν¬ μμ : $data") | ||
| SocialDeepLinkBus.emit(data) // β λ€μ λ¨κ³μμ λ§λ€ νμΌ | ||
|
Comment on lines
+53
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. λ‘κ·Έμ
π€ Prompt for AI Agents |
||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+47
to
57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
AndroidManifestμ π HTTPS λ₯λ§ν¬ λμ μμ μ μ private fun handleDeepLinkIntent(intent: Intent) {
val uri = intent.data ?: return
when (uri.host) {
"auth" -> {
val data = extractSocialDeepLinkData(intent) ?: return
- Log.d("DEEPLINK", "μμ
λ‘κ·ΈμΈ λ₯λ§ν¬ μμ : $data")
+ Log.d("DEEPLINK", "μμ
λ‘κ·ΈμΈ λ₯λ§ν¬ μμ (custom scheme)")
+ SocialDeepLinkBus.emit(data)
+ }
+ "linkuserver.store" -> {
+ if (uri.path == "/auth") {
+ val data = extractSocialDeepLinkData(intent) ?: return
+ Log.d("DEEPLINK", "μμ
λ‘κ·ΈμΈ λ₯λ§ν¬ μμ (https)")
+ SocialDeepLinkBus.emit(data)
+ }
+ }
+ }
+ }π€ Prompt for AI Agents |
||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| /** | ||
| * SystemBarController ꡬν | ||
| * μ± μ μ μμ€ν λ° λ¨μΌ μ μ΄ μ§μ | ||
| */ | ||
| override fun setSystemBarMode(mode: SystemBarMode) { | ||
| if (currentSystemBarMode == mode) return | ||
| currentSystemBarMode = mode | ||
|
|
||
| WindowCompat.setDecorFitsSystemWindows( | ||
| window, | ||
| mode == SystemBarMode.VISIBLE | ||
| ) | ||
|
|
||
| val controller = WindowInsetsControllerCompat( | ||
| window, | ||
| window.decorView | ||
| ) | ||
|
|
||
| if (mode == SystemBarMode.VISIBLE) { | ||
| controller.show( | ||
| WindowInsetsCompat.Type.statusBars() or | ||
| WindowInsetsCompat.Type.navigationBars() | ||
| ) | ||
| controller.systemBarsBehavior = | ||
| WindowInsetsControllerCompat.BEHAVIOR_DEFAULT | ||
| } else { | ||
| controller.hide( | ||
| WindowInsetsCompat.Type.statusBars() or | ||
| WindowInsetsCompat.Type.navigationBars() | ||
| ) | ||
| controller.systemBarsBehavior = | ||
| WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ import androidx.activity.compose.rememberLauncherForActivityResult | |
| import androidx.activity.result.contract.ActivityResultContracts | ||
| import androidx.compose.animation.EnterTransition | ||
| import androidx.compose.animation.ExitTransition | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
|
|
@@ -47,28 +46,11 @@ import com.example.mypage.MyPageViewModel | |
| //import com.example.mypage.MyPageScreen | ||
| import androidx.navigation.NavType | ||
| import androidx.navigation.navArgument | ||
| import androidx.navigation.compose.navigation | ||
|
|
||
|
|
||
| import androidx.navigation.compose.currentBackStackEntryAsState | ||
| import com.example.home.HomeApp | ||
| import com.example.curation.ui.CurationDetailScreen | ||
| import com.example.curation.ui.CurationScreen | ||
| import com.example.login.ui.animation.AnimatedLoginScreen | ||
| import com.example.login.ui.screen.EmailVerificationScreen | ||
| import com.example.login.ui.terms.ServiceTermsScreen | ||
| import com.example.login.ui.terms.PrivacyTermsScreenFixed | ||
| import com.example.login.ui.terms.MarketingTermsScreenComposable | ||
| import com.example.login.ui.screen.SignUpPasswordScreen | ||
| import com.example.login.ui.screen.EmailLoginScreen | ||
| import com.example.login.ui.screen.InterestContentScreen | ||
| import com.example.login.ui.screen.InterestPurposeScreen | ||
| import com.example.login.ui.screen.SignUpGenderScreen | ||
| import com.example.login.ui.screen.SignUpNicknameScreen | ||
| import com.example.login.ui.screen.SignUpJobScreen | ||
| import com.example.login.ui.screen.WelcomeScreen | ||
| import com.example.login.ui.screen.ResetPasswordScreen | ||
| import com.example.login.viewmodel.SignUpViewModel | ||
| import java.io.File | ||
| import java.io.FileOutputStream | ||
|
|
||
|
|
@@ -86,19 +68,20 @@ import com.example.login.viewmodel.LoginViewModel | |
|
|
||
| import dagger.hilt.android.EntryPointAccessors | ||
| import androidx.core.net.toUri | ||
| import com.example.curation.CurationDetailViewModel | ||
| import com.example.core.model.auth.LoginState | ||
| import com.example.core.model.auth.SocialLoginEvent | ||
| import com.example.linku_android.curation.curationGraph | ||
| import com.example.linku_android.deeplink.SocialDeepLinkBus | ||
| import com.example.linku_android.deeplink.appLinkRoute | ||
| import com.example.login.LoginApp | ||
| import com.example.login.ui.bottom_sheet.TermsAgreementSheet | ||
| import com.example.login.viewmodel.LoginState | ||
| import com.example.login.navigation.LoginApp | ||
|
|
||
|
|
||
|
|
||
| @Composable | ||
| fun MainApp( | ||
| viewModel: MainViewModel, | ||
| ) { | ||
|
|
||
| ) { | ||
|
|
||
| // μ± μ€ν μ μ€ννμ¬ μ΄μ κ³μ κΈ°λ‘ μμ | ||
| LaunchedEffect(Unit) { | ||
|
|
@@ -127,9 +110,51 @@ fun MainApp( | |
| // λ§μ΄νμ΄μ§μμ μ¬μ©ν λ·°λͺ¨λΈ | ||
| val mypageViewModel: MyPageViewModel = hiltViewModel() | ||
|
|
||
| // TEMP ν ν° μμ λ³΄κ΄ | ||
| var pendingSocialToken by remember { mutableStateOf<String?>(null) } | ||
|
|
||
| // SocialDeepLinkBus ꡬλ - MainActivityμμ emitν μμ λ₯λ§ν¬ μμ | ||
| LaunchedEffect(Unit) { | ||
| Log.d("SOCIAL_VM", "Bus ꡬλ μμ") | ||
| SocialDeepLinkBus.flow.collect { data -> | ||
| Log.d("SOCIAL_VM", "MainApp Bus μμ : $data") | ||
| loginViewModel.handleSocialDeepLink(data) | ||
| } | ||
| } | ||
|
Comment on lines
+117
to
+123
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Busμμ μμ ν λ°μ΄ν° λ‘κΉ μ ν ν°μ΄ λ ΈμΆλ©λλ€. Line 120μ π€ Prompt for AI Agents |
||
|
|
||
|
|
||
| val socialLoginEvent by loginViewModel.socialLoginEvent.collectAsStateWithLifecycle() | ||
| 4 | ||
| LaunchedEffect(socialLoginEvent) { | ||
|
Comment on lines
+126
to
+128
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§© Analysis chainπ Script executed: cat -n app/src/main/java/com/example/linku_android/MainApp.kt | sed -n '122,132p'Repository: LinkYou-2025/LinkU_Android Length of output: 534 λΆνμν 리ν°λ΄ ν ν° μ κ±° νμ Line 127μ λ¨λ
μ«μ π€ Prompt for AI Agents |
||
| val event = socialLoginEvent as? SocialLoginEvent.NavigateToSocialEntry ?: return@LaunchedEffect | ||
| pendingSocialToken = event.socialToken | ||
| navigator.navigate("login_root") { | ||
| popUpTo(0) { inclusive = true } | ||
| launchSingleTop = true | ||
| } | ||
| loginViewModel.consumeSocialLoginEvent() | ||
| } | ||
|
|
||
|
|
||
| var currentLinkuNavigationItem by remember { mutableStateOf<LinkuNavigationItem?>(null) } | ||
| var showNavBar by remember { mutableStateOf(false) } | ||
|
|
||
| val loginState by loginViewModel.loginState.collectAsStateWithLifecycle() | ||
| LaunchedEffect(loginState) { | ||
| if (loginState is LoginState.Success) { | ||
| Log.d("SOCIAL_VM", "LoginState.Success κ°μ§ β ν μ΄λ") | ||
| homeViewModel.refreshAfterLogin() | ||
| mypageViewModel.refreshUserInfo() | ||
| showNavBar = true | ||
| currentLinkuNavigationItem = LinkuNavigationItem.HOME | ||
| navigator.navigate(NavigationRoute.Home.route) { | ||
| popUpTo(0) { inclusive = true } | ||
| launchSingleTop = true | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+142
to
+155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
μ΄ μμ
λ‘κ·ΈμΈ μ±κ³΅μ λν΄μλ§ λ°μνλλ‘ μ‘°κ±΄μ μΆκ°νκ±°λ, π οΈ μμ λ‘κ·ΈμΈ μ μ© μ‘°κ±΄ μΆκ° μ μ LaunchedEffect(loginState) {
- if (loginState is LoginState.Success) {
+ val success = loginState as? LoginState.Success ?: return@LaunchedEffect
+ // μμ
λ‘κ·ΈμΈ(ACTIVE λ₯λ§ν¬)μμλ§ μ¬κΈ°μ ν μ΄λ μ²λ¦¬
+ if (success.result.status == "ACTIVE" && pendingSocialToken == null) {
Log.d("SOCIAL_VM", "LoginState.Success κ°μ§ β ν μ΄λ")
homeViewModel.refreshAfterLogin()
mypageViewModel.refreshUserInfo()
showNavBar = true
currentLinkuNavigationItem = LinkuNavigationItem.HOME
navigator.navigate(NavigationRoute.Home.route) {
popUpTo(0) { inclusive = true }
launchSingleTop = true
}
}
}π€ Prompt for AI Agents |
||
|
|
||
|
|
||
| var saveLinkEntryTriggered by remember { mutableStateOf(false) } | ||
|
|
||
| // νμ¬ λΌμ°νΈ κ΄μ°° | ||
|
|
@@ -206,7 +231,7 @@ fun MainApp( | |
| val deps = remember { | ||
| EntryPointAccessors.fromApplication(app, SplashDeps::class.java) | ||
| } | ||
| val loginVM: LoginViewModel = hiltViewModel() | ||
|
|
||
|
|
||
|
|
||
| NavHost( | ||
|
|
@@ -261,7 +286,7 @@ fun MainApp( | |
| autoLoginTried = true | ||
|
|
||
| // refresh μμ β μλλ‘κ·ΈμΈ μλ | ||
| loginVM.tryAutoLogin( | ||
| loginViewModel.tryAutoLogin( | ||
| onSuccess = { | ||
| navigator.navigate(NavigationRoute.Home.route) { | ||
| popUpTo(NavigationRoute.Splash.route) { inclusive = true } | ||
|
|
@@ -288,7 +313,9 @@ fun MainApp( | |
| //navController = navigator, | ||
| loginViewModel = loginViewModel, | ||
| showNavBar = { showNavBar = it }, | ||
| initialSocialToken = pendingSocialToken, | ||
| onLoginSuccess = { | ||
| pendingSocialToken = null | ||
| // μΈμ μ λ³΄κ° μ μ₯ ν, ν νλ©΄ λ°μ΄ν° μ¦μ λ‘λ | ||
| homeViewModel.refreshAfterLogin() | ||
| // λ§μ΄νμ΄μ§ μ 보λ 미리 λ‘κ·Έ(μμ°μ€λ½κ²?) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||
| package com.example.linku_android.deeplink | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| import com.example.core.model.auth.SocialLoginData | ||||||||||||||||||||||||||||||||||
| import kotlinx.coroutines.flow.MutableSharedFlow | ||||||||||||||||||||||||||||||||||
| import kotlinx.coroutines.flow.SharedFlow | ||||||||||||||||||||||||||||||||||
| import kotlinx.coroutines.flow.asSharedFlow | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| object SocialDeepLinkBus { | ||||||||||||||||||||||||||||||||||
| private val _flow = MutableSharedFlow<SocialLoginData>( | ||||||||||||||||||||||||||||||||||
| extraBufferCapacity = 1, | ||||||||||||||||||||||||||||||||||
| replay = 1 // λ¦κ² ꡬλ ν΄λ λ§μ§λ§ κ° λ°μ μ μμ | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| val flow: SharedFlow<SocialLoginData> = _flow.asSharedFlow() | ||||||||||||||||||||||||||||||||||
| fun emit(data: SocialLoginData) { _flow.tryEmit(data) } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
μ²λ¦¬ μλ£ ν replay μΊμλ₯Ό μ΄κΈ°ννλ λ©μλλ₯Ό μΆκ°νλ κ²μ κΆμ₯ν©λλ€. β»οΈ μΊμ μ΄κΈ°ν λ©μλ μΆκ° μ μ object SocialDeepLinkBus {
private val _flow = MutableSharedFlow<SocialLoginData>(
extraBufferCapacity = 1,
replay = 1
)
val flow: SharedFlow<SocialLoginData> = _flow.asSharedFlow()
fun emit(data: SocialLoginData) { _flow.tryEmit(data) }
+ fun clear() { _flow.resetReplayCache() }
}π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.example.linku_android.deeplink | ||
|
|
||
| import android.content.Intent | ||
| import android.util.Log | ||
| import com.example.core.model.auth.SocialLoginData | ||
|
|
||
| fun extractSocialDeepLinkData(intent: Intent): SocialLoginData? { | ||
| val uri = intent.data ?: return null | ||
|
|
||
| Log.d("SOCIAL_LOGIN", "URI μ 체: $uri") | ||
| Log.d("SOCIAL_LOGIN", "scheme: ${uri.scheme}") | ||
| Log.d("SOCIAL_LOGIN", "host: ${uri.host}") | ||
| Log.d("SOCIAL_LOGIN", "path: ${uri.path}") | ||
|
|
||
|
|
||
| val provider = uri.getQueryParameter("provider") ?: return null | ||
| val result = uri.getQueryParameter("result") ?: return null | ||
|
|
||
| return SocialLoginData( | ||
| provider = provider, | ||
| result = result, | ||
| status = uri.getQueryParameter("status"), | ||
| accessToken = uri.getQueryParameter("accessToken"), | ||
| refreshToken = uri.getQueryParameter("refreshToken"), | ||
| socialToken = uri.getQueryParameter("socialToken"), | ||
| errorCode = uri.getQueryParameter("errorCode") | ||
| ) | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.