Skip to content

Commit

Permalink
Merge pull request #120 from THT-Team/develop
Browse files Browse the repository at this point in the history
QA 회원가입 변경사항 적용
  • Loading branch information
cwj-c authored Feb 10, 2024
2 parents 3bb083f + 775f146 commit da1de40
Show file tree
Hide file tree
Showing 307 changed files with 8,031 additions and 2,393 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/android_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
Expand Down Expand Up @@ -85,10 +85,10 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
Expand Down Expand Up @@ -135,10 +135,10 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
Expand Down Expand Up @@ -84,10 +84,10 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
Expand Down Expand Up @@ -134,10 +134,10 @@ jobs:
echo -e KAKAO_NATIVE_APP_KEY=\"$KAKAO_NATIVE_APP_KEY\" >> ./local.properties
echo -e NAVER_CLIENT_ID=\"$NAVER_CLIENT_ID\" >> ./local.properties
echo -e NAVER_CLIENT_SECRET=\"$NAVER_CLIENT_SECRET\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"CEO_EMAIL\" >> ./local.properties
echo -e REGION_CODE_SERVICE_KEY=\"$REGION_CODE_SERVICE_KEY\" >> ./local.properties
echo -e APP_EMAIL_ID=\"$APP_EMAIL_ID\" >> ./local.properties
echo -e APP_EMAIL_PASSWORD=\"$APP_EMAIL_PASSWORD\" >> ./local.properties
echo -e CEO_EMAIL=\"$CEO_EMAIL\" >> ./local.properties
cat ./local.properties
env:
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
Expand Down
3 changes: 2 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ android {
}

dependencies {
implementation(project(":core:navigation"))
implementation(project(":core:ui"))
implementation(project(":domain"))
implementation(project(":data"))

implementation(project(":feature:chat"))
implementation(project(":feature:heart"))
implementation(project(":feature:like"))
implementation(project(":feature:setting"))
implementation(project(":feature:signin"))
implementation(project(":feature:tohot"))
Expand Down
22 changes: 15 additions & 7 deletions app/src/main/java/com/tht/tht/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import androidx.lifecycle.repeatOnLifecycle
import com.tht.tht.databinding.ActivityHomeBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import tht.core.navigation.ToHotNavigation
import tht.core.ui.base.BaseActivity
import tht.core.ui.base.FragmentNavigator
import tht.core.ui.delegate.viewBinding
import tht.core.ui.extension.hideSoftInput
import tht.feature.chat.ChatFragment
import tht.feature.heart.HeartFragment
import tht.feature.setting.MyFragment
import tht.feature.like.like.LikeFragment
import tht.feature.setting.MyPageFragment
import tht.feature.tohot.tohot.fragment.ToHotFragment
import javax.inject.Inject

@SuppressLint("CommitTransaction")
@AndroidEntryPoint
Expand All @@ -28,6 +30,9 @@ class HomeActivity : BaseActivity<HomeViewModel, ActivityHomeBinding>(), Fragmen
override val vm by viewModels<HomeViewModel>()
override val binding by viewBinding(ActivityHomeBinding::inflate)

@Inject
lateinit var toHotNavigation: ToHotNavigation

override fun initViews() {
initNavigationBar()
}
Expand All @@ -42,19 +47,22 @@ class HomeActivity : BaseActivity<HomeViewModel, ActivityHomeBinding>(), Fragmen
binding.bnvHome.setOnItemSelectedListener { item ->
when (item.itemId) {
R.id.menu_tohot -> {
showFragment(ToHotFragment.TAG)
toHotNavigation.navigateToHot(
supportFragmentManager,
R.id.fragment_container
)
true
}
R.id.menu_heart -> {
showFragment(HeartFragment.TAG)
showFragment(LikeFragment.TAG)
true
}
R.id.menu_chat -> {
showFragment(ChatFragment.TAG)
true
}
R.id.menu_my -> {
showFragment(MyFragment.TAG)
showFragment(MyPageFragment.TAG)
true
}
else -> false
Expand Down Expand Up @@ -115,9 +123,9 @@ class HomeActivity : BaseActivity<HomeViewModel, ActivityHomeBinding>(), Fragmen
private fun getFragmentByTag(tag: String): Fragment? {
return when (tag) {
ToHotFragment.TAG -> ToHotFragment.newInstance()
HeartFragment.TAG -> HeartFragment.newInstance()
LikeFragment.TAG -> LikeFragment.newInstance()
ChatFragment.TAG -> ChatFragment.newInstance()
MyFragment.TAG -> MyFragment.newInstance()
MyPageFragment.TAG -> MyPageFragment.newInstance()
else -> null
}
}
Expand Down
49 changes: 26 additions & 23 deletions app/src/main/java/com/tht/tht/SplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package com.tht.tht
import android.animation.Animator
import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import com.tht.tht.databinding.ActivitySplashBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import tht.core.navigation.HomeNavigation
import tht.core.navigation.SignupNavigation
import tht.core.ui.delegate.viewBinding
import tht.feature.signin.prelogin.PreloginActivity
import javax.inject.Inject

@SuppressLint("CustomSplashScreen")
@AndroidEntryPoint
Expand All @@ -22,6 +23,12 @@ class SplashActivity : AppCompatActivity() {
private val viewModel: SplashViewModel by viewModels()
private val binding: ActivitySplashBinding by viewBinding(ActivitySplashBinding::inflate)

@Inject
lateinit var signupNavigation: SignupNavigation

@Inject
lateinit var homeNavigation: HomeNavigation

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
Expand All @@ -46,28 +53,24 @@ class SplashActivity : AppCompatActivity() {
}

private fun observeViewModel() {
val signupResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
Log.d("TAG", "signupResult => $it")
when (it.resultCode) {
RESULT_OK -> viewModel.signupSuccessEvent()
else -> viewModel.signupCancelEvent()
}
}

lifecycleScope.launch {
viewModel.sideEffect.collect {
when (it) {
is SplashSideEffect.Signup -> {
signupResult.launch(PreloginActivity.getIntent(this@SplashActivity))
}

is SplashSideEffect.Home -> {
startActivity(HomeActivity.newIntent(this@SplashActivity))
finish()
}
launch {
viewModel.loading.collect {
binding.progress.isVisible = it
}
}
launch {
viewModel.sideEffect.collect {
when (it) {
is SplashSideEffect.Signup -> {
signupNavigation.navigatePreLogin(this@SplashActivity)
finish()
}

is SplashSideEffect.Cancel -> {
finish()
is SplashSideEffect.Home -> {
homeNavigation.navigateHome(this@SplashActivity)
finish()
}
}
}
}
Expand Down
33 changes: 18 additions & 15 deletions app/src/main/java/com/tht/tht/SplashViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,53 @@ package com.tht.tht

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.tht.tht.domain.token.token.FetchThtTokenUseCase
import com.tht.tht.domain.token.token.CheckAndRefreshThtAccessTokenUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class SplashViewModel @Inject constructor(
private val fetchThtTokenUseCase: FetchThtTokenUseCase
private val checkAndRefreshThtAccessTokenUseCase: CheckAndRefreshThtAccessTokenUseCase
) : ViewModel() {

private val _sideEffect = MutableSharedFlow<SplashSideEffect>()
val sideEffect = _sideEffect.asSharedFlow()

fun splashFinishEvent() {
checkAutoLogin()
}
private val _loading = MutableStateFlow(false)
val loading = _loading.asStateFlow()

fun signupSuccessEvent() {
fun splashFinishEvent() {
checkAutoLogin()
}

private fun checkAutoLogin() {
viewModelScope.launch {
fetchThtTokenUseCase()
launch {
delay(500)
_loading.value = true
}
checkAndRefreshThtAccessTokenUseCase()
.onSuccess {
_sideEffect.emit(SplashSideEffect.Home)
when (it) {
true -> _sideEffect.emit(SplashSideEffect.Home)
else -> _sideEffect.emit(SplashSideEffect.Signup)
}
}.onFailure {
it.printStackTrace()
_sideEffect.emit(SplashSideEffect.Signup)
}
}
}

fun signupCancelEvent() {
viewModelScope.launch {
_sideEffect.emit(SplashSideEffect.Cancel)
_loading.value = false
}
}
}

sealed class SplashSideEffect {
object Signup : SplashSideEffect()
object Home : SplashSideEffect()
object Cancel : SplashSideEffect()
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/tht/tht/ThtFcmService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.tht.tht

import android.util.Log
import com.google.firebase.messaging.FirebaseMessagingService
import com.tht.tht.domain.login.usecase.RefreshFcmTokenLoginUseCase
import com.tht.tht.domain.token.token.RefreshFcmTokenUseCase
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
Expand All @@ -14,7 +14,7 @@ import javax.inject.Inject
class ThtFcmService : FirebaseMessagingService() {

@Inject
lateinit var refreshFcmTokenLoginUseCase: RefreshFcmTokenLoginUseCase
lateinit var refreshFcmTokenUseCase: RefreshFcmTokenUseCase

private val job = SupervisorJob()
private val serviceScope = CoroutineScope(job)
Expand All @@ -23,7 +23,7 @@ class ThtFcmService : FirebaseMessagingService() {
super.onNewToken(token)
Log.d("TAG", "onNewToken => $token")
serviceScope.launch {
refreshFcmTokenLoginUseCase(token)
refreshFcmTokenUseCase(token)
.onFailure {
it.printStackTrace()
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/tht/tht/navigation/HomeNavigationImpl.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.tht.tht.navigation

import android.content.Context
import com.tht.tht.HomeActivity
import tht.core.navigation.HomeNavigation
import javax.inject.Inject

class HomeNavigationImpl @Inject constructor() : HomeNavigation {

override fun navigateHome(context: Context) {
context.startActivity(HomeActivity.newIntent(context))
}
}
25 changes: 25 additions & 0 deletions app/src/main/java/com/tht/tht/navigation/NavigationModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.tht.tht.navigation

import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import tht.core.navigation.HomeNavigation
import tht.core.navigation.SignupNavigation
import tht.core.navigation.ToHotNavigation
import tht.feature.signin.navigation.SignupNavigationImpl
import tht.feature.tohot.navigation.ToHotNavigationImpl

@Module
@InstallIn(SingletonComponent::class)
abstract class NavigationModule {

@Binds
abstract fun bindHomeNavigation(impl: HomeNavigationImpl): HomeNavigation

@Binds
abstract fun bindSignupNavigation(impl: SignupNavigationImpl): SignupNavigation

@Binds
abstract fun bindToHotNavigation(impl: ToHotNavigationImpl): ToHotNavigation
}
Loading

0 comments on commit da1de40

Please sign in to comment.