Skip to content

Commit

Permalink
[Feat] Runnect#144 - git pull origin develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwogus0128 committed May 19, 2023
2 parents 78523bd + 6047c72 commit 3735004
Show file tree
Hide file tree
Showing 25 changed files with 673 additions and 109 deletions.
6 changes: 3 additions & 3 deletions Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ enum ImageLiterals {
static var icLogoCircle: UIImage { .load(named: "ic_logo_circle") }
static var icMore: UIImage { .load(named: "ic_more") }
static var icPlus: UIImage { .load(named: "ic_plus") }
static var icFrameEdit: UIImage {
.load(named: "ic_frame_edit")
}

// img
static var imgBackground: UIImage { .load(named: "img_background") }
Expand Down Expand Up @@ -74,6 +71,9 @@ enum ImageLiterals {
static var imgSpaceship: UIImage { .load(named: "img_spaceship") }
static var imgAppIcon: UIImage { .load(named: "img_app_icon") }
static var imgAd: UIImage { .load(named: "img_ad") }
static var imgBanner1: UIImage { .load(named: "img_banner1") }
static var imgBanner2: UIImage { .load(named: "img_banner2") }
static var imgBanner3: UIImage { .load(named: "img_banner3") }
static var imgAppleLogin: UIImage { .load(named: "img_apple_login")}
static var imgKakaoLogin: UIImage { .load(named: "img_kakao_login")}
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"images" : [
{
"filename" : "Frame 2064.png",
"filename" : "ios 1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame 2064@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame 2064@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
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,21 @@
{
"images" : [
{
"filename" : "ios 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "ios 3.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct UploadedCourseDetailResponseDto: Codable {

struct UploadUser: Codable {
let nickname: String
let level: Int
let level: String
let image: String
let isNowUser: Bool?
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum PublicCourseRouter {
case getUploadedCourseDetail(publicCourseId: Int)
case getUploadedCourseInfo
case updatePublicCourse(publicCourseId: Int, editCourseRequestDto: EditCourseRequestDto)
case deleteUploadedCourse(publicCourseIdList: [Int])
}

extension PublicCourseRouter: TargetType {
Expand All @@ -38,6 +39,8 @@ extension PublicCourseRouter: TargetType {
return "/public-course/user"
case .updatePublicCourse(let publicCourseId, _):
return "/public-course/\(publicCourseId)"
case .deleteUploadedCourse:
return "/public-course"
}
}

Expand All @@ -49,6 +52,8 @@ extension PublicCourseRouter: TargetType {
return .post
case .updatePublicCourse:
return .patch
case .deleteUploadedCourse:
return .put
}
}

Expand All @@ -66,6 +71,8 @@ extension PublicCourseRouter: TargetType {
return .requestParameters(parameters: try param.asParameter(), encoding: JSONEncoding.default)
} catch {
fatalError("Encoding 실패")}
case .deleteUploadedCourse(let publicCourseIdList):
return .requestParameters(parameters: ["publicCourseIdList": publicCourseIdList], encoding: JSONEncoding.default)
case .getCourseData, .getUploadedCourseDetail, .getUploadedCourseInfo:
return .requestPlain
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ extension CourseDetailVC {
}

@objc func startButtonDidTap() {
guard handleVisitor() else { return }
guard let courseId = self.courseId else { return }
getCourseDetailWithPath(courseId: courseId)
}
Expand All @@ -147,14 +148,14 @@ extension CourseDetailVC {
let editAction = UIAlertAction(title: "수정하기", style: .default, handler: {(_: UIAlertAction!) in
self.navigationController?.pushViewController(courseEditVC, animated: false)
})
let deleteVC = RNAlertVC(description: "코스를 정말로 삭제하시겠어요?")
deleteVC.rightButtonTapAction = { [weak self] in
deleteVC.dismiss(animated: false)
let deleteAlertVC = RNAlertVC(description: "러닝 기록을 정말로 삭제하시겠어요?").setButtonTitle("취소", "삭제하기")
deleteAlertVC.rightButtonTapAction = { [weak self] in
deleteAlertVC.dismiss(animated: false)
self?.deleteCourse()
}
deleteVC.modalPresentationStyle = .overFullScreen
deleteAlertVC.modalPresentationStyle = .overFullScreen
let deleteAction = UIAlertAction(title: "삭제하기", style: .destructive, handler: {(_: UIAlertAction!) in
self.present(deleteVC, animated: false, completion: nil)})
self.present(deleteAlertVC, animated: false, completion: nil)})
[ editAction, deleteAction, cancelAction].forEach { editAlertController.addAction($0) }
present(editAlertController, animated: false, completion: nil)
} else {
Expand Down Expand Up @@ -204,7 +205,7 @@ extension CourseDetailVC {
self.uploadedCourseDetailModel = model
self.mapImageView.setImage(with: model.publicCourse.image)
self.profileImageView.image = GoalRewardInfoModel.stampNameImageDictionary[model.user.image]
self.profileNameLabel.text = model.user.nickname
self.profileNameLabel.text = model.user.nickname
self.runningLevelLabel.text = "Lv. \(model.user.level)"
self.courseTitleLabel.text = model.publicCourse.title
self.isMyCourse = model.user.isNowUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Created by YEONOO on 2023/05/06.
//


import UIKit

import SnapKit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,34 @@ import Then

class AdImageCollectionViewCell: UICollectionViewCell {

// MARK: - collectionview

private lazy var bannerCollectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = .clear
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.isScrollEnabled = true
collectionView.showsVerticalScrollIndicator = false
return collectionView
}()
// MARK: - Constants

final let collectionViewInset = UIEdgeInsets(top: 28, left: 16, bottom: 28, right: 16)

// MARK: - UI Components
private let adImageView = UIImageView().then {
$0.image = ImageLiterals.imgAd
}
var imgBanners: [UIImage] = [ImageLiterals.imgBanner1, ImageLiterals.imgBanner2, ImageLiterals.imgBanner3]
var currentPage: Int = 0
private var timer: Timer?

private var pageControl = UIPageControl()
// MARK: - Life cycle
override init(frame: CGRect) {
super.init(frame: frame)
layout()
setDelegate()
startBannerSlide()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
Expand All @@ -28,14 +48,89 @@ class AdImageCollectionViewCell: UICollectionViewCell {
// MARK: - Extensions

extension AdImageCollectionViewCell {
private func setDelegate() {
bannerCollectionView.delegate = self
bannerCollectionView.dataSource = self
bannerCollectionView.isPagingEnabled = true
bannerCollectionView.showsHorizontalScrollIndicator = false
bannerCollectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "BannerCell")
}
func startBannerSlide() {

// 초기 페이지 설정
currentPage = imgBanners.count
timer = Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(animateBannerSlide), userInfo: nil, repeats: true)

// 페이지 컨트롤 설정
pageControl.currentPage = 0
pageControl.numberOfPages = imgBanners.count
pageControl.pageIndicatorTintColor = .lightGray // 페이지를 암시하는 동그란 점의 색상
pageControl.currentPageIndicatorTintColor = .white
}
@objc func animateBannerSlide() {
currentPage += 1

if currentPage >= imgBanners.count {
currentPage = 0
}

let indexPath = IndexPath(item: currentPage, section: 0)
bannerCollectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)

pageControl.currentPage = currentPage
}

// 페이지 컨트롤 업데이트
func updatePageControl() {
let currentIndex = currentPage % imgBanners.count
pageControl.currentPage = currentIndex
}

// MARK: - Layout Helpers

func layout() {
contentView.backgroundColor = .clear
contentView.addSubview(adImageView)
adImageView.snp.makeConstraints { make in
contentView.addSubview(bannerCollectionView)
contentView.addSubview(pageControl)
bannerCollectionView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
pageControl.snp.makeConstraints { make in
make.centerX.equalTo(self)
make.bottom.equalTo(bannerCollectionView.snp.bottom)
}
}
}

// MARK: - UICollectionViewDelegate, UICollectionViewDataSource

extension AdImageCollectionViewCell: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return imgBanners.count*3
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = bannerCollectionView.dequeueReusableCell(withReuseIdentifier: "BannerCell", for: indexPath)

// 배너 이미지 설정
let imageIndex = indexPath.item % imgBanners.count
let imageView = UIImageView(frame: cell.contentView.bounds)
imageView.image = imgBanners[imageIndex]
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true
cell.contentView.addSubviews(imageView)
return cell
}
}

// MARK: - UICollectionViewDelegateFlowLayout

extension AdImageCollectionViewCell: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return self.frame.size
}

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SnapKit
import Then

class MapCollectionViewCell: UICollectionViewCell {

// MARK: - collectionview

private lazy var mapCollectionView: UICollectionView = {
Expand All @@ -38,7 +38,6 @@ class MapCollectionViewCell: UICollectionViewCell {
layout()
register()
setDelegate()
layout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class TitleCollectionViewCell: UICollectionViewCell {

private let mainLabel: UILabel = {
let label = UILabel()
label.text = "코스 추천"
label.text = "이런 코스 어때요?"
label.font = UIFont.h4
label.textColor = UIColor.g1
return label
}()
private let subLabel: UILabel = {
let label = UILabel()
label.text = "새로운 코스를 발견해나가요"
label.text = "상쾌한 하루를 시작하게 만들어주는 러닝코스"
label.font = UIFont.b6
label.textColor = UIColor.g1
return label
Expand Down
Loading

0 comments on commit 3735004

Please sign in to comment.