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

- AppsFlyer OneLink로 공유링크 생성
This commit is contained in:
Yu Sung 2025-03-07 01:30:39 +09:00
parent 285eb585e0
commit 4a0ccfa075
4 changed files with 57 additions and 3 deletions

View File

@ -200,6 +200,19 @@ final class ContentDetailViewModel: ObservableObject {
} }
func shareAudioContent(contentImage: String, contentTitle: String) { 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) { func registerComment(comment: String, isSecret: Bool) {

View File

@ -57,7 +57,11 @@ struct UserProfileView: View {
} showCreatorFollowNotifyDialog: { } showCreatorFollowNotifyDialog: {
isShowFollowNotifyDialog = true isShowFollowNotifyDialog = true
} shareChannel: { } shareChannel: {
viewModel.shareChannel(userId: userId) viewModel.shareChannel(
userId: creatorProfile.creator.creatorId,
nickname: creatorProfile.creator.nickname,
profileImage: creatorProfile.creator.profileUrl
)
} }
if creatorProfile.isCreatorRole { if creatorProfile.isCreatorRole {

View File

@ -398,7 +398,17 @@ final class UserProfileViewModel: ObservableObject {
.store(in: &subscription) .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) { func userBlock(userId: Int) {

View File

@ -924,6 +924,33 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
} }
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() { func kickOut() {