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

24.04.13-14) [Fix/Refector] Deinit 문제 해결, 기타 코드 refector #59

Merged
merged 6 commits into from
Apr 14, 2024
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
24 changes: 16 additions & 8 deletions AVIRO.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
C510005E2ABAA3C700F65C1F /* Enum+.swift in Sources */ = {isa = PBXBuildFile; fileRef = C510005D2ABAA3C700F65C1F /* Enum+.swift */; };
C51000612ABAE61F00F65C1F /* ReportReviewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C51000602ABAE61F00F65C1F /* ReportReviewModel.swift */; };
C51000632ABAE6A200F65C1F /* MenuModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C51000622ABAE6A200F65C1F /* MenuModel.swift */; };
C5101DFE2BCC125300FF6C69 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = C52CD2DB2BCA4E940031671B /* PrivacyInfo.xcprivacy */; };
C51132C12A559BCA006E1EC3 /* AppController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C51132C02A559BCA006E1EC3 /* AppController.swift */; };
C51385422AAADB0E001AB827 /* EditNickNameButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C51385412AAADB0E001AB827 /* EditNickNameButton.swift */; };
C51385452AAAE493001AB827 /* MyDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C51385442AAAE493001AB827 /* MyDataModel.swift */; };
Expand Down Expand Up @@ -88,6 +89,7 @@
C528E4BC2A5F9AB6002BD72E /* ThridRegistrationPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C528E4BB2A5F9AB6002BD72E /* ThridRegistrationPresenter.swift */; };
C528E4BE2A5FB816002BD72E /* TermsTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C528E4BD2A5FB816002BD72E /* TermsTableCell.swift */; };
C528E4C02A5FF1CB002BD72E /* FinalRegistrationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C528E4BF2A5FF1CB002BD72E /* FinalRegistrationViewController.swift */; };
C52CD2DD2BCA5C310031671B /* BlurEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C52CD2DC2BCA5C310031671B /* BlurEffectView.swift */; };
C52FA3432A175B20005E70DC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C52FA3422A175B20005E70DC /* AppDelegate.swift */; };
C52FA3452A175B20005E70DC /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C52FA3442A175B20005E70DC /* SceneDelegate.swift */; };
C52FA3472A175B20005E70DC /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C52FA3462A175B20005E70DC /* HomeViewController.swift */; };
Expand Down Expand Up @@ -362,6 +364,8 @@
C528E4BB2A5F9AB6002BD72E /* ThridRegistrationPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThridRegistrationPresenter.swift; sourceTree = "<group>"; };
C528E4BD2A5FB816002BD72E /* TermsTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsTableCell.swift; sourceTree = "<group>"; };
C528E4BF2A5FF1CB002BD72E /* FinalRegistrationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FinalRegistrationViewController.swift; sourceTree = "<group>"; };
C52CD2DB2BCA4E940031671B /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
C52CD2DC2BCA5C310031671B /* BlurEffectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurEffectView.swift; sourceTree = "<group>"; };
C52FA33F2A175B20005E70DC /* AVIRO.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AVIRO.app; sourceTree = BUILT_PRODUCTS_DIR; };
C52FA3422A175B20005E70DC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C52FA3442A175B20005E70DC /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -603,6 +607,7 @@
C52FA34D2A175B20005E70DC /* LaunchScreen.storyboard */,
C52FA3502A175B20005E70DC /* Info.plist */,
62166DED2BA2E92300F05D40 /* API.plist */,
C52CD2DB2BCA4E940031671B /* PrivacyInfo.xcprivacy */,
);
path = App;
sourceTree = "<group>";
Expand Down Expand Up @@ -1647,6 +1652,7 @@
C54BC0D82A2C2CEE00B65439 /* UIButton */,
C54BC0D92A2C2CF900B65439 /* UITextLabel */,
C5B071E22A59B3C200AE709A /* UITextField */,
C52CD2DC2BCA5C310031671B /* BlurEffectView.swift */,
);
path = SubClass;
sourceTree = "<group>";
Expand Down Expand Up @@ -2147,6 +2153,7 @@
C52FA34F2A175B20005E70DC /* LaunchScreen.storyboard in Resources */,
C510004F2AB5F76600F65C1F /* Pretendard-Bold.otf in Resources */,
C505EB162ACC048E0057A4F8 /* Berry2.json in Resources */,
C5101DFE2BCC125300FF6C69 /* PrivacyInfo.xcprivacy in Resources */,
C51000512AB5F76600F65C1F /* Pretendard-ExtraBold.otf in Resources */,
C51000522AB5F76600F65C1F /* Pretendard-Regular.otf in Resources */,
C510004D2AB5F76600F65C1F /* Pretendard-ExtraLight.otf in Resources */,
Expand Down Expand Up @@ -2480,6 +2487,7 @@
C505C1DA2B3AC0070058F115 /* AVIROConfiguration.swift in Sources */,
C5FD92F72A9CDB9300CF4673 /* EditMenuTopView.swift in Sources */,
C56857822A7113CF00F52715 /* RequestTableViewCell.swift in Sources */,
C52CD2DD2BCA5C310031671B /* BlurEffectView.swift in Sources */,
C5C2907B2A85E51B00ED5DCE /* PlaceReviewsView.swift in Sources */,
C5A201BD2A98708800A54381 /* EditPlaceInfoPresenter.swift in Sources */,
C59491D32AB0336100880B4B /* UIView(Animation)+Extension.swift in Sources */,
Expand Down Expand Up @@ -2661,14 +2669,14 @@
CODE_SIGN_ENTITLEMENTS = AVIRO/AVIRO.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = C4K2HXA435;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AVIRO/App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "어비로";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "현재 내 위치와 가까운 가게를 찾아드려요. 위치 정보를 저장하지 않으니 안심하세요.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "현재 내 위치와 가까운 가게를 찾아드려요. 위치 정보를 저장하지 않으니 안심하세요.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "근처 비건 식당 검색이 이제 더 쉬어집니다! 사용자의 위치 정보는 서비스 이용간 최적화하는 데 사용되며, 모든 데이터는 안전하게 관리됩니다.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "근처 비건 식당 검색이 이제 더 쉬어집니다! 사용자의 위치 정보는 서비스 이용간 최적화하는 데 사용되며, 모든 데이터는 안전하게 관리됩니다.";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
Expand All @@ -2679,7 +2687,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.3;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = SeonghunJeon.VeganRestaurant;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -2698,14 +2706,14 @@
CODE_SIGN_ENTITLEMENTS = AVIRO/AVIRO.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = C4K2HXA435;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AVIRO/App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "어비로";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "현재 내 위치와 가까운 가게를 찾아드려요. 위치 정보를 저장하지 않으니 안심하세요.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "현재 내 위치와 가까운 가게를 찾아드려요. 위치 정보를 저장하지 않으니 안심하세요.";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "근처 비건 식당 검색이 이제 더 쉬어집니다! 사용자의 위치 정보는 서비스 이용간 최적화하는 데 사용되며, 모든 데이터는 안전하게 관리됩니다.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "근처 비건 식당 검색이 이제 더 쉬어집니다! 사용자의 위치 정보는 서비스 이용간 최적화하는 데 사용되며, 모든 데이터는 안전하게 관리됩니다.";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
Expand All @@ -2716,7 +2724,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.3;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = SeonghunJeon.VeganRestaurant;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
5 changes: 5 additions & 0 deletions AVIRO.xcodeproj/xcshareddata/xcschemes/AVIRO.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "IDEPreferLogStreaming"
value = "YES"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
Expand Down
Binary file added AVIRO/AVIRO-PrivacyReport 2024-04-13 14-28-13.pdf
Binary file not shown.
106 changes: 57 additions & 49 deletions AVIRO/App/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,38 @@ import KeychainSwift
final class AppController {
static let shared = AppController()

private var userKey: String?

private let keychain = KeychainSwift()
private let amplitude = AmplitudeUtility()

private var window: UIWindow!
private var rootViewController: UIViewController? {
didSet {
window.rootViewController = rootViewController
window.makeKeyAndVisible()
}
}

private init() {
self.userKey = keychain.get(KeychainKey.appleRefreshToken.rawValue)
}
private init() { }

// MARK: 외부랑 소통할 메서드
func show(in window: UIWindow) {
self.window = window
window.backgroundColor = .gray7
window.makeKeyAndVisible()


checkState()
// setTabBarView()
}

func setupLoginViewAfterLogout(in window: UIWindow, with type: LoginViewToastType) {
self.window = window
window.backgroundColor = .gray7

setLoginView(type: type)
}

// MARK: 불러올 view 확인 메서드
private func checkState() {
let userKey = keychain.get(KeychainKey.appleRefreshToken.rawValue)

// 최초 튜토리얼 화면 안 봤을 때
guard UserDefaults.standard.bool(forKey: UDKey.tutorial.rawValue) else {
setTutorialView()
Expand All @@ -56,65 +60,69 @@ final class AppController {
let userCheck = AVIROAutoLoginWhenAppleUserDTO(refreshToken: userKey)

AVIROAPI.manager.checkAppleUserWhenInitiate(with: userCheck) { [weak self] result in
switch result {
case .success(let model):
if model.statusCode == 200 {
if let data = model.data {
MyData.my.whenLogin(
userId: data.userId,
userName: data.userName,
userEmail: data.userEmail,
userNickname: data.nickname,
marketingAgree: data.marketingAgree
)
self?.setTabBarView()
DispatchQueue.main.async {
switch result {
case .success(let model):
if model.statusCode == 200 {
if let data = model.data {
MyData.my.whenLogin(
userId: data.userId,
userName: data.userName,
userEmail: data.userEmail,
userNickname: data.nickname,
marketingAgree: data.marketingAgree
)
self?.setTabBarView()
}
} else {
self?.keychain.delete(KeychainKey.appleRefreshToken.rawValue)
self?.setLoginView()
}
} else {
case .failure:
self?.keychain.delete(KeychainKey.appleRefreshToken.rawValue)
self?.setLoginView()
}
case .failure:
self?.keychain.delete(KeychainKey.appleRefreshToken.rawValue)
self?.setLoginView()
}
}
}

// MARK: tutorial View
private func setTutorialView() {
DispatchQueue.main.async { [weak self] in
let tutorialVC = TutorialViewController()

self?.rootViewController = UINavigationController(rootViewController: tutorialVC)
}
let tutorialVC = TutorialViewController()

rootViewController = UINavigationController(rootViewController: tutorialVC)
}

// MARK: login View
private func setLoginView() {
DispatchQueue.main.async { [weak self] in
let loginVC = LoginViewController()

self?.rootViewController = UINavigationController(rootViewController: loginVC)
private func setLoginView(type: LoginViewToastType = .none) {
let loginVC = LoginViewController()
let presenter = LoginViewPresenter(viewController: loginVC)
loginVC.presenter = presenter

switch type {
case .logout:
presenter.whenAfterLogout = true
case .withdrawal:
presenter.whenAfterWithdrawal = true
case .none:
break
}

rootViewController = UINavigationController(rootViewController: loginVC)
}

// MARK: TabBar View
private func setTabBarView() {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }

let tabBarVC = AVIROTabBarController.create(
amplitude: self.amplitude,
type: [
TabBarType.home,
TabBarType.plus,
TabBarType.challenge
]
)
let tabBarVC = AVIROTabBarController.create(
amplitude: self.amplitude,
type: [
TabBarType.home,
TabBarType.plus,
TabBarType.challenge
]
)
tabBarVC.selectedIndex = 0

self.rootViewController = tabBarVC

tabBarVC.selectedIndex = 0
}
rootViewController = tabBarVC
}
}
23 changes: 9 additions & 14 deletions AVIRO/App/LaunchScreenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,27 @@ final class LaunchScreenViewController: UIViewController {
titleLabel.topAnchor.constraint(equalTo: aviroImage.bottomAnchor, constant: 16),
titleLabel.centerXAnchor.constraint(equalTo: aviroImage.centerXAnchor)
])

// UIScreen.main.bounds.height
}

private func checkVersion() {
DispatchQueue.global().async { [weak self] in
let latestVersion = SystemUtility().latestVersion() ?? "0.0.0"
SystemUtility().latestVersion { [weak self] latestVersion in
let latestVersion = latestVersion ?? "0.0.0"
let currentVersion = SystemUtility.appVersion ?? "0.0.0"

let splitLatestVersion = latestVersion.split(separator: ".").map { $0 }
let splitCurrentVersion = currentVersion.split(separator: ".").map { $0 }

print(latestVersion)

DispatchQueue.main.async {
if splitCurrentVersion[0] < splitLatestVersion[0] {
if splitCurrentVersion[0] < splitLatestVersion[0] {
self?.showUpdateAlert(latestVersion)
return
} else {
if splitCurrentVersion[1] < splitLatestVersion[1] {
self?.showUpdateAlert(latestVersion)
return
} else {
if splitCurrentVersion[1] < splitLatestVersion[1] {
self?.showUpdateAlert(latestVersion)
return
}
}
self?.isUpdateRequire = false
}
self?.isUpdateRequire = false
}
}

Expand Down
23 changes: 23 additions & 0 deletions AVIRO/App/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
</array>
</dict>
</plist>
19 changes: 19 additions & 0 deletions AVIRO/Custom/Extension/UIView(Animation)+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,23 @@ extension UIView {
}
}
}

func activeClickButton(
duration: Double = 0.15,
delay: Double = 0,
scaleX: Double = 1.08,
scaleY: Double = 0.95
) {
UIView.animate(
withDuration: duration,
delay: delay,
options: [.allowUserInteraction],
animations: {
self.transform = CGAffineTransform(scaleX: scaleX, y: scaleY)
}, completion: { _ in
UIView.animate(withDuration: duration) {
self.transform = CGAffineTransform.identity
}
})
}
}
27 changes: 27 additions & 0 deletions AVIRO/Custom/SubClass/BlurEffectView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// BlurEffectView.swift
// AVIRO
//
// Created by 전성훈 on 4/13/24.
//

import UIKit

final class BlurEffectView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)

setupAttribute()
}

required init?(coder: NSCoder) {
fatalError()
}

private func setupAttribute() {
self.backgroundColor = .black
self.alpha = 0.6

self.isHidden = true
}
}
Loading