Skip to content

Commit

Permalink
[Feat] #231 - 공통 모달 컨텐츠 변경
Browse files Browse the repository at this point in the history
[Feat] #231 - 공통 모달 컨텐츠 변경
  • Loading branch information
yungu0010 authored Feb 18, 2024
2 parents 50fe52f + 63e9e49 commit d007877
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 65 deletions.
14 changes: 7 additions & 7 deletions iOS-NOTTODO/iOS-NOTTODO.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
09A1465F2A192C4900DDC308 /* WeekMissionResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09A1465E2A192C4900DDC308 /* WeekMissionResponseDTO.swift */; };
09A146652A1964B500DDC308 /* AddAnotherDayResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09A146642A19649A00DDC308 /* AddAnotherDayResponseDTO.swift */; };
09C8602D2AB14B4800C4F4B1 /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 09C8602C2AB14B4800C4F4B1 /* FSCalendar */; };
09CF56042B09F23800526C8C /* HomeDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09CF56032B09F23800526C8C /* HomeDataSource.swift */; };
09CF56022B09E98A00526C8C /* DetailAchieveHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09CF56012B09E98A00526C8C /* DetailAchieveHeaderView.swift */; };
09CF56042B09F23800526C8C /* HomeDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09CF56032B09F23800526C8C /* HomeDataSource.swift */; };
09DCCD1F2A18ED76003DCF8A /* DailyMissionResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09DCCD1E2A18ED76003DCF8A /* DailyMissionResponseDTO.swift */; };
09DCCD212A18EF43003DCF8A /* HomeSevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09DCCD202A18EF43003DCF8A /* HomeSevice.swift */; };
09DCCD232A18EFB0003DCF8A /* HomeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09DCCD222A18EFB0003DCF8A /* HomeAPI.swift */; };
Expand Down Expand Up @@ -212,8 +212,8 @@
099FC98829B3233D005B37E6 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; };
09A1465E2A192C4900DDC308 /* WeekMissionResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekMissionResponseDTO.swift; sourceTree = "<group>"; };
09A146642A19649A00DDC308 /* AddAnotherDayResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAnotherDayResponseDTO.swift; sourceTree = "<group>"; };
09CF56032B09F23800526C8C /* HomeDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeDataSource.swift; sourceTree = "<group>"; };
09CF56012B09E98A00526C8C /* DetailAchieveHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailAchieveHeaderView.swift; sourceTree = "<group>"; };
09CF56032B09F23800526C8C /* HomeDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeDataSource.swift; sourceTree = "<group>"; };
09DCCD1E2A18ED76003DCF8A /* DailyMissionResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyMissionResponseDTO.swift; sourceTree = "<group>"; };
09DCCD202A18EF43003DCF8A /* HomeSevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeSevice.swift; sourceTree = "<group>"; };
09DCCD222A18EFB0003DCF8A /* HomeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeAPI.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1587,7 +1587,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CQJ9UKUU35;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -1602,7 +1602,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = "nottodo.iOS-NOTTODO";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1625,7 +1625,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = CQJ9UKUU35;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -1640,7 +1640,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
MARKETING_VERSION = 1.0.3;
PRODUCT_BUNDLE_IDENTIFIER = "nottodo.iOS-NOTTODO";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1846,4 +1846,4 @@
/* End XCSwiftPackageProductDependency section */
};
rootObject = 3B027A6C299C31B500BEB65C /* Project object */;
}
}
6 changes: 3 additions & 3 deletions iOS-NOTTODO/iOS-NOTTODO/Global/Enum/MyInfoURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import SafariServices

enum MyInfoURL {
case guid, faq, notice, question, service, personalInfo, googleForm
case guid, faq, notice, question, service, personalInfo, commonAlarmModal
var url: String {
switch self {
case .guid:
Expand All @@ -25,8 +25,8 @@ enum MyInfoURL {
return "https://teamnottodo.notion.site/81594da775614d23900cdb2475eadb73?pvs=4"
case .personalInfo:
return "https://teamnottodo.notion.site/5af34df7da3649fc941312c5f533c1eb"
case .googleForm:
return "https://forms.gle/gwBJ4hL4bCTjXRTP6"
case .commonAlarmModal:
return "https://open.kakao.com/o/gbrW727f"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ extension UIImage {
static var icToastError: UIImage { UIImage(named: "ic_toast_error")! }
static var icBell: UIImage { UIImage(named: "ic_bell")! }
static var icCircle: UIImage { UIImage(named: "acceptCircle")! }
static var icStarbucks: UIImage { UIImage(named: "ic_starbucks")! }

// image

static var imgCreateTip: UIImage { UIImage(named: "img_create_tip")! }
static var imgUser: UIImage { UIImage(named: "img_myinfouser")! }
static var imgTotal: UIImage { UIImage(named: "img_total")! }
static var imgStarbucks: UIImage { UIImage(named: "img_starbucks")! }
static var imgOpenChat: UIImage { UIImage(named: "img_openchat")! }

// recommend

Expand Down
41 changes: 26 additions & 15 deletions iOS-NOTTODO/iOS-NOTTODO/Global/Extensions/UILabel+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,7 @@ extension UILabel {
self.attributedText = attributedString
}

func htmlToString(_ targetString: String) -> NSAttributedString? {
let text = targetString

guard let data = text.data(using: .utf8) else {
return NSAttributedString()
}
do {
return try NSAttributedString(data: data,
options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue],
documentAttributes: nil)
} catch {
return NSAttributedString()
}
}

/// 라벨 일부 textColor와 font 변경해주는 함수
func setAttributedText(targetFontList: [String: UIFont],
targetColorList: [String: UIColor]) {
let fullText = self.text ?? ""
Expand All @@ -91,4 +77,29 @@ extension UILabel {
}
self.attributedText = attributedString
}

/// 라벨에 highlight를 칠해주는 함수
func partHighlightText(targetString: String, targetHighlightColor: UIColor) {
guard let fullText = self.text else { return }
let range = (fullText as NSString).range(of: targetString)
let attributedString = NSMutableAttributedString(string: fullText)
attributedString.addAttribute(.backgroundColor, value: targetHighlightColor, range: range)
self.attributedText = attributedString
}

/// html을 string으로 변경해주는 함수
func htmlToString(_ targetString: String) -> NSAttributedString? {
let text = targetString

guard let data = text.data(using: .utf8) else {
return NSAttributedString()
}
do {
return try NSAttributedString(data: data,
options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue],
documentAttributes: nil)
} catch {
return NSAttributedString()
}
}
}
2 changes: 1 addition & 1 deletion iOS-NOTTODO/iOS-NOTTODO/Global/Literals/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ struct I18N {
static let allow = "허용"
static let notiDialogButton = "네, 알겠어요 :)"

static let formButton = "이정도야 쉽지!"
static let commonModalTitle = "지금 바로 참여하기"
static let deprecatedTitle = "더 이상 보지 않기"
static let close = "닫기"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ final class CommonNotificationViewController: UIViewController {
private let backgroundView = UIView()
private let titleLabel = UILabel()
private let subTitleLabel = UILabel()
private let highlightView = UIView()
private let icon = UIImageView()
private let deprecatedTitle = UILabel()
private let bottomView = UIView()
private lazy var formButton = UIButton()
private lazy var closeButton = UIButton()
private lazy var deprecatedButton = UIButton()
private let blackButton = UIButton()
private let greenButton = UIButton()
private let closeButton = UIButton()
private let deprecatedButton = UIButton()

// MARK: - View Life Cycle

Expand All @@ -47,14 +49,15 @@ extension CommonNotificationViewController {

backgroundView.do {
$0.backgroundColor = .white
$0.layer.cornerRadius = 15
$0.layer.cornerRadius = 20
}

titleLabel.do {
$0.font = .Pretendard(.bold, size: 18)
$0.textAlignment = .center
$0.text = "1분 서비스 피드백하고 \n기프티콘 받아가세요!"
$0.numberOfLines = 2
$0.font = .Pretendard(.semiBold, size: 22)
$0.textAlignment = .left
$0.text = "오픈채팅으로\n일일 인증 하고\n갓생살자!"
$0.numberOfLines = 0
$0.partHighlightText(targetString: "일일 인증", targetHighlightColor: .green2 ?? .black)
}

subTitleLabel.do {
Expand All @@ -63,32 +66,45 @@ extension CommonNotificationViewController {
$0.text = "매주 추첨을 통해 스타벅스 기프티콘을 드려요"
}

highlightView.do {
$0.backgroundColor = .green2
}

deprecatedTitle.do {
$0.font = .Pretendard(.medium, size: 13)
$0.font = .Pretendard(.semiBold, size: 15)
$0.text = I18N.deprecatedTitle
$0.textColor = .gray3
}

icon.do {
$0.contentMode = .scaleAspectFit
$0.image = .icStarbucks
$0.image = .imgOpenChat
}

bottomView.do {
$0.backgroundColor = .gray5
$0.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner]
$0.layer.cornerRadius = 15
$0.layer.cornerRadius = 20
}

formButton.do {
blackButton.do {
$0.backgroundColor = .black
$0.setTitle(I18N.formButton, for: .normal)
$0.setTitle(I18N.commonModalTitle, for: .normal)
$0.setTitleColor(.white, for: .normal)
$0.titleLabel?.font = .Pretendard(.medium, size: 13)
$0.layer.cornerRadius = 20
$0.addTarget(self, action: #selector(didFormButtonTap), for: .touchUpInside)
}

greenButton.do {
$0.backgroundColor = .green2
$0.setTitle(I18N.commonModalTitle, for: .normal)
$0.setTitleColor(.ntdBlack, for: .normal)
$0.titleLabel?.font = .Pretendard(.semiBold, size: 20)
$0.layer.cornerRadius = 8
$0.addTarget(self, action: #selector(didFormButtonTap), for: .touchUpInside)
}

deprecatedButton.do {
$0.setImage(.deprecatedCheckBox, for: .normal)
$0.setImage(.deprecatedCheckBoxFill, for: .selected)
Expand All @@ -97,63 +113,59 @@ extension CommonNotificationViewController {

closeButton.do {
$0.setTitle(I18N.close, for: .normal)
$0.setTitleColor(.gray3, for: .normal)
$0.titleLabel?.font = .Pretendard(.medium, size: 13)
$0.setTitleColor(.ntdBlack, for: .normal)
$0.titleLabel?.font = .Pretendard(.semiBold, size: 15)
$0.addTarget(self, action: #selector(didCancelButtonTap), for: .touchUpInside)
}
}

private func setLayout() {

view.addSubview(backgroundView)
backgroundView.addSubviews(titleLabel, subTitleLabel, icon, formButton, bottomView)
backgroundView.addSubviews(titleLabel, highlightView, icon, greenButton, bottomView)
bottomView.addSubviews(deprecatedButton, deprecatedTitle, closeButton)

backgroundView.snp.makeConstraints {
$0.horizontalEdges.equalToSuperview().inset(46)
$0.height.equalTo(408)
$0.width.equalTo(312)
$0.height.equalTo(459)
$0.center.equalToSuperview()
}
titleLabel.snp.makeConstraints {
$0.top.equalToSuperview().inset(28)
$0.centerX.equalToSuperview()
}

subTitleLabel.snp.makeConstraints {
$0.top.equalTo(titleLabel.snp.bottom).offset(6)
$0.centerX.equalToSuperview()
titleLabel.snp.makeConstraints {
$0.top.equalToSuperview().inset(30)
$0.leading.equalToSuperview().inset(32)
}

icon.snp.makeConstraints {
$0.top.equalTo(subTitleLabel.snp.bottom).offset(7)
$0.horizontalEdges.equalToSuperview().inset(16)
$0.height.equalTo(197)
$0.top.equalTo(titleLabel.snp.bottom).offset(4)
$0.horizontalEdges.equalToSuperview().inset(28)
$0.height.equalTo(201)
}

formButton.snp.makeConstraints {
$0.top.equalTo(icon.snp.bottom).offset(4)
$0.horizontalEdges.equalToSuperview().inset(36)
$0.height.equalTo(40)
greenButton.snp.makeConstraints {
$0.top.equalTo(icon.snp.bottom).offset(7)
$0.horizontalEdges.equalToSuperview().inset(32)
$0.height.equalTo(52)
}

bottomView.snp.makeConstraints {
$0.horizontalEdges.bottom.equalToSuperview()
$0.height.equalTo(50)
$0.height.equalTo(58)
}

deprecatedButton.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.leading.equalToSuperview().inset(10)
$0.leading.equalToSuperview().inset(20)
$0.size.equalTo(20)
}

deprecatedTitle.snp.makeConstraints {
$0.leading.equalTo(deprecatedButton.snp.trailing).offset(4)
$0.leading.equalTo(deprecatedButton.snp.trailing).offset(5)
$0.centerY.equalToSuperview()
}

closeButton.snp.makeConstraints {
$0.trailing.equalToSuperview().inset(15)
$0.trailing.equalToSuperview().inset(33)
$0.centerY.equalToSuperview()
}
}
Expand All @@ -166,7 +178,7 @@ extension CommonNotificationViewController {
@objc
func didFormButtonTap() {

guard let url = URL(string: MyInfoURL.googleForm.url) else { return }
guard let url = URL(string: MyInfoURL.commonAlarmModal.url) else { return }
let safariView: SFSafariViewController = SFSafariViewController(url: url)
safariView.delegate = self
self.present(safariView, animated: true, completion: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class NottodoModalViewController: UIViewController {
private var modalView = UIView()
private let withdrawView = WithdrawModalView()
private let quitView = QuitModalView()
private lazy var safariViewController = SFSafariViewController(url: URL(string: MyInfoURL.googleForm.url)!)
private lazy var safariViewController = SFSafariViewController(url: URL(string: MyInfoURL.commonAlarmModal.url)!)

// MARK: - Life Cycle

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "img_open_chat.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "img_open_chat@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "img_open_chat@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.

0 comments on commit d007877

Please sign in to comment.