From fb85f3e90c665faafb8c6854f1b9897de69eabcc Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 13 Mar 2026 16:32:57 +0900 Subject: [PATCH] =?UTF-8?q?refactor(toast):=20=EA=B3=B5=ED=86=B5=20?= =?UTF-8?q?=ED=86=A0=EC=8A=A4=ED=8A=B8=20=EB=AA=A8=EB=94=94=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=EC=96=B4=EB=A5=BC=20=EC=A0=81=EC=9A=A9=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 11 +-- .../AuditionApplicantRecordingView.swift | 24 +---- .../Applicant/AuditionApplyView.swift | 18 +--- .../Audition/Detail/AuditionDetailView.swift | 16 +--- .../Role/AuditionRoleDetailView.swift | 32 +------ .../Chat/Character/CharacterView.swift | 18 +--- .../Detail/CharacterDetailView.swift | 20 +--- .../Gallery/CharacterDetailGalleryView.swift | 20 +--- .../New/Views/NewCharacterListView.swift | 18 +--- SodaLive/Sources/Chat/ChatTabView.swift | 2 - .../Chat/Original/OriginalTabView.swift | 18 +--- .../Sources/Chat/Talk/Room/ChatRoomView.swift | 18 +--- .../Room/Settings/ChatBgSelectionView.swift | 20 +--- SodaLive/Sources/Common/BaseView.swift | 96 +++++++++++++++++++ .../Content/All/ContentRankingAllView.swift | 20 +--- .../Sources/Content/ContentListView.swift | 16 +--- .../Content/Create/ContentCreateView.swift | 18 +--- .../Comment/AudioContentCommentListView.swift | 18 +--- .../Content/Detail/ContentDetailView.swift | 18 +--- .../Detail/LiveRoomDonationDialogView.swift | 16 +--- .../V2/Alarm/ContentMainTabAlarmView.swift | 16 +--- .../Main/V2/Asmr/ContentMainTabAsmrView.swift | 16 +--- .../Content/ContentMainTabContentView.swift | 16 +--- .../ContentMainIntroduceCreatorAllView.swift | 16 +--- .../Main/V2/Free/ContentMainTabFreeView.swift | 16 +--- .../Main/V2/Home/ContentMainTabHomeView.swift | 16 +--- .../V2/Replay/ContentMainTabReplayView.swift | 16 +--- .../Completed/CompletedSeriesView.swift | 16 +--- .../V2/Series/ContentMainTabSeriesView.swift | 16 +--- .../Content/Modify/ContentModifyView.swift | 18 +--- .../Playlist/ContentPlaylistListView.swift | 16 +--- .../Create/ContentPlaylistCreateView.swift | 16 +--- .../Detail/ContentPlaylistDetailView.swift | 16 +--- .../Modify/ContentPlaylistModifyView.swift | 16 +--- .../Series/Detail/SeriesDetailView.swift | 18 +--- .../Main/ByGenre/SeriesMainByGenreView.swift | 16 +--- .../DayOfWeek/SeriesMainDayOfWeekView.swift | 16 +--- .../Series/Main/Home/SeriesMainHomeView.swift | 16 +--- SodaLive/Sources/ContentView.swift | 18 +--- .../Sources/Dialog/MemberProfileDialog.swift | 21 +--- SodaLive/Sources/Explorer/ExplorerView.swift | 18 +--- .../ChannelDonationAllView.swift | 16 +--- .../CreatorCommunityCommentListView.swift | 18 +--- .../All/CreatorCommunityAllView.swift | 36 +------ .../Modify/CreatorCommunityModifyView.swift | 18 +--- .../CreatorCommunityRecordingVoiceView.swift | 24 +---- .../Write/CreatorCommunityWriteView.swift | 18 +--- .../FanTalk/UserProfileFanTalkAllView.swift | 16 +--- .../FollowerList/FollowerListView.swift | 16 +--- .../Profile/UserProfileDonationAllView.swift | 16 +--- .../Explorer/Profile/UserProfileView.swift | 32 +------ .../Sources/Follow/FollowCreatorView.swift | 16 +--- SodaLive/Sources/Home/HomeTabView.swift | 16 +--- SodaLive/Sources/Live/LiveView.swift | 20 +--- .../Live/Room/Create/LiveRoomCreateView.swift | 18 +--- .../Live/Room/Detail/LiveDetailView.swift | 21 +--- .../LiveRoomDonationMessageDialog.swift | 16 +--- .../LiveRoomDonationRankingDialog.swift | 16 +--- .../Dialog/LiveRoomHeartRankingDialog.swift | 19 +--- .../Live/Room/Edit/LiveRoomEditView.swift | 18 +--- .../Live/Room/Menu/MenuSettingsView.swift | 16 +--- .../Config/RouletteSettingsView.swift | 18 +--- .../Sources/Live/Room/V2/LiveRoomViewV2.swift | 41 +------- .../Text/Detail/TextMessageDetailView.swift | 20 +--- .../Text/Write/TextMessageWriteView.swift | 20 +--- .../Message/Voice/VoiceMessageView.swift | 20 +--- .../Voice/Write/VoiceMessageWriteView.swift | 45 +-------- .../MyPage/Block/BlockMemberListView.swift | 16 +--- .../MyPage/Can/Charge/CanChargeView.swift | 20 +--- .../MyPage/Can/Coupon/CanCouponView.swift | 20 +--- .../MyPage/Can/Payment/CanPaymentView.swift | 60 +----------- .../MyPage/Can/Payment/CanPgPaymentView.swift | 20 +--- .../Can/Payment/Temp/CanPaymentTempView.swift | 20 +--- .../MyPage/Can/Status/CanStatusView.swift | 20 +--- SodaLive/Sources/MyPage/MyPageView.swift | 19 +--- .../OrderList/OrderListAllInnerView.swift | 16 +--- .../MyPage/Point/PointStatusView.swift | 20 +--- .../Profile/Nickname/NicknameUpdateView.swift | 20 +--- .../Profile/Password/ModifyPasswordView.swift | 20 +--- .../MyPage/Profile/ProfileUpdateView.swift | 20 +--- .../Cancel/LiveReservationCancelView.swift | 25 +---- .../LiveReservationStatusView.swift | 20 +--- .../ServiceCenter/ServiceCenterView.swift | 20 +--- .../List/PushNotificationListView.swift | 20 +--- SodaLive/Sources/Search/SearchView.swift | 18 +--- .../SearchChannel/SearchChannelView.swift | 18 +--- .../Settings/Event/EventListView.swift | 20 +--- .../Settings/Notice/NoticeListView.swift | 20 +--- .../NotificationSettingsView.swift | 40 +------- SodaLive/Sources/Settings/SettingsView.swift | 20 +--- .../Settings/SignOut/SignOutView.swift | 20 +--- .../User/FindPassword/FindPasswordView.swift | 17 +--- SodaLive/Sources/User/Login/LoginView.swift | 20 +--- SodaLive/Sources/User/SignUp/SignUpView.swift | 20 +--- docs/20260313_토스트비차단표시통일.md | 65 +++++++++++++ 95 files changed, 261 insertions(+), 1729 deletions(-) create mode 100644 docs/20260313_토스트비차단표시통일.md diff --git a/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved index c51020f..cb6857a 100644 --- a/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/SodaLive.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "9f35428c4c178ca4a8bfa4b72544585a9e4d5b119825b423e1d2166cbe03fe37", + "originHash" : "cf552e0db687218f4a2207a39678af43731c56f6f8ea12b111a15ac39574aa38", "pins" : [ { "identity" : "abseil-cpp-binary", @@ -199,15 +199,6 @@ "revision" : "28c3261c9836cd3f4d64ab6419a3628d2b167811" } }, - { - "identity" : "popupview", - "kind" : "remoteSourceControl", - "location" : "https://github.com/exyte/PopupView.git", - "state" : { - "revision" : "1b99d6e9872ef91fd57aaef657661b5a00069638", - "version" : "1.3.1" - } - }, { "identity" : "promises", "kind" : "remoteSourceControl", diff --git a/SodaLive/Sources/Audition/Applicant/AuditionApplicantRecordingView.swift b/SodaLive/Sources/Audition/Applicant/AuditionApplicantRecordingView.swift index 0abcb2e..1fd714c 100644 --- a/SodaLive/Sources/Audition/Applicant/AuditionApplicantRecordingView.swift +++ b/SodaLive/Sources/Audition/Applicant/AuditionApplicantRecordingView.swift @@ -170,29 +170,7 @@ struct AuditionApplicantRecordingView: View { } } } - .popup(isPresented: $soundManager.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(soundManager.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - .onDisappear { - if soundManager.onClose { - isShowing = false - } - } - } - } + .sodaToast(isPresented: $soundManager.isShowPopup, message: soundManager.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Audition/Applicant/AuditionApplyView.swift b/SodaLive/Sources/Audition/Applicant/AuditionApplyView.swift index 661e7ff..a733b2a 100644 --- a/SodaLive/Sources/Audition/Applicant/AuditionApplyView.swift +++ b/SodaLive/Sources/Audition/Applicant/AuditionApplyView.swift @@ -130,23 +130,7 @@ struct AuditionApplyView: View { } .ignoresSafeArea() } - .popup(isPresented: $isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $isShowPopup, message: errorMessage, autohideIn: 2) .onAppear { withAnimation { isShow = true diff --git a/SodaLive/Sources/Audition/Detail/AuditionDetailView.swift b/SodaLive/Sources/Audition/Detail/AuditionDetailView.swift index 671acf4..ccc9c51 100644 --- a/SodaLive/Sources/Audition/Detail/AuditionDetailView.swift +++ b/SodaLive/Sources/Audition/Detail/AuditionDetailView.swift @@ -68,21 +68,7 @@ struct AuditionDetailView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getAuditionDetail(auditionId: auditionId) { AppState.shared.back() diff --git a/SodaLive/Sources/Audition/Role/AuditionRoleDetailView.swift b/SodaLive/Sources/Audition/Role/AuditionRoleDetailView.swift index cb7c08c..fd0bf50 100644 --- a/SodaLive/Sources/Audition/Role/AuditionRoleDetailView.swift +++ b/SodaLive/Sources/Audition/Role/AuditionRoleDetailView.swift @@ -150,36 +150,8 @@ struct AuditionRoleDetailView: View { .padding(.horizontal, 13.3) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } - .popup(isPresented: $soundManager.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(soundManager.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) + .sodaToast(isPresented: $soundManager.isShowPopup, message: soundManager.errorMessage, autohideIn: 2) .onAppear { viewModel.onFailure = { AppState.shared.back() } viewModel.auditionRoleId = roleId diff --git a/SodaLive/Sources/Chat/Character/CharacterView.swift b/SodaLive/Sources/Chat/Character/CharacterView.swift index e745f6e..11f4cb6 100644 --- a/SodaLive/Sources/Chat/Character/CharacterView.swift +++ b/SodaLive/Sources/Chat/Character/CharacterView.swift @@ -120,23 +120,7 @@ struct CharacterView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift b/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift index d82af59..3144b5d 100644 --- a/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift +++ b/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift @@ -132,25 +132,7 @@ struct CharacterDetailView: View { } .navigationTitle("") .navigationBarBackButtonHidden() - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(alignment: .center) - .frame(maxWidth: .infinity) - .padding(.horizontal, 33.3) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } .onAppear { viewModel.characterId = characterId diff --git a/SodaLive/Sources/Chat/Character/Detail/Gallery/CharacterDetailGalleryView.swift b/SodaLive/Sources/Chat/Character/Detail/Gallery/CharacterDetailGalleryView.swift index 287933b..9aebc20 100644 --- a/SodaLive/Sources/Chat/Character/Detail/Gallery/CharacterDetailGalleryView.swift +++ b/SodaLive/Sources/Chat/Character/Detail/Gallery/CharacterDetailGalleryView.swift @@ -45,25 +45,7 @@ struct CharacterDetailGalleryView: View { Spacer() } .padding(.top, 24) - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(alignment: .center) - .frame(maxWidth: .infinity) - .padding(.horizontal, 33.3) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } .onAppear { viewModel.characterId = characterId diff --git a/SodaLive/Sources/Chat/Character/New/Views/NewCharacterListView.swift b/SodaLive/Sources/Chat/Character/New/Views/NewCharacterListView.swift index a5c05c6..0227a96 100644 --- a/SodaLive/Sources/Chat/Character/New/Views/NewCharacterListView.swift +++ b/SodaLive/Sources/Chat/Character/New/Views/NewCharacterListView.swift @@ -90,23 +90,7 @@ struct NewCharacterListView: View { } .background(Color.black) } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Chat/ChatTabView.swift b/SodaLive/Sources/Chat/ChatTabView.swift index 1d4ebe6..8ededd1 100644 --- a/SodaLive/Sources/Chat/ChatTabView.swift +++ b/SodaLive/Sources/Chat/ChatTabView.swift @@ -8,8 +8,6 @@ import SwiftUI import Bootpay import BootpayUI -import PopupView - struct ChatTabView: View { @AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token) @AppStorage("auth") private var auth: Bool = UserDefaults.bool(forKey: UserDefaultsKey.auth) diff --git a/SodaLive/Sources/Chat/Original/OriginalTabView.swift b/SodaLive/Sources/Chat/Original/OriginalTabView.swift index 9ca828a..5104672 100644 --- a/SodaLive/Sources/Chat/Original/OriginalTabView.swift +++ b/SodaLive/Sources/Chat/Original/OriginalTabView.swift @@ -69,23 +69,7 @@ struct OriginalTabView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Chat/Talk/Room/ChatRoomView.swift b/SodaLive/Sources/Chat/Talk/Room/ChatRoomView.swift index 763405c..b8cb6f9 100644 --- a/SodaLive/Sources/Chat/Talk/Room/ChatRoomView.swift +++ b/SodaLive/Sources/Chat/Talk/Room/ChatRoomView.swift @@ -308,23 +308,7 @@ struct ChatRoomView: View { .onDisappear { viewModel.stopTimer() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Chat/Talk/Room/Settings/ChatBgSelectionView.swift b/SodaLive/Sources/Chat/Talk/Room/Settings/ChatBgSelectionView.swift index 3cf297a..c003461 100644 --- a/SodaLive/Sources/Chat/Talk/Room/Settings/ChatBgSelectionView.swift +++ b/SodaLive/Sources/Chat/Talk/Room/Settings/ChatBgSelectionView.swift @@ -44,25 +44,7 @@ struct ChatBgSelectionView: View { Spacer() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(alignment: .center) - .frame(maxWidth: .infinity) - .padding(.horizontal, 33.3) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } .onAppear { viewModel.characterId = characterId diff --git a/SodaLive/Sources/Common/BaseView.swift b/SodaLive/Sources/Common/BaseView.swift index 3a65447..5c4fcee 100644 --- a/SodaLive/Sources/Common/BaseView.swift +++ b/SodaLive/Sources/Common/BaseView.swift @@ -36,3 +36,99 @@ struct BaseView_Previews: PreviewProvider { BaseView(isLoading: .constant(false)) {} } } + +private struct SodaToastModifier: ViewModifier { + @Binding var isPresented: Bool + let message: String + let autohideIn: Double + + private let toastBackgroundColor = Color( + red: 59.0 / 255.0, + green: 185.0 / 255.0, + blue: 241.0 / 255.0, + opacity: 0.92 + ) + + @State private var dismissWorkItem: DispatchWorkItem? + + func body(content: Content) -> some View { + content + .overlay(alignment: .top) { + GeometryReader { geo in + if isPresented, !message.isEmpty { + Text(message) + .appFont(size: 12, weight: .medium) + .foregroundColor(.white) + .multilineTextAlignment(.center) + .lineLimit(2) + .padding(.horizontal, 18) + .padding(.vertical, 12) + .background( + Capsule() + .fill(toastBackgroundColor) + ) + .overlay( + Capsule() + .stroke(Color.white.opacity(0.15), lineWidth: 1) + ) + .padding(.top, geo.safeAreaInsets.top + 8) + .padding(.horizontal, 24) + .frame(maxWidth: .infinity, alignment: .top) + .transition(.move(edge: .top).combined(with: .opacity)) + } + } + .allowsHitTesting(false) + } + .animation(.easeInOut(duration: 0.2), value: isPresented) + .onAppear { + if isPresented { + scheduleDismiss() + } + } + .onChange(of: isPresented) { newValue in + if newValue { + scheduleDismiss() + } else { + cancelDismiss() + } + } + .onDisappear { + cancelDismiss() + } + } + + private func scheduleDismiss() { + cancelDismiss() + + guard autohideIn > 0 else { + return + } + + let workItem = DispatchWorkItem { + withAnimation { + isPresented = false + } + } + + dismissWorkItem = workItem + + DispatchQueue.main.asyncAfter(deadline: .now() + autohideIn, execute: workItem) + } + + private func cancelDismiss() { + dismissWorkItem?.cancel() + dismissWorkItem = nil + } +} + +extension View { + func sodaToast(isPresented: Binding, message: String, autohideIn: Double = 2) -> some View { + modifier( + SodaToastModifier( + isPresented: isPresented, + message: message, + autohideIn: autohideIn + ) + ) + } +} diff --git a/SodaLive/Sources/Content/All/ContentRankingAllView.swift b/SodaLive/Sources/Content/All/ContentRankingAllView.swift index 813f2d4..90bae75 100644 --- a/SodaLive/Sources/Content/All/ContentRankingAllView.swift +++ b/SodaLive/Sources/Content/All/ContentRankingAllView.swift @@ -143,25 +143,7 @@ struct ContentRankingAllView: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { if !isInitialized { viewModel.getContentRankingSortType() diff --git a/SodaLive/Sources/Content/ContentListView.swift b/SodaLive/Sources/Content/ContentListView.swift index 58eb289..242f249 100644 --- a/SodaLive/Sources/Content/ContentListView.swift +++ b/SodaLive/Sources/Content/ContentListView.swift @@ -152,21 +152,7 @@ struct ContentListView: View { isInitialized = true } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Content/Create/ContentCreateView.swift b/SodaLive/Sources/Content/Create/ContentCreateView.swift index f650fb4..64b72a2 100644 --- a/SodaLive/Sources/Content/Create/ContentCreateView.swift +++ b/SodaLive/Sources/Content/Create/ContentCreateView.swift @@ -662,23 +662,7 @@ struct ContentCreateView: View { } .onTapGesture { hideKeyboard() } .edgesIgnoringSafeArea(.bottom) - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift index 221be8a..08c6f0f 100644 --- a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift +++ b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift @@ -188,23 +188,7 @@ struct AudioContentCommentListView: View { viewModel.audioContentId = audioContentId viewModel.getCommentList() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Content/Detail/ContentDetailView.swift b/SodaLive/Sources/Content/Detail/ContentDetailView.swift index b4dd1a4..c06a972 100644 --- a/SodaLive/Sources/Content/Detail/ContentDetailView.swift +++ b/SodaLive/Sources/Content/Detail/ContentDetailView.swift @@ -433,23 +433,7 @@ struct ContentDetailView: View { .toolbar(.hidden, for: .navigationBar) } ) - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift b/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift index 4fb24dc..d94c973 100644 --- a/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift +++ b/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift @@ -291,21 +291,7 @@ struct LiveRoomDonationDialogView: View { .background(Color.gray22) .cornerRadius(20, corners: [.topLeft, .topRight]) } - .popup(isPresented: $isShowErrorPopup, type: .toast, position: .bottom, autohideIn: 1.3) { - HStack { - Spacer() - Text(errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $isShowErrorPopup, message: errorMessage, autohideIn: 1.3) .offset(y: isAudioContentDonation ? 0 : 0 - keyboardHandler.keyboardHeight) } } diff --git a/SodaLive/Sources/Content/Main/V2/Alarm/ContentMainTabAlarmView.swift b/SodaLive/Sources/Content/Main/V2/Alarm/ContentMainTabAlarmView.swift index 030fac7..2909542 100644 --- a/SodaLive/Sources/Content/Main/V2/Alarm/ContentMainTabAlarmView.swift +++ b/SodaLive/Sources/Content/Main/V2/Alarm/ContentMainTabAlarmView.swift @@ -50,21 +50,7 @@ struct ContentMainTabAlarmView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Content/Main/V2/Asmr/ContentMainTabAsmrView.swift b/SodaLive/Sources/Content/Main/V2/Asmr/ContentMainTabAsmrView.swift index 497753a..68cbb3e 100644 --- a/SodaLive/Sources/Content/Main/V2/Asmr/ContentMainTabAsmrView.swift +++ b/SodaLive/Sources/Content/Main/V2/Asmr/ContentMainTabAsmrView.swift @@ -60,21 +60,7 @@ struct ContentMainTabAsmrView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift b/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift index 9ae63e0..6b7969e 100644 --- a/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift +++ b/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift @@ -84,21 +84,7 @@ struct ContentMainTabContentView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Content/Main/V2/Free/All/ContentMainIntroduceCreatorAllView.swift b/SodaLive/Sources/Content/Main/V2/Free/All/ContentMainIntroduceCreatorAllView.swift index 8834576..e6efaea 100644 --- a/SodaLive/Sources/Content/Main/V2/Free/All/ContentMainIntroduceCreatorAllView.swift +++ b/SodaLive/Sources/Content/Main/V2/Free/All/ContentMainIntroduceCreatorAllView.swift @@ -56,21 +56,7 @@ struct ContentMainIntroduceCreatorAllView: View { } } .navigationBarHidden(true) - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift b/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift index 401a072..c718dbe 100644 --- a/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift +++ b/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift @@ -78,21 +78,7 @@ struct ContentMainTabFreeView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift b/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift index 4f44604..dc3b529 100644 --- a/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift +++ b/SodaLive/Sources/Content/Main/V2/Home/ContentMainTabHomeView.swift @@ -291,21 +291,7 @@ struct ContentMainTabHomeView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Content/Main/V2/Replay/ContentMainTabReplayView.swift b/SodaLive/Sources/Content/Main/V2/Replay/ContentMainTabReplayView.swift index aabfedd..78801a4 100644 --- a/SodaLive/Sources/Content/Main/V2/Replay/ContentMainTabReplayView.swift +++ b/SodaLive/Sources/Content/Main/V2/Replay/ContentMainTabReplayView.swift @@ -60,21 +60,7 @@ struct ContentMainTabReplayView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Content/Main/V2/Series/Completed/CompletedSeriesView.swift b/SodaLive/Sources/Content/Main/V2/Series/Completed/CompletedSeriesView.swift index b1cbd06..0251dfb 100644 --- a/SodaLive/Sources/Content/Main/V2/Series/Completed/CompletedSeriesView.swift +++ b/SodaLive/Sources/Content/Main/V2/Series/Completed/CompletedSeriesView.swift @@ -60,21 +60,7 @@ struct CompletedSeriesView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getCompletedSeries() } diff --git a/SodaLive/Sources/Content/Main/V2/Series/ContentMainTabSeriesView.swift b/SodaLive/Sources/Content/Main/V2/Series/ContentMainTabSeriesView.swift index e6f2212..0ff92f5 100644 --- a/SodaLive/Sources/Content/Main/V2/Series/ContentMainTabSeriesView.swift +++ b/SodaLive/Sources/Content/Main/V2/Series/ContentMainTabSeriesView.swift @@ -86,21 +86,7 @@ struct ContentMainTabSeriesView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Content/Modify/ContentModifyView.swift b/SodaLive/Sources/Content/Modify/ContentModifyView.swift index 0fed4ca..b143ae0 100644 --- a/SodaLive/Sources/Content/Modify/ContentModifyView.swift +++ b/SodaLive/Sources/Content/Modify/ContentModifyView.swift @@ -277,23 +277,7 @@ struct ContentModifyView: View { } .onTapGesture { hideKeyboard() } .edgesIgnoringSafeArea(.bottom) - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.contentId = contentId viewModel.getAudioContentDetail { diff --git a/SodaLive/Sources/Content/Playlist/ContentPlaylistListView.swift b/SodaLive/Sources/Content/Playlist/ContentPlaylistListView.swift index 94827db..545606f 100644 --- a/SodaLive/Sources/Content/Playlist/ContentPlaylistListView.swift +++ b/SodaLive/Sources/Content/Playlist/ContentPlaylistListView.swift @@ -71,21 +71,7 @@ struct ContentPlaylistListView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getPlaylistList() } diff --git a/SodaLive/Sources/Content/Playlist/Create/ContentPlaylistCreateView.swift b/SodaLive/Sources/Content/Playlist/Create/ContentPlaylistCreateView.swift index afeb8cf..4782723 100644 --- a/SodaLive/Sources/Content/Playlist/Create/ContentPlaylistCreateView.swift +++ b/SodaLive/Sources/Content/Playlist/Create/ContentPlaylistCreateView.swift @@ -138,21 +138,7 @@ struct ContentPlaylistCreateView: View { } .padding(.vertical, 13.3) } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) if isShowAddContentView { PlaylistAddContentView( diff --git a/SodaLive/Sources/Content/Playlist/Detail/ContentPlaylistDetailView.swift b/SodaLive/Sources/Content/Playlist/Detail/ContentPlaylistDetailView.swift index b0572c6..e9e99a4 100644 --- a/SodaLive/Sources/Content/Playlist/Detail/ContentPlaylistDetailView.swift +++ b/SodaLive/Sources/Content/Playlist/Detail/ContentPlaylistDetailView.swift @@ -238,21 +238,7 @@ struct ContentPlaylistDetailView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.playlistId = playlistId } diff --git a/SodaLive/Sources/Content/Playlist/Modify/ContentPlaylistModifyView.swift b/SodaLive/Sources/Content/Playlist/Modify/ContentPlaylistModifyView.swift index 478db2a..c502c36 100644 --- a/SodaLive/Sources/Content/Playlist/Modify/ContentPlaylistModifyView.swift +++ b/SodaLive/Sources/Content/Playlist/Modify/ContentPlaylistModifyView.swift @@ -139,21 +139,7 @@ struct ContentPlaylistModifyView: View { } .padding(.vertical, 13.3) } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.playlistId = playlistId } diff --git a/SodaLive/Sources/Content/Series/Detail/SeriesDetailView.swift b/SodaLive/Sources/Content/Series/Detail/SeriesDetailView.swift index d8b8fac..c35daea 100644 --- a/SodaLive/Sources/Content/Series/Detail/SeriesDetailView.swift +++ b/SodaLive/Sources/Content/Series/Detail/SeriesDetailView.swift @@ -261,23 +261,7 @@ struct SeriesDetailView: View { goBack() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } private func goBack() { diff --git a/SodaLive/Sources/Content/Series/Main/ByGenre/SeriesMainByGenreView.swift b/SodaLive/Sources/Content/Series/Main/ByGenre/SeriesMainByGenreView.swift index eb84d7d..931928c 100644 --- a/SodaLive/Sources/Content/Series/Main/ByGenre/SeriesMainByGenreView.swift +++ b/SodaLive/Sources/Content/Series/Main/ByGenre/SeriesMainByGenreView.swift @@ -57,21 +57,7 @@ struct SeriesMainByGenreView: View { .padding(.horizontal, horizontalPadding) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { if !isInitialized { viewModel.getGenreList() diff --git a/SodaLive/Sources/Content/Series/Main/DayOfWeek/SeriesMainDayOfWeekView.swift b/SodaLive/Sources/Content/Series/Main/DayOfWeek/SeriesMainDayOfWeekView.swift index b033d8f..659e8a7 100644 --- a/SodaLive/Sources/Content/Series/Main/DayOfWeek/SeriesMainDayOfWeekView.swift +++ b/SodaLive/Sources/Content/Series/Main/DayOfWeek/SeriesMainDayOfWeekView.swift @@ -88,21 +88,7 @@ struct SeriesMainDayOfWeekView: View { .padding(.horizontal, horizontalPadding) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { if !isInitialized { dayOfWeek = dayOfWeeks[Calendar.current.component(.weekday, from: Date())] diff --git a/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeView.swift b/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeView.swift index e0968fa..8f260a8 100644 --- a/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeView.swift +++ b/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeView.swift @@ -100,21 +100,7 @@ struct SeriesMainHomeView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { if !isInitialized { viewModel.fetchHome() diff --git a/SodaLive/Sources/ContentView.swift b/SodaLive/Sources/ContentView.swift index 6c9d71f..1b1b15e 100644 --- a/SodaLive/Sources/ContentView.swift +++ b/SodaLive/Sources/ContentView.swift @@ -62,23 +62,7 @@ struct ContentView: View { self.isShowDialog = true } } - .popup(isPresented: $appState.isShowErrorPopup, type: .toast, position: .top, autohideIn: 1) { - GeometryReader { geo in - HStack { - Spacer() - Text(appState.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $appState.isShowErrorPopup, message: appState.errorMessage, autohideIn: 1) .navigationDestination(for: AppRoute.self) { route in if let step = appState.appStep(for: route) { AppStepLayerView(step: step, canPgPaymentViewModel: canPgPaymentViewModel) diff --git a/SodaLive/Sources/Dialog/MemberProfileDialog.swift b/SodaLive/Sources/Dialog/MemberProfileDialog.swift index 2620532..24a0e58 100644 --- a/SodaLive/Sources/Dialog/MemberProfileDialog.swift +++ b/SodaLive/Sources/Dialog/MemberProfileDialog.swift @@ -121,26 +121,7 @@ struct MemberProfileDialog: View { viewModel.getMemberProfile(memberId: memberId) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - .onDisappear { - if viewModel.dismissDialog { - isShowing = false - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) if viewModel.isShowUesrBlockConfirm { UserBlockConfirmDialogView( diff --git a/SodaLive/Sources/Explorer/ExplorerView.swift b/SodaLive/Sources/Explorer/ExplorerView.swift index c22bfb3..4094ca9 100644 --- a/SodaLive/Sources/Explorer/ExplorerView.swift +++ b/SodaLive/Sources/Explorer/ExplorerView.swift @@ -96,23 +96,7 @@ struct ExplorerView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getExplorer() } diff --git a/SodaLive/Sources/Explorer/Profile/ChannelDonation/ChannelDonationAllView.swift b/SodaLive/Sources/Explorer/Profile/ChannelDonation/ChannelDonationAllView.swift index fcee2f7..9d7dbaf 100644 --- a/SodaLive/Sources/Explorer/Profile/ChannelDonation/ChannelDonationAllView.swift +++ b/SodaLive/Sources/Explorer/Profile/ChannelDonation/ChannelDonationAllView.swift @@ -59,21 +59,7 @@ struct ChannelDonationAllView: View { .onAppear { viewModel.setCreatorId(creatorId) } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/Comment/CreatorCommunityCommentListView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/Comment/CreatorCommunityCommentListView.swift index 1eaea27..8717f7e 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/Comment/CreatorCommunityCommentListView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/Comment/CreatorCommunityCommentListView.swift @@ -189,23 +189,7 @@ struct CreatorCommunityCommentListView: View { viewModel.postId = postId viewModel.getCommentList() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift index 6d4e5b4..fad75c8 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift @@ -140,40 +140,8 @@ struct CreatorCommunityAllView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } - .popup(isPresented: $playerManager.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(playerManager.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) + .sodaToast(isPresented: $playerManager.isShowPopup, message: playerManager.errorMessage, autohideIn: 2) .onAppear { viewModel.creatorId = creatorId viewModel.getCommunityPostList() diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Modify/CreatorCommunityModifyView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Modify/CreatorCommunityModifyView.swift index b447dd4..a119ee8 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Modify/CreatorCommunityModifyView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Modify/CreatorCommunityModifyView.swift @@ -245,23 +245,7 @@ struct CreatorCommunityModifyView: View { } .onTapGesture { hideKeyboard() } .edgesIgnoringSafeArea(.bottom) - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.postId = postId viewModel.getCommunityPostDetail { diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityRecordingVoiceView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityRecordingVoiceView.swift index 16ef05e..020bd64 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityRecordingVoiceView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityRecordingVoiceView.swift @@ -173,29 +173,7 @@ struct CreatorCommunityRecordingVoiceView: View { } } } - .popup(isPresented: $soundManager.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(soundManager.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - .onDisappear { - if soundManager.onClose { - isShowing = false - } - } - } - } + .sodaToast(isPresented: $soundManager.isShowPopup, message: soundManager.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityWriteView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityWriteView.swift index 310a975..745b078 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityWriteView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/Write/CreatorCommunityWriteView.swift @@ -344,23 +344,7 @@ struct CreatorCommunityWriteView: View { } .onTapGesture { hideKeyboard() } .edgesIgnoringSafeArea(.bottom) - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Explorer/Profile/FanTalk/UserProfileFanTalkAllView.swift b/SodaLive/Sources/Explorer/Profile/FanTalk/UserProfileFanTalkAllView.swift index 5ae5344..2ffc80f 100644 --- a/SodaLive/Sources/Explorer/Profile/FanTalk/UserProfileFanTalkAllView.swift +++ b/SodaLive/Sources/Explorer/Profile/FanTalk/UserProfileFanTalkAllView.swift @@ -136,21 +136,7 @@ struct UserProfileFanTalkAllView: View { .padding(.horizontal, 13.3) } .onTapGesture { hideKeyboard() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) ZStack { if viewModel.isShowCheersReportView { diff --git a/SodaLive/Sources/Explorer/Profile/FollowerList/FollowerListView.swift b/SodaLive/Sources/Explorer/Profile/FollowerList/FollowerListView.swift index c3528f8..75859b2 100644 --- a/SodaLive/Sources/Explorer/Profile/FollowerList/FollowerListView.swift +++ b/SodaLive/Sources/Explorer/Profile/FollowerList/FollowerListView.swift @@ -116,21 +116,7 @@ struct FollowerListView: View { ) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.userId = userId viewModel.getFollowerList() diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileDonationAllView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileDonationAllView.swift index 14e158a..875215b 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileDonationAllView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileDonationAllView.swift @@ -201,21 +201,7 @@ struct UserProfileDonationAllView: View { viewModel.userId = userId viewModel.getCreatorProfileDonationRanking() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 5e678f6..c590dc3 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -606,36 +606,8 @@ struct UserProfileView: View { } .navigationTitle("") .navigationBarBackButtonHidden() - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } - .popup(isPresented: $channelDonationViewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(channelDonationViewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) + .sodaToast(isPresented: $channelDonationViewModel.isShowPopup, message: channelDonationViewModel.errorMessage, autohideIn: 2) .ignoresSafeArea(.container, edges: .all) .sheet( isPresented: $viewModel.isShowShareView, diff --git a/SodaLive/Sources/Follow/FollowCreatorView.swift b/SodaLive/Sources/Follow/FollowCreatorView.swift index 34c4340..dd24ad8 100644 --- a/SodaLive/Sources/Follow/FollowCreatorView.swift +++ b/SodaLive/Sources/Follow/FollowCreatorView.swift @@ -79,21 +79,7 @@ struct FollowCreatorView: View { .onAppear { viewModel.getFollowedCreatorAllList() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) if isShowFollowNotifyDialog { CreatorFollowNotifyDialog( diff --git a/SodaLive/Sources/Home/HomeTabView.swift b/SodaLive/Sources/Home/HomeTabView.swift index 51369cb..a2a5a33 100644 --- a/SodaLive/Sources/Home/HomeTabView.swift +++ b/SodaLive/Sources/Home/HomeTabView.swift @@ -521,21 +521,7 @@ struct HomeTabView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .regular) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Live/LiveView.swift b/SodaLive/Sources/Live/LiveView.swift index 8e8a481..c950ed9 100644 --- a/SodaLive/Sources/Live/LiveView.swift +++ b/SodaLive/Sources/Live/LiveView.swift @@ -186,25 +186,7 @@ struct LiveView: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } private func onCreateSuccess(response: CreateLiveRoomResponse) { diff --git a/SodaLive/Sources/Live/Room/Create/LiveRoomCreateView.swift b/SodaLive/Sources/Live/Room/Create/LiveRoomCreateView.swift index 64c084b..4a125de 100644 --- a/SodaLive/Sources/Live/Room/Create/LiveRoomCreateView.swift +++ b/SodaLive/Sources/Live/Room/Create/LiveRoomCreateView.swift @@ -261,23 +261,7 @@ struct LiveRoomCreateView: View { .edgesIgnoringSafeArea(.bottom) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.timeSettingMode = timeSettingMode viewModel.getAllMenuPreset() diff --git a/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift b/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift index 6236754..2afd707 100644 --- a/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift +++ b/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift @@ -283,26 +283,7 @@ struct LiveDetailView: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 1) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - .onDisappear { - hideView() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 1) .sheet( isPresented: $viewModel.isShowShareView, onDismiss: { viewModel.shareMessage = "" }, diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift index 3dd3074..a9bbd76 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift @@ -74,21 +74,7 @@ struct LiveRoomDonationMessageDialog: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getDonationMessageList() creatorId = viewModel.liveRoomInfo?.creatorId ?? 0 diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift index 2f886d7..83e90de 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift @@ -73,21 +73,7 @@ struct LiveRoomDonationRankingDialog: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getDonationStatus() } diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomHeartRankingDialog.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomHeartRankingDialog.swift index d6abfbd..55226f5 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomHeartRankingDialog.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomHeartRankingDialog.swift @@ -96,24 +96,7 @@ struct LiveRoomHeartRankingDialog: View { LoadingView() } } - .popup(isPresented: $isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - .onDisappear { - isShowing = false - } - } + .sodaToast(isPresented: $isShowPopup, message: errorMessage, autohideIn: 2) .onAppear { getHeartStatus() } diff --git a/SodaLive/Sources/Live/Room/Edit/LiveRoomEditView.swift b/SodaLive/Sources/Live/Room/Edit/LiveRoomEditView.swift index 2e3054f..88d0fc6 100644 --- a/SodaLive/Sources/Live/Room/Edit/LiveRoomEditView.swift +++ b/SodaLive/Sources/Live/Room/Edit/LiveRoomEditView.swift @@ -85,23 +85,7 @@ struct LiveRoomEditView: View { } .edgesIgnoringSafeArea(.bottom) } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.room = room } diff --git a/SodaLive/Sources/Live/Room/Menu/MenuSettingsView.swift b/SodaLive/Sources/Live/Room/Menu/MenuSettingsView.swift index 66ae1b6..7323541 100644 --- a/SodaLive/Sources/Live/Room/Menu/MenuSettingsView.swift +++ b/SodaLive/Sources/Live/Room/Menu/MenuSettingsView.swift @@ -82,21 +82,7 @@ struct MenuSettingsView: View { .onTapGesture { hideKeyboard() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/Live/Room/Routlette/Config/RouletteSettingsView.swift b/SodaLive/Sources/Live/Room/Routlette/Config/RouletteSettingsView.swift index 577afae..b824edd 100644 --- a/SodaLive/Sources/Live/Room/Routlette/Config/RouletteSettingsView.swift +++ b/SodaLive/Sources/Live/Room/Routlette/Config/RouletteSettingsView.swift @@ -239,23 +239,7 @@ struct RouletteSettingsView: View { } } .ignoresSafeArea(edges: .bottom) - .popup(isPresented: $viewModel.isShowErrorPopup, type: .toast, position: .top, autohideIn: 1.3) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowErrorPopup, message: viewModel.errorMessage, autohideIn: 1.3) .onAppear { viewModel.availableActive = availableActive viewModel.getAllRoulette(creatorId: UserDefaults.int(forKey: .userId)) diff --git a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift index f39f65a..0b62c3a 100644 --- a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift +++ b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift @@ -462,28 +462,7 @@ struct LiveRoomViewV2: View { } } } - .popup(isPresented: $viewModel.isShowErrorPopup, type: .toast, position: .top, autohideIn: 1.3) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - .onDisappear { - if viewModel.liveRoomInfo == nil { - viewModel.quitRoom() - } - } - } - } + .sodaToast(isPresented: $viewModel.isShowErrorPopup, message: viewModel.errorMessage, autohideIn: 1.3) .cornerRadius(16.7, corners: [.topLeft, .topRight]) .offset(y: -(keyboardHandler.keyboardHeight > 0 ? keyboardHandler.keyboardHeight : 0)) .onAppear { @@ -644,23 +623,7 @@ struct LiveRoomViewV2: View { } ) .padding(20) - .popup(isPresented: $viewModel.isShowReportPopup, type: .toast, position: .top, autohideIn: 1.3) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.reportMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowReportPopup, message: viewModel.reportMessage, autohideIn: 1.3) } if viewModel.isShowReportMenu { diff --git a/SodaLive/Sources/Message/Text/Detail/TextMessageDetailView.swift b/SodaLive/Sources/Message/Text/Detail/TextMessageDetailView.swift index 94be838..4f4caea 100644 --- a/SodaLive/Sources/Message/Text/Detail/TextMessageDetailView.swift +++ b/SodaLive/Sources/Message/Text/Detail/TextMessageDetailView.swift @@ -157,25 +157,7 @@ struct TextMessageDetailView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.messageId = messageItem.messageId } diff --git a/SodaLive/Sources/Message/Text/Write/TextMessageWriteView.swift b/SodaLive/Sources/Message/Text/Write/TextMessageWriteView.swift index 54dbe73..1c108fd 100644 --- a/SodaLive/Sources/Message/Text/Write/TextMessageWriteView.swift +++ b/SodaLive/Sources/Message/Text/Write/TextMessageWriteView.swift @@ -116,25 +116,7 @@ struct TextMessageWriteView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { UITextView.appearance().backgroundColor = .clear diff --git a/SodaLive/Sources/Message/Voice/VoiceMessageView.swift b/SodaLive/Sources/Message/Voice/VoiceMessageView.swift index 1431f72..ddfc7bb 100644 --- a/SodaLive/Sources/Message/Voice/VoiceMessageView.swift +++ b/SodaLive/Sources/Message/Voice/VoiceMessageView.swift @@ -176,25 +176,7 @@ struct VoiceMessageView: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.refresh() } diff --git a/SodaLive/Sources/Message/Voice/Write/VoiceMessageWriteView.swift b/SodaLive/Sources/Message/Voice/Write/VoiceMessageWriteView.swift index 8eb1567..4fc0c33 100644 --- a/SodaLive/Sources/Message/Voice/Write/VoiceMessageWriteView.swift +++ b/SodaLive/Sources/Message/Voice/Write/VoiceMessageWriteView.swift @@ -229,49 +229,8 @@ struct VoiceMessageWriteView: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } - .popup(isPresented: $soundManager.isShowPopup, type: .toast, position: .top, autohideIn: 1) { - GeometryReader { geo in - HStack { - Spacer() - Text(soundManager.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - .onDisappear { - if soundManager.onClose { - hideView() - } - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) + .sodaToast(isPresented: $soundManager.isShowPopup, message: soundManager.errorMessage, autohideIn: 1) .onAppear { stopTimer() soundManager.startTimer = startTimer diff --git a/SodaLive/Sources/MyPage/Block/BlockMemberListView.swift b/SodaLive/Sources/MyPage/Block/BlockMemberListView.swift index 922eceb..7e227a2 100644 --- a/SodaLive/Sources/MyPage/Block/BlockMemberListView.swift +++ b/SodaLive/Sources/MyPage/Block/BlockMemberListView.swift @@ -65,21 +65,7 @@ struct BlockMemberListView: View { .onAppear { viewModel.getBlockedMemberList() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift b/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift index e1e0ef6..2ded721 100644 --- a/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift +++ b/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift @@ -66,25 +66,7 @@ struct CanChargeView: View { } } } - .popup(isPresented: $storeManager.isShowPopup, type: .toast, position: .top, autohideIn: 1) { - GeometryReader { geo in - HStack { - Spacer() - Text(storeManager.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $storeManager.isShowPopup, message: storeManager.errorMessage, autohideIn: 1) } } diff --git a/SodaLive/Sources/MyPage/Can/Coupon/CanCouponView.swift b/SodaLive/Sources/MyPage/Can/Coupon/CanCouponView.swift index 6d5139d..de665ac 100644 --- a/SodaLive/Sources/MyPage/Can/Coupon/CanCouponView.swift +++ b/SodaLive/Sources/MyPage/Can/Coupon/CanCouponView.swift @@ -109,25 +109,7 @@ struct CanCouponView: View { .padding(13.3) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/MyPage/Can/Payment/CanPaymentView.swift b/SodaLive/Sources/MyPage/Can/Payment/CanPaymentView.swift index 631c8f1..eb98091 100644 --- a/SodaLive/Sources/MyPage/Can/Payment/CanPaymentView.swift +++ b/SodaLive/Sources/MyPage/Can/Payment/CanPaymentView.swift @@ -161,25 +161,7 @@ struct CanPaymentView: View { .frame(width: proxy.size.width, height: 15.3) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .edgesIgnoringSafeArea(.bottom) } @@ -187,44 +169,8 @@ struct CanPaymentView: View { LoadingView() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } - .popup(isPresented: $storeManager.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(storeManager.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) + .sodaToast(isPresented: $storeManager.isShowPopup, message: storeManager.errorMessage, autohideIn: 2) .onAppear { storeManager.onSuccessPayment = { receiptString, chargeId in viewModel.verifyPayment(receiptString: receiptString, chargeId: chargeId) { diff --git a/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift b/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift index 006b4de..4248b7b 100644 --- a/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift +++ b/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift @@ -337,25 +337,7 @@ struct CanPgPaymentView: View { .frame(width: proxy.size.width, height: 15.3) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .edgesIgnoringSafeArea(.bottom) } } diff --git a/SodaLive/Sources/MyPage/Can/Payment/Temp/CanPaymentTempView.swift b/SodaLive/Sources/MyPage/Can/Payment/Temp/CanPaymentTempView.swift index fbcd1fd..d3cc1ba 100644 --- a/SodaLive/Sources/MyPage/Can/Payment/Temp/CanPaymentTempView.swift +++ b/SodaLive/Sources/MyPage/Can/Payment/Temp/CanPaymentTempView.swift @@ -244,25 +244,7 @@ struct CanPaymentTempView: View { .frame(width: proxy.size.width, height: 15.3) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .edgesIgnoringSafeArea(.bottom) } } diff --git a/SodaLive/Sources/MyPage/Can/Status/CanStatusView.swift b/SodaLive/Sources/MyPage/Can/Status/CanStatusView.swift index 2d48d51..99f73cd 100644 --- a/SodaLive/Sources/MyPage/Can/Status/CanStatusView.swift +++ b/SodaLive/Sources/MyPage/Can/Status/CanStatusView.swift @@ -167,25 +167,7 @@ struct CanStatusView: View { .edgesIgnoringSafeArea(.bottom) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getCanStatus() } diff --git a/SodaLive/Sources/MyPage/MyPageView.swift b/SodaLive/Sources/MyPage/MyPageView.swift index 3b85d83..27b2b73 100644 --- a/SodaLive/Sources/MyPage/MyPageView.swift +++ b/SodaLive/Sources/MyPage/MyPageView.swift @@ -9,7 +9,6 @@ import SwiftUI import Bootpay import BootpayUI -import PopupView import Kingfisher import RefreshableScrollView @@ -168,23 +167,7 @@ struct MyPageView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { payload.applicationId = BOOTPAY_APP_ID payload.price = 0 diff --git a/SodaLive/Sources/MyPage/OrderList/OrderListAllInnerView.swift b/SodaLive/Sources/MyPage/OrderList/OrderListAllInnerView.swift index 43e588d..cbd4752 100644 --- a/SodaLive/Sources/MyPage/OrderList/OrderListAllInnerView.swift +++ b/SodaLive/Sources/MyPage/OrderList/OrderListAllInnerView.swift @@ -61,21 +61,7 @@ struct OrderListAllInnerView: View { isInitialized = true } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/MyPage/Point/PointStatusView.swift b/SodaLive/Sources/MyPage/Point/PointStatusView.swift index 3bdfc82..3fa929d 100644 --- a/SodaLive/Sources/MyPage/Point/PointStatusView.swift +++ b/SodaLive/Sources/MyPage/Point/PointStatusView.swift @@ -110,25 +110,7 @@ struct PointStatusView: View { .edgesIgnoringSafeArea(.bottom) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getPointStatus() } diff --git a/SodaLive/Sources/MyPage/Profile/Nickname/NicknameUpdateView.swift b/SodaLive/Sources/MyPage/Profile/Nickname/NicknameUpdateView.swift index f83e976..a621367 100644 --- a/SodaLive/Sources/MyPage/Profile/Nickname/NicknameUpdateView.swift +++ b/SodaLive/Sources/MyPage/Profile/Nickname/NicknameUpdateView.swift @@ -86,25 +86,7 @@ struct NicknameUpdateView: View { viewModel.nickname = UserDefaults.string(forKey: .nickname) viewModel.getChangeNicknamePrice() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/MyPage/Profile/Password/ModifyPasswordView.swift b/SodaLive/Sources/MyPage/Profile/Password/ModifyPasswordView.swift index a597003..a008b9e 100644 --- a/SodaLive/Sources/MyPage/Profile/Password/ModifyPasswordView.swift +++ b/SodaLive/Sources/MyPage/Profile/Password/ModifyPasswordView.swift @@ -86,24 +86,6 @@ struct ModifyPasswordView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift b/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift index 836e476..152eac2 100644 --- a/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift +++ b/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift @@ -448,25 +448,7 @@ struct ProfileUpdateView: View { viewModel.refresh = refresh viewModel.getMyProfile() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } } diff --git a/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift b/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift index 290a620..f306cb2 100644 --- a/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift +++ b/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift @@ -203,30 +203,7 @@ struct LiveReservationCancelView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 1) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - .onDisappear { - if reservationId <= 0 { - AppState.shared.back() - } - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 1) .onAppear { if reservationId <= 0 { viewModel.errorMessage = "잘못된 예약정보 입니다." diff --git a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift index ba01bbf..ba5f0f8 100644 --- a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift +++ b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift @@ -32,25 +32,7 @@ struct LiveReservationStatusView: View { .frame(maxHeight: .infinity) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getLiveReservationStatus() } diff --git a/SodaLive/Sources/MyPage/ServiceCenter/ServiceCenterView.swift b/SodaLive/Sources/MyPage/ServiceCenter/ServiceCenterView.swift index 34ecc19..a060f42 100644 --- a/SodaLive/Sources/MyPage/ServiceCenter/ServiceCenterView.swift +++ b/SodaLive/Sources/MyPage/ServiceCenter/ServiceCenterView.swift @@ -70,25 +70,7 @@ struct ServiceCenterView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getFaqCategories() } diff --git a/SodaLive/Sources/Notification/List/PushNotificationListView.swift b/SodaLive/Sources/Notification/List/PushNotificationListView.swift index 227bac7..c57f778 100644 --- a/SodaLive/Sources/Notification/List/PushNotificationListView.swift +++ b/SodaLive/Sources/Notification/List/PushNotificationListView.swift @@ -55,25 +55,7 @@ struct PushNotificationListView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .navigationBarHidden(true) } diff --git a/SodaLive/Sources/Search/SearchView.swift b/SodaLive/Sources/Search/SearchView.swift index a29d1e4..adf32f7 100644 --- a/SodaLive/Sources/Search/SearchView.swift +++ b/SodaLive/Sources/Search/SearchView.swift @@ -134,23 +134,7 @@ struct SearchView: View { Spacer() } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { if viewModel.keyword.isEmpty { viewModel.keyword = UserDefaults.string(forKey: .searchChannel) diff --git a/SodaLive/Sources/SearchChannel/SearchChannelView.swift b/SodaLive/Sources/SearchChannel/SearchChannelView.swift index 87839c1..fdfd08a 100644 --- a/SodaLive/Sources/SearchChannel/SearchChannelView.swift +++ b/SodaLive/Sources/SearchChannel/SearchChannelView.swift @@ -86,23 +86,7 @@ struct SearchChannelView: View { .padding(.vertical, 20) .padding(.horizontal, 13.3) } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.channel = UserDefaults.string(forKey: .searchChannel) } diff --git a/SodaLive/Sources/Settings/Event/EventListView.swift b/SodaLive/Sources/Settings/Event/EventListView.swift index eac2780..70b8535 100644 --- a/SodaLive/Sources/Settings/Event/EventListView.swift +++ b/SodaLive/Sources/Settings/Event/EventListView.swift @@ -48,25 +48,7 @@ struct EventListView: View { .padding(.vertical, 13.3) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getEvents() } diff --git a/SodaLive/Sources/Settings/Notice/NoticeListView.swift b/SodaLive/Sources/Settings/Notice/NoticeListView.swift index b4666da..ca3c5dc 100644 --- a/SodaLive/Sources/Settings/Notice/NoticeListView.swift +++ b/SodaLive/Sources/Settings/Notice/NoticeListView.swift @@ -50,25 +50,7 @@ struct NoticeListView: View { .padding(.vertical, 13.3) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getNotices() } diff --git a/SodaLive/Sources/Settings/Notification/NotificationSettingsView.swift b/SodaLive/Sources/Settings/Notification/NotificationSettingsView.swift index 99d2fcc..c794000 100644 --- a/SodaLive/Sources/Settings/Notification/NotificationSettingsView.swift +++ b/SodaLive/Sources/Settings/Notification/NotificationSettingsView.swift @@ -86,25 +86,7 @@ struct NotificationSettingsView: View { viewModel.getMemberInfo() } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } @@ -246,25 +228,7 @@ struct NotificationReceiveSettingsView: View { isInitialized = true } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) if isShowFollowNotifyDialog { CreatorFollowNotifyDialog( diff --git a/SodaLive/Sources/Settings/SettingsView.swift b/SodaLive/Sources/Settings/SettingsView.swift index 6e672c9..fc38535 100644 --- a/SodaLive/Sources/Settings/SettingsView.swift +++ b/SodaLive/Sources/Settings/SettingsView.swift @@ -260,25 +260,7 @@ struct SettingsView: View { ) } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/Settings/SignOut/SignOutView.swift b/SodaLive/Sources/Settings/SignOut/SignOutView.swift index b94e5c8..2f4089c 100644 --- a/SodaLive/Sources/Settings/SignOut/SignOutView.swift +++ b/SodaLive/Sources/Settings/SignOut/SignOutView.swift @@ -115,25 +115,7 @@ struct SignOutView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "3bb9f1")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/User/FindPassword/FindPasswordView.swift b/SodaLive/Sources/User/FindPassword/FindPasswordView.swift index 52b8f9c..652ffdd 100644 --- a/SodaLive/Sources/User/FindPassword/FindPasswordView.swift +++ b/SodaLive/Sources/User/FindPassword/FindPasswordView.swift @@ -89,22 +89,7 @@ struct FindPasswordView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/User/Login/LoginView.swift b/SodaLive/Sources/User/Login/LoginView.swift index d2245ac..4a8e500 100644 --- a/SodaLive/Sources/User/Login/LoginView.swift +++ b/SodaLive/Sources/User/Login/LoginView.swift @@ -6,8 +6,6 @@ // import SwiftUI -import PopupView - struct LoginView: View { enum FocusField: Hashable { @@ -163,23 +161,7 @@ struct LoginView: View { self.focusedField = .email } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.center) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/SodaLive/Sources/User/SignUp/SignUpView.swift b/SodaLive/Sources/User/SignUp/SignUpView.swift index cc4d7fd..e9c7703 100644 --- a/SodaLive/Sources/User/SignUp/SignUpView.swift +++ b/SodaLive/Sources/User/SignUp/SignUpView.swift @@ -188,25 +188,7 @@ struct SignUpView: View { } } } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { - GeometryReader { geo in - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .padding(.horizontal, 6.7) - .frame(width: geo.size.width - 66.7, alignment: .center) - .appFont(size: 12, weight: .medium) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .fixedSize(horizontal: false, vertical: true) - .cornerRadius(20) - .padding(.top, 66.7) - Spacer() - } - } - } + .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) } } diff --git a/docs/20260313_토스트비차단표시통일.md b/docs/20260313_토스트비차단표시통일.md new file mode 100644 index 0000000..9ca01ff --- /dev/null +++ b/docs/20260313_토스트비차단표시통일.md @@ -0,0 +1,65 @@ +# 20260313 토스트 비차단 표시 통일 + +- [x] 토스트 공통 구현/사용 지점 탐색 +- [x] 비차단 토스트 표시 정책(동적 아일랜드형 또는 하단 슬라이드형) 선택 및 공통 적용 +- [x] 기존 `.popup(... type: .toast ...)` 사용처가 공통 정책을 따르도록 정리 +- [x] 정적 진단/빌드/테스트 검증 수행 및 결과 기록 + +## 검증 기록 + +### 1차 +- 무엇/왜/어떻게: 기존 `PopupView` 기반 토스트 호출을 전역에서 제거하고, 비차단 Dynamic Island 형태의 공통 토스트 modifier(`sodaToast`)로 통일했다. 토스트 표시 중 스크롤/입력을 막지 않도록 오버레이에 `allowsHitTesting(false)`를 적용했다. +- 실행 명령: + - 전역 호출 치환/검증 + - `grep(pattern="\\.popup\\(", path="SodaLive/Sources", include="*.swift")` → 결과 없음 + - `grep(pattern="\\.sodaToast\\(", path="SodaLive/Sources", include="*.swift")` → 99개 호출 확인 + - 빌드 + - `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build` + - `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" -configuration Debug build` + - 테스트 + - `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test` + - `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" test` + - 정적 진단 + - `lsp_diagnostics`: `SodaLive/Sources/Common/BaseView.swift`, `SodaLive/Sources/Search/SearchView.swift`, `SodaLive/Sources/Content/Main/V2/Replay/ContentMainTabReplayView.swift` +- 결과: + - `.popup(... type: .toast ...)`: 전역 0건 확인 + - `.sodaToast(...)`: 전역 99건 적용 확인 + - `SodaLive` Debug 빌드: 성공(`** BUILD SUCCEEDED **`) + - `SodaLive-dev` Debug 빌드: 성공(`** BUILD SUCCEEDED **`) + - `SodaLive` 테스트: 실패 - `Scheme SodaLive is not currently configured for the test action.` + - `SodaLive-dev` 테스트: 실패 - `Scheme SodaLive-dev is not currently configured for the test action.` + - `lsp_diagnostics`: SourceKit 로컬 해석 한계로 모듈/심볼 미해결 오류가 출력되었으나, 실제 Xcode 빌드는 양 스킴 모두 성공 + +### 2차 +- 무엇/왜/어떻게: 사용자 추가 요청에 따라 토스트 배경색을 `#3BB9F1`로 변경하고, 기존 투명도(`0.92`)를 동일하게 유지했다. +- 실행 명령: + - 정적 진단 + - `lsp_diagnostics`: `SodaLive/Sources/Common/BaseView.swift` + - 빌드 + - `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build` + - 테스트 + - `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test` +- 결과: + - `SodaLive/Sources/Common/BaseView.swift` 진단: 오류 없음 + - `SodaLive` Debug 빌드: 성공(`** BUILD SUCCEEDED **`) + - `SodaLive` 테스트: 실패 - `Scheme SodaLive is not currently configured for the test action.` + +## 다른 UI에서 사용 방법 + +- 토스트가 필요한 View에 아래 형태로 동일하게 적용한다. + +```swift +.sodaToast( + isPresented: $viewModel.isShowPopup, + message: viewModel.errorMessage, + autohideIn: 2 +) +``` + +- 파라미터 규칙 + - `isPresented`: 표시 상태 바인딩 (`Binding`) + - `message`: 사용자에게 노출할 문자열 + - `autohideIn`: 자동 숨김 초(기본값 `2`) +- UI 정책 + - 위치/스타일은 공통 Dynamic Island 형태로 고정되어 별도 커스터마이즈 없이 동일 UX를 유지한다. + - 터치 차단이 없도록 구현되어 토스트 표시 중에도 스크롤/텍스트 입력이 가능하다.