라이브 공유하기 버튼 다시 추가
This commit is contained in:
		| @@ -4,25 +4,13 @@ | ||||
| <dict> | ||||
| 	<key>FirebaseAppDelegateProxyEnabled</key> | ||||
| 	<false/> | ||||
| 	<key>GADApplicationIdentifier</key> | ||||
| 	<string>ca-app-pub-1299501215847962~8852459715</string> | ||||
| 	<key>NSAppTransportSecurity</key> | ||||
| 	<dict> | ||||
| 		<key>NSAllowsArbitraryLoads</key> | ||||
| 		<true/> | ||||
| 	</dict> | ||||
| 	<key>UIAppFonts</key> | ||||
| 	<array> | ||||
| 		<string>gmarket_sans_bold.otf</string> | ||||
| 		<string>gmarket_sans_medium.otf</string> | ||||
| 		<string>gmarket_sans_light.otf</string> | ||||
| 	</array> | ||||
| 	<key>UIBackgroundModes</key> | ||||
| 	<array> | ||||
| 		<string>audio</string> | ||||
| 		<string>fetch</string> | ||||
| 		<string>remote-notification</string> | ||||
| 	</array> | ||||
|     <key>GADApplicationIdentifier</key> | ||||
|     <string>ca-app-pub-1299501215847962~8852459715</string> | ||||
| 	<key>SKAdNetworkItems</key> | ||||
| 	<array> | ||||
| 		<dict> | ||||
| @@ -222,5 +210,17 @@ | ||||
| 			<string>3qcr597p9d.skadnetwork</string> | ||||
| 		</dict> | ||||
| 	</array> | ||||
| 	<key>UIAppFonts</key> | ||||
| 	<array> | ||||
| 		<string>gmarket_sans_bold.otf</string> | ||||
| 		<string>gmarket_sans_medium.otf</string> | ||||
| 		<string>gmarket_sans_light.otf</string> | ||||
| 	</array> | ||||
| 	<key>UIBackgroundModes</key> | ||||
| 	<array> | ||||
| 		<string>audio</string> | ||||
| 		<string>fetch</string> | ||||
| 		<string>remote-notification</string> | ||||
| 	</array> | ||||
| </dict> | ||||
| </plist> | ||||
|   | ||||
| @@ -814,6 +814,50 @@ final class LiveRoomViewModel: NSObject, ObservableObject { | ||||
|             .store(in: &subscription) | ||||
|     } | ||||
|      | ||||
|     func shareRoom() { | ||||
|         guard let link = URL(string: "https://sodalive.net/?room_id=\(AppState.shared.roomId)") else { return } | ||||
|         let dynamicLinksDomainURIPrefix = "https://sodalive.page.link" | ||||
|         guard let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix) else { | ||||
|             self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요." | ||||
|             self.isShowErrorPopup = true | ||||
|             return | ||||
|         } | ||||
|          | ||||
|         linkBuilder.iOSParameters = DynamicLinkIOSParameters(bundleID: "kr.co.vividnext.sodalive") | ||||
|         linkBuilder.iOSParameters?.appStoreID = "6461721697" | ||||
|          | ||||
|         linkBuilder.androidParameters = DynamicLinkAndroidParameters(packageName: "kr.co.vividnext.sodalive") | ||||
|          | ||||
|         guard let longDynamicLink = linkBuilder.url else { | ||||
|             self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요." | ||||
|             self.isShowErrorPopup = true | ||||
|             return | ||||
|         } | ||||
|         DEBUG_LOG("The long URL is: \(longDynamicLink)") | ||||
|          | ||||
|         DynamicLinkComponents.shortenURL(longDynamicLink, options: nil) { [unowned self] url, warnings, error in | ||||
|             let shortUrl = url?.absoluteString | ||||
|              | ||||
|             if let liveRoomInfo = self.liveRoomInfo { | ||||
|                 let urlString = shortUrl != nil ? shortUrl! : longDynamicLink.absoluteString | ||||
|                 if liveRoomInfo.isPrivateRoom { | ||||
|                     shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 소다라이브 비공개라이브에 초대하였습니다.\n" + | ||||
|                     "※ 라이브 참여: \(urlString)\n" + | ||||
|                     "(입장 비밀번호: \(liveRoomInfo.password!))" | ||||
|                 } else { | ||||
|                     shareMessage = "\(UserDefaults.string(forKey: .nickname))님이 귀하를 소다라이브 공개라이브에 초대하였습니다.\n" + | ||||
|                     "※ 라이브 참여: \(urlString)" | ||||
|                 } | ||||
|                  | ||||
|                 isShowShareView = true | ||||
|             } else { | ||||
|                 self.errorMessage = "공유링크를 생성하지 못했습니다.\n다시 시도해 주세요." | ||||
|                 self.isShowErrorPopup = true | ||||
|                 return | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     func kickOut() { | ||||
|         repository.kickOut(roomId: AppState.shared.roomId, userId: kickOutId) | ||||
|             .sink { result in | ||||
|   | ||||
| @@ -30,6 +30,7 @@ struct LiveRoomInfoGuestView: View { | ||||
|      | ||||
|     let onClickQuit: () -> Void | ||||
|     let onClickToggleBg: () -> Void | ||||
|     let onClickShare: () -> Void | ||||
|     let onClickFollow: (Bool) -> Void | ||||
|     let onClickProfile: (Int) -> Void | ||||
|     let onClickNotice: () -> Void | ||||
| @@ -85,6 +86,13 @@ struct LiveRoomInfoGuestView: View { | ||||
|                         strokeWidth: 1, | ||||
|                         strokeCornerRadius: 5.3 | ||||
|                     ) { onClickToggleBg() } | ||||
|                      | ||||
|                     LiveRoomOverlayStrokeImageButton( | ||||
|                         imageName: "ic_share", | ||||
|                         strokeColor: Color.graybb, | ||||
|                         strokeWidth: 1, | ||||
|                         strokeCornerRadius: 5.3 | ||||
|                     ) { onClickShare() } | ||||
|                 } | ||||
|                  | ||||
|                 HStack(spacing: 8) { | ||||
| @@ -218,6 +226,7 @@ struct LiveRoomInfoGuestView_Previews: PreviewProvider { | ||||
|             isAdult: false, | ||||
|             onClickQuit: {}, | ||||
|             onClickToggleBg: {}, | ||||
|             onClickShare: {}, | ||||
|             onClickFollow: { _ in }, | ||||
|             onClickProfile: { _ in }, | ||||
|             onClickNotice: {}, | ||||
|   | ||||
| @@ -31,6 +31,7 @@ struct LiveRoomInfoHostView: View { | ||||
|      | ||||
|     let onClickQuit: () -> Void | ||||
|     let onClickToggleBg: () -> Void | ||||
|     let onClickShare: () -> Void | ||||
|     let onClickEdit: () -> Void | ||||
|     let onClickProfile: (Int) -> Void | ||||
|     let onClickNotice: () -> Void | ||||
| @@ -77,6 +78,13 @@ struct LiveRoomInfoHostView: View { | ||||
|                         strokeCornerRadius: 5.3 | ||||
|                     ) { onClickToggleBg() } | ||||
|                      | ||||
|                     LiveRoomOverlayStrokeImageButton( | ||||
|                         imageName: "ic_share", | ||||
|                         strokeColor: Color.graybb, | ||||
|                         strokeWidth: 1, | ||||
|                         strokeCornerRadius: 5.3 | ||||
|                     ) { onClickShare() } | ||||
|                      | ||||
|                     LiveRoomOverlayStrokeImageButton( | ||||
|                         imageName: "ic_edit", | ||||
|                         strokeColor: Color.graybb, | ||||
| @@ -233,6 +241,7 @@ struct LiveRoomInfoHostView_Previews: PreviewProvider { | ||||
|             isAdult: false, | ||||
|             onClickQuit: {}, | ||||
|             onClickToggleBg: {}, | ||||
|             onClickShare: {}, | ||||
|             onClickEdit: {}, | ||||
|             onClickProfile: { _ in }, | ||||
|             onClickNotice: {}, | ||||
|   | ||||
| @@ -45,6 +45,9 @@ struct LiveRoomViewV2: View { | ||||
|                             onClickToggleBg: { | ||||
|                                 viewModel.isBgOn.toggle() | ||||
|                             }, | ||||
|                             onClickShare: { | ||||
|                                 viewModel.shareRoom() | ||||
|                             }, | ||||
|                             onClickEdit: { | ||||
|                                 viewModel.isShowEditRoomInfoDialog = true | ||||
|                             }, | ||||
| @@ -92,6 +95,9 @@ struct LiveRoomViewV2: View { | ||||
|                             onClickToggleBg: { | ||||
|                                 viewModel.isBgOn.toggle() | ||||
|                             }, | ||||
|                             onClickShare: { | ||||
|                                 viewModel.shareRoom() | ||||
|                             }, | ||||
|                             onClickFollow: { | ||||
|                                 if $0 { | ||||
|                                     viewModel.creatorUnFollow() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung