From 90b6dfb49890b7b1e991b8f698aa8e5e840b128b Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 20 Nov 2025 18:08:54 +0900 Subject: [PATCH] =?UTF-8?q?fix(banner):=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=EA=B0=80=202=EC=9E=A5=EC=94=A9=20=EB=84=98=EC=96=B4=EA=B0=80?= =?UTF-8?q?=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Banner/AutoSlideCharacterBannerView.swift | 12 +----------- .../Content/Main/Banner/ContentMainBannerView.swift | 12 +----------- .../Content/Main/V2/ContentMainBannerViewV2.swift | 10 +--------- .../Series/Main/Home/SeriesMainHomeBannerView.swift | 10 +--------- .../Live/EventBanner/SectionEventBannerView.swift | 12 +----------- 5 files changed, 5 insertions(+), 51 deletions(-) diff --git a/SodaLive/Sources/Chat/Character/Banner/AutoSlideCharacterBannerView.swift b/SodaLive/Sources/Chat/Character/Banner/AutoSlideCharacterBannerView.swift index ad04973..406f7e5 100644 --- a/SodaLive/Sources/Chat/Character/Banner/AutoSlideCharacterBannerView.swift +++ b/SodaLive/Sources/Chat/Character/Banner/AutoSlideCharacterBannerView.swift @@ -79,11 +79,10 @@ private struct AutoSlideCharacterBannerPage: View { let width: CGFloat let height: CGFloat let onTap: (CharacterBannerResponse) -> Void - @State private var boundURL: URL? var body: some View { Group { - if let boundURL { + if let boundURL = URL(string: item.imageUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? item.imageUrl){ DownsampledKFImage( url: boundURL, size: CGSize(width: width, height: height) @@ -96,14 +95,5 @@ private struct AutoSlideCharacterBannerPage: View { } .contentShape(Rectangle()) .onTapGesture { onTap(item) } - .onAppear { - let encoded = item.imageUrl.addingPercentEncoding( - withAllowedCharacters: .urlQueryAllowed - ) ?? item.imageUrl - boundURL = URL(string: encoded) - } - .onDisappear { - boundURL = nil - } } } diff --git a/SodaLive/Sources/Content/Main/Banner/ContentMainBannerView.swift b/SodaLive/Sources/Content/Main/Banner/ContentMainBannerView.swift index 89b9052..de44e6e 100644 --- a/SodaLive/Sources/Content/Main/Banner/ContentMainBannerView.swift +++ b/SodaLive/Sources/Content/Main/Banner/ContentMainBannerView.swift @@ -82,11 +82,10 @@ private struct ContentMainBannerPage: View { let item: GetAudioContentBannerResponse let width: CGFloat let height: CGFloat - @State private var boundURL: URL? var body: some View { Group { - if let boundURL { + if let boundURL = URL(string: item.thumbnailImageUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? item.thumbnailImageUrl) { KFImage(boundURL) .cancelOnDisappear(true) .downsampling(size: CGSize(width: width, height: height)) @@ -118,15 +117,6 @@ private struct ContentMainBannerPage: View { } } } - .onAppear { - let urlString = item.thumbnailImageUrl.addingPercentEncoding( - withAllowedCharacters: .urlQueryAllowed - ) ?? item.thumbnailImageUrl - boundURL = URL(string: urlString) - } - .onDisappear { - boundURL = nil - } } } diff --git a/SodaLive/Sources/Content/Main/V2/ContentMainBannerViewV2.swift b/SodaLive/Sources/Content/Main/V2/ContentMainBannerViewV2.swift index 15da358..6cdf67d 100644 --- a/SodaLive/Sources/Content/Main/V2/ContentMainBannerViewV2.swift +++ b/SodaLive/Sources/Content/Main/V2/ContentMainBannerViewV2.swift @@ -107,11 +107,10 @@ struct ContentMainBannerImageView: View { let width: CGFloat let height: CGFloat let item: GetAudioContentBannerResponse - @State private var boundURL: URL? var body: some View { Group { - if let boundURL { + if let boundURL = URL(string: url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? url) { DownsampledKFImage( url: boundURL, size: CGSize(width: width, height: height) @@ -138,12 +137,5 @@ struct ContentMainBannerImageView: View { } } } - .onAppear { - let encoded = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? url - boundURL = URL(string: encoded) - } - .onDisappear { - boundURL = nil - } } } diff --git a/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeBannerView.swift b/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeBannerView.swift index dff2950..c34269c 100644 --- a/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeBannerView.swift +++ b/SodaLive/Sources/Content/Series/Main/Home/SeriesMainHomeBannerView.swift @@ -80,11 +80,10 @@ struct SeriesMainHomeBannerImageView: View { let url: String let width: CGFloat let height: CGFloat - @State private var boundURL: URL? var body: some View { Group { - if let boundURL { + if let boundURL = URL(string: url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? url) { DownsampledKFImage( url: boundURL, size: CGSize(width: width, height: height) @@ -97,13 +96,6 @@ struct SeriesMainHomeBannerImageView: View { } } .contentShape(Rectangle()) - .onAppear { - let encoded = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? url - boundURL = URL(string: encoded) - } - .onDisappear { - boundURL = nil - } } } diff --git a/SodaLive/Sources/Live/EventBanner/SectionEventBannerView.swift b/SodaLive/Sources/Live/EventBanner/SectionEventBannerView.swift index 0c43cfb..4513713 100644 --- a/SodaLive/Sources/Live/EventBanner/SectionEventBannerView.swift +++ b/SodaLive/Sources/Live/EventBanner/SectionEventBannerView.swift @@ -77,11 +77,10 @@ private struct SectionEventBannerPage: View { let width: CGFloat let height: CGFloat let token: String - @State private var boundURL: URL? var body: some View { Group { - if let boundURL { + if let boundURL = URL(string: item.thumbnailImageUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? item.thumbnailImageUrl) { KFImage(boundURL) .cancelOnDisappear(true) .downsampling(size: CGSize(width: width, height: height)) @@ -108,14 +107,5 @@ private struct SectionEventBannerPage: View { AppState.shared.setAppStep(step: .login) } } - .onAppear { - let urlString = item.thumbnailImageUrl.addingPercentEncoding( - withAllowedCharacters: .urlQueryAllowed - ) ?? item.thumbnailImageUrl - boundURL = URL(string: urlString) - } - .onDisappear { - boundURL = nil - } } }