Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] #318 - 콕 찌르기 메인 화면 UI #323

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ public enum AmplitudeEventType: String {
case review = "click_review"
case faq = "click_faq"
case playgroundCommunity = "click_playground_community"
case poke = "click_poke"
}
1 change: 1 addition & 0 deletions SOPT-iOS/Projects/Core/Sources/Enum/ServiceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ public enum ServiceType {

public enum AppServiceType {
case soptamp
case poke
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public extension AppServiceType {
var toAmplitudeEventType: AmplitudeEventType {
switch self {
case .soptamp: return .soptamp
case .poke: return .poke
}
}
}
9 changes: 9 additions & 0 deletions SOPT-iOS/Projects/Core/Sources/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ public struct I18N {
public struct WebView {
public static let close = "닫기"
}

public struct Poke {
public static let poke = "콕 찌르기"
public static let someonePokedMe = "누가 나를 찔렀어요"
public static let pokeMyFriends = "내 친구를 찔러보세요"
public static let pokeNearbyFriends = "내 친구의 친구를 찔러보세요"
public static let emptyFriendDescription = "아직 없어요 T.T\n내 친구가 더 많은 친구가 생길 때까지 기다려주세요"
public static let refreshGuide = "화면을 밑으로 당기면\n다른 친구를 볼 수 있어요"
}
}

extension I18N {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public protocol MainCoordinatable {
var onNoticeButtonTap: (() -> Void)? { get set }
var onMyPageButtonTap: ((UserType) -> Void)? { get set }
var onSoptamp: (() -> Void)? { get set }
var onPoke: (() -> Void)? { get set }
var onSafari: ((String) -> Void)? { get set }
var onAttendance: (() -> Void)? { get set }
var onNeedSignIn: (() -> Void)? { get set }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum MainCoordinatorDestination {
case myPage(UserType)
case attendance
case stamp
case poke
case signIn
}
public protocol MainCoordinatorOutput {
Expand Down Expand Up @@ -53,6 +54,9 @@ final class MainCoordinator: DefaultMainCoordinator {
main.vm.onSoptamp = { [weak self] in
self?.requestCoordinating?(.stamp)
}
main.vm.onPoke = { [weak self] in
self?.requestCoordinating?(.poke)
}
main.vm.onAttendance = { [weak self] in
self?.requestCoordinating?(.attendance)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class MainViewModel: MainViewModelType {
var userType: UserType = .visitor
var mainServiceList: [ServiceType] = [.officialHomepage, .review, .project]
var otherServiceList: [ServiceType] = [.instagram, .youtube, .faq]
var appServiceList: [AppServiceType] = [.soptamp]
var appServiceList: [AppServiceType] = [.poke, .soptamp]
var userMainInfo: UserMainInfoModel?
var mainDescription: MainDescriptionModel = .defaultDescription

Expand Down Expand Up @@ -56,6 +56,7 @@ public class MainViewModel: MainViewModelType {
public var onSafari: ((String) -> Void)?
public var onAttendance: (() -> Void)?
public var onSoptamp: (() -> Void)?
public var onPoke: (() -> Void)?
public var onNeedSignIn: (() -> Void)?

// MARK: - init
Expand Down Expand Up @@ -187,8 +188,10 @@ extension MainViewModel {
guard userType != .visitor else { return }
guard let service = appServiceList[safe: indexPath.item] else { return }
self.trackAmplitude(event: service.toAmplitudeEventType)

onSoptamp?()
switch service {
case .soptamp: onSoptamp?()
case .poke: onPoke?()
}
default: break
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,26 @@ extension AppServiceType {
switch self {
case .soptamp:
return DSKitAsset.Assets.imgSoptamp.image
case .poke:
return DSKitAsset.Assets.imgPoke.image
}
}

var title: String {
switch self {
case .soptamp:
return I18N.Main.AppService.soptamp
case .poke:
return I18N.Poke.poke
}
}

var backgroundColor: UIColor {
switch self {
case .soptamp:
return DSKitAsset.Colors.gray800.color
case .poke:
return DSKitAsset.Colors.gray800.color
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// PokeFeatureBuildable.swift
// PokeFeatureInterface
//
// Created by sejin on 12/7/23.
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import Foundation

import Domain

public protocol PokeFeatureBuildable {
func makePokeMain() -> NotificationDetailPresentable
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// PokeMainPresentable.swift
// PokeFeatureInterface
//
// Created by sejin on 12/7/23.
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import BaseFeatureDependency
import Core
import Domain

public protocol PokeMainViewControllable: ViewControllable { }

public protocol PokeMainCoordinatable {
var onNaviBackTap: (() -> Void)? { get set }
}

public typealias PokeMainViewModelType = ViewModelType & PokeMainCoordinatable
public typealias NotificationDetailPresentable = (vc: PokeMainViewControllable, vm: any PokeMainViewModelType)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public final class PokeProfileCardView: UIView {

// MARK: - Properties

lazy var kokButtonTap: Driver<Void> = kokButton.tap
typealias UserId = String

lazy var kokButtonTap: Driver<UserId?> = kokButton.tap.map { self.userId }.asDriver()

var userId: String?

// MARK: - UI Components

Expand Down Expand Up @@ -80,6 +84,10 @@ public final class PokeProfileCardView: UIView {
make.width.equalTo(120)
}

labelStackView.snp.makeConstraints { make in
make.height.equalTo(38)
}

containerStackView.snp.makeConstraints { make in
make.top.equalToSuperview().inset(4)
make.bottom.equalToSuperview().inset(4)
Expand All @@ -95,13 +103,11 @@ public final class PokeProfileCardView: UIView {

// MARK: - Methods

@discardableResult
func setData(imageURL: String, name: String, part: String) -> Self {
self.profileImageView.setImage(with: imageURL)
self.nameLabel.text = name
self.partLabel.text = part

return self
func setData(with model: ProfileCardContentModel) {
self.userId = model.userId
self.profileImageView.setImage(with: model.avatarUrl)
self.nameLabel.text = model.name
self.partLabel.text = model.partInfomation
}

@discardableResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ public final class PokeProfileListView: UIView {

// MARK: - Properties

lazy var kokButtonTap: Driver<Void> = kokButton.tap
typealias UserId = String

lazy var kokButtonTap: Driver<UserId?> = kokButton.tap.map { self.userId }.asDriver()

var viewType: ProfileListType

var userId: String?

// MARK: - UI Components

private let profileImageView = PokeProfileImageView()
Expand Down Expand Up @@ -167,12 +171,12 @@ public final class PokeProfileListView: UIView {
// MARK: - Methods

@discardableResult
func setData(imageURL: String, relation: PokeRelation, name: String, part: String, kokCount: Int) -> Self {
self.profileImageView.setImage(with: imageURL, relation: relation)
self.nameLabel.text = name
self.partLabel.text = part
self.kokCountLabel.text = "\(kokCount)콕"

func setData(with model: ProfileListContentModel) -> Self {
self.userId = model.userId
self.profileImageView.setImage(with: model.avatarUrl, relation: model.relation)
self.nameLabel.text = model.name
self.partLabel.text = model.partInfomation
self.kokCountLabel.text = "\(model.pokeCount)콕"
return self
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// PokeBuilder.swift
// PokeFeatureInterface
//
// Created by sejin on 12/7/23.
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import Core
import Domain
@_exported import PokeFeatureInterface

public final class PokeBuilder {
public init() {}
}

extension PokeBuilder: PokeFeatureBuildable {
public func makePokeMain() -> PokeFeatureInterface.NotificationDetailPresentable {
let viewModel = PokeMainViewModel()
let pokeMainVC = PokeMainVC(viewModel: viewModel)
return (pokeMainVC, viewModel)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// PokeCoordinator.swift
// PokeFeature
//
// Created by sejin on 12/7/23.
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import UIKit

import Core
import BaseFeatureDependency
import PokeFeatureInterface
import Domain

public
final class PokeCoordinator: DefaultCoordinator {
public var finishFlow: (() -> Void)?

private let factory: PokeFeatureBuildable
private let router: Router
private weak var rootController: UINavigationController?

public init(router: Router, factory: PokeFeatureBuildable) {
self.router = router
self.factory = factory
}

public override func start() {
showPokeMain()
}

private func showPokeMain() {
var pokeMain = factory.makePokeMain()

pokeMain.vm.onNaviBackTap = { [weak self] in
self?.router.dismissModule(animated: true)
self?.finishFlow?()
}

rootController = pokeMain.vc.asNavigationController
router.present(rootController, animated: true, modalPresentationSytle: .overFullScreen)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// ProfileCardContentModel.swift
// PokeFeature
//
// Created by sejin on 12/8/23.
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import Foundation

public struct ProfileCardContentModel {
let userId: String
let avatarUrl: String
let name: String
let partInfomation: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ProfileListContentModel.swift
// PokeFeature
//
// Created by sejin on 12/8/23.
// Copyright © 2023 SOPT-iOS. All rights reserved.
//

import Foundation

public struct ProfileListContentModel {
let userId: String
let avatarUrl: String
let name: String
let partInfomation: String
let pokeCount: Int
let relation: PokeRelation
}
Loading