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

리팩토링을 조금 해보았습니다. #177

Merged
merged 6 commits into from
Dec 6, 2019
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
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ error: 120

excluded:
- Toonie/Supporting Files/AppDelegate.swift
- Pods
- Toonie/Pods
- Toonie/Common/CommonFunction.swift
5 changes: 2 additions & 3 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '10.1'
# platform :ios, '11.0'

target 'Toonie' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
Expand All @@ -11,12 +11,11 @@ target 'Toonie' do
pod 'lottie-ios', '~> 3.1.0'
pod 'SwiftLint'
pod 'SnapKit', '~> 4.2'
pod 'Alamofire'
pod 'Alamofire', '~> 4.2'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Fabric'
pod 'Crashlytics'
pod 'Charts', '~> 3.2.0'

target 'ToonieTests' do
inherit! :search_paths
Expand Down
14 changes: 4 additions & 10 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
PODS:
- Alamofire (4.8.2)
- Charts (3.2.2):
- Charts/Core (= 3.2.2)
- Charts/Core (3.2.2)
- Crashlytics (3.13.1):
- Fabric (~> 1.10.1)
- Fabric (1.10.1)
Expand Down Expand Up @@ -77,8 +74,7 @@ PODS:
- SwiftLint (0.32.0)

DEPENDENCIES:
- Alamofire
- Charts (~> 3.2.0)
- Alamofire (~> 4.2)
- Crashlytics
- Fabric
- Firebase/Core
Expand All @@ -90,9 +86,8 @@ DEPENDENCIES:
- SwiftLint

SPEC REPOS:
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- Alamofire
- Charts
- Crashlytics
- Fabric
- Firebase
Expand All @@ -113,7 +108,6 @@ SPEC REPOS:

SPEC CHECKSUMS:
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
Charts: f69cf0518b6d1d62608ca504248f1bbe0b6ae77e
Crashlytics: 5aa8e90dcbf2f34898b4f5a0037787531246cca0
Fabric: f6f21452846788bb44595d73e9909d79d328e617
Firebase: 8d77bb33624ae9b62d745d82ec023de5f70f7e4f
Expand All @@ -132,6 +126,6 @@ SPEC CHECKSUMS:
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
SwiftLint: 009a898ef2a1c851f45e1b59349bf6ff2ddc990d

PODFILE CHECKSUM: c388aaf1062b83710ab8d3b2aecea92ff8d3dd97
PODFILE CHECKSUM: 1c4262268c6002aed5cd12af7b7793c9df5a6206

COCOAPODS: 1.7.0
COCOAPODS: 1.8.4
67 changes: 21 additions & 46 deletions Toonie.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
B631B8F7968327C48928F96FC6378209 /* SwipeOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E6DFA61908EBFE82D1698D239891682 /* SwipeOptions.swift */; };
D23CBF74B49019C4D424B8BBD0EECA96 /* SwipeResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5414960D1B6665D0EC9E38C91978EFB /* SwipeResult.swift */; };
00B844A8E54481E4FA25E50FD8DCAAD1 /* SwipeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94BC01D7FE19730BC7ED7E301350E372 /* SwipeView.swift */; };
5F1E70F63A95A1FF272CCB653A4C2601 /* SwipeViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36354638E53497878C5439AC5660B77A /* SwipeViewDelegate.swift */; };
9E6CBE75E90DB0F0A7FCD8CD72CF4A77 /* SwipeViewState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AB7E8074D6C978182E7669BB6001E8A /* SwipeViewState.swift */; };
4AE025D2C380F51BB508CE678B09CB78 /* TagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3671FD5527EB6A77347C274B14DB174B /* TagCollectionViewCell.swift */; };
5B5A91FF17C85623166C3C785AA24108 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05FF2AD238FECB950A261C5B8CA41D6 /* TodayViewController.swift */; };
Expand Down Expand Up @@ -255,7 +254,6 @@
4E6DFA61908EBFE82D1698D239891682 /* SwipeOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeOptions.swift; sourceTree = "<group>"; };
B5414960D1B6665D0EC9E38C91978EFB /* SwipeResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeResult.swift; sourceTree = "<group>"; };
94BC01D7FE19730BC7ED7E301350E372 /* SwipeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeView.swift; sourceTree = "<group>"; };
36354638E53497878C5439AC5660B77A /* SwipeViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeViewDelegate.swift; sourceTree = "<group>"; };
5AB7E8074D6C978182E7669BB6001E8A /* SwipeViewState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwipeViewState.swift; sourceTree = "<group>"; };
3671FD5527EB6A77347C274B14DB174B /* TagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCollectionViewCell.swift; sourceTree = "<group>"; };
D05FF2AD238FECB950A261C5B8CA41D6 /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -443,6 +441,19 @@
path = Toonie;
sourceTree = "<group>";
};
51483B2FA5A46C3D0289677EDBBA0457 /* Pods */ = {
isa = PBXGroup;
children = (
46461D78EB2754C9A17D4352D5F97AC7 /* Pods-Toonie.debug.xcconfig */,
300FB960FFEE2976C603D16E5DC4B10B /* Pods-Toonie.release.xcconfig */,
F9FED2BB74D689EF6B88421CC1B8579D /* Pods-ToonieTests.debug.xcconfig */,
630481886041EA402305CF71D731B02B /* Pods-ToonieTests.release.xcconfig */,
8AFEFE4CBE574CB4EC9D40CB2C33B674 /* Pods-ToonieWidget.debug.xcconfig */,
647D3371521DDB35BF9F6896BA9AB234 /* Pods-ToonieWidget.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
57EE88FD2A2AE25905F1BBA9889DD2BC /* Community */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -502,19 +513,6 @@
path = Controllers;
sourceTree = "<group>";
};
51483B2FA5A46C3D0289677EDBBA0457 /* Pods */ = {
isa = PBXGroup;
children = (
46461D78EB2754C9A17D4352D5F97AC7 /* Pods-Toonie.debug.xcconfig */,
300FB960FFEE2976C603D16E5DC4B10B /* Pods-Toonie.release.xcconfig */,
F9FED2BB74D689EF6B88421CC1B8579D /* Pods-ToonieTests.debug.xcconfig */,
630481886041EA402305CF71D731B02B /* Pods-ToonieTests.release.xcconfig */,
8AFEFE4CBE574CB4EC9D40CB2C33B674 /* Pods-ToonieWidget.debug.xcconfig */,
647D3371521DDB35BF9F6896BA9AB234 /* Pods-ToonieWidget.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
7836618FE7A43F2F101ED61B0304A6AB /* Extension */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -725,7 +723,6 @@
4E6DFA61908EBFE82D1698D239891682 /* SwipeOptions.swift */,
B5414960D1B6665D0EC9E38C91978EFB /* SwipeResult.swift */,
94BC01D7FE19730BC7ED7E301350E372 /* SwipeView.swift */,
36354638E53497878C5439AC5660B77A /* SwipeViewDelegate.swift */,
5AB7E8074D6C978182E7669BB6001E8A /* SwipeViewState.swift */,
);
path = SwipeCard;
Expand Down Expand Up @@ -921,7 +918,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
4039ED9FF2DB05B090E76221D04E96A3 /* [CP] Check Pods Manifest.lock */ = {
0A03A8E701D8806A7558B618CCC2B0D5 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -936,14 +933,14 @@
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ToonieTests-checkManifestLockResult.txt",
"$(DERIVED_FILE_DIR)/Pods-Toonie-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
0A03A8E701D8806A7558B618CCC2B0D5 /* [CP] Check Pods Manifest.lock */ = {
2FC97DFA743912EDF459972618878A0E /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -958,14 +955,14 @@
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Toonie-checkManifestLockResult.txt",
"$(DERIVED_FILE_DIR)/Pods-ToonieWidget-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
2FC97DFA743912EDF459972618878A0E /* [CP] Check Pods Manifest.lock */ = {
4039ED9FF2DB05B090E76221D04E96A3 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -980,7 +977,7 @@
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ToonieWidget-checkManifestLockResult.txt",
"$(DERIVED_FILE_DIR)/Pods-ToonieTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -1010,32 +1007,11 @@
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Toonie/Pods-Toonie-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/Charts/Charts.framework",
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
"${BUILT_PRODUCTS_DIR}/KTCenterFlowLayout/KTCenterFlowLayout.framework",
"${BUILT_PRODUCTS_DIR}/Kingfisher/Kingfisher.framework",
"${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework",
"${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework",
"${BUILT_PRODUCTS_DIR}/lottie-ios/Lottie.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
"${PODS_ROOT}/Target Support Files/Pods-Toonie/Pods-Toonie-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Charts.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KTCenterFlowLayout.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kingfisher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lottie.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
"${PODS_ROOT}/Target Support Files/Pods-Toonie/Pods-Toonie-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -1111,7 +1087,6 @@
B631B8F7968327C48928F96FC6378209 /* SwipeOptions.swift in Sources */,
D23CBF74B49019C4D424B8BBD0EECA96 /* SwipeResult.swift in Sources */,
00B844A8E54481E4FA25E50FD8DCAAD1 /* SwipeView.swift in Sources */,
5F1E70F63A95A1FF272CCB653A4C2601 /* SwipeViewDelegate.swift in Sources */,
9E6CBE75E90DB0F0A7FCD8CD72CF4A77 /* SwipeViewState.swift in Sources */,
4AE025D2C380F51BB508CE678B09CB78 /* TagCollectionViewCell.swift in Sources */,
F57EDB00538821C89A0497742A6F2B14 /* TodayViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<key>ToonieWidget.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>23</integer>
<integer>22</integer>
</dict>
</dict>
</dict>
Expand Down
54 changes: 26 additions & 28 deletions Toonie/Common/CommonUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class CommonUtility: NSObject {
var myTagDic = [String: String]()

//싱글톤
static let sharedInstance = CommonUtility()
static let shared = CommonUtility()

///userToken 가져옴
static func getUserToken() -> String? {
Expand All @@ -46,10 +46,10 @@ final class CommonUtility: NSObject {
}

static func analytics(eventName: String, param: [String: Any]?) {
// var replaceEventName = eventName.replacingOccurrences(of: "Toonie.", with: "")
// replaceEventName = devSwitch ? "dev"+replaceEventName : replaceEventName
// Analytics.logEvent(replaceEventName,
// parameters: param)
// var replaceEventName = eventName.replacingOccurrences(of: "Toonie.", with: "")
// replaceEventName = devSwitch ? "dev"+replaceEventName : replaceEventName
// Analytics.logEvent(replaceEventName,
// parameters: param)
}

func compareToVersion(newVersion: String) -> Int {
Expand Down Expand Up @@ -94,40 +94,38 @@ final class CommonUtility: NSObject {
}
return 0
}

///앱 3번 실행마다 앱리뷰 요청
func showStoreReview() {
let detailEnterCnt = UserDefaults.standard.integer(forKey: "appStartCount")

if 3 <= detailEnterCnt {
SKStoreReviewController.requestReview()
UserDefaults.standard.set(0, forKey: "appStartCount")
}
if detailEnterCnt <= 3 {
SKStoreReviewController.requestReview()
UserDefaults.standard.set(0, forKey: "appStartCount")
}
}

///오늘나는 인스타툰을 읽고 싶어요: 하루에 한번인데 오늘 하루 지났는지 체크함
func isDateCompare(lastCloseTime: Date?,
hideDay: Int) -> Bool{
func checkPassOneDay(by lastCloseTime: Date?,
hideDay: Int) -> Bool {
//true: 안지남 -> 팝업뜨면안됨, false: 지남 -> 팝업떠야함

guard lastCloseTime != nil else {
guard let lastCloseTime = lastCloseTime else {
return false
}

if let lastCloseTime = lastCloseTime {
do {
let formatter = DateComponentsFormatter()
formatter.allowedUnits = [.hour]
formatter.unitsStyle = .full
if let hourString = formatter.string(from: lastCloseTime.addingTimeInterval(TimeInterval(86400 * hideDay))
, to: Date.init()) {
print("\(hourString)만큼 차이납니다.")

let hour = hourString.replacingOccurrences(of: " hours", with: "")

if 0 <= Int(hour) ?? 0 {
return false
}

do {
let formatter = DateComponentsFormatter()
formatter.allowedUnits = [.hour]
formatter.unitsStyle = .full
if let hourString = formatter.string(from: lastCloseTime.addingTimeInterval(TimeInterval(86400 * hideDay))
, to: Date.init()) {
print("\(hourString)만큼 차이납니다.")

let hour = Int(hourString.replacingOccurrences(of: " hours", with: "")) ?? 0

if hour <= 0 {
return false
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions Toonie/Community/CommunityTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,27 @@ import UIKit

final class CommunityTableViewCell: UITableViewCell {

// MARK: - IBOutlet

@IBOutlet private weak var nameLabel: UILabel!
@IBOutlet private weak var modifyButton: UIButton!
@IBOutlet private weak var dayAndTimeButton: UILabel!
@IBOutlet weak var contentsLabel: UILabel!
@IBOutlet weak var recommendView: UIView!
@IBOutlet weak var recommendCollectionView: UICollectionView!
@IBOutlet weak var recommendButton: UIButton!

@IBOutlet weak var recommendViewHeightConstraint: NSLayoutConstraint!


override func awakeFromNib() {
super.awakeFromNib()
// Initialization code

recommendCollectionView.dataSource = self
recommendCollectionView.delegate = self
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

override func layoutSubviews() {
Expand All @@ -44,16 +43,20 @@ final class CommunityTableViewCell: UITableViewCell {

}

// MARK: - UICollectionViewDataSource

extension CommunityTableViewCell: UICollectionViewDataSource {

func collectionView(_ collectionView: UICollectionView,
numberOfItemsInSection section: Int) -> Int {
return 10
}

func collectionView(_ collectionView: UICollectionView,
cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CommunityCollectionViewCell",
for: indexPath) as? CommunityCollectionViewCell
guard let cell = collectionView
.dequeueReusableCell(withReuseIdentifier: "CommunityCollectionViewCell",
for: indexPath) as? CommunityCollectionViewCell
else {
return UICollectionViewCell()
}
Expand All @@ -67,6 +70,8 @@ extension CommunityTableViewCell: UICollectionViewDataSource {

}

// MARK: - UICollectionViewDelegate

extension CommunityTableViewCell: UICollectionViewDelegate {

}
Loading