Skip to content

Commit

Permalink
✨ 튜토리얼 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
samsung-ga committed Sep 2, 2022
1 parent b4738b4 commit 6874593
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "dialog_tutorial.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
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,12 @@
{
"images" : [
{
"filename" : "abc.png",
"idiom" : "universal"
}
],
"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,12 @@
{
"images" : [
{
"filename" : "zzz.png",
"idiom" : "universal"
}
],
"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.
5 changes: 4 additions & 1 deletion Projects/DesignSystem/Sources/Assets/AssetImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ public enum Assets: String {
case ic_star
case good_luck
case ic_union

case dialog_tutorial
case tutorial_8plus
case tutorial_11promax

public var image: UIImage? {
let bundle = Bundle(identifier: "kr.mash-up.DesignSystem")
return .init(named: self.rawValue, in: bundle, with: nil)
Expand Down
128 changes: 128 additions & 0 deletions Projects/Features/GuestList/Targets/Scene/Sources/DeviceManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
//
// DeviceManager.swift
// GuestListScene
//
// Created by Woody on 2022/09/03.
// Copyright © 2022 kr.mash-up. All rights reserved.
//

import UIKit

class DeviceManager {
// 디바이스 OS 버전 조회
static func getOsVersion() -> String {
return UIDevice.current.systemVersion
}

// 디바이스 모델 조회
static func getModel() -> String {
var systemInfo = utsname()
uname(&systemInfo)
let machineMirror = Mirror(reflecting: systemInfo.machine)
let model = machineMirror.children.reduce("") { identifier, element in
guard let value = element.value as? Int8, value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}
return model
}

// 디바이스 모델명 조회
static func getModelName() -> String {
var systemInfo = utsname()
uname(&systemInfo)
let machineMirror = Mirror(reflecting: systemInfo.machine)
let model = machineMirror.children.reduce("") { identifier, element in
guard let value = element.value as? Int8, value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}

switch model {
// Simulator
case "i386", "x86_64": return "Simulator"
// iPod
case "iPod1,1": return "iPod Touch"
case "iPod2,1", "iPod3,1", "iPod4,1": return "iPod Touch"
case "iPod5,1", "iPod7,1": return "iPod Touch"
// iPad
case "iPad1,1": return "iPad"
case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4":return "iPad 2"
case "iPad2,5", "iPad2,6", "iPad2,7": return "iPad Mini"
case "iPad3,1", "iPad3,2", "iPad3,3": return "iPad 3"
case "iPad3,4", "iPad3,5", "iPad3,6": return "iPad 4"
case "iPad4,1", "iPad4,2", "iPad4,3": return "iPad Air"
case "iPad4,4", "iPad4,5", "iPad4,6": return "iPad Mini 2"
case "iPad4,7", "iPad4,8", "iPad4,9": return "iPad Mini 3"
case "iPad5,1", "iPad5,2": return "iPad Mini 4"
case "iPad5,3", "iPad5,4": return "iPad Air 2"
case "iPad6,11", "iPad6,12": return "iPad 5"
case "iPad6,3", "iPad6,4": return "iPad Pro 9.7 Inch"
case "iPad6,7", "iPad6,8": return "iPad Pro 12.9 Inch"
case "iPad7,1", "iPad7,2": return "iPad Pro 12.9 Inch 2. Generation"
case "iPad7,3", "iPad7,4": return "iPad Pro 10.5 Inch"
// iPhone
case "iPhone1,1", "iPhone1,2", "iPhone2,1": return "iPhone"
case "iPhone3,1", "iPhone3,2", "iPhone3,3": return "iPhone 4"
case "iPhone4,1": return "iPhone 4s"
case "iPhone5,1", "iPhone5,2": return "iPhone 5"
case "iPhone5,3", "iPhone5,4": return "iPhone 5c"
case "iPhone6,1", "iPhone6,2": return "iPhone 5s"
case "iPhone7,1": return "iPhone 6 Plus"
case "iPhone7,2": return "iPhone 6"
case "iPhone8,1": return "iPhone 6s"
case "iPhone8,2": return "iPhone 6s Plus"
case "iPhone8,4": return "iPhone SE"
case "iPhone9,1", "iPhone9,3": return "iPhone 7"
case "iPhone9,2", "iPhone9,4": return "iPhone 7 Plus"
case "iPhone10,1", "iPhone10,4": return "iPhone 8"
case "iPhone10,2", "iPhone10,5": return "iPhone 8 Plus"
case "iPhone10,3", "iPhone10,6": return "iPhone X"
case "iPhone11,2": return "iPhone XS"
case "iPhone11,4", "iPhone11,6": return "iPhone XS Max"
case "iPhone11,8": return "iPhone XR"
case "iPhone12,1": return "iPhone 11"
case "iPhone12,3": return "iPhone 11 Pro"
case "iPhone12,5": return "iPhone 11 Pro Max"
case "iPhone12,8": return "iPhone SE 2nd Gen"
case "iPhone13,1": return "iPhone 12 Mini"
case "iPhone13,2": return "iPhone 12"
case "iPhone13,3": return "iPhone 12 Pro"
case "iPhone13,4": return "iPhone 12 Pro Max"
default: return model
}
}

enum DeviceRatio {
case _9_19
case _9_16
}
static func getDeviceKind() -> DeviceRatio {
let model = DeviceManager.getModel()

/*
iPhone 8+
and 7+, 6s+, 6+
Phone SE (gen 3)
and SE (gen 2), 8, 7, 6s, 6
*/

if model == "iPhone10,2" || // iPhone 8+
model == "iPhone10,5" || // iPhone 8+
model == "iPhone9,2" || // iPhone 7+
model == "iPhone9,4" || // iPhone 7+
model == "iPhone8,1" || // iPhone 6s
model == "iPhone8,2" || // iPhone 6s+
model == "iPhone12,8" || // iPhone SE 2nd Gen
model == "iPhone9,1" || // iphone 7
model == "iPhone9,3" || // iphone 7
model == "iPhone10,1" || // iphone 8
model == "iPhone10,4" || // iphone 8
model == "iPhone7,2" ||
model == "iPhone8,1" // iphone 6
{
return ._9_16
}

return ._9_19
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,16 @@ public class GuestListViewController: UIViewController, GuestListDisplayLogic {
return v
}()

// private lazy var refreshGuestListButton: UIButton = {
// let v = UIButton(type: .system)
// v.setImage(<#T##image: UIImage?##UIImage?#>, for: <#T##UIControl.State#>)
// v.setTitleColor(Pallete.Light.grey500.color, for: .normal)
// v.setTitle("결혼식 변경", for: .normal)
// v.layer.cornerRadius = 8
// v.layer.borderWidth = 1
// v.layer.borderColor = Pallete.Light.grey100.color?.cgColor
// v.isHidden = true
// v.addTarget(self, action: #selector(refreshGuestListButtonDidTap), for: .touchUpInside)
// return v
// }()
lazy var tutorialView: UIImageView = {
let v = UIImageView(asset: .tutorial_11promax)
if DeviceManager.getDeviceKind() == ._9_16 {
v.image = .create(.tutorial_8plus)
}
v.contentMode = .scaleAspectFill
v.isUserInteractionEnabled = true
v.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tutorialViewDidTap)))
return v
}()

private func getGuestCardViewColor(for index: Int) -> UIColor? {
switch index % 4 {
Expand Down Expand Up @@ -193,10 +191,18 @@ public class GuestListViewController: UIViewController, GuestListDisplayLogic {
router?.routeToMyProfile()
}

// @objc
// private func refreshGuestListButtonDidTap() {
// interactor?.fetchGuests()
// }
@objc
func tutorialViewDidTap() {
UIView.animate(
withDuration: 0.22,
delay: 0,
options: .allowAnimatedContent,
animations: { [weak self] in
self?.tutorialView.alpha = 0
}, completion: { [weak self] _ in
self?.tutorialView.isHidden = true
})
}

// MARK: View lifecycle

Expand All @@ -219,7 +225,19 @@ public class GuestListViewController: UIViewController, GuestListDisplayLogic {
return self?.guestCardView
}
}


private func judgeTutorial() {
if UserDefaults.standard.bool(forKey: "tutorial") == false {
UserDefaults.standard.set(true, forKey: "tutorial")
self.view.addSubview(self.tutorialView)
self.tutorialView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
self.tutorialView.alpha = 1
self.tutorialView.isHidden = false
}
}

private func setUI() {
self.view.backgroundColor = Pallete.Light.background.color

Expand All @@ -230,6 +248,7 @@ public class GuestListViewController: UIViewController, GuestListDisplayLogic {
self.view.addSubview(self.secondTitleLabel)
self.view.addSubview(self.reportButton)
self.view.addSubview(self.emptyView)

self.navigationView.addSubview(self.likeListButton)
self.navigationView.addSubview(self.myInfoButton)

Expand Down Expand Up @@ -276,10 +295,6 @@ public class GuestListViewController: UIViewController, GuestListDisplayLogic {
make.leading.trailing.equalToSuperview()
make.bottom.equalTo(self.view.safeAreaLayoutGuide)
}
// self.refreshGuestListButton.snp.makeConstraints { make in
// make.top.equalTo(self.emptyView.imageView.snp.bottom).offset(29)
// make.centerX.equalToSuperview()
// }
}

private func setNotificationCenter() {
Expand Down Expand Up @@ -334,8 +349,8 @@ public class GuestListViewController: UIViewController, GuestListDisplayLogic {
self.firstTitleLabel.isHidden = viewModel.guestCardViewModels.isEmpty
self.secondTitleLabel.isHidden = viewModel.guestCardViewModels.isEmpty
self.emptyView.isHidden = !viewModel.guestCardViewModels.isEmpty
// self.refreshGuestListButton.isHidden = !viewModel.guestCardViewModels.isEmpty
self.reportButton.isHidden = viewModel.guestCardViewModels.isEmpty
self.judgeTutorial()
}
}

Expand Down
2 changes: 1 addition & 1 deletion Projects/Marryting/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ProjectDescriptionHelpers

let infoPlist: [String: InfoPlist.Value] = [
"CFBundleDevelopmentRegion": "ko_KR",
"CFBundleShortVersionString": "1.0.2",
"CFBundleShortVersionString": "1.0.3",
"CFBundleVersion": "1",
"CFBundleDisplayName": "메리팅",
"UIMainStoryboardFile": "",
Expand Down

0 comments on commit 6874593

Please sign in to comment.