Skip to content

Commit

Permalink
Merge pull request Team-ShortcutsZip#525 from JMM00/feature/518-Explo…
Browse files Browse the repository at this point in the history
…reShortcutView

[Feat] Team-ShortcutsZip#518 ExploreShortcutView공통 익스텐션 적용 및 모델 확장
  • Loading branch information
JMM00 authored Apr 11, 2024
2 parents aa5a555 + c49b3b9 commit 5b5b7e9
Show file tree
Hide file tree
Showing 15 changed files with 345 additions and 242 deletions.
27 changes: 15 additions & 12 deletions HappyAnding/HappyAnding.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
A0DD085729276608008177BB /* URL+DeepLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0DD085629276608008177BB /* URL+DeepLink.swift */; };
A0F822AC2910B8F100AF4448 /* ShortcutsZipViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0F822AB2910B8F100AF4448 /* ShortcutsZipViewModel.swift */; };
A0F822B729164D2300AF4448 /* ListCategoryShortcutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0F822B629164D2300AF4448 /* ListCategoryShortcutView.swift */; };
A309862B2BBFE5650004D993 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D5889E72AA36A52000C4849 /* AppDelegate.swift */; };
A309862D2BBFE5F50004D993 /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = A309862C2BBFE5F50004D993 /* FirebaseMessaging */; };
A309862F2BBFE6B90004D993 /* View+Shadow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A309862E2BBFE6B90004D993 /* View+Shadow.swift */; };
A31F1844292A637300AF4A82 /* Date+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9CAEF822914855900224B0A /* Date+String.swift */; };
A31F1846292A638700AF4A82 /* (null) in Sources */ = {isa = PBXBuildFile; };
A31F1848292A64D700AF4A82 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87E99C7128F94EA8009B691F /* Assets.xcassets */; };
Expand Down Expand Up @@ -151,7 +154,6 @@
F98017182BBC29A7004F2EA7 /* SCZ+Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = F98017172BBC29A7004F2EA7 /* SCZ+Color.swift */; };
F980171A2BBC29D6004F2EA7 /* PromotionSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = F98017192BBC29D6004F2EA7 /* PromotionSection.swift */; };
F980171C2BBC29F7004F2EA7 /* CardSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = F980171B2BBC29F7004F2EA7 /* CardSection.swift */; };
F980171E2BBC2A24004F2EA7 /* ExploreShortcutSectionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F980171D2BBC2A24004F2EA7 /* ExploreShortcutSectionType.swift */; };
F98017202BBC2A6F004F2EA7 /* ExploreCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F980171F2BBC2A6F004F2EA7 /* ExploreCell.swift */; };
F98017222BBC3FD8004F2EA7 /* ExpandedRankingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F98017212BBC3FD8004F2EA7 /* ExpandedRankingView.swift */; };
F98017242BBC4061004F2EA7 /* ShortcutIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F98017232BBC4061004F2EA7 /* ShortcutIcon.swift */; };
Expand Down Expand Up @@ -285,6 +287,7 @@
A0DD085629276608008177BB /* URL+DeepLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+DeepLink.swift"; sourceTree = "<group>"; };
A0F822AB2910B8F100AF4448 /* ShortcutsZipViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutsZipViewModel.swift; sourceTree = "<group>"; };
A0F822B629164D2300AF4448 /* ListCategoryShortcutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListCategoryShortcutView.swift; sourceTree = "<group>"; };
A309862E2BBFE6B90004D993 /* View+Shadow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Shadow.swift"; sourceTree = "<group>"; };
A323D3C92AEE870700DDA716 /* SuggestionForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionForm.swift; sourceTree = "<group>"; };
A323D3CB2AEEA10F00DDA716 /* SuggestionFormViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionFormViewModel.swift; sourceTree = "<group>"; };
A33F74AD2908D8C800B8D0D0 /* CheckBoxShortcutCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckBoxShortcutCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -327,7 +330,6 @@
F98017172BBC29A7004F2EA7 /* SCZ+Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SCZ+Color.swift"; sourceTree = "<group>"; };
F98017192BBC29D6004F2EA7 /* PromotionSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromotionSection.swift; sourceTree = "<group>"; };
F980171B2BBC29F7004F2EA7 /* CardSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardSection.swift; sourceTree = "<group>"; };
F980171D2BBC2A24004F2EA7 /* ExploreShortcutSectionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreShortcutSectionType.swift; sourceTree = "<group>"; };
F980171F2BBC2A6F004F2EA7 /* ExploreCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExploreCell.swift; sourceTree = "<group>"; };
F98017212BBC3FD8004F2EA7 /* ExpandedRankingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandedRankingView.swift; sourceTree = "<group>"; };
F98017232BBC4061004F2EA7 /* ShortcutIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutIcon.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -377,6 +379,7 @@
files = (
A3FC474B292A61550058BF26 /* FirebaseDatabase in Frameworks */,
A3FC474D292A61550058BF26 /* FirebaseFirestoreCombine-Community in Frameworks */,
A309862D2BBFE5F50004D993 /* FirebaseMessaging in Frameworks */,
A3FC4747292A61550058BF26 /* FirebaseAnalytics in Frameworks */,
A3FC4749292A61550058BF26 /* FirebaseAuth in Frameworks */,
);
Expand All @@ -385,14 +388,6 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
4DB674822AF11B7900A83C0B /* Support */ = {
isa = PBXGroup;
children = (
4D5889E72AA36A52000C4849 /* AppDelegate.swift */,
);
path = Support;
sourceTree = "<group>";
};
8786B2DD29A7F8C8000B46A1 /* String */ = {
isa = PBXGroup;
children = (
Expand All @@ -409,6 +404,7 @@
8786B2E329A7F966000B46A1 /* View+NavigationBar.swift */,
8751B29829A32CC000C2B27E /* View+Navigation.swift */,
8786B33D29ABA5A9000B46A1 /* View+Shape.swift */,
A309862E2BBFE6B90004D993 /* View+Shadow.swift */,
8786B2E129A7F93B000B46A1 /* View+UIFont.swift */,
);
path = View;
Expand Down Expand Up @@ -488,7 +484,6 @@
3D41EE06290A458B008BE986 /* Info.plist */,
87E99CC22901454D009B691F /* Extensions */,
A39504852AD46ACB0019895E /* Support */,
4DB674822AF11B7900A83C0B /* Support */,
87E99C9828FFF1D2009B691F /* Views */,
87E99CD729042503009B691F /* Model */,
A0F822AA2910B8B900AF4448 /* ViewModel */,
Expand Down Expand Up @@ -726,6 +721,7 @@
isa = PBXGroup;
children = (
A39504862AD46B9B0019895E /* HapticManager.swift */,
4D5889E72AA36A52000C4849 /* AppDelegate.swift */,
);
path = Support;
sourceTree = "<group>";
Expand Down Expand Up @@ -857,6 +853,7 @@
A3FC4748292A61550058BF26 /* FirebaseAuth */,
A3FC474A292A61550058BF26 /* FirebaseDatabase */,
A3FC474C292A61550058BF26 /* FirebaseFirestoreCombine-Community */,
A309862C2BBFE5F50004D993 /* FirebaseMessaging */,
);
productName = ShareExtension;
productReference = A3A6AD14292763E2004C49DC /* ShareExtension.appex */;
Expand Down Expand Up @@ -993,7 +990,6 @@
F9AFF6E32A59153B00FFFFAD /* WriteShortcutViewModel.swift in Sources */,
8786B2E629A7F987000B46A1 /* String+Date.swift in Sources */,
F980171C2BBC29F7004F2EA7 /* CardSection.swift in Sources */,
F980171E2BBC2A24004F2EA7 /* ExploreShortcutSectionType.swift in Sources */,
F96D45B72980301F000C2441 /* SubtitleTextView.swift in Sources */,
A323D3CA2AEE870700DDA716 /* SuggestionForm.swift in Sources */,
4DF15D752A4ECE1F0014F854 /* ListCategoryShortcutViewModel.swift in Sources */,
Expand All @@ -1019,6 +1015,7 @@
87E99CA128FFF225009B691F /* MyPageView.swift in Sources */,
8792478D2918CE450040D5C3 /* UINavigationContoller+Gesture.swift in Sources */,
8786B33C29ABA588000B46A1 /* View+Gesture.swift in Sources */,
A309862F2BBFE6B90004D993 /* View+Shadow.swift in Sources */,
87E99CC7290145AD009B691F /* ShortcutCell.swift in Sources */,
87E99CBB28FFF298009B691F /* IconModalView.swift in Sources */,
F98017222BBC3FD8004F2EA7 /* ExpandedRankingView.swift in Sources */,
Expand Down Expand Up @@ -1096,6 +1093,7 @@
A3439AF529395A100043E273 /* UserAuth.swift in Sources */,
A31F1846292A638700AF4A82 /* (null) in Sources */,
F9DB8EB92939853D00516CE1 /* ShareExtensionValidationTextField.swift in Sources */,
A309862B2BBFE5650004D993 /* AppDelegate.swift in Sources */,
F92766562A61A0E5009C4EC2 /* WriteShortcutModalViewModel.swift in Sources */,
8786B2EA29A7F9E7000B46A1 /* View+NavigationBar.swift in Sources */,
A3C5576C292BE084003907DC /* ShareExtensionWriteShortcutView.swift in Sources */,
Expand Down Expand Up @@ -1566,6 +1564,11 @@
package = F94B435B2907B19A00987819 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseMessaging;
};
A309862C2BBFE5F50004D993 /* FirebaseMessaging */ = {
isa = XCSwiftPackageProductDependency;
package = F94B435B2907B19A00987819 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseMessaging;
};
A3FC4746292A61550058BF26 /* FirebaseAnalytics */ = {
isa = XCSwiftPackageProductDependency;
package = F94B435B2907B19A00987819 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x40",
"green" : "0x40",
"red" : "0x40"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x40",
"green" : "0x40",
"red" : "0x40"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
20 changes: 20 additions & 0 deletions HappyAnding/HappyAnding/Extensions/View/View+Shadow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// View+Shadow.swift
// HappyAnding
//
// Created by HanGyeongjun on 4/5/24.
//

import SwiftUI

extension View {

///View에 Drop Shadow를 적용합니다.
///모든 View에서 사용되는 값에 변화가 없어 매개변수는 없습니다.
func dropShadow() -> some View {
self.shadow(color: Color("CharcoalGray").opacity(0.04),
radius: 8,
x: 0,
y: 2)
}
}
20 changes: 18 additions & 2 deletions HappyAnding/HappyAnding/Extensions/View/View+Shape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,37 @@ import SwiftUI
/// 뷰의 모서리를 설정하기 위한 확장입니다.
extension View {

//TODO: 디자인 업데이트 완료 후 해당 익스텐션 삭제 필요
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
clipShape( RoundedCorner(radius: radius, corners: corners) )
}

///반투명 테두리가 있는 둥근 모서리를 설정하기 위한 확장입니다.
///테두리의 두께는 고정값입니다.
///
///cornerRadius: 둥근 모서리의 정도를 설정합니다. 기본값 16.
///color: 테두리의 색상을 설정합니다. 기본값 "CharcoalGray"
///isBlendMode: 블랜드모드 적용을 조정합니다. 기본값 false
///opacity: 테두리의 투명도를 설정합니다. 기본값 1.0
func roundedBorder(cornerRadius: CGFloat = 16, color: Color = Color("CharcoalGray"), isNormalBlend: Bool = true, opacity: Double = 1.0) -> some View {
self.overlay(
RoundedRectangle(cornerRadius: cornerRadius)
.strokeBorder(color.opacity(opacity), lineWidth: 2)
.blendMode(isNormalBlend ? .normal : .multiply)
)
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
}
}


//MARK: - 둥근 모서리

/// 해당 Shape을 이용하여 다른 뷰에 적용합니다.
struct RoundedCorner: Shape {

var radius: CGFloat = .infinity
var corners: UIRectCorner = .allCorners

func path(in rect: CGRect) -> Path {
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
return Path(path.cgPath)
Expand Down
58 changes: 58 additions & 0 deletions HappyAnding/HappyAnding/Model/SectionType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import SwiftUI

enum SectionType {
case recent
Expand All @@ -15,6 +16,22 @@ enum SectionType {
case myLovingShortcut
case myDownloadShortcut

var icon: String {
switch self {
case .recent:
return "sparkles"
case .download:
return "trophy.fill"
case .popular:
return "heart.fill"
case .myShortcut:
return "square.text.square"
case .myLovingShortcut:
return "heart.fill"
case .myDownloadShortcut:
return "arrow.down.square.fill"
}
}
var title: String {
switch self {
case .recent:
Expand Down Expand Up @@ -48,4 +65,45 @@ enum SectionType {
return viewModel.shortcutsUserDownloaded
}
}

func fetchTitleIcon() -> some View {
switch self {
case .recent:
return Image(systemName: self.icon)
.foregroundStyle(
Color(hexString: "E4C139"),
Color(hexString: "E4C139")
)
case .download:
return Image(systemName: self.icon)
.foregroundStyle(
Color(hexString: "404040", opacity: 0.48),
Color(hexString: "404040", opacity: 0.48)
)
case .popular:
return Image(systemName: self.icon)
.foregroundStyle(
Color(hexString: "3366FF", opacity: 0.88),
Color(hexString: "3366FF", opacity: 0.88)
)
case .myShortcut:
return Image(systemName: "square.text.square.fill")
.foregroundStyle(
SCZColor.CharcoalGray.opacity64,
Color.white
)
case .myDownloadShortcut:
return Image(systemName: "arrow.down.square.fill")
.foregroundStyle(
Color.white,
SCZColor.CharcoalGray.opacity24
)
case .myLovingShortcut:
return Image(systemName: "heart.fill")
.foregroundStyle(
Color(hexString: "3366FF", opacity: 0.88),
Color(hexString: "3366FF", opacity: 0.88)
)
}
}
}
8 changes: 4 additions & 4 deletions HappyAnding/HappyAnding/TextLiteral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum TextLiteral {
static let appStoreUrl: String = "itms-apps://itunes.apple.com/app/6444001181"

// MARK: - ExploreShortcutView
static let exploreShortcutViewTitle: String = "단축어 둘러보기"
static let exploreShortcutViewTitle: String = "둘러보기"

//MARK: - announcementCell
static let newFeatureTag: String = "새로운 기능"
Expand Down Expand Up @@ -67,7 +67,7 @@ enum TextLiteral {
static let categoryViewFold: String = "접기"

// MARK: - MyShortcutCardListView
static let myShortcutCardListViewTitle: String = "내가 작성한 단축어"
static let myShortcutCardListViewTitle: String = "작성한 단축어"

// MARK: - ValidationCheckTextField
static let validationCheckTextFieldInvalid: String = "단축어 링크가 아니에요"
Expand Down Expand Up @@ -226,8 +226,8 @@ enum TextLiteral {
// MARK: - MyPageView
static let myPageViewTitle: String = "프로필"
static let myPageViewMyCuration: String = "내가 작성한 추천 모음집"
static let myPageViewLikedShortcuts: String = "좋아요한 단축어"
static let myPageViewDownloadedShortcuts: String = "다운로드한 단축어"
static let myPageViewLikedShortcuts: String = "내가 좋아요한"
static let myPageViewDownloadedShortcuts: String = "다운로드한"

// MARK: - MailView
static let mailViewReceiver: String = "[email protected]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ final class ExploreShortcutViewModel: ObservableObject {
func fetchShortcuts(by category: Category) -> [Shortcuts] {
self.shortcutsZipViewModel.shortcutsInCategory[category.index]
}
func fetchShortcuts(by sectionType: ExploreShortcutSectionType) -> [Shortcuts] {

func fetchShortcuts(by sectionType: SectionType) -> [Shortcuts] {
sectionType.filterShortcuts(from: self.shortcutsZipViewModel)
}

Expand Down
Loading

0 comments on commit 5b5b7e9

Please sign in to comment.