Skip to content
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

[FEAT] 유저 리뷰 알림과 연결 #147

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TeumMessagingService : FirebaseMessagingService() {
alertMessage.type = message.data["type"].toString()
}
if (alertMessage.type == END_MEETING) {
alertMessage.meetingId = message.data["meetingId"]?.toInt()
alertMessage.meetingId = message.data["meetingId"]?.toLong()
alertMessage.participants = message.data["participants"]?.toList()?.map { it.digitToInt() }
}
if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,10 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
if (isFromAlarm) {
val message = intent.getSerializableExtra(MESSAGE) as Message
var action = HomeFragmentDirections.actionHomeFragmentToFragmentFamiliar()
when (message.type) {
BEFORE_MEETING -> {
}
END_MEETING -> {
// val meetingId = message.meetingId
// val participants = message.participants
// action = HomeFragmentDirections.{홈 -> 유저리뷰로 이동하는 navi}
}
RECOMMEND_USER -> {
action = HomeFragmentDirections.actionHomeFragmentToFragmentMyPage()
}
if (message.type == RECOMMEND_USER) {
action = HomeFragmentDirections.actionHomeFragmentToFragmentMyPage()
}
// END_MEETING은 따로 처리
val navHostFragment = supportFragmentManager.findFragmentById(R.id.fl_main) as NavHostFragment
navHostFragment.navController.navigate(action)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.teumteum.domain.repository.AuthRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import timber.log.Timber
import javax.inject.Inject

@HiltViewModel
Expand All @@ -20,7 +19,6 @@ class SignInViewModel @Inject constructor(
var oauthId = ""

fun updateMemberState(socialLoginResult: SocialLoginResult) {
Timber.tag("teum-login").d("${socialLoginResult}")
if (socialLoginResult.message == null) {
if (!socialLoginResult.accessToken.isNullOrEmpty() && !socialLoginResult.refreshToken.isNullOrEmpty()) {
// 기존 회원일 때
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject

@HiltViewModel
Expand Down Expand Up @@ -205,12 +206,14 @@ class SignUpViewModel @Inject constructor(
}

fun setAllInterests(interests: List<String>, selfResource: Array<String>, fieldResource: Array<String>) {
Timber.tag("teum-fix").d("setAllInterests called")
interestSelf.value.clear()
interestField.value.clear()
for (i in interests) {
if (i in selfResource) addInterestSelf(i)
else if (i in fieldResource) addInterestField(i)
}
updateInterestCount()
}

private var _goalText = MutableStateFlow<String>("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.teumteum.teumteum.util.custom.view.model.BackCard
import com.teumteum.teumteum.util.custom.view.model.FrontCard
import com.teumteum.teumteum.util.custom.view.model.Interest
import dagger.hilt.android.AndroidEntryPoint
import timber.log.Timber
import java.util.Locale

@AndroidEntryPoint
Expand All @@ -39,6 +40,7 @@ class CardFixFragment
private lateinit var frontAnimation: AnimatorSet
private lateinit var backAnimation: AnimatorSet
private var isFront = true
private var isFirstLoaded = true

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand All @@ -50,6 +52,7 @@ class CardFixFragment

private fun initCard() {
with(viewModel) {
Timber.tag("teum-fix").d("initCard called")
val fc = CHARACTER_CARD_LIST[characterId.value]?.let {
when (community.value) {
STATUS_WORKER -> FrontCard(userName.value, "@${companyName.value}", jobDetailClass.value,
Expand Down Expand Up @@ -190,9 +193,12 @@ class CardFixFragment
}
}
currentList.observe(viewLifecycleOwner) { interests ->
val selfArray = resources.getStringArray(R.array.interest_1)
val fieldArray = resources.getStringArray(R.array.interest_2)
viewModel.setAllInterests(interests.map { it.toString() }, selfArray, fieldArray)
if (!isFirstLoaded) {
val selfArray = resources.getStringArray(R.array.interest_1)
val fieldArray = resources.getStringArray(R.array.interest_2)
viewModel.setAllInterests(interests.map { it.toString() }, selfArray, fieldArray)
}
isFirstLoaded = false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ class SplashActivity
}

private fun startHomeScreen() {
val intent = MainActivity.getIntent(this, -1, isFromAlarm = isFromAlarm)
if (isFromAlarm) intent.putExtra(MESSAGE, message)
var intent = MainActivity.getIntent(this, -1, isFromAlarm = isFromAlarm)
if (isFromAlarm) {
if (message.type == END_MEETING)
intent = MainActivity.getIntent(this, message.meetingId!!, message.title)
else intent.putExtra(MESSAGE, message)
}
startActivity(intent)
finish()
}
Expand All @@ -121,5 +125,6 @@ class SplashActivity

const val IS_FROM_ALARM = "isFromAlarm"
const val MESSAGE = "message"
private const val END_MEETING = "END_MEETING"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ data class Message(
var title: String,
var body: String,
var type: String,
var meetingId: Int? = -1,
var participants: List<Int>? = listOf()
var meetingId: Long? = null,
var participants: List<Int>? = null
): java.io.Serializable
Loading