Skip to content

Commit

Permalink
Merge pull request #34 from GPle-Team/33-CodeRefactoring-ErrorEdit
Browse files Browse the repository at this point in the history
🔀 :: [#33] 리팩토링 및 오류 수정
  • Loading branch information
Xixn2 authored Dec 29, 2024
2 parents a1d10be + 4b4db25 commit 1186255
Show file tree
Hide file tree
Showing 13 changed files with 299 additions and 327 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ Derived/
*.xcworkspace
*.xcodeproj
master.key
Package.resolved
2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[tools]
tuist = "4.9.0"
tuist = "4.32.0"

2 changes: 1 addition & 1 deletion Projects/App/Sources/Application/GPleApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwiftUI
struct GPleApp: App {
var body: some Scene {
WindowGroup {
MainView(postViewModel: PostViewModel())
SplashView()
}
}
}
25 changes: 10 additions & 15 deletions Projects/App/Sources/Feature/DetailFeature/Sources/DetailView.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import SwiftUI

struct DetailView: View {
@StateObject var viewModel: DetailViewModel
@State private var topNavigationState: Bool = false
@State private var emojiName: [String] = ["heart", "congrats", "thumbsUp", "thinking", "poop", "china"]
@State private var emojiServerName: [String] = ["HEART", "CONGRATUATION", "THUMBSUP", "THINKING", "POOP", "CHINA"]
@State private var emojiStates: [Int] = [0, 2, 3, 400, 500, 600]
@State private var test: [Bool] = [false, false, false, false, false, false]
@State private var graySmileState: Bool = false
@Environment(\.dismiss) private var dismiss
@StateObject var postViewModel: PostViewModel
Expand All @@ -23,6 +20,7 @@ struct DetailView: View {
@State public var checkEmojiList: [Bool] = []
@State public var createTime: String = ""
@State public var topNavigationBar: Bool = true
@State private var selectedIndex = 0

var body: some View {
NavigationStack {
Expand Down Expand Up @@ -66,12 +64,11 @@ struct DetailView: View {
.font(GPleFontFamily.Pretendard.regular.swiftUIFont(size: 14))
.foregroundStyle(GPleAsset.Color.gray800.swiftUIColor)


Spacer()
}
.padding(.top, 8)

TabView(selection: $viewModel.imageCount) {
TabView(selection: $selectedIndex) {
ForEach(imageUrl.indices, id: \.self) { index in
if let imageUrl = URL(string: imageUrl[index]) {
AsyncImage(url: imageUrl) { image in
Expand All @@ -96,7 +93,6 @@ struct DetailView: View {
.padding(.top, 16)
.padding(.leading, 16)


HStack(spacing: 8) {
ForEach(tagList.indices, id: \.self) { tag in
Text("@\(tagList[tag].name)")
Expand All @@ -107,7 +103,6 @@ struct DetailView: View {
.padding(.top, 6)
.padding(.leading, 16)


let dateString = createTime.split(separator: "T").first
if let dateString = dateString {
let components = dateString.split(separator: "-")
Expand Down Expand Up @@ -155,12 +150,14 @@ struct DetailView: View {
postViewModel.postEmoji { success in
print("\(emojiName[tag]) 성공")

if checkEmojiList[tag] == true {
emojiList[tag] -= 1
checkEmojiList[tag].toggle()
} else {
emojiList[tag] = 1
checkEmojiList[tag].toggle()
if success {
if checkEmojiList[tag] == true {
emojiList[tag] -= 1
checkEmojiList[tag].toggle()
} else {
emojiList[tag] = 1
checkEmojiList[tag].toggle()
}
}
}
}) {
Expand All @@ -177,11 +174,9 @@ struct DetailView: View {
.padding(.leading, 20)
.padding(.top, 10)
}

}
}


Spacer()
}
.padding(.top, 8)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct LocationPostView: View {
case "GYM":
ForEach(viewModel.gymPostList) { post in
DetailView(
viewModel: DetailViewModel(),
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
Expand Down Expand Up @@ -62,7 +61,6 @@ struct LocationPostView: View {
case "HOME":
ForEach(viewModel.homePostList) { post in
DetailView(
viewModel: DetailViewModel(),
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
Expand Down Expand Up @@ -90,7 +88,6 @@ struct LocationPostView: View {
case "PLAYGROUND":
ForEach(viewModel.playgroundPostList) { post in
DetailView(
viewModel: DetailViewModel(),
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
Expand Down Expand Up @@ -118,7 +115,6 @@ struct LocationPostView: View {
case "DOMITORY":
ForEach(viewModel.domitoryPostList) { post in
DetailView(
viewModel: DetailViewModel(),
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
Expand Down Expand Up @@ -146,7 +142,6 @@ struct LocationPostView: View {
case "WALKING_TRAIL":
ForEach(viewModel.walkingTrailPostList) { post in
DetailView(
viewModel: DetailViewModel(),
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
Expand Down
Loading

0 comments on commit 1186255

Please sign in to comment.