parent
4a0ccfa075
commit
c8ea7acb2e
|
@ -202,17 +202,24 @@ 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)"
|
||||
var params = [
|
||||
"af_dp": "voiceon://",
|
||||
"deep_link_value": "content",
|
||||
"deep_link_sub5": "\(contentId)",
|
||||
"af_og_title": contentTitle,
|
||||
"af_og_description": "지금 보이스온에서 이 콘텐츠 감상하기",
|
||||
"af_og_image": contentImage
|
||||
]
|
||||
|
||||
if let shareUrl = createOneLinkUrlWithURLComponents(params: params) {
|
||||
self.shareMessage = shareUrl
|
||||
self.isShowShareView = true
|
||||
} else {
|
||||
self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요."
|
||||
self.isShowPopup = true
|
||||
}
|
||||
|
||||
self.isLoading = false
|
||||
self.shareMessage = shareUrl
|
||||
self.isShowShareView = true
|
||||
}
|
||||
|
||||
func registerComment(comment: String, isSecret: Bool) {
|
||||
|
|
|
@ -398,17 +398,27 @@ final class UserProfileViewModel: ObservableObject {
|
|||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
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)"
|
||||
func shareChannel(userId: Int, nickname: String, profileImage: String) {
|
||||
isLoading = true
|
||||
|
||||
self.shareMessage = "보이스온 \(nickname)님의 채널입니다.\n\(shareUrl)"
|
||||
self.isShowShareView = true
|
||||
let params = [
|
||||
"af_dp": "voiceon://",
|
||||
"deep_link_value": "channel",
|
||||
"deep_link_sub5": "\(userId)",
|
||||
"af_og_title": "보이스온",
|
||||
"af_og_description": "보이스온 \(nickname)님의 채널입니다.",
|
||||
"af_og_image": profileImage
|
||||
]
|
||||
|
||||
if let shareUrl = createOneLinkUrlWithURLComponents(params: params) {
|
||||
self.shareMessage = "보이스온 \(nickname)님의 채널입니다.\n\(shareUrl)"
|
||||
self.isShowShareView = true
|
||||
} else {
|
||||
self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요."
|
||||
self.isShowPopup = true
|
||||
}
|
||||
|
||||
self.isLoading = false
|
||||
}
|
||||
|
||||
func userBlock(userId: Int) {
|
||||
|
|
|
@ -925,27 +925,34 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
|
|||
|
||||
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=지금 보이스온에서 라이브 참여하기"
|
||||
var params = [
|
||||
"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)"
|
||||
params["af_og_image"] = coverImageUrl
|
||||
}
|
||||
|
||||
if liveRoomInfo.isPrivateRoom {
|
||||
shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 비공개라이브에 초대하였습니다.\n" +
|
||||
"※ 라이브 참여: \(shareUrl)\n" +
|
||||
"(입장 비밀번호: \(liveRoomInfo.password!))"
|
||||
if let shareUrl = createOneLinkUrlWithURLComponents(params: params) {
|
||||
if liveRoomInfo.isPrivateRoom {
|
||||
shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 비공개라이브에 초대하였습니다.\n" +
|
||||
"※ 라이브 참여: \(shareUrl)\n" +
|
||||
"(입장 비밀번호: \(liveRoomInfo.password!))"
|
||||
} else {
|
||||
shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 공개라이브에 초대하였습니다.\n" +
|
||||
"※ 라이브 참여: \(shareUrl)"
|
||||
}
|
||||
|
||||
isShowShareView = true
|
||||
} else {
|
||||
shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 공개라이브에 초대하였습니다.\n" +
|
||||
"※ 라이브 참여: \(shareUrl)"
|
||||
self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요."
|
||||
self.isShowErrorPopup = true
|
||||
return
|
||||
}
|
||||
|
||||
isShowShareView = true
|
||||
} else {
|
||||
self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요."
|
||||
self.isShowErrorPopup = true
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// Utils.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 3/7/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
func createOneLinkUrlWithURLComponents(params: [String: String]) -> String? {
|
||||
var components = URLComponents(string: "https://voiceon.onelink.me/RkTm")
|
||||
components?.queryItems = params.map { key, value in
|
||||
URLQueryItem(name: key, value: value)
|
||||
}
|
||||
|
||||
return components?.url?.absoluteString
|
||||
}
|
Loading…
Reference in New Issue