Skip to content

Commit

Permalink
[Merge] #94 -> develop
Browse files Browse the repository at this point in the history
[Fix/#94] ์˜ค๋ฅ˜ ์ˆ˜์ • ๋ฐ setting ๋งํฌ ์—ฐ๊ฒฐ
  • Loading branch information
chattymin authored Jan 14, 2024
2 parents d602bdd + bb7c6e9 commit 24c3e8b
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 18 deletions.
15 changes: 15 additions & 0 deletions .idea/git_toolbox_prj.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<!-- Redirect URI: "kakao${NATIVE_APP_KEY}://oauth" -->
<data
android:host="oauth"
android:scheme="kakao${NATIVE_APP_KEY}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class SignInActivity : BaseActivity<ActivitySigninBinding>(R.layout.activity_signin) {

private val viewModel by viewModels<SignInViewModel>()

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -95,6 +96,6 @@ class SignInActivity : BaseActivity<ActivitySigninBinding>(R.layout.activity_sig
}

companion object {
const val TERMS_URL = "http://www.naver.com"
const val TERMS_URL = "https://goinggoing.notion.site/75f5d981a5b842a6be74a9dc17ca67de?pvs=74"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SignInViewModel @Inject constructor(
private val authRepository: AuthRepository,
private val tokenRepository: TokenRepository,
) : ViewModel() {

private val _postChangeTokenState = MutableStateFlow(AuthState.EMPTY)
val postChangeTokenState: StateFlow<AuthState> = _postChangeTokenState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import androidx.activity.viewModels
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.going.domain.entity.AuthState
import com.going.domain.entity.NameState
import com.going.presentation.R
import com.going.presentation.databinding.ActivityOnboardingProfileSettingBinding
import com.going.domain.entity.AuthState
import com.going.presentation.onboarding.splash.SplashActivity
import com.going.presentation.tendency.ttest.TendencyTestActivity
import com.going.ui.base.BaseActivity
Expand All @@ -24,6 +24,7 @@ import kotlinx.coroutines.flow.onEach
@AndroidEntryPoint
class OnboardingProfileSettingActivity :
BaseActivity<ActivityOnboardingProfileSettingBinding>(R.layout.activity_onboarding_profile_setting) {

private val viewModel by viewModels<OnboardingProfileSettingViewModel>()

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.going.presentation.onboarding.signup
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.going.domain.entity.AuthState
import com.going.domain.entity.NameState
import com.going.domain.entity.request.SignUpRequestModel
import com.going.domain.repository.AuthRepository
import com.going.domain.entity.AuthState
import com.kakao.sdk.auth.AuthApiClient
import com.kakao.sdk.auth.TokenManagerProvider
import com.kakao.sdk.user.UserApiClient
Expand All @@ -21,6 +21,7 @@ import javax.inject.Inject
class OnboardingProfileSettingViewModel @Inject constructor(
private val authRepository: AuthRepository,
) : ViewModel() {

val name = MutableStateFlow("")
val nowNameLength = MutableLiveData(0)
val info = MutableStateFlow("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class SplashActivity : BaseActivity<ActivitySplashBinding>(R.layout.activity_splash) {

private val viewModel by viewModels<SplashViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -39,7 +40,11 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(R.layout.activity_spl

private fun initSplash() {
Handler(Looper.getMainLooper()).postDelayed({
viewModel.getUserState()
if (viewModel.getHasAccessToken()) {
viewModel.getUserState()
} else {
navigateToSignInScreen()
}
}, 3000)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.lifecycle.viewModelScope
import com.going.domain.entity.AuthState
import com.going.domain.repository.AuthRepository
import com.going.domain.repository.TokenRepository
import com.going.presentation.onboarding.signin.SignInViewModel
import com.going.presentation.util.toErrorCode
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
Expand All @@ -18,6 +17,7 @@ class SplashViewModel @Inject constructor(
private val authRepository: AuthRepository,
private val tokenRepository: TokenRepository,
) : ViewModel() {

private val _userState = MutableStateFlow(AuthState.LOADING)
val userState: StateFlow<AuthState> = _userState
fun getHasAccessToken(): Boolean = tokenRepository.getAccessToken().isNotBlank()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.going.presentation.setting

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import com.going.presentation.R
import com.going.presentation.databinding.ActivitySettingBinding
Expand All @@ -18,11 +20,12 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>(R.layout.activity_s

initProfileClickListener()
initInquireClickListener()
setVersionCode()
initPolicyClickListener()
initTermsClickListener()
initAboutDooripClickListener()
initLogoutClickListener()
initQuitClickListener()
setVersionCode()
}

private fun initProfileClickListener() {
Expand All @@ -32,16 +35,37 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>(R.layout.activity_s

private fun initInquireClickListener() {
binding.btnSettingInquire.setOnSingleClickListener {
Intent(Intent.ACTION_VIEW, Uri.parse(FAQ)).apply {
startActivity(this)
}
}
}

private fun setVersionCode() {
binding.tvSettingShowServiceVersion.text = VERSION_CODE
}

private fun initPolicyClickListener() {
binding.btnSettingPolicy.setOnSingleClickListener {
Intent(Intent.ACTION_VIEW, Uri.parse(PRIVACY_POLICY_URL)).apply {
startActivity(this)
}
}
}

private fun initTermsClickListener() {
binding.btnSettingTerms.setOnSingleClickListener {
Intent(Intent.ACTION_VIEW, Uri.parse(TERMS_URL)).apply {
startActivity(this)
}
}
}

private fun initAboutDooripClickListener() {
binding.btnSettingAboutDoorip.setOnSingleClickListener {
Intent(Intent.ACTION_VIEW, Uri.parse(ABOUT_DOORIP_URL)).apply {
startActivity(this)
}
}
}

Expand All @@ -67,10 +91,6 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>(R.layout.activity_s
quitDialog?.show(supportFragmentManager, quitDialog?.tag)
}

private fun setVersionCode() {
binding.tvSettingShowServiceVersion.text = VERSION_CODE
}

override fun onDestroy() {
super.onDestroy()
if (logoutDialog?.isAdded == true) logoutDialog?.dismiss()
Expand All @@ -79,5 +99,13 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>(R.layout.activity_s

companion object {
private const val VERSION_CODE = "v1.0"
private const val FAQ =
"https://goinggoing.notion.site/FAQ-920f6ad93fea46a983061f412e15cad1?pvs=74"
private const val PRIVACY_POLICY_URL =
"https://goinggoing.notion.site/c4d5513bba2c4c20aaf9e21522289304?pvs=74"
private const val TERMS_URL =
"https://goinggoing.notion.site/75f5d981a5b842a6be74a9dc17ca67de?pvs=74"
private const val ABOUT_DOORIP_URL =
"https://goinggoing.notion.site/758273e2bebb477aac0adb0195359f21"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import java.io.FileOutputStream
@AndroidEntryPoint
class TendencyResultActivity :
BaseActivity<ActivityTendencyResultBinding>(R.layout.activity_tendency_result) {

private val viewModel by viewModels<TendencyResultViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -54,16 +55,16 @@ class TendencyResultActivity :
viewModel.userInfoState.flowWithLifecycle(lifecycle).onEach { state ->
when (state) {
is UiState.Loading -> return@onEach
is UiState.Success -> bindTendencyInfo(state.data.result)
is UiState.Success -> bindTendencyInfo(state.data.name, state.data.result)
is UiState.Failure -> toast(state.msg)
is UiState.Empty -> return@onEach
}
}.launchIn(lifecycleScope)
}

private fun bindTendencyInfo(number: Int) {
private fun bindTendencyInfo(name: String, number: Int) {
with(binding) {
tvTendencyTestResultTitle.text = getString(R.string.tendency_test_result_title, "์ฐ๋‘๋ฆ…")
tvTendencyTestResultTitle.text = getString(R.string.tendency_test_result_title, name)

viewModel.mockTendencyResult[number].apply {
imgTendencyTestResult.setImageResource(resultImage)
Expand Down Expand Up @@ -154,11 +155,11 @@ class TendencyResultActivity :
PERMISSION_REQUEST_CODE,
)
} else {
saveImageToGallery(resources)
saveImageToGallery()
}
}

private fun saveImageToGallery(resources: Resources) {
private fun saveImageToGallery() {
val imageBitmap: Bitmap = BitmapFactory.decodeResource(
resources,
R.drawable.img_tendency_result_ari,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import javax.inject.Inject
class TendencyResultViewModel @Inject constructor(
private val profileRepository: ProfileRepository,
) : ViewModel() {

private val _userInfoState = MutableStateFlow<UiState<UserProfileRequestModel>>(UiState.Empty)
val userInfoState: StateFlow<UiState<UserProfileRequestModel>> = _userInfoState

Expand Down Expand Up @@ -277,4 +278,5 @@ class TendencyResultViewModel @Inject constructor(
),
),
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class TendencyTestActivity :
override fun onAnimationStart(animation: Animator) {
viewModel.clearAllChecked()
setProgressAnimate(binding.pbTendencyTest, viewModel.step.value)

for (i in 1 until fadeOutList.size) {
fadeOutList[i].start()
}
Expand Down
Binary file modified presentation/src/main/res/drawable/img_sign_in_kakao_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 36 additions & 1 deletion presentation/src/main/res/layout/activity_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,41 @@

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_setting_terms"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="8dp"
android:background="@drawable/shape_rect_6_white000_fill"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_setting_policy">

<TextView
android:id="@+id/tv_setting_terms"
style="@style/TextAppearance.Doorip.Body1.Medi"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginVertical="11dp"
android:layout_marginStart="16dp"
android:text="@string/setting_tv_terms"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/iv_setting_terms_enter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_enter_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>


<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_setting_about_doorip"
Expand All @@ -200,7 +235,7 @@
android:background="@drawable/shape_rect_6_white000_fill"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_setting_policy">
app:layout_constraintTop_toBottomOf="@id/btn_setting_terms">

<TextView
android:id="@+id/tv_setting_about_doorip"
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/res/layout/activity_signin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
android:layout_marginHorizontal="30dp"
android:layout_marginBottom="12dp"
android:src="@drawable/img_sign_in_kakao_button"
android:adjustViewBounds="true"
app:layout_constraintBottom_toTopOf="@id/btn_terms"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
3 changes: 2 additions & 1 deletion presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
<string name="setting_tv_profile">ํ”„๋กœํ•„</string>
<string name="setting_tv_inquire">๋ฌธ์˜ํ•˜๊ธฐ</string>
<string name="setting_tv_service_version">์„œ๋น„์Šค ๋ฒ„์ „</string>
<string name="setting_tv_policy">์•ฝ๊ด€ ๋ฐ ์ •์ฑ…</string>
<string name="setting_tv_policy">์„œ๋น„์Šค ์ด์šฉ ์•ฝ๊ด€</string>
<string name="setting_tv_terms">๊ฐœ์ธ์ •๋ณด ์ฒ˜๋ฆฌ ๋ฐฉ์นจ</string>
<string name="setting_tv_about_doorip">About doorip</string>
<string name="setting_tv_logout">๋กœ๊ทธ์•„์›ƒ</string>
<string name="setting_quit_dialog_title">์ •๋ง ํƒˆํ‡ดํ•˜์‹œ๊ฒ ์–ด์š”?</string>
Expand Down

0 comments on commit 24c3e8b

Please sign in to comment.