Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ”€ :: (#551) PanModal ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ FittedSheets๋กœ ๋Œ€์ฒด #621

Merged
merged 8 commits into from
Jun 18, 2024
Merged
18 changes: 9 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@
"version" : "10.25.0"
}
},
{
"identity" : "fittedsheets",
"kind" : "remoteSourceControl",
"location" : "https://github.com/gordontucker/FittedSheets.git",
"state" : {
"revision" : "5d7f5a6307ad510aa05de5a4a16ac40846d3b2d3",
"version" : "2.6.1"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -225,15 +234,6 @@
"version" : "4.2.0"
}
},
{
"identity" : "panmodal",
"kind" : "remoteSourceControl",
"location" : "https://github.com/slackhq/PanModal.git",
"state" : {
"revision" : "b012aecb6b67a8e46369227f893c12544846613f",
"version" : "1.2.7"
}
},
{
"identity" : "promises",
"kind" : "remoteSourceControl",
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/Moya/Moya.git", from: "15.0.3"),
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "7.11.0"),
.package(url: "https://github.com/slackhq/PanModal.git", from: "1.2.0"),
.package(url: "https://github.com/gordontucker/FittedSheets.git", from: "2.6.1"),
.package(url: "https://github.com/ReactiveX/RxSwift.git",from: "6.7.1"),
.package(url: "https://github.com/devxoul/Then", from: "3.0.0"),
.package(url: "https://github.com/SnapKit/SnapKit.git", from: "5.7.1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public extension TargetDependency.SPM {
// MARK: External
static let Moya = TargetDependency.external(name: "Moya")
static let RxMoya = TargetDependency.external(name: "RxMoya")
static let PanModal = TargetDependency.external(name: "PanModal")
static let FittedSheets = TargetDependency.external(name: "FittedSheets")
static let RxSwift = TargetDependency.external(name: "RxSwift")
static let RxCocoa = TargetDependency.external(name: "RxCocoa")
static let Kingfisher = TargetDependency.external(name: "Kingfisher")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public protocol TextPopUpFactory {
func makeView(
text: String?,
cancelButtonIsHidden: Bool,
allowsDragAndTapToDismiss: Bool?,
confirmButtonText: String?,
cancelButtonText: String?,
completion: (() -> Void)?,
Expand Down
23 changes: 15 additions & 8 deletions Projects/Features/BaseFeature/Resources/Base.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
Expand Down Expand Up @@ -339,6 +339,7 @@
<constraint firstItem="bzT-MY-nfF" firstAttribute="top" secondItem="gkT-eU-P4o" secondAttribute="top" id="7Sg-Qj-9ki"/>
<constraint firstItem="bzT-MY-nfF" firstAttribute="leading" secondItem="gkT-eU-P4o" secondAttribute="leading" id="TLo-M7-80o"/>
<constraint firstItem="gkT-eU-P4o" firstAttribute="trailing" secondItem="bzT-MY-nfF" secondAttribute="trailing" id="aJP-GL-FCF"/>
<constraint firstItem="gkT-eU-P4o" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="bzT-MY-nfF" secondAttribute="bottom" id="pm0-Cd-K6T"/>
</constraints>
</view>
<connections>
Expand Down Expand Up @@ -399,7 +400,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="cfO-nl-nfD">
<rect key="frame" x="20" y="126" width="303" height="19"/>
<rect key="frame" x="20" y="126.33333333333336" width="303" height="18.666666666666671"/>
<color key="textColor" name="gray800"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" returnKeyType="done" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
Expand All @@ -426,13 +427,19 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dXA-NK-1pe">
<rect key="frame" x="20" y="90" width="42" height="21"/>
<rect key="frame" x="20" y="84" width="42" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="9PB-tI-7We"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XrV-Zc-jwE">
<rect key="frame" x="20" y="24" width="42" height="21"/>
<rect key="frame" x="20" y="24" width="42" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="nPs-Zl-t09"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -442,6 +449,7 @@
<constraints>
<constraint firstAttribute="trailing" secondItem="ij3-fi-jC1" secondAttribute="trailing" constant="20" id="0cV-AG-oXd"/>
<constraint firstItem="Kn4-E0-QGV" firstAttribute="centerY" secondItem="AUz-tK-BNV" secondAttribute="centerY" id="3hl-TH-OSP"/>
<constraint firstItem="dXA-NK-1pe" firstAttribute="top" secondItem="XrV-Zc-jwE" secondAttribute="bottom" constant="32" id="6Ki-ib-7EC"/>
<constraint firstItem="GKw-Bn-dI7" firstAttribute="centerX" secondItem="xs4-m5-Jmc" secondAttribute="centerX" id="6dJ-aL-Dwn"/>
<constraint firstItem="O6b-uG-uWT" firstAttribute="leading" secondItem="cfO-nl-nfD" secondAttribute="trailing" constant="5" id="6yN-Iy-hpx"/>
<constraint firstItem="ij3-fi-jC1" firstAttribute="bottom" secondItem="AUz-tK-BNV" secondAttribute="top" constant="4" id="ADz-D1-Znw"/>
Expand All @@ -451,7 +459,6 @@
<constraint firstItem="Kn4-E0-QGV" firstAttribute="leading" secondItem="Iat-p0-Uk6" secondAttribute="trailing" id="J4h-q5-5bp"/>
<constraint firstItem="dXA-NK-1pe" firstAttribute="leading" secondItem="rWb-JT-gub" secondAttribute="leading" constant="20" id="MiA-Vz-kXQ"/>
<constraint firstAttribute="bottom" secondItem="xs4-m5-Jmc" secondAttribute="bottom" constant="10" id="NV4-CY-70Q"/>
<constraint firstItem="cfO-nl-nfD" firstAttribute="top" secondItem="dXA-NK-1pe" secondAttribute="bottom" constant="15" id="QQB-YJ-T3c"/>
<constraint firstItem="ij3-fi-jC1" firstAttribute="leading" secondItem="rWb-JT-gub" secondAttribute="leading" constant="20" id="Vsd-1u-9UH"/>
<constraint firstItem="ij3-fi-jC1" firstAttribute="top" secondItem="cfO-nl-nfD" secondAttribute="bottom" constant="11" id="Xob-yg-ouk"/>
<constraint firstItem="GKw-Bn-dI7" firstAttribute="centerY" secondItem="xs4-m5-Jmc" secondAttribute="centerY" id="aJv-7M-AbD"/>
Expand Down Expand Up @@ -500,7 +507,7 @@
<resources>
<image name="cross_close" width="32" height="32"/>
<namedColor name="POINT">
<color red="0.035999998450279236" green="0.7850000262260437" blue="0.94999998807907104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.035294117647058823" green="0.78431372549019607" blue="0.94901960784313721" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="WAKTAVERSE">
<color red="0.0" green="0.9570000171661377" blue="0.72899997234344482" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand All @@ -512,7 +519,7 @@
<color red="0.99199998378753662" green="0.99199998378753662" blue="0.99199998378753662" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="gray400">
<color red="0.59600001573562622" green="0.63499999046325684" blue="0.70200002193450928" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.80000000000000004" green="0.80000000000000004" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="gray800">
<color red="0.11400000005960464" green="0.16099999845027924" blue="0.22400000691413879" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public final class TextPopUpComponent: Component<EmptyDependency>, TextPopUpFact
public func makeView(
text: String?,
cancelButtonIsHidden: Bool,
allowsDragAndTapToDismiss: Bool?,
confirmButtonText: String?,
cancelButtonText: String?,
completion: (() -> Void)?,
Expand All @@ -15,7 +14,6 @@ public final class TextPopUpComponent: Component<EmptyDependency>, TextPopUpFact
return TextPopupViewController.viewController(
text: text ?? "",
cancelButtonIsHidden: cancelButtonIsHidden,
allowsDragAndTapToDismiss: allowsDragAndTapToDismiss ?? true,
confirmButtonText: confirmButtonText ?? "ํ™•์ธ",
cancelButtonText: cancelButtonText ?? "์ทจ์†Œ",
completion: completion,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import DesignSystem
import PanModal
import UIKit
import Utility

Expand All @@ -12,7 +11,6 @@ public final class TextPopupViewController: UIViewController, ViewControllerFrom
var cancelButtonIsHidden: Bool = false
var completion: (() -> Void)?
var cancelCompletion: (() -> Void)?
var allowsDragAndTapToDismiss: Bool = true
var cancelButtonText: String = ""
var confirmButtonText: String = ""

Expand All @@ -29,7 +27,6 @@ public final class TextPopupViewController: UIViewController, ViewControllerFrom
public static func viewController(
text: String = "",
cancelButtonIsHidden: Bool,
allowsDragAndTapToDismiss: Bool = true,
confirmButtonText: String = "ํ™•์ธ",
cancelButtonText: String = "์ทจ์†Œ",
completion: (() -> Void)? = nil,
Expand All @@ -39,7 +36,6 @@ public final class TextPopupViewController: UIViewController, ViewControllerFrom
let viewController = TextPopupViewController.viewController(storyBoardName: "Base", bundle: Bundle.module)
viewController.contentString = text
viewController.cancelButtonIsHidden = cancelButtonIsHidden
viewController.allowsDragAndTapToDismiss = allowsDragAndTapToDismiss
viewController.completion = completion
viewController.cancelCompletion = cancelCompletion
viewController.confirmButtonText = confirmButtonText
Expand All @@ -48,13 +44,15 @@ public final class TextPopupViewController: UIViewController, ViewControllerFrom
}

@IBAction func cancelButtonAction(_ sender: Any) {
dismiss(animated: true)
cancelCompletion?()
dismiss(animated: true, completion: { [cancelCompletion] in
cancelCompletion?()
})
}

@IBAction func confirmButtonAction(_ sender: Any) {
dismiss(animated: true)
completion?()
dismiss(animated: true, completion: { [completion] in
completion?()
})
}
}

Expand Down Expand Up @@ -108,57 +106,3 @@ extension TextPopupViewController {
contentLabel.attributedText = contentAttributedString
}
}

extension TextPopupViewController: PanModalPresentable {
override public var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}

public var panModalBackgroundColor: UIColor {
return colorFromRGB(0x000000, alpha: 0.4)
}

public var panScrollable: UIScrollView? {
return nil
}

public var longFormHeight: PanModalHeight {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineHeightMultiple = 1.3
paragraphStyle.alignment = .center

let contentAttributedString = NSMutableAttributedString(
string: contentString,
attributes: [
.font: DesignSystem.DesignSystemFontFamily.Pretendard.medium.font(size: 18),
.foregroundColor: DesignSystemAsset.GrayColor.gray900.color,
.kern: -0.5,
.paragraphStyle: paragraphStyle
]
)

let contentHeight: CGFloat = contentAttributedString.height(containerWidth: APP_WIDTH() - 40)
let spacingHeight: CGFloat = 60 + 52 + 56 + 10
return .contentHeight(spacingHeight + contentHeight)
}

public var cornerRadius: CGFloat {
return 24.0
}

public var allowsExtendedPanScrolling: Bool {
return true
}

public var showDragIndicator: Bool {
return false
}

public var allowsDragToDismiss: Bool {
return allowsDragAndTapToDismiss
}

public var allowsTapToDismiss: Bool {
return allowsDragAndTapToDismiss
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,6 @@ extension SongCartView {
}
)
guard let parent = self.parentViewController() else { return }
parent.showPanModal(content: viewController)
parent.showFittedSheets(content: viewController)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public final class TextPopUpComponentStub: TextPopUpFactory {
public func makeView(
text: String?,
cancelButtonIsHidden: Bool,
allowsDragAndTapToDismiss: Bool?,
confirmButtonText: String?,
cancelButtonText: String?,
completion: (() -> Void)?,
Expand All @@ -15,7 +14,6 @@ public final class TextPopUpComponentStub: TextPopUpFactory {
return TextPopupViewController.viewController(
text: text ?? "",
cancelButtonIsHidden: cancelButtonIsHidden,
allowsDragAndTapToDismiss: allowsDragAndTapToDismiss ?? true,
confirmButtonText: confirmButtonText ?? "ํ™•์ธ",
cancelButtonText: cancelButtonText ?? "์ทจ์†Œ",
completion: completion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ChartDomainInterface
import DesignSystem
import LogManager
import NVActivityIndicatorView
import PanModal
import PlayListDomainInterface
import PlaylistFeatureInterface
import RxCocoa
Expand Down
7 changes: 4 additions & 3 deletions Projects/Features/MainTabFeature/Resources/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
Expand Down Expand Up @@ -259,6 +259,7 @@
<constraint firstItem="CHC-RK-OHq" firstAttribute="top" secondItem="osQ-4a-9GI" secondAttribute="top" id="9bL-fg-0Ak"/>
<constraint firstItem="CHC-RK-OHq" firstAttribute="leading" secondItem="osQ-4a-9GI" secondAttribute="leading" id="LGN-xs-qsq"/>
<constraint firstAttribute="trailing" secondItem="CHC-RK-OHq" secondAttribute="trailing" id="kUO-eF-5sI"/>
<constraint firstItem="osQ-4a-9GI" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="CHC-RK-OHq" secondAttribute="bottom" id="quz-qd-tAu"/>
</constraints>
</view>
<connections>
Expand All @@ -276,7 +277,7 @@
</scenes>
<resources>
<namedColor name="POINT">
<color red="0.035999998450279236" green="0.7850000262260437" blue="0.94999998807907104" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.035294117647058823" green="0.78431372549019607" blue="0.94901960784313721" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="gray100">
<color red="0.94900000095367432" green="0.9570000171661377" blue="0.96899998188018799" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private extension MainTabBarViewController {
.bind(with: self) { owner, model in
let viewController = owner.noticePopupComponent.makeView(model: model)
viewController.delegate = owner
owner.showPanModal(content: viewController)
owner.showFittedSheets(content: viewController)
}
.disposed(by: disposeBag)
}
Expand Down
Loading
Loading