Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ enum ImageLiterals {
static var icFollowButton: UIImage {.load(named: "ic_follow_button")}
static var icFollowedButton: UIImage {.load(named: "ic_followed_button")}
static var icShareButton: UIImage {.load(named: "ic_share")}
static var icModify: UIImage {.load(named: "ic_modify")}
static var icRemove: UIImage {.load(named: "ic_remove")}
static var icReport: UIImage {.load(named: "ic_report")}

// img
static var imgBackground: UIImage { .load(named: "img_background") }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Vector.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Vector@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Vector@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Vector.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Vector@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Vector@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Group 9565.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 9565@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 9565@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import FirebaseCore
import FirebaseDynamicLinks
import KakaoSDKShare
import KakaoSDKTemplate
import DropDown

final class CourseDetailVC: UIViewController {

Expand Down Expand Up @@ -195,39 +196,33 @@ extension CourseDetailVC {
@objc func moreButtonDidTap() {
guard let isMyCourse = self.isMyCourse, let uploadedCourseDetailModel = self.uploadedCourseDetailModel else { return }

let cancelAction = UIAlertAction(title: "닫기", style: .cancel, handler: nil)
let items = isMyCourse ? ["수정하기", "삭제하기"] : ["신고하기"]
let imageArray: [UIImage] = isMyCourse ? [ImageLiterals.icModify, ImageLiterals.icRemove] : [ImageLiterals.icReport]

if isMyCourse == true {
let editAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)

let editAction = UIAlertAction(title: "수정하기", style: .default, handler: {(_: UIAlertAction!) in
let courseEditVC = CourseEditVC()
courseEditVC.loadData(model: uploadedCourseDetailModel)
courseEditVC.publicCourseId = self.publicCourseId
self.navigationController?.pushViewController(courseEditVC, animated: false)
})
let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기")
deleteAlertVC.rightButtonTapAction = { [weak self] in
deleteAlertVC.dismiss(animated: false)
self?.deleteCourse()
}
deleteAlertVC.modalPresentationStyle = .overFullScreen
let deleteAction = UIAlertAction(title: "삭제하기", style: .destructive, handler: {(_: UIAlertAction!) in
self.present(deleteAlertVC, animated: false, completion: nil)
})
[ editAction, deleteAction, cancelAction].forEach { editAlertController.addAction($0) }
present(editAlertController, animated: false, completion: nil)
} else {
// 신고폼 올라오는 거(유저아이디가 내가 아닌 경우)
let reportAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let formUrl = NSURL(string: "https://docs.google.com/forms/d/e/1FAIpQLSek2rkClKfGaz1zwTEHX3Oojbq_pbF3ifPYMYezBU0_pe-_Tg/viewform")
let formSafariView: SFSafariViewController = SFSafariViewController(url: formUrl! as URL)
let reportAction = UIAlertAction(title: "신고하기", style: .destructive, handler: {(_: UIAlertAction!) in
self.present(formSafariView, animated: true, completion: nil)
})
[ reportAction, cancelAction ].forEach { reportAlertController.addAction($0) }
present(reportAlertController, animated: true, completion: nil)
let menu = DropDown().then {
$0.anchorView = moreButton
$0.backgroundColor = .w1
$0.bottomOffset = CGPoint(x: -136, y: moreButton.bounds.height - 10)
$0.width = 170
$0.cellHeight = 40
$0.cornerRadius = 12
$0.dismissMode = .onTap
$0.separatorColor = UIColor(hex: "#EBEBEB")
$0.dataSource = items
$0.textFont = .b3
}

menu.customCellConfiguration = { (index: Index, _: String, cell: DropDownCell) -> Void in
let lastDividerLineRemove = UIView(frame: CGRect(origin: CGPoint(x: 0, y: isMyCourse ? 79 : 39), size: CGSize(width: 170, height: 10)))
lastDividerLineRemove.backgroundColor = .white
cell.separatorInset = .zero
cell.dropDownImage.image = imageArray[index]
cell.addSubview(lastDividerLineRemove)
}
Copy link
Collaborator Author

@thingineeer thingineeer Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lastDividerLineRemove 뷰를 통해
팝업 뷰에 보이는 맨 아래 선을 지워 주었습니다.


dropDownTouchAction(menu: menu, uploadedCourseDetailModel: uploadedCourseDetailModel, isMyCourse: isMyCourse)

menu.show()
}

private func pushToCountDownVC() {
Expand Down Expand Up @@ -534,3 +529,45 @@ extension CourseDetailVC {
}
}
}

// MARK: - DropDown

extension CourseDetailVC {
private func dropDownTouchAction(menu: DropDown, uploadedCourseDetailModel: UploadedCourseDetailResponseDto, isMyCourse: Bool) {

DropDown.appearance().textColor = .g1
DropDown.appearance().selectionBackgroundColor = .w1
DropDown.appearance().shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.2)
DropDown.appearance().shadowOpacity = 1
DropDown.appearance().shadowRadius = 10

menu.selectionAction = { [unowned self] (_, item) in
menu.clearSelection()

switch item {
case "수정하기":
let courseEditVC = CourseEditVC()
courseEditVC.loadData(model: uploadedCourseDetailModel)
courseEditVC.publicCourseId = self.publicCourseId
self.navigationController?.pushViewController(courseEditVC, animated: false)
case "삭제하기":
let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기")
deleteAlertVC.modalPresentationStyle = .overFullScreen
deleteAlertVC.rightButtonTapAction = {
deleteAlertVC.dismiss(animated: false)
self.deleteCourse()
self.navigationController?.popViewController(animated: true)
}
self.present(deleteAlertVC, animated: false)
case "신고하기":
if !isMyCourse {
let formUrl = NSURL(string: "https://docs.google.com/forms/d/e/1FAIpQLSek2rkClKfGaz1zwTEHX3Oojbq_pbF3ifPYMYezBU0_pe-_Tg/viewform")
let formSafariView: SFSafariViewController = SFSafariViewController(url: formUrl! as URL)
self.present(formSafariView, animated: true, completion: nil)
}
default:
self.showToast(message: "없는 명령어 입니다.")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ extension CourseEditVC {
case .success(let result):
let status = result.statusCode
if 200..<300 ~= status {
self.showToast(message: "게시글 수정이 완료되었어요")
self.navigationController?.popViewController(animated: true) /// 추가한 부분 수정 필요
showToast(message: "게시글 수정이 완료되었어요")
}
if status >= 400 {
print("400 error")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ extension UploadedCourseInfoVC {
let responseDto = try result.map(BaseResponse<PickedMapListResponseDto>.self)
guard let data = responseDto.data else { return }
self.setData(courseList: data.publicCourses)
UploadedCourseInfoCollectionView.reloadData()
} catch {
print(error.localizedDescription)
}
Expand Down