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) + } }