Skip to content
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
8 changes: 8 additions & 0 deletions Projects/App/GOMS-iOS-V2Debug.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>aps-environment</key>
<string>development</string>
</dict>
</plist>
20 changes: 19 additions & 1 deletion Projects/App/Sources/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,46 @@ import Firebase
import UserNotifications
import Feature
import AudioToolbox
import FirebaseMessaging

@main
class AppDelegate: UIResponder, UIApplicationDelegate {




let notificationViewModel = NotificationViewModel()

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {




FirebaseApp.configure()

UNUserNotificationCenter.current().delegate = self

Messaging.messaging().delegate = self

Messaging.messaging().token { token, error in
if let token = token {
print("FCM", token)
}
}

requestNotificationAuthorization()

return true
}

private func requestNotificationAuthorization() {



print("λΉŒλ“œ 버전:",
Bundle.main.infoDictionary?["CFBundleVersion"] ?? "nil")
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound, .carPlay]) { granted, error in
if let error = error {
print("Error requesting notification authorization: \(error.localizedDescription)")
Expand Down
50 changes: 26 additions & 24 deletions Projects/App/Sources/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
let isSwitchOn = defaults.bool(forKey: "isSwitchOn")
let adminIsSwitchOn = defaults.bool(forKey: "isSwitchMakeOn")

checkForUpdates { needsUpdate in
if needsUpdate {
print("μ—…λ°μ΄νŠΈ ν•„μš”")
self.showUpdatePopup()
} else {
print("μ΅œμ‹  λ²„μ „μž…λ‹ˆλ‹€")
}
}
//*checkForUpdates { needsUpdate in
// if needsUpdate {
// print("μ—…λ°μ΄νŠΈ ν•„μš”")
// self.showUpdatePopup()
// } else {
// print("μ΅œμ‹  λ²„μ „μž…λ‹ˆλ‹€")
// }
// }

applySavedTheme()

Expand Down Expand Up @@ -133,24 +133,26 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}

private func showUpdatePopup() {
let alertController = UIAlertController(
title: "μ—…λ°μ΄νŠΈ μ•Œλ¦Ό",
message: "더 λ‚˜μ€ μ„œλΉ„μŠ€λ₯Ό μœ„ν•΄ κ³°μŠ€κ°€ μˆ˜μ •λ˜μ—ˆμ–΄μš”!\nμ›ν™œν•œ μ‚¬μš©μ„ μœ„ν•΄ μ—…λ°μ΄νŠΈ ν›„ μ΄μš©ν•΄μ£Όμ„Έμš”!",
preferredStyle: .alert
)

let updateAction = UIAlertAction(title: "확인", style: .default) { _ in
if let url = URL(string: "https://apps.apple.com/kr/app/goms/id6502936560") {
UIApplication.shared.open(url)
}
}
DispatchQueue.main.async {

alertController.addAction(updateAction)
guard let rootVC = self.window?.rootViewController else { return }

DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.window?.rootViewController?.present(alertController, animated: true) {
print("μ—…λ°μ΄νŠΈ νŒμ—… ν‘œμ‹œλ¨")
}
// 이미 λ‹€λ₯Έ VCλ₯Ό present 쀑이면 쀑볡 λ°©μ§€
if rootVC.presentedViewController != nil { return }

let alertController = UIAlertController(
title: "μ—…λ°μ΄νŠΈ μ•Œλ¦Ό",
message: "μ›ν™œν•œ μ‚¬μš©μ„ μœ„ν•΄ μ—…λ°μ΄νŠΈ ν›„ μ΄μš©ν•΄μ£Όμ„Έμš”!",
preferredStyle: .alert
)

alertController.addAction(UIAlertAction(title: "μ—…λ°μ΄νŠΈ", style: .default) { _ in
if let url = URL(string: "μ•±μŠ€ν† μ–΄URL") {
UIApplication.shared.open(url)
}
})

rootVC.present(alertController, animated: true)
}
}

Expand Down
12 changes: 9 additions & 3 deletions Projects/App/Support/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.5.1</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CloudTypeBaseURL</key>
<string>$(CloudTypeBaseURL)</string>
<key>FirebaseAppDelegateProxyEnabled</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>http://gsmsv-1.yujun.kr:23346</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>Localization native development region</key>
Expand All @@ -32,13 +34,15 @@
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsUsageDescription</key>
<false/>
</dict>
<key>NSCameraUsageDescription</key>
<string>QR μŠ€μΊ”μ„ μœ„ν•΄ 카메라λ₯Ό ν—ˆμš©ν•΄μ£Όμ„Έμš”.</string>
<key>SERVER_HOST</key>
<string> ${SERVER_HOST}</string>
<key>SchoolBaseURL</key>
<string>$(SchoolBaseURL)</string>
<string>http://gsmsv-1.yujun.kr:23346/api/v2</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down Expand Up @@ -82,5 +86,7 @@
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.000",
"red" : "0.000"
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
Expand All @@ -41,9 +41,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ public final class FindPasswordViewController: BaseViewController {
viewModel.sendAuthCode { success, statusCode in
if statusCode == 204 {
self.successUI()
let authCodeVC = AuthCodeViewController(viewModel: self.viewModel, previousViewController: self, email: self.emailTextField.text ?? "")
let email = self.emailTextField.text ?? ""

let authCodeVC = AuthCodeViewController(
viewModel: self.viewModel,
previousViewController: self,
email: email
)
self.navigationController?.pushViewController(authCodeVC, animated: true)
} else if statusCode == 404 {
self.nonExistentUser()
Expand Down Expand Up @@ -166,8 +172,7 @@ public final class FindPasswordViewController: BaseViewController {
extension FindPasswordViewController: UITextFieldDelegate {
public func textFieldDidChange(_ textField: UITextField) {
if textField == emailTextField {
viewModel.setupEmail(email: emailTextField.text ?? "")
}
viewModel.setupEmail(email: emailTextField.text ?? "") }
}

public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ public final class IntroViewController: BaseViewController {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -87,53 +87,68 @@ public final class NewPasswordViewController: BaseViewController {

// MARK: - Seletors
@objc func doneButtonTapped() {
let defaults = UserDefaults.standard
let localPassword = defaults.string(forKey: "localPass")
self.validatePassword()
let isValidPassword = self.validatePassword()
viewModel.setupEmail(email: self.email)
viewModel.setupNewServePassword(newPassword: passwordTextField.text ?? "", checkPassword: checkPasswordTextField.text ?? "")
viewModel.setupPassword(password: localPassword ?? "")
viewModel.newPassword { [self] success, statusCode in
if !isValidPassword {
self.passwordWrongRegularExpressionUI()
} else if passwordTextField.text != checkPasswordTextField.text {
self.passwordErrorUI()


print("🚨 DONE BUTTON TAPPED")
print("🚨 VC email:", email)

let isValidPassword = validatePassword()

if !isValidPassword {
passwordWrongRegularExpressionUI()
return
}

if passwordTextField.text != checkPasswordTextField.text {
passwordErrorUI()
conditionsLabel.isHidden = true
} else if passwordTextField.text == "" {
self.passwordErrorUI()
return
}

if passwordTextField.text == "" {
passwordErrorUI()
return
}
else if !success {

viewModel.setupNewServePassword(
newPassword: passwordTextField.text ?? "",
checkPassword: checkPasswordTextField.text ?? ""
)

print("🚨 CALLING newPassword API")

viewModel.newPassword { [self] success, statusCode in

if !success {
switch statusCode {

case 400:
print("400")
self.passwordOverlapErrorUI()
conditionsLabel.isHidden = false

case 404:
print("404")

default:
print("Error: \(statusCode)")
}
} else if success {
let defaults = UserDefaults.standard

} else {

UserDefaults.standard.set(self.checkPasswordTextField.text, forKey: "localPass")
let alert = UIAlertController(title: "μž¬μ„€μ • μ™„λ£Œ", message: "λΉ„λ°€λ²ˆν˜Έκ°€ μž¬μ„€μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€.\n둜그인 ν™”λ©΄μœΌλ‘œ λŒμ•„κ°‘λ‹ˆλ‹€.", preferredStyle: .alert)

let check = UIAlertAction(title: "확인", style: .default) { action in

let alert = UIAlertController(
title: "μž¬μ„€μ • μ™„λ£Œ",
message: "λΉ„λ°€λ²ˆν˜Έκ°€ μž¬μ„€μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€.\n둜그인 ν™”λ©΄μœΌλ‘œ λŒμ•„κ°‘λ‹ˆλ‹€.",
preferredStyle: .alert
)

let check = UIAlertAction(title: "확인", style: .default) { _ in
let loginVC = IntroViewController()
self.navigationController?.pushViewController(loginVC, animated: true)
}

passwordOverlapErrorLabel.isHidden = true
passwordTextField.layer.borderWidth = 0
passwordTextField.setPlaceholderColor(.color.gomsTertiary.color)

passwordErrorLabel.isHidden = true
checkPasswordTextField.layer.borderWidth = 0
checkPasswordTextField.setPlaceholderColor(.color.gomsTertiary.color)


alert.addAction(check)
self.present(alert, animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,49 @@ public final class PasswordSettingViewController: BaseViewController {

// MARK: - Seletors
@objc func signUpButtonTapped() {
viewModel.setupNewPassword(newPassword: passwordTextField.text ?? "", checkPassword: checkPasswordTextField.text ?? "")


view.endEditing(true)

let password = passwordTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
let confirmPassword = checkPasswordTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""

print("password:", password)
print("confirm:", confirmPassword)

guard password == confirmPassword else {
passwordErrorUI()
return
}

viewModel.setupNewPassword(newPassword: password, checkPassword: confirmPassword)

DispatchQueue.main.async {
self.present(self.loader, animated: true)
}

viewModel.signUp { success in
if success {
self.signUpSuccessUI()
let signInVC = SignInViewController(viewModel: self.viewModel)
self.navigationController?.pushViewController(signInVC, animated: true)
self.loader.dismiss(animated: true)
} else {
self.passwordErrorUI()
self.loader.dismiss(animated: true)

viewModel.signUp { [weak self] success in
guard let self = self else { return }

DispatchQueue.main.async {

self.loader.dismiss(animated: true) {

if success {

self.signUpSuccessUI()

let signInVC = SignInViewController(viewModel: AuthViewModel())

self.navigationController?.setViewControllers([signInVC], animated: true)

} else {

self.passwordErrorUI()

}

}

}
}
}
Expand Down
Loading
Loading