라이브, 콘텐츠, 채널 공유 재추가
- AppsFlyer OneLink로 공유링크 생성
This commit is contained in:
		| @@ -776,7 +776,20 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin | ||||
|             } | ||||
|  | ||||
|             binding.tvShare.visibility = View.VISIBLE | ||||
|             binding.tvShare.setOnClickListener {} | ||||
|             binding.tvShare.setOnClickListener { | ||||
|                 viewModel.shareContent( | ||||
|                     audioContentId = audioContentId, | ||||
|                     contentImage = response.coverImageUrl, | ||||
|                     contentTitle = "${response.title} - ${response.creator.nickname}" | ||||
|                 ) { | ||||
|                     val intent = Intent(Intent.ACTION_SEND) | ||||
|                     intent.type = "text/plain" | ||||
|                     intent.putExtra(Intent.EXTRA_TEXT, it) | ||||
|  | ||||
|                     val shareIntent = Intent.createChooser(intent, "오디오콘텐츠 공유") | ||||
|                     startActivity(shareIntent) | ||||
|                 } | ||||
|             } | ||||
|         } else { | ||||
|             binding.svActionButtons.visibility = View.GONE | ||||
|             binding.llLike.visibility = View.GONE | ||||
|   | ||||
| @@ -296,6 +296,22 @@ class AudioContentDetailViewModel( | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|     fun shareContent( | ||||
|         audioContentId: Long, | ||||
|         contentImage: String, | ||||
|         contentTitle: String, | ||||
|         onSuccess: (String) -> 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 | ||||
|  | ||||
|   | ||||
| @@ -116,7 +116,6 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>( | ||||
|                 binding.ivMenu, | ||||
|             ) | ||||
|         } | ||||
|         binding.layoutUserProfile.ivShare.setOnClickListener {} | ||||
|  | ||||
|         setupLiveView() | ||||
|         setupDonationView() | ||||
| @@ -646,6 +645,21 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>( | ||||
|     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 | ||||
|   | ||||
| @@ -31,8 +31,6 @@ class UserProfileViewModel( | ||||
|     val creatorProfileLiveData: LiveData<GetCreatorProfileResponse> | ||||
|         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( | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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( | ||||
|   | ||||
| @@ -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) | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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) | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user