푸시, 딥링크 - 라이브 탭으로 이동하지 않아도 실행되도록 수정
This commit is contained in:
parent
9eb136379c
commit
ad7a5b36f1
|
@ -21,7 +21,6 @@ import com.zhpan.indicator.enums.IndicatorSlideMode
|
|||
import com.zhpan.indicator.enums.IndicatorStyle
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentPlayService
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
|
@ -95,25 +94,6 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|||
|
||||
message = "라이브를 불러오고 있습니다."
|
||||
viewModel.getSummary()
|
||||
|
||||
try {
|
||||
val roomId = requireArguments().getLong(Constants.EXTRA_ROOM_ID)
|
||||
val channelId = requireArguments().getLong(Constants.EXTRA_USER_ID)
|
||||
val audioContentId = requireArguments().getLong(Constants.EXTRA_AUDIO_CONTENT_ID)
|
||||
|
||||
if (roomId > 0) {
|
||||
enterLiveRoom(roomId)
|
||||
} else if (channelId > 0) {
|
||||
val nextIntent = Intent(requireContext(), UserProfileActivity::class.java)
|
||||
nextIntent.putExtra(Constants.EXTRA_USER_ID, channelId)
|
||||
startActivity(nextIntent)
|
||||
} else if (audioContentId > 0) {
|
||||
val nextIntent = Intent(requireContext(), AudioContentDetailActivity::class.java)
|
||||
nextIntent.putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, audioContentId)
|
||||
startActivity(nextIntent)
|
||||
}
|
||||
} catch (_: IllegalStateException) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupView() {
|
||||
|
|
|
@ -52,40 +52,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
|||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
|
||||
val bundle = intent.getBundleExtra(Constants.EXTRA_DATA)
|
||||
if (bundle != null) {
|
||||
try {
|
||||
val roomId = bundle.getLong(Constants.EXTRA_ROOM_ID)
|
||||
val channelId = bundle.getLong(Constants.EXTRA_USER_ID)
|
||||
val audioContentId = bundle.getLong(Constants.EXTRA_AUDIO_CONTENT_ID)
|
||||
val isLiveReservation = bundle.getBoolean(Constants.EXTRA_LIVE_RESERVATION_RESPONSE)
|
||||
|
||||
if (roomId > 0) {
|
||||
if (isLiveReservation) {
|
||||
liveFragment.reservationRoom(roomId)
|
||||
} else {
|
||||
handler.postDelayed({
|
||||
liveFragment.enterLiveRoom(roomId)
|
||||
}, 500)
|
||||
}
|
||||
} else if (channelId > 0) {
|
||||
val nextIntent = Intent(applicationContext, UserProfileActivity::class.java)
|
||||
nextIntent.putExtra(Constants.EXTRA_USER_ID, channelId)
|
||||
startActivity(nextIntent)
|
||||
} else if (audioContentId > 0) {
|
||||
val nextIntent = Intent(
|
||||
applicationContext,
|
||||
AudioContentDetailActivity::class.java
|
||||
)
|
||||
nextIntent.putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, audioContentId)
|
||||
startActivity(nextIntent)
|
||||
}
|
||||
} catch (_: IllegalStateException) {
|
||||
}
|
||||
}
|
||||
|
||||
checkReceivedMessage(intent)
|
||||
executeDeeplink()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -95,7 +62,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
|||
|
||||
getMemberInfo()
|
||||
getEventPopup()
|
||||
checkReceivedMessage(intent)
|
||||
|
||||
handler.postDelayed({ executeDeeplink() }, 500)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -115,25 +83,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
|||
unregisterReceiver(audioContentReceiver)
|
||||
}
|
||||
|
||||
private fun checkReceivedMessage(intent: Intent) {
|
||||
handler.postDelayed({
|
||||
val messageId =
|
||||
intent.getBundleExtra(Constants.EXTRA_DATA)?.getLong(Constants.EXTRA_MESSAGE_ID)
|
||||
if (messageId != null && messageId > 0) {
|
||||
changeFragment(MainViewModel.CurrentTab.MESSAGE)
|
||||
setTabSelected(binding.tabLive, isSelected = false)
|
||||
setTabSelected(binding.tabExplorer, isSelected = false)
|
||||
setTabSelected(binding.tabMessage, isSelected = true)
|
||||
setTabSelected(binding.tabMy, isSelected = false)
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
|
||||
override fun setupView() {
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
liveFragment = LiveFragment().apply {
|
||||
arguments = intent.getBundleExtra(Constants.EXTRA_DATA)
|
||||
}
|
||||
liveFragment = LiveFragment()
|
||||
|
||||
notificationSettingsDialog = NotificationSettingsDialog(
|
||||
this,
|
||||
|
@ -149,6 +101,57 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
|||
setupBottomTabLayout()
|
||||
}
|
||||
|
||||
private fun executeDeeplink() {
|
||||
val bundle = intent.getBundleExtra(Constants.EXTRA_DATA)
|
||||
if (bundle != null) {
|
||||
try {
|
||||
val roomId = bundle.getLong(Constants.EXTRA_ROOM_ID)
|
||||
val channelId = bundle.getLong(Constants.EXTRA_USER_ID)
|
||||
val messageId = bundle.getLong(Constants.EXTRA_MESSAGE_ID)
|
||||
val contentId = bundle.getLong(Constants.EXTRA_AUDIO_CONTENT_ID)
|
||||
val isLiveReservation = bundle.getBoolean(Constants.EXTRA_LIVE_RESERVATION_RESPONSE)
|
||||
|
||||
if (roomId > 0) {
|
||||
changeFragment(MainViewModel.CurrentTab.LIVE)
|
||||
setTabSelected(binding.tabLive, isSelected = true)
|
||||
setTabSelected(binding.tabExplorer, isSelected = false)
|
||||
setTabSelected(binding.tabMessage, isSelected = false)
|
||||
setTabSelected(binding.tabMy, isSelected = false)
|
||||
setTabSelected(binding.tabContent, isSelected = false)
|
||||
|
||||
handler.postDelayed({
|
||||
if (isLiveReservation) {
|
||||
liveFragment.reservationRoom(roomId)
|
||||
} else {
|
||||
liveFragment.enterLiveRoom(roomId)
|
||||
}
|
||||
}, 500)
|
||||
} else if (channelId > 0) {
|
||||
val nextIntent = Intent(applicationContext, UserProfileActivity::class.java)
|
||||
nextIntent.putExtra(Constants.EXTRA_USER_ID, channelId)
|
||||
startActivity(nextIntent)
|
||||
} else if (contentId > 0) {
|
||||
val nextIntent = Intent(
|
||||
applicationContext,
|
||||
AudioContentDetailActivity::class.java
|
||||
)
|
||||
nextIntent.putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, contentId)
|
||||
startActivity(nextIntent)
|
||||
} else if (messageId > 0) {
|
||||
handler.postDelayed({
|
||||
changeFragment(MainViewModel.CurrentTab.MESSAGE)
|
||||
setTabSelected(binding.tabLive, isSelected = false)
|
||||
setTabSelected(binding.tabExplorer, isSelected = false)
|
||||
setTabSelected(binding.tabMessage, isSelected = true)
|
||||
setTabSelected(binding.tabMy, isSelected = false)
|
||||
setTabSelected(binding.tabContent, isSelected = false)
|
||||
}, 500)
|
||||
}
|
||||
} catch (_: IllegalStateException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupBottomTabLayout() {
|
||||
setupTab(
|
||||
binding = binding.tabContent,
|
||||
|
|
Loading…
Reference in New Issue