diff --git a/Projects/DSKit/Sources/Components/PokitLinkPreview.swift b/Projects/DSKit/Sources/Components/PokitLinkPreview.swift index 844619af..88828f43 100644 --- a/Projects/DSKit/Sources/Components/PokitLinkPreview.swift +++ b/Projects/DSKit/Sources/Components/PokitLinkPreview.swift @@ -7,6 +7,7 @@ import SwiftUI +import Util import NukeUI public struct PokitLinkPreview: View { @@ -33,7 +34,6 @@ public struct PokitLinkPreview: View { } } - private var buttonLabel: some View { HStack(spacing: 16) { Group { @@ -54,18 +54,13 @@ public struct PokitLinkPreview: View { .background { RoundedRectangle(cornerRadius: 12, style: .continuous) .fill(.pokit(.bg(.base))) + .shadow(color: .black.opacity(0.06), radius: 3, x: 2, y: 2) } .overlay { RoundedRectangle(cornerRadius: 12, style: .continuous) .stroke(.pokit(.border(.tertiary)), lineWidth: 1) } - .shadow(color: .black.opacity(0.06), radius: 3, x: 2, y: 2) - .onAppear { - withAnimation { - UINotificationFeedbackGenerator() - .notificationOccurred(.success) - } - } + .onChange(of: imageURL, perform: onChangeImageURL) } @MainActor @@ -134,6 +129,14 @@ public struct PokitLinkPreview: View { else { return } openURL(url) } + + private func onChangeImageURL(_ imageURL: String?) { + guard imageURL != nil else { return } + let isError = title == Constants.제목을_입력해주세요_문구 + print("\(#function): \(isError), \(title)") + UINotificationFeedbackGenerator() + .notificationOccurred(isError ? .error : .success) + } } #Preview { diff --git a/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingFeature.swift b/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingFeature.swift index a5847ac0..db01fe14 100644 --- a/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingFeature.swift +++ b/Projects/Feature/FeatureContentSetting/Sources/ContentSetting/ContentSettingFeature.swift @@ -255,8 +255,8 @@ private extension ContentSettingFeature { let contentTitle = state.title.isEmpty ? Constants.제목을_입력해주세요_문구 : state.title - state.linkTitle = title ?? contentTitle state.linkImageURL = imageURL ?? Constants.기본_썸네일_주소.absoluteString + state.linkTitle = title ?? contentTitle if let title, state.domain.title.isEmpty { state.domain.title = title }