Skip to content

Commit

Permalink
[MERGE] #354 -> develop
Browse files Browse the repository at this point in the history
[FEAT/#354] Profile / 프로필 수정 뷰 대학생 부분 구현
  • Loading branch information
Marchbreeze authored Jan 30, 2024
2 parents 7e3a76b + 0ee6e46 commit 7573b94
Show file tree
Hide file tree
Showing 50 changed files with 2,376 additions and 338 deletions.
46 changes: 42 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

<queries>
<package android:name="com.instagram.android" />
Expand All @@ -32,6 +32,7 @@
android:theme="@style/Theme.YELLO"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<activity
android:name=".presentation.splash.SplashActivity"
android:exported="true"
Expand Down Expand Up @@ -60,10 +61,12 @@
android:name=".presentation.auth.SignInActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.auth.SocialSyncActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true">
Expand All @@ -82,7 +85,7 @@
<activity
android:name=".presentation.onboarding.activity.EditNameActivity"
android:exported="true"
android:screenOrientation="portrait"/>
android:screenOrientation="portrait" />

<activity
android:name=".presentation.onboarding.activity.OnBoardingActivity"
Expand All @@ -93,58 +96,92 @@
android:name=".presentation.onboarding.activity.GetAlarmActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialAActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialBActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialCActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialDActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialEndActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialEndPlusActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.MainActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.yello.vote.VoteActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.manage.ProfileManageActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.manage.ProfileQuitTwoActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.manage.ProfileQuitOneActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.detail.SchoolProfileDetailActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.detail.UnivProfileDetailActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.mod.SchoolProfileModActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.mod.UnivProfileModActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.myyello.read.MyYelloReadActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.pay.PayActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.search.SearchActivity"
android:exported="false"
Expand All @@ -162,5 +199,6 @@
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />

</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class ProfileViewModel @Inject constructor(
private val payRepository: PayRepository,
) : ViewModel() {

init {
resetPageVariable()
resetStateVariable()
}

private val _getUserDataResult = MutableSharedFlow<Boolean>()
val getUserDataResult: SharedFlow<Boolean> = _getUserDataResult

Expand Down Expand Up @@ -67,7 +72,7 @@ class ProfileViewModel @Inject constructor(

var isItemBottomSheetRunning: Boolean = false

var isFirstScroll: Boolean = true
private var isFirstScroll: Boolean = true

private var currentPage = -1
private var isPagingFinish = false
Expand All @@ -87,10 +92,13 @@ class ProfileViewModel @Inject constructor(
_deleteFriendState.value = UiState.Empty
}

fun initViewModelVariable() {
fun resetPageVariable() {
currentPage = -1
isPagingFinish = false
totalPage = Int.MAX_VALUE
}

fun resetStateVariable() {
_deleteFriendState.value = UiState.Empty
_deleteUserState.value = UiState.Empty
_kakaoLogoutState.value = UiState.Empty
Expand Down Expand Up @@ -245,6 +253,7 @@ class ProfileViewModel @Inject constructor(
}.onFailure(Timber::e)
}
}

fun getUserSubsInfoStateFromServer() {
viewModelScope.launch {
payRepository.getUserSubsInfo()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.el.yello.presentation.main.profile.detail

import android.os.Bundle
import com.el.yello.R
import com.el.yello.databinding.ActivityProfileSchoolDetailBinding
import com.example.ui.base.BindingActivity
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class SchoolProfileDetailActivity :
BindingActivity<ActivityProfileSchoolDetailBinding>(R.layout.activity_profile_school_detail) {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
package com.el.yello.presentation.main.profile.detail

import android.os.Bundle
import androidx.activity.viewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.el.yello.R
import com.el.yello.databinding.ActivityProfileUnivDetailBinding
import com.el.yello.presentation.main.profile.mod.UnivProfileModActivity
import com.el.yello.util.Utils.setImageOrBasicThumbnail
import com.el.yello.util.context.yelloSnackbar
import com.example.ui.activity.navigateTo
import com.example.ui.base.BindingActivity
import com.example.ui.context.toast
import com.example.ui.view.UiState
import com.example.ui.view.setOnSingleClickListener
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class UnivProfileDetailActivity :
BindingActivity<ActivityProfileUnivDetailBinding>(R.layout.activity_profile_univ_detail) {

private val viewModel by viewModels<UnivProfileDetailViewModel>()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding.vm = viewModel
initProfileModBtnListener()
initChangeThumbnailBtnListener()
initBackBtnListener()
observeUserDataState()
observeKakaoDataResult()
observeModProfileState()
}

override fun onResume() {
super.onResume()

viewModel.getUserDataFromServer()
}

private fun initProfileModBtnListener() {
binding.btnModSchool.setOnSingleClickListener {
this.navigateTo<UnivProfileModActivity>()
viewModel.resetViewModelState()
}
binding.btnModSubgroup.setOnSingleClickListener {
this.navigateTo<UnivProfileModActivity>()
viewModel.resetViewModelState()
}
binding.btnModYear.setOnSingleClickListener {
this.navigateTo<UnivProfileModActivity>()
viewModel.resetViewModelState()
}
}

private fun initChangeThumbnailBtnListener() {
binding.btnChangeKakaoImage.setOnSingleClickListener {
viewModel.getUserInfoFromKakao()
}
}

private fun initBackBtnListener() {
binding.btnProfileDetailBack.setOnSingleClickListener { finish() }
}

private fun observeUserDataState() {
viewModel.getUserDataState.flowWithLifecycle(lifecycle).onEach { state ->
when (state) {
is UiState.Success -> {
binding.ivProfileDetailThumbnail.setImageOrBasicThumbnail(state.data)
}

is UiState.Failure -> {
toast(getString(R.string.profile_error_user_data))
}

is UiState.Empty -> return@onEach

is UiState.Loading -> return@onEach
}
}.launchIn(lifecycleScope)
}

private fun observeKakaoDataResult() {
viewModel.getKakaoInfoResult.flowWithLifecycle(lifecycle).onEach { result ->
if (!result) yelloSnackbar(binding.root, getString(R.string.msg_error))
}.launchIn(lifecycleScope)
}

private fun observeModProfileState() {
viewModel.postToModProfileState.flowWithLifecycle(lifecycle).onEach { state ->
when (state) {
is UiState.Success -> {
binding.ivProfileDetailThumbnail.setImageOrBasicThumbnail(state.data)
toast(getString(R.string.profile_detail_image_change))
}

is UiState.Failure -> {
toast(getString(R.string.sign_in_error_connection))
}

is UiState.Empty -> return@onEach

is UiState.Loading -> return@onEach
}
}.launchIn(lifecycleScope)
}
}
Loading

0 comments on commit 7573b94

Please sign in to comment.