fix(liveroom): 딥링크 이동 안내 문구를 단순화한다
This commit is contained in:
@@ -22,7 +22,6 @@ import android.graphics.Path
|
||||
import android.graphics.Rect
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
@@ -124,7 +123,6 @@ import kr.co.vividnext.sodalive.settings.language.LanguageManager
|
||||
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
||||
import org.koin.android.ext.android.inject
|
||||
import org.json.JSONObject
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.random.Random
|
||||
@@ -254,9 +252,8 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
private val deepLinkConfirmReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
val bundle = intent?.getBundleExtra(Constants.EXTRA_DATA) ?: return
|
||||
val destinationPageName = resolveDestinationPageName(bundle)
|
||||
|
||||
showDeepLinkNavigationDialog(destinationPageName) {
|
||||
showDeepLinkNavigationDialog {
|
||||
val nextIntent = Intent(applicationContext, MainActivity::class.java).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
putExtra(Constants.EXTRA_DATA, bundle)
|
||||
@@ -1227,10 +1224,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
private fun handleNoticeUrlClick(url: String) {
|
||||
val viewIntent = Intent(Intent.ACTION_VIEW, url.toUri())
|
||||
if (isInAppDeepLinkIntent(viewIntent)) {
|
||||
val deepLinkExtras = buildDeepLinkExtrasFromUri(viewIntent.data)
|
||||
val destinationPageName = resolveDestinationPageName(deepLinkExtras)
|
||||
|
||||
showDeepLinkNavigationDialog(destinationPageName) {
|
||||
showDeepLinkNavigationDialog {
|
||||
startActivity(viewIntent)
|
||||
finish()
|
||||
}
|
||||
@@ -1261,89 +1255,12 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildDeepLinkExtrasFromUri(data: Uri?): Bundle {
|
||||
val extras = Bundle()
|
||||
if (data == null) {
|
||||
return extras
|
||||
}
|
||||
|
||||
fun putQuery(key: String) {
|
||||
val value = data.getQueryParameter(key)
|
||||
if (!value.isNullOrBlank()) {
|
||||
extras.putString(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
putQuery("room_id")
|
||||
putQuery("channel_id")
|
||||
putQuery("message_id")
|
||||
putQuery("audition_id")
|
||||
putQuery("content_id")
|
||||
putQuery("deep_link_value")
|
||||
putQuery("deep_link_sub5")
|
||||
|
||||
val deepLinkValue = extras.getString("deep_link_value")
|
||||
val deepLinkValueId = extras.getString("deep_link_sub5")
|
||||
|
||||
if (!deepLinkValue.isNullOrBlank() && !deepLinkValueId.isNullOrBlank()) {
|
||||
when (deepLinkValue.lowercase(Locale.ROOT)) {
|
||||
"live" -> if (!extras.containsKey("room_id")) {
|
||||
extras.putString("room_id", deepLinkValueId)
|
||||
}
|
||||
|
||||
"channel" -> if (!extras.containsKey("channel_id")) {
|
||||
extras.putString("channel_id", deepLinkValueId)
|
||||
}
|
||||
|
||||
"content" -> if (!extras.containsKey("content_id")) {
|
||||
extras.putString("content_id", deepLinkValueId)
|
||||
}
|
||||
|
||||
"audition" -> if (!extras.containsKey("audition_id")) {
|
||||
extras.putString("audition_id", deepLinkValueId)
|
||||
}
|
||||
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
return extras
|
||||
}
|
||||
|
||||
private fun resolveDestinationPageName(bundle: Bundle): String {
|
||||
val roomId = bundle.getString("room_id")?.toLongOrNull()
|
||||
?: bundle.getLong(Constants.EXTRA_ROOM_ID).takeIf { it > 0 }
|
||||
val channelId = bundle.getString("channel_id")?.toLongOrNull()
|
||||
?: bundle.getLong(Constants.EXTRA_USER_ID).takeIf { it > 0 }
|
||||
val messageId = bundle.getString("message_id")?.toLongOrNull()
|
||||
?: bundle.getLong(Constants.EXTRA_MESSAGE_ID).takeIf { it > 0 }
|
||||
val contentId = bundle.getString("content_id")?.toLongOrNull()
|
||||
?: bundle.getLong(Constants.EXTRA_AUDIO_CONTENT_ID).takeIf { it > 0 }
|
||||
|
||||
return when {
|
||||
roomId != null && roomId > 0 -> getString(R.string.screen_live_room_deeplink_target_live_room)
|
||||
channelId != null && channelId > 0 -> getString(R.string.screen_live_room_deeplink_target_channel_profile)
|
||||
contentId != null && contentId > 0 -> getString(R.string.screen_live_room_deeplink_target_content_detail)
|
||||
messageId != null && messageId > 0 -> getString(R.string.screen_live_room_deeplink_target_message)
|
||||
else -> {
|
||||
when (bundle.getString("deep_link_value")?.lowercase(Locale.ROOT)) {
|
||||
"live" -> getString(R.string.screen_live_room_deeplink_target_live_room)
|
||||
"channel" -> getString(R.string.screen_live_room_deeplink_target_channel_profile)
|
||||
"content" -> getString(R.string.screen_live_room_deeplink_target_content_detail)
|
||||
"series" -> getString(R.string.screen_live_room_deeplink_target_series_detail)
|
||||
"audition" -> getString(R.string.screen_live_room_deeplink_target_audition)
|
||||
else -> getString(R.string.screen_live_room_deeplink_target_default)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDeepLinkNavigationDialog(destinationPageName: String, onConfirm: () -> Unit) {
|
||||
private fun showDeepLinkNavigationDialog(onConfirm: () -> Unit) {
|
||||
SodaDialog(
|
||||
activity = this,
|
||||
layoutInflater = layoutInflater,
|
||||
title = getString(R.string.screen_live_room_deeplink_move_title),
|
||||
desc = getString(R.string.screen_live_room_deeplink_move_message, destinationPageName),
|
||||
desc = getString(R.string.screen_live_room_deeplink_move_message),
|
||||
confirmButtonTitle = getString(R.string.screen_live_room_yes),
|
||||
confirmButtonClick = {
|
||||
onConfirm()
|
||||
|
||||
@@ -429,15 +429,8 @@
|
||||
<string name="screen_live_room_end_message">End this live?\nChat history will not be saved and will disappear.\nParticipants will also be removed when the live ends.</string>
|
||||
<string name="screen_live_room_exit_title">Leave live</string>
|
||||
<string name="screen_live_room_exit_message">Leave this live room?</string>
|
||||
<string name="screen_live_room_deeplink_move_title">Open deep link</string>
|
||||
<string name="screen_live_room_deeplink_move_message">Close this page and move to %1$s?</string>
|
||||
<string name="screen_live_room_deeplink_target_live_room">Live room page</string>
|
||||
<string name="screen_live_room_deeplink_target_channel_profile">Channel profile page</string>
|
||||
<string name="screen_live_room_deeplink_target_content_detail">Content detail page</string>
|
||||
<string name="screen_live_room_deeplink_target_message">Message page</string>
|
||||
<string name="screen_live_room_deeplink_target_series_detail">Series detail page</string>
|
||||
<string name="screen_live_room_deeplink_target_audition">Audition page</string>
|
||||
<string name="screen_live_room_deeplink_target_default">requested page</string>
|
||||
<string name="screen_live_room_deeplink_move_title">Notification</string>
|
||||
<string name="screen_live_room_deeplink_move_message">If you move to another page, you will leave the current live.</string>
|
||||
<string name="screen_live_room_yes">Yes</string>
|
||||
<string name="screen_live_room_no">No</string>
|
||||
<string name="screen_live_room_request_speaker">Speaker request sent.\nwait a moment.</string>
|
||||
|
||||
@@ -428,15 +428,8 @@
|
||||
<string name="screen_live_room_end_message">ライブを終了しますか?\n終了するとチャット内容は保存されず消えます。\nリスナーもライブ終了と共に\n強制退出となります。</string>
|
||||
<string name="screen_live_room_exit_title">ライブ退出</string>
|
||||
<string name="screen_live_room_exit_message">ライブから退出しますか?</string>
|
||||
<string name="screen_live_room_deeplink_move_title">ディープリンク移動</string>
|
||||
<string name="screen_live_room_deeplink_move_message">現在のページを終了して%1$sへ移動しますか?</string>
|
||||
<string name="screen_live_room_deeplink_target_live_room">ライブルームページ</string>
|
||||
<string name="screen_live_room_deeplink_target_channel_profile">チャンネルプロフィールページ</string>
|
||||
<string name="screen_live_room_deeplink_target_content_detail">コンテンツ詳細ページ</string>
|
||||
<string name="screen_live_room_deeplink_target_message">メッセージページ</string>
|
||||
<string name="screen_live_room_deeplink_target_series_detail">シリーズ詳細ページ</string>
|
||||
<string name="screen_live_room_deeplink_target_audition">オーディションページ</string>
|
||||
<string name="screen_live_room_deeplink_target_default">リクエストされたページ</string>
|
||||
<string name="screen_live_room_deeplink_move_title">通知</string>
|
||||
<string name="screen_live_room_deeplink_move_message">他のページに移動すると、現在のライブから退出します。</string>
|
||||
<string name="screen_live_room_yes">はい</string>
|
||||
<string name="screen_live_room_no">いいえ</string>
|
||||
<string name="screen_live_room_request_speaker">スピーカーリクエストを送りました。\n少々お待ちください。</string>
|
||||
|
||||
@@ -428,15 +428,8 @@
|
||||
<string name="screen_live_room_end_message">라이브를 종료하시겠습니까?\n라이브를 종료하면 대화내용은\n저장되지 않고 사라집니다.\n참여자들 또한 라이브가 종료되어\n강제퇴장 됩니다.</string>
|
||||
<string name="screen_live_room_exit_title">라이브 나가기</string>
|
||||
<string name="screen_live_room_exit_message">라이브에서 나가시겠습니까?</string>
|
||||
<string name="screen_live_room_deeplink_move_title">딥링크 이동</string>
|
||||
<string name="screen_live_room_deeplink_move_message">현재 페이지를 종료하고 %1$s로 이동하시겠습니까?</string>
|
||||
<string name="screen_live_room_deeplink_target_live_room">라이브룸 페이지</string>
|
||||
<string name="screen_live_room_deeplink_target_channel_profile">채널 프로필 페이지</string>
|
||||
<string name="screen_live_room_deeplink_target_content_detail">콘텐츠 상세 페이지</string>
|
||||
<string name="screen_live_room_deeplink_target_message">메시지 페이지</string>
|
||||
<string name="screen_live_room_deeplink_target_series_detail">시리즈 상세 페이지</string>
|
||||
<string name="screen_live_room_deeplink_target_audition">오디션 페이지</string>
|
||||
<string name="screen_live_room_deeplink_target_default">요청한 페이지</string>
|
||||
<string name="screen_live_room_deeplink_move_title">알림</string>
|
||||
<string name="screen_live_room_deeplink_move_message">다른 페이지로 이동시 현재 라이브에서 나가게 됩니다.</string>
|
||||
<string name="screen_live_room_yes">예</string>
|
||||
<string name="screen_live_room_no">아니오</string>
|
||||
<string name="screen_live_room_request_speaker">스피커 요청을 보냈습니다.\n잠시만 기다려 주세요.</string>
|
||||
|
||||
Reference in New Issue
Block a user