From d8afdecc89f3cbd26581bfbc8230bb6abdbbd198 Mon Sep 17 00:00:00 2001 From: klaus Date: Fri, 7 Mar 2025 00:40:48 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C,=20=EC=BD=98?= =?UTF-8?q?=ED=85=90=EC=B8=A0,=20=EC=B1=84=EB=84=90=20=EA=B3=B5=EC=9C=A0?= =?UTF-8?q?=20=EC=9E=AC=EC=B6=94=EA=B0=80=20-=20AppsFlyer=20OneLink?= =?UTF-8?q?=EB=A1=9C=20=EA=B3=B5=EC=9C=A0=EB=A7=81=ED=81=AC=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/AudioContentDetailActivity.kt | 15 +++++++++- .../detail/AudioContentDetailViewModel.kt | 16 ++++++++++ .../explorer/profile/UserProfileActivity.kt | 16 +++++++++- .../explorer/profile/UserProfileViewModel.kt | 19 ++++++++++-- .../sodalive/live/room/LiveRoomActivity.kt | 16 +++++++++- .../sodalive/live/room/LiveRoomViewModel.kt | 29 +++++++++++++++++++ .../room/detail/LiveRoomDetailFragment.kt | 12 ++++++++ .../room/detail/LiveRoomDetailViewModel.kt | 27 +++++++++++++++++ 8 files changed, 145 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/audio_content/detail/AudioContentDetailActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/audio_content/detail/AudioContentDetailActivity.kt index d6f82f9..0c898e6 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/audio_content/detail/AudioContentDetailActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/audio_content/detail/AudioContentDetailActivity.kt @@ -776,7 +776,20 @@ class AudioContentDetailActivity : BaseActivity Unit + ) { + val shareUrl = "https://voiceon.onelink.me/RkTm?" + + "af_dp=voiceon://" + + "&deep_link_value=content" + + "&deep_link_sub5=$audioContentId" + + "&af_og_title=$contentTitle" + + "&af_og_description=지금 보이스온에서 이 콘텐츠 감상하기" + + "&af_og_image=$contentImage" + onSuccess(shareUrl) + } + fun deleteAudioContent(audioContentId: Long, onSuccess: () -> Unit) { isLoading.value = true diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt index f0d7ea4..11c001f 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileActivity.kt @@ -116,7 +116,6 @@ class UserProfileActivity : BaseActivity( binding.ivMenu, ) } - binding.layoutUserProfile.ivShare.setOnClickListener {} setupLiveView() setupDonationView() @@ -646,6 +645,21 @@ class UserProfileActivity : BaseActivity( private fun setCreatorProfile(creator: CreatorResponse) { val layoutUserProfile = binding.layoutUserProfile + layoutUserProfile.ivShare.setOnClickListener { + viewModel.shareChannel( + userId = creator.creatorId, + nickname = creator.nickname, + profileImage = creator.profileUrl + ) { + val intent = Intent(Intent.ACTION_SEND) + intent.type = "text/plain" + intent.putExtra(Intent.EXTRA_TEXT, it) + + val shareIntent = Intent.createChooser(intent, "채널 공유") + startActivity(shareIntent) + } + } + if (creator.creatorId == SharedPreferenceManager.userId) { layoutUserProfile.tvFollowerList.visibility = View.VISIBLE layoutUserProfile.llNotification.visibility = View.GONE diff --git a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt index ee369de..6b0e214 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/explorer/profile/UserProfileViewModel.kt @@ -31,8 +31,6 @@ class UserProfileViewModel( val creatorProfileLiveData: LiveData get() = _creatorProfileLiveData - private var creatorNickname = "" - fun cheersReport(cheersId: Long, reason: String) { _isLoading.value = true @@ -266,6 +264,23 @@ class UserProfileViewModel( ) } + fun shareChannel( + userId: Long, + nickname: String, + profileImage: String, + onSuccess: (String) -> Unit + ) { + val shareUrl = "https://voiceon.onelink.me/RkTm?" + + "af_dp=voiceon://" + + "&deep_link_value=channel" + + "&deep_link_sub5=$userId" + + "&af_og_title=보이스온" + + "&af_og_description=보이스온 ${nickname}님의 채널입니다." + + "&af_og_image=$profileImage" + + onSuccess("보이스온 ${nickname}님의 채널입니다.\n$shareUrl") + } + fun userBlock(userId: Long) { _isLoading.value = true compositeDisposable.add( diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt index e688b0c..21eca09 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt @@ -1001,7 +1001,21 @@ class LiveRoomActivity : BaseActivity(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 diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomViewModel.kt index 6feb472..1bf82fe 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomViewModel.kt @@ -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( diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt index 2de0f85..2ac2c07 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt @@ -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) + } } } diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailViewModel.kt index 862773e..a6b941a 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailViewModel.kt @@ -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) + } }