라이브, 콘텐츠, 채널 공유 재추가

- AppsFlyer OneLink로 공유링크 생성
This commit is contained in:
2025-03-07 00:40:48 +09:00
parent 46e1efff2a
commit d8afdecc89
8 changed files with 145 additions and 5 deletions

View File

@@ -1001,7 +1001,21 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
binding.ivEdit.visibility = View.GONE
}
binding.ivShare.setOnClickListener {}
binding.ivShare.setOnClickListener {
viewModel.shareRoomLink(
response.roomId,
response.isPrivateRoom,
response.password,
response.coverImageUrl
) {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "라이브 공유")
startActivity(shareIntent)
}
}
if (response.creatorId == SharedPreferenceManager.userId) {
binding.llViewUsers.visibility = View.VISIBLE

View File

@@ -295,6 +295,35 @@ class LiveRoomViewModel(
)
}
fun shareRoomLink(
roomId: Long,
isPrivateRoom: Boolean,
password: String?,
coverImage: String,
onSuccess: (String) -> Unit
) {
val shareUrl = "https://voiceon.onelink.me/RkTm?" +
"af_dp=voiceon://" +
"&deep_link_value=live" +
"&deep_link_sub5=$roomId" +
"&af_og_title=보이스온" +
"&af_og_description=지금 보이스온에서 라이브 참여하기" +
"&af_og_image=$coverImage"
val message = if (isPrivateRoom) {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 비공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $shareUrl\n" +
"(입장 비밀번호 : $password)"
} else {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $shareUrl"
}
onSuccess(message)
}
fun creatorFollow(creatorId: Long, roomId: Long, isGetUserProfile: Boolean = false) {
_isLoading.value = true
compositeDisposable.add(

View File

@@ -349,5 +349,17 @@ class LiveRoomDetailFragment(
}
private fun shareRoom(response: GetRoomDetailResponse) {
viewModel.shareRoomLink(
response.roomId,
response.isPrivateRoom,
response.password,
) {
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, it)
val shareIntent = Intent.createChooser(intent, "라이브 공유")
startActivity(shareIntent)
}
}
}

View File

@@ -56,4 +56,31 @@ class LiveRoomDetailViewModel(private val repository: LiveRepository) : BaseView
)
)
}
fun shareRoomLink(
roomId: Long,
isPrivateRoom: Boolean,
password: Int?,
onSuccess: (String) -> Unit
) {
val shareUrl = "https://voiceon.onelink.me/RkTm?" +
"af_dp=voiceon://" +
"&deep_link_value=live" +
"&deep_link_sub5=$roomId" +
"&af_og_title=보이스온" +
"&af_og_description=지금 보이스온에서 라이브 참여하기"
val message = if (isPrivateRoom) {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 비공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $shareUrl\n" +
"(입장 비밀번호 : $password)"
} else {
"${SharedPreferenceManager.nickname}님이 귀하를 " +
"보이스온의 공개라이브에 초대하였습니다.\n" +
"※ 라이브 참여: $shareUrl"
}
onSuccess(message)
}
}