diff --git a/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift b/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift index 55cb67c..baedb5e 100644 --- a/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift +++ b/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift @@ -200,6 +200,19 @@ final class ContentDetailViewModel: ObservableObject { } func shareAudioContent(contentImage: String, contentTitle: String) { + isLoading = true + + let shareUrl = "https://voiceon.onelink.me/RkTm?" + + "af_dp=voiceon://" + + "&deep_link_value=content" + + "&deep_link_sub5=\(contentId)" + + "&af_og_title=\(contentTitle)" + + "&af_og_description=지금 보이스온에서 이 콘텐츠 감상하기" + + "&af_og_image=\(contentImage)" + + self.isLoading = false + self.shareMessage = shareUrl + self.isShowShareView = true } func registerComment(comment: String, isSecret: Bool) { diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 8e383cb..0b0f84d 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -57,7 +57,11 @@ struct UserProfileView: View { } showCreatorFollowNotifyDialog: { isShowFollowNotifyDialog = true } shareChannel: { - viewModel.shareChannel(userId: userId) + viewModel.shareChannel( + userId: creatorProfile.creator.creatorId, + nickname: creatorProfile.creator.nickname, + profileImage: creatorProfile.creator.profileUrl + ) } if creatorProfile.isCreatorRole { diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift b/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift index e5b6e9c..0f2a93b 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift @@ -398,7 +398,17 @@ final class UserProfileViewModel: ObservableObject { .store(in: &subscription) } - func shareChannel(userId: Int) { + func shareChannel(userId: Int, nickname: String, profileImage: String) { + let 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)" + + self.shareMessage = "보이스온 \(nickname)님의 채널입니다.\n\(shareUrl)" + self.isShowShareView = true } func userBlock(userId: Int) { diff --git a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift index e4b4888..91e9c64 100644 --- a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift +++ b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift @@ -923,7 +923,34 @@ final class LiveRoomViewModel: NSObject, ObservableObject { .store(in: &subscription) } - func shareRoom() { + func shareRoom() { + if let liveRoomInfo = self.liveRoomInfo { + var shareUrl = "https://voiceon.onelink.me/RkTm?" + + "af_dp=voiceon://" + + "&deep_link_value=live" + + "&deep_link_sub5=\(AppState.shared.roomId)" + + "&af_og_title=보이스온" + + "&af_og_description=지금 보이스온에서 라이브 참여하기" + + if let coverImageUrl = coverImageUrl { + shareUrl = shareUrl + "&af_og_image=\(coverImageUrl)" + } + + if liveRoomInfo.isPrivateRoom { + shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 비공개라이브에 초대하였습니다.\n" + + "※ 라이브 참여: \(shareUrl)\n" + + "(입장 비밀번호: \(liveRoomInfo.password!))" + } else { + shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 공개라이브에 초대하였습니다.\n" + + "※ 라이브 참여: \(shareUrl)" + } + + isShowShareView = true + } else { + self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요." + self.isShowErrorPopup = true + return + } } func kickOut() {