diff --git a/SodaLive/Sources/I18n/I18n.swift b/SodaLive/Sources/I18n/I18n.swift index 836a6aa2..8d9cdf85 100644 --- a/SodaLive/Sources/I18n/I18n.swift +++ b/SodaLive/Sources/I18n/I18n.swift @@ -3474,6 +3474,7 @@ If you block this user, the following features will be restricted. } enum CreatorChannelHome { + static var channelShare: String { pick(ko: "채널 공유", en: "Share channel", ja: "チャンネルを共有") } static var home: String { pick(ko: "홈", en: "Home", ja: "ホーム") } static var live: String { pick(ko: "라이브", en: "Live", ja: "ライブ") } static var currentLive: String { pick(ko: "현재 라이브", en: "Live now", ja: "現在ライブ") } diff --git a/SodaLive/Sources/Report/ProfileReportMenuView.swift b/SodaLive/Sources/Report/ProfileReportMenuView.swift index 0d415ac4..e75da847 100644 --- a/SodaLive/Sources/Report/ProfileReportMenuView.swift +++ b/SodaLive/Sources/Report/ProfileReportMenuView.swift @@ -16,6 +16,7 @@ struct ProfileReportMenuView: View { let userUnBlockAction: () -> Void let userReportAction: () -> Void let profileReportAction: () -> Void + var channelShareAction: (() -> Void)? = nil var body: some View { ZStack { @@ -28,6 +29,23 @@ struct ProfileReportMenuView: View { Spacer() VStack(spacing: 13.3) { + if let channelShareAction = channelShareAction { + HStack(spacing: 0) { + Text(I18n.CreatorChannelHome.channelShare) + .appFont(size: 13.3, weight: .medium) + .foregroundColor(.white) + + Spacer() + } + .padding(.vertical, 8) + .padding(.horizontal, 26.7) + .contentShape(Rectangle()) + .onTapGesture { + isShowing = false + channelShareAction() + } + } + HStack(spacing: 0) { Text(isBlockedUser ? I18n.User.unblockUserAction : I18n.User.blockUserAction) .appFont(size: 13.3, weight: .medium) diff --git a/SodaLive/Sources/V2/CreatorChannel/Components/CreatorChannelTitleBar.swift b/SodaLive/Sources/V2/CreatorChannel/Components/CreatorChannelTitleBar.swift index bf6dd048..1950171c 100644 --- a/SodaLive/Sources/V2/CreatorChannel/Components/CreatorChannelTitleBar.swift +++ b/SodaLive/Sources/V2/CreatorChannel/Components/CreatorChannelTitleBar.swift @@ -5,6 +5,7 @@ struct CreatorChannelTitleBar: View { let isFollow: Bool let isNotify: Bool let backgroundProgress: CGFloat + let showsTrailingActions: Bool let showsCreatorActions: Bool let onTapBack: () -> Void let onTapFollow: () -> Void @@ -12,24 +13,28 @@ struct CreatorChannelTitleBar: View { let onTapNotify: () -> Void let onTapUnnotify: () -> Void let onTapMore: () -> Void + let onTapShare: () -> Void init( nickname: String, isFollow: Bool, isNotify: Bool, backgroundProgress: CGFloat, + showsTrailingActions: Bool = true, showsCreatorActions: Bool = true, onTapBack: @escaping () -> Void, onTapFollow: @escaping () -> Void, onTapUnfollow: @escaping () -> Void, onTapNotify: @escaping () -> Void, onTapUnnotify: @escaping () -> Void, - onTapMore: @escaping () -> Void + onTapMore: @escaping () -> Void, + onTapShare: @escaping () -> Void = {} ) { self.nickname = nickname self.isFollow = isFollow self.isNotify = isNotify self.backgroundProgress = backgroundProgress + self.showsTrailingActions = showsTrailingActions self.showsCreatorActions = showsCreatorActions self.onTapBack = onTapBack self.onTapFollow = onTapFollow @@ -37,6 +42,7 @@ struct CreatorChannelTitleBar: View { self.onTapNotify = onTapNotify self.onTapUnnotify = onTapUnnotify self.onTapMore = onTapMore + self.onTapShare = onTapShare } var body: some View { @@ -56,22 +62,32 @@ struct CreatorChannelTitleBar: View { .opacity(backgroundProgress >= 1 ? 1 : 0) .frame(maxWidth: .infinity, alignment: .leading) - if showsCreatorActions { - HStack(spacing: SodaSpacing.s14) { - followButton + if showsTrailingActions { + if showsCreatorActions { + HStack(spacing: SodaSpacing.s14) { + followButton - if isFollow { - notifyButton + if isFollow { + notifyButton + } + + Button(action: onTapMore) { + Image("ic_new_more") + .resizable() + .frame(width: 24, height: 24) + } + .buttonStyle(.plain) } - - Button(action: onTapMore) { - Image("ic_new_more") + .layoutPriority(1) + } else { + Button(action: onTapShare) { + Image("ic_audio_content_share") .resizable() .frame(width: 24, height: 24) } .buttonStyle(.plain) + .accessibilityLabel(I18n.CreatorChannelHome.channelShare) } - .layoutPriority(1) } } .padding(.horizontal, SodaSpacing.s14) diff --git a/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift b/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift index fc0d2d5e..3290210c 100644 --- a/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift +++ b/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift @@ -192,7 +192,7 @@ struct CreatorChannelView: View { ) } - if viewModel.response != nil && isShowReportMenu { + if let creator = viewModel.response?.creator, isShowReportMenu { VStack(spacing: 0) { ProfileReportMenuView( isShowing: $isShowReportMenu, @@ -200,7 +200,10 @@ struct CreatorChannelView: View { userBlockAction: { isShowUserBlockConfirm = true }, userUnBlockAction: {}, userReportAction: { isShowUserReport = true }, - profileReportAction: { isShowProfileReport = true } + profileReportAction: { isShowProfileReport = true }, + channelShareAction: { + viewModel.shareChannel(creatorId: creator.creatorId, nickname: creator.nickname) + } ) if proxy.safeAreaInsets.bottom > 0 { @@ -246,6 +249,13 @@ struct CreatorChannelView: View { } } .navigationBarBackButtonHidden(true) + .sheet( + isPresented: $viewModel.isShowShareView, + onDismiss: { viewModel.shareMessage = "" }, + content: { + ActivityViewController(activityItems: [viewModel.shareMessage]) + } + ) .fullScreenCover(isPresented: $isShowAuthView) { authView } @@ -270,6 +280,7 @@ struct CreatorChannelView: View { isFollow: viewModel.response?.creator.isFollow ?? false, isNotify: viewModel.response?.creator.isNotify ?? false, backgroundProgress: backgroundProgress, + showsTrailingActions: viewModel.response != nil, showsCreatorActions: !isOwnCreatorChannel, onTapBack: { dismiss() @@ -288,6 +299,11 @@ struct CreatorChannelView: View { }, onTapMore: { isShowReportMenu = true + }, + onTapShare: { + if let creator = viewModel.response?.creator { + viewModel.shareChannel(creatorId: creator.creatorId, nickname: creator.nickname) + } } ) }