parent
4a0ccfa075
commit
c8ea7acb2e
|
@ -202,17 +202,24 @@ final class ContentDetailViewModel: ObservableObject {
|
||||||
func shareAudioContent(contentImage: String, contentTitle: String) {
|
func shareAudioContent(contentImage: String, contentTitle: String) {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
let shareUrl = "https://voiceon.onelink.me/RkTm?" +
|
var params = [
|
||||||
"af_dp=voiceon://" +
|
"af_dp": "voiceon://",
|
||||||
"&deep_link_value=content" +
|
"deep_link_value": "content",
|
||||||
"&deep_link_sub5=\(contentId)" +
|
"deep_link_sub5": "\(contentId)",
|
||||||
"&af_og_title=\(contentTitle)" +
|
"af_og_title": contentTitle,
|
||||||
"&af_og_description=지금 보이스온에서 이 콘텐츠 감상하기" +
|
"af_og_description": "지금 보이스온에서 이 콘텐츠 감상하기",
|
||||||
"&af_og_image=\(contentImage)"
|
"af_og_image": contentImage
|
||||||
|
]
|
||||||
|
|
||||||
self.isLoading = false
|
if let shareUrl = createOneLinkUrlWithURLComponents(params: params) {
|
||||||
self.shareMessage = shareUrl
|
self.shareMessage = shareUrl
|
||||||
self.isShowShareView = true
|
self.isShowShareView = true
|
||||||
|
} else {
|
||||||
|
self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요."
|
||||||
|
self.isShowPopup = true
|
||||||
|
}
|
||||||
|
|
||||||
|
self.isLoading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerComment(comment: String, isSecret: Bool) {
|
func registerComment(comment: String, isSecret: Bool) {
|
||||||
|
|
|
@ -399,16 +399,26 @@ final class UserProfileViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func shareChannel(userId: Int, nickname: String, profileImage: String) {
|
func shareChannel(userId: Int, nickname: String, profileImage: String) {
|
||||||
let shareUrl = "https://voiceon.onelink.me/RkTm?" +
|
isLoading = true
|
||||||
"af_dp=voiceon://" +
|
|
||||||
"&deep_link_value=channel" +
|
|
||||||
"&deep_link_sub5=\(userId)" +
|
|
||||||
"&af_og_title=보이스온" +
|
|
||||||
"&af_og_description=보이스온 \(nickname)님의 채널입니다." +
|
|
||||||
"&af_og_image=\(profileImage)"
|
|
||||||
|
|
||||||
|
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.shareMessage = "보이스온 \(nickname)님의 채널입니다.\n\(shareUrl)"
|
||||||
self.isShowShareView = true
|
self.isShowShareView = true
|
||||||
|
} else {
|
||||||
|
self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요."
|
||||||
|
self.isShowPopup = true
|
||||||
|
}
|
||||||
|
|
||||||
|
self.isLoading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func userBlock(userId: Int) {
|
func userBlock(userId: Int) {
|
||||||
|
|
|
@ -925,17 +925,19 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
|
||||||
|
|
||||||
func shareRoom() {
|
func shareRoom() {
|
||||||
if let liveRoomInfo = self.liveRoomInfo {
|
if let liveRoomInfo = self.liveRoomInfo {
|
||||||
var shareUrl = "https://voiceon.onelink.me/RkTm?" +
|
var params = [
|
||||||
"af_dp=voiceon://" +
|
"af_dp": "voiceon://",
|
||||||
"&deep_link_value=live" +
|
"deep_link_value": "live",
|
||||||
"&deep_link_sub5=\(AppState.shared.roomId)" +
|
"deep_link_sub5": "\(AppState.shared.roomId)",
|
||||||
"&af_og_title=보이스온" +
|
"af_og_title": "보이스온",
|
||||||
"&af_og_description=지금 보이스온에서 라이브 참여하기"
|
"af_og_description": "지금 보이스온에서 라이브 참여하기"
|
||||||
|
]
|
||||||
|
|
||||||
if let coverImageUrl = coverImageUrl {
|
if let coverImageUrl = coverImageUrl {
|
||||||
shareUrl = shareUrl + "&af_og_image=\(coverImageUrl)"
|
params["af_og_image"] = coverImageUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let shareUrl = createOneLinkUrlWithURLComponents(params: params) {
|
||||||
if liveRoomInfo.isPrivateRoom {
|
if liveRoomInfo.isPrivateRoom {
|
||||||
shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 비공개라이브에 초대하였습니다.\n" +
|
shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 보이스온 비공개라이브에 초대하였습니다.\n" +
|
||||||
"※ 라이브 참여: \(shareUrl)\n" +
|
"※ 라이브 참여: \(shareUrl)\n" +
|
||||||
|
@ -951,6 +953,11 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
|
||||||
self.isShowErrorPopup = true
|
self.isShowErrorPopup = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요."
|
||||||
|
self.isShowErrorPopup = true
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func kickOut() {
|
func kickOut() {
|
||||||
|
|
|
@ -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