Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
HanGyeongjun committed Jan 20, 2023
2 parents d12b9df + 6c50641 commit ab8ebe5
Show file tree
Hide file tree
Showing 30 changed files with 705 additions and 322 deletions.
10 changes: 10 additions & 0 deletions HappyAnding/HappyAnding.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
4D3DBB88292E67E600DE8160 /* EditNicknameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D3DBB87292E67E500DE8160 /* EditNicknameView.swift */; };
4D3DBB962934E31A00DE8160 /* ShowProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D3DBB952934E31A00DE8160 /* ShowProfileView.swift */; };
4D402E7B2979342800D9A825 /* RecentRegisteredView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D402E7A2979342800D9A825 /* RecentRegisteredView.swift */; };
4D61A767291E1EE8000EF531 /* NavigationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D61A766291E1EE8000EF531 /* NavigationViewModel.swift */; };
4D778A34290A53BA00C15AC4 /* Application+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D778A33290A53BA00C15AC4 /* Application+Extension.swift */; };
4DAD635E292AB61700ABF8C1 /* UpdateShortcutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DAD635D292AB61700ABF8C1 /* UpdateShortcutView.swift */; };
Expand Down Expand Up @@ -108,6 +109,7 @@
A3FF01882918581E00384211 /* LicenseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FF01872918581E00384211 /* LicenseView.swift */; };
A3FF018A2918F8EF00384211 /* apache.txt in Resources */ = {isa = PBXBuildFile; fileRef = A3FF01892918F8EF00384211 /* apache.txt */; };
A3FF018E291ACFA500384211 /* WithdrawalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FF018D291ACFA500384211 /* WithdrawalView.swift */; };
A3FF4F832979C09000FA9EEE /* LineBreaking+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FF4F822979C09000FA9EEE /* LineBreaking+Extension.swift */; };
F90DEA4F29327E4D002140E2 /* NavigationStackModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8764C0D6291F85DF00E1593B /* NavigationStackModel.swift */; };
F90DEA5029327E5D002140E2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87E99C7128F94EA8009B691F /* Assets.xcassets */; };
F90DEA5129327E62002140E2 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3D41EE07290A4C18008BE986 /* Launch Screen.storyboard */; };
Expand Down Expand Up @@ -176,6 +178,7 @@
3D41EE07290A4C18008BE986 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
4D3DBB87292E67E500DE8160 /* EditNicknameView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditNicknameView.swift; sourceTree = "<group>"; };
4D3DBB952934E31A00DE8160 /* ShowProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowProfileView.swift; sourceTree = "<group>"; };
4D402E7A2979342800D9A825 /* RecentRegisteredView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentRegisteredView.swift; sourceTree = "<group>"; };
4D61A766291E1EE8000EF531 /* NavigationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationViewModel.swift; sourceTree = "<group>"; };
4D778A33290A53BA00C15AC4 /* Application+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Application+Extension.swift"; sourceTree = "<group>"; };
4DAD635D292AB61700ABF8C1 /* UpdateShortcutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateShortcutView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -266,6 +269,7 @@
A3FF01872918581E00384211 /* LicenseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicenseView.swift; sourceTree = "<group>"; };
A3FF01892918F8EF00384211 /* apache.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = apache.txt; sourceTree = "<group>"; };
A3FF018D291ACFA500384211 /* WithdrawalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithdrawalView.swift; sourceTree = "<group>"; };
A3FF4F822979C09000FA9EEE /* LineBreaking+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LineBreaking+Extension.swift"; sourceTree = "<group>"; };
F9131B6A2922D38D00868A0E /* Keyword.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keyword.swift; sourceTree = "<group>"; };
F9136EB5293612310034AAB2 /* ShortcutsZipView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutsZipView.swift; sourceTree = "<group>"; };
F94B432D2907088400987819 /* UserCurationListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserCurationListView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -502,6 +506,7 @@
8795A16F292AB945004B765F /* UIScreen+Extension.swift */,
F9AC2BB92935D34C00165820 /* Image+Extension.swift */,
A3439AFA2939B0E80043E273 /* UserDefaults+Extension.swift */,
A3FF4F822979C09000FA9EEE /* LineBreaking+Extension.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -556,6 +561,7 @@
isa = PBXGroup;
children = (
87E99CA828FFF24F009B691F /* ExploreShortcutView.swift */,
4D402E7A2979342800D9A825 /* RecentRegisteredView.swift */,
A04ACB0B29041CEE004A85A6 /* LovedShortcutView.swift */,
A04ACB0929041CD8004A85A6 /* DownloadRankView.swift */,
A04ACB0D29041D61004A85A6 /* CategoryView.swift */,
Expand Down Expand Up @@ -846,6 +852,7 @@
A04ACB0A29041CD8004A85A6 /* DownloadRankView.swift in Sources */,
87E99CD1290145DE009B691F /* PaletteView.swift in Sources */,
4DAD6370292BCB1000ABF8C1 /* CategoryCardView.swift in Sources */,
4D402E7B2979342800D9A825 /* RecentRegisteredView.swift in Sources */,
87E99CDB29042CCA009B691F /* Category.swift in Sources */,
8795A16E292AB841004B765F /* View+Extension.swift in Sources */,
A04ACB062903D0B2004A85A6 /* MyShortcutCardView.swift in Sources */,
Expand Down Expand Up @@ -899,6 +906,7 @@
87E99CCB290145C4009B691F /* UserCurationCell.swift in Sources */,
F9724BBF292755E400860F8A /* Comment.swift in Sources */,
87E99CA328FFF22E009B691F /* ExploreCurationView.swift in Sources */,
A3FF4F832979C09000FA9EEE /* LineBreaking+Extension.swift in Sources */,
A0F822B729164D2300AF4448 /* ShortcutsListView.swift in Sources */,
4D3DBB88292E67E600DE8160 /* EditNicknameView.swift in Sources */,
87E99CE82907C6E6009B691F /* Shortcuts.swift in Sources */,
Expand Down Expand Up @@ -1264,6 +1272,7 @@
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.happyanding.HappyAnding.ShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1296,6 +1305,7 @@
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.happyanding.HappyAnding.ShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
12 changes: 12 additions & 0 deletions HappyAnding/HappyAnding/Extensions/LineBreaking+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// LineBreaking+Extension.swift
// HappyAnding
//
// Created by HanGyeongjun on 2023/01/20.
//

import Foundation

extension String {
var lineBreaking: String { self + " " }
}
16 changes: 1 addition & 15 deletions HappyAnding/HappyAnding/Model/SectionType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,11 @@
import Foundation

enum SectionType: String {
case recent = "최신 단축어"
case download = "다운로드 순위"
case popular = "사랑받는 단축어"
case myShortcut = "내가 작성한 단축어"
case myLovingShortcut = "좋아요한 단축어"
case myDownloadShortcut = "다운로드한 단축어"

var description: String {
switch self {
case .download:
return "1위 ~ 100위"
case .popular:
return "💡 좋아요를 많이 받은 단축어들로 구성되어 있어요!"
case .myShortcut:
return ""
case .myLovingShortcut:
return "💗 내가 좋아요를 누른 단축어를 모아볼 수 있어요"
case .myDownloadShortcut:
return "💫 내가 다운로드한 단축어를 모아볼 수 있어요"
}
}
}

11 changes: 9 additions & 2 deletions HappyAnding/HappyAnding/ViewModel/ShortcutsZipViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ShortcutsZipViewModel: ObservableObject {
fetchCuration(isAdmin: false) { curations in
self.userCurations = curations.sorted(by: { $0.dateTime > $1.dateTime })
self.curationsMadeByUser = self.fetchCurationByAuthor(author: self.currentUser())
self.sortCuration()
}
fetchKeyword { keywords in
self.keywords = keywords
Expand All @@ -72,6 +73,7 @@ class ShortcutsZipViewModel: ObservableObject {
}

func refreshPersonalCurations() {
self.personalCurations.removeAll()
let personalCurationIDs = Set(self.shortcutsUserDownloaded.flatMap({ $0.curationIDs }))
for curationID in personalCurationIDs {
if let curation = self.userCurations.first(where: { $0.id == curationID }) {
Expand Down Expand Up @@ -308,7 +310,13 @@ class ShortcutsZipViewModel: ObservableObject {

//MARK: - 큐레이션


//MARK: 추천모음집 단축어 순서 정렬 함수
func sortCuration() {
for index in 0..<userCurations.count {
userCurations[index].shortcuts = userCurations[index].shortcuts.sorted{ $0.title < $1.title}
}
}

//MARK: Curation을 (admin, user) 구분하여 가져오는 함수

func fetchCuration(isAdmin: Bool, completionHandler: @escaping ([Curation])->()) {
Expand Down Expand Up @@ -430,7 +438,6 @@ class ShortcutsZipViewModel: ObservableObject {
}
}
}

}

//MARK: 좋아요 수를 업데이트하는 함수
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ struct AdminCurationCell: View {
.Title1()
.foregroundColor(.Text_curation)
.lineLimit(1)
Text(adminCuration.subtitle)
Text(adminCuration.subtitle.replacingOccurrences(of: "\\n", with: "\n"))
.Body2()
.foregroundColor(.Text_curation)
.lineLimit(2)
.multilineTextAlignment(.leading)
}
Spacer()
}
}


///백그라운드 이미지
var backgroundImage: some View {
ZStack {
Expand Down
17 changes: 7 additions & 10 deletions HappyAnding/HappyAnding/Views/Components/CurationListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ struct CurationListView: View {
VStack(spacing: 0) {
listHeader

ForEach(Array(data.curation.enumerated()), id: \.offset) { index, curation in
if index < 2 {

let data = NavigationReadUserCurationType(userCuration: curation,
navigationParentView: self.data.navigationParentView)
NavigationLink(value: data) {
UserCurationCell(curation: curation,
navigationParentView: self.data.navigationParentView,
lineLimit: 2)
}
ForEach(data.curation.prefix(2), id: \.self) { curation in
let data = NavigationReadUserCurationType(userCuration: curation,
navigationParentView: self.data.navigationParentView)
NavigationLink(value: data) {
UserCurationCell(curation: curation,
navigationParentView: self.data.navigationParentView,
lineLimit: 2)
}
}
}
Expand Down
139 changes: 49 additions & 90 deletions HappyAnding/HappyAnding/Views/Components/ListShortcutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,37 @@ struct ListShortcutView: View {
@EnvironmentObject var shortcutsZipViewModel: ShortcutsZipViewModel

@State var data: NavigationListShortcutType
@State var shortcutsArray: [Shortcuts] = []
@State private var isLastItem = false

var body: some View {
if let shortcuts = data.shortcuts {
if shortcuts.count == 0 {
VStack(spacing: 0) {
if data.sectionType != .myShortcut {
header
.listRowBackground(Color.Background)
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets())
}
Text("\(data.sectionType.rawValue)가 없습니다.")
.Body2()
.foregroundColor(Color.Gray4)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.background(Color.Background.ignoresSafeArea(.all, edges: .all))
.navigationTitle(getNavigationTitle(data.sectionType))
.navigationBarTitleDisplayMode(.inline)
Text("\(data.sectionType.rawValue)가 없습니다.")
.Body2()
.foregroundColor(Color.Gray4)
.frame(maxWidth: .infinity, maxHeight: .infinity)

.background(Color.Background.ignoresSafeArea(.all, edges: .all))
.navigationTitle(data.sectionType.rawValue)
.navigationBarTitleDisplayMode(.inline)
} else {
ScrollView {
LazyVStack(spacing: 0) {

if data.sectionType != .myShortcut {
header
.listRowBackground(Color.Background)
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets())
}

//TODO: 무한 스크롤을 위한 업데이트 함수 필요
ForEach(Array(shortcuts.enumerated()), id: \.offset) { index, shortcut in
let navigationData = NavigationReadShortcutType(shortcut: shortcut,
shortcutID: shortcut.id,
navigationParentView: self.data.navigationParentView)

NavigationLink(value: navigationData) {
if data.sectionType == .download && index < 100 {
ShortcutCell(shortcut: shortcut,
rankNumber: index + 1,
navigationParentView: data.navigationParentView)
.listRowInsets(EdgeInsets())
.listRowSeparator(.hidden)
} else {
ShortcutCell(shortcut: shortcut,
navigationParentView: data.navigationParentView,
sectionType: data.sectionType)
.listRowInsets(EdgeInsets())
.listRowSeparator(.hidden)
}
}
switch data.sectionType {
case .recent:
makeShortcutCellList(shortcutsZipViewModel.allShortcuts)
case .download:
makeIndexShortcutCellList(shortcutsZipViewModel.sortedShortcutsByDownload)
case .popular:
makeShortcutCellList(shortcutsZipViewModel.sortedShortcutsByLike)
case .myDownloadShortcut:
makeShortcutCellList(shortcutsZipViewModel.shortcutsUserDownloaded)
case .myLovingShortcut:
makeShortcutCellList(shortcutsZipViewModel.shortcutsUserLiked)
case .myShortcut:
makeShortcutCellList(shortcutsZipViewModel.shortcutsMadeByUser)
}
Rectangle()
.fill(Color.Background)
Expand All @@ -75,67 +53,48 @@ struct ListShortcutView: View {
.listRowSeparator(.hidden)
}
}
.scrollIndicators(.hidden)
.listRowBackground(Color.Background)
.listStyle(.plain)
.background(Color.Background.ignoresSafeArea(.all, edges: .all))
.scrollContentBackground(.hidden)
.navigationTitle(getNavigationTitle(data.sectionType))
.navigationTitle(data.sectionType.rawValue)
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackground ({ Color.Background })
}
}
}

var header: some View {

VStack {
Text(getDescriptions(data.sectionType))
.foregroundColor(.Gray5)
.Body2()
.padding(16)
.frame(maxWidth: .infinity,
alignment: data.sectionType == .download ? .center : .leading)
.background(
Rectangle()
.foregroundColor(Color.Gray1)
.cornerRadius(12)
)
@ViewBuilder
private func makeShortcutCellList(_ shortcuts: [Shortcuts]) -> some View {
ForEach(shortcuts, id: \.self) { shortcut in
let navigationData = NavigationReadShortcutType(shortcut: shortcut,
shortcutID: shortcut.id,
navigationParentView: self.data.navigationParentView)

NavigationLink(value: navigationData) {
ShortcutCell(shortcut: shortcut,
navigationParentView: data.navigationParentView,
sectionType: data.sectionType)
.listRowInsets(EdgeInsets())
.listRowSeparator(.hidden)
.listRowBackground(Color.Background)
}
.padding(.vertical, 20)
.padding(.horizontal, 16)
}


private func getNavigationTitle(_ sectionType: SectionType) -> String {
switch sectionType {
case .download:
return "다운로드 순위"
case .popular:
return "사랑받는 단축어"
case .myShortcut:
return "내가 작성한 단축어"
case .myLovingShortcut:
return "좋아요한 단축어"
case .myDownloadShortcut:
return "다운로드한 단축어"
}
}
}

private func getDescriptions(_ sectionType: SectionType) -> String {
switch sectionType {
case .download:
return "1위 ~ 100위"
case .popular:
return "💡 좋아요를 많이 받은 단축어들로 구성되어 있어요!"
case .myShortcut:
return ""
case .myLovingShortcut:
return "💗 내가 좋아요를 누른 단축어를 모아볼 수 있어요"
case .myDownloadShortcut:
return "💫 내가 다운로드한 단축어를 모아볼 수 있어요"
@ViewBuilder
private func makeIndexShortcutCellList(_ shortcuts: [Shortcuts]) -> some View {
ForEach(Array(shortcuts.enumerated()), id: \.offset) { index, shortcut in
let navigationData = NavigationReadShortcutType(shortcut: shortcut,
shortcutID: shortcut.id,
navigationParentView: self.data.navigationParentView)

NavigationLink(value: navigationData) {
ShortcutCell(shortcut: shortcut,
rankNumber: index + 1,
navigationParentView: data.navigationParentView)
.listRowInsets(EdgeInsets())
.listRowSeparator(.hidden)
}
}
}
}
Loading

0 comments on commit ab8ebe5

Please sign in to comment.