diff --git a/VODA_iOS/Podfile b/VODA_iOS/Podfile index c9c562f..dc88f97 100644 --- a/VODA_iOS/Podfile +++ b/VODA_iOS/Podfile @@ -7,17 +7,17 @@ target 'VODA_iOS' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! - pod 'Moya' - pod 'Kingfisher' - pod 'SwiftLint' - pod 'lottie-ios' - pod 'SoundWave' + pod 'Moya', '~> 15.0.0' + pod 'Kingfisher', '~> 7.2.0' + pod 'SwiftLint', '0.46.5' + pod 'lottie-ios', '3.3.0' + pod 'SoundWave', '0.1.4' - pod 'GoogleSignIn' + pod 'GoogleSignIn', '6.1.0' pod 'KakaoSDK', '2.5.6' - pod 'Firebase/Messaging' + pod 'Firebase/Messaging', '8.14.0' - pod 'DropDown' + pod 'DropDown', '2.3.13' # Pods for VODA_iOS diff --git a/VODA_iOS/Podfile.lock b/VODA_iOS/Podfile.lock index 54c1977..2abf9e8 100644 --- a/VODA_iOS/Podfile.lock +++ b/VODA_iOS/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Alamofire (5.5.0) + - Alamofire (5.6.1) - AppAuth (1.5.0): - AppAuth/Core (= 1.5.0) - AppAuth/ExternalUserAgent (= 1.5.0) @@ -7,26 +7,26 @@ PODS: - AppAuth/ExternalUserAgent (1.5.0): - AppAuth/Core - DropDown (2.3.13) - - Firebase/CoreOnly (8.13.0): - - FirebaseCore (= 8.13.0) - - Firebase/Messaging (8.13.0): + - Firebase/CoreOnly (8.14.0): + - FirebaseCore (= 8.14.0) + - Firebase/Messaging (8.14.0): - Firebase/CoreOnly - - FirebaseMessaging (~> 8.13.0) - - FirebaseCore (8.13.0): + - FirebaseMessaging (~> 8.14.0) + - FirebaseCore (8.14.0): - FirebaseCoreDiagnostics (~> 8.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - - FirebaseCoreDiagnostics (8.13.0): + - FirebaseCoreDiagnostics (8.15.0): - GoogleDataTransport (~> 9.1) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - nanopb (~> 2.30908.0) - - FirebaseInstallations (8.13.0): + - FirebaseInstallations (8.15.0): - FirebaseCore (~> 8.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/UserDefaults (~> 7.7) - PromisesObjC (< 3.0, >= 1.2) - - FirebaseMessaging (8.13.0): + - FirebaseMessaging (8.14.0): - FirebaseCore (~> 8.0) - FirebaseInstallations (~> 8.0) - GoogleDataTransport (~> 9.1) @@ -35,9 +35,9 @@ PODS: - GoogleUtilities/Reachability (~> 7.7) - GoogleUtilities/UserDefaults (~> 7.7) - nanopb (~> 2.30908.0) - - GoogleDataTransport (9.1.2): - - GoogleUtilities/Environment (~> 7.2) - - nanopb (~> 2.30908.0) + - GoogleDataTransport (9.1.4): + - GoogleUtilities/Environment (~> 7.7) + - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - GoogleSignIn (6.1.0): - AppAuth (~> 1.4) @@ -60,10 +60,10 @@ PODS: - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (7.7.0): - GoogleUtilities/Logger - - GTMAppAuth (1.2.2): + - GTMAppAuth (1.3.0): - AppAuth/Core (~> 1.4) - GTMSessionFetcher/Core (~> 1.5) - - GTMSessionFetcher/Core (1.7.0) + - GTMSessionFetcher/Core (1.7.2) - KakaoSDK (2.5.6): - KakaoSDKAuth (= 2.5.6) - KakaoSDKCommon (= 2.5.6) @@ -96,7 +96,7 @@ PODS: - KakaoSDKCommon/Common (= 2.5.6) - KakaoSDKUser (2.5.6): - KakaoSDKAuth (= 2.5.6) - - Kingfisher (7.2.0) + - Kingfisher (7.2.2) - lottie-ios (3.3.0) - Moya (15.0.0): - Moya/Core (= 15.0.0) @@ -107,20 +107,20 @@ PODS: - nanopb/encode (= 2.30908.0) - nanopb/decode (2.30908.0) - nanopb/encode (2.30908.0) - - PromisesObjC (2.0.0) + - PromisesObjC (2.1.0) - SoundWave (0.1.4) - SwiftLint (0.46.5) DEPENDENCIES: - - DropDown - - Firebase/Messaging - - GoogleSignIn + - DropDown (= 2.3.13) + - Firebase/Messaging (= 8.14.0) + - GoogleSignIn (= 6.1.0) - KakaoSDK (= 2.5.6) - - Kingfisher - - lottie-ios - - Moya - - SoundWave - - SwiftLint + - Kingfisher (~> 7.2.0) + - lottie-ios (= 3.3.0) + - Moya (~> 15.0.0) + - SoundWave (= 0.1.4) + - SwiftLint (= 0.46.5) SPEC REPOS: trunk: @@ -155,19 +155,19 @@ SPEC REPOS: - SwiftLint SPEC CHECKSUMS: - Alamofire: 1c4fb5369c3fe93d2857c780d8bbe09f06f97e7c + Alamofire: 87bd8c952f9a4454320fce00d9cc3de57bcadaf5 AppAuth: 80317d99ac7ff2801a2f18ff86b48cd315ed465d DropDown: 8a2116376c1981888557f72ec2ffc9a5e0e456ec - Firebase: ee9b1d9b1801371e29f5591eda89eb5a314ab599 - FirebaseCore: c7e3fa30492e50ccdeef280bf0d5584af38da3e1 - FirebaseCoreDiagnostics: c2836d254a8f0bbb4121ff18f2c2ea39d118fd08 - FirebaseInstallations: 60edbf7e11d91ae4c751d26c200dfd037099abe0 - FirebaseMessaging: 8cddb4c478663611d58c03b353e10dd0ed6468f6 - GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940 + Firebase: 7e8fe528c161b9271d365217a74c16aaf834578e + FirebaseCore: b84a44ee7ba999e0f9f76d198a9c7f60a797b848 + FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb + FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd + FirebaseMessaging: 5ebc42d281567658a2cb72b9ef3506e4a1a1a6e4 + GoogleDataTransport: 5fffe35792f8b96ec8d6775f5eccd83c998d5a3b GoogleSignIn: c90b5bec45e780f54c6a8e1e3c182a86e3dda69d GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1 - GTMAppAuth: ad5c2b70b9a8689e1a04033c9369c4915bfcbe89 - GTMSessionFetcher: 43748f93435c2aa068b1cbe39655aaf600652e91 + GTMAppAuth: 4d8f864896f3646f0c33baf38a28362f4c601e15 + GTMSessionFetcher: 5595ec75acf5be50814f81e9189490412bad82ba KakaoSDK: cf7977079b8b2925ee366ebe29aae51921e648ce KakaoSDKAuth: 1e1fa737e78eed3f301ab5c164526781a37a42f9 KakaoSDKCommon: cdf340a8f671eef75f4ca012003cb350af3c4b6d @@ -177,14 +177,14 @@ SPEC CHECKSUMS: KakaoSDKTalk: 68c72269e9095afb9582f324b94f99dd6284e361 KakaoSDKTemplate: 0370e640abd33d0acb3d7bbe4ef3c02dc42a4576 KakaoSDKUser: f488aa4699b3fd3a836ab5c7e25e2cb4cea190c1 - Kingfisher: 3ac0b75b155cabc0e544877d1a4deea29feece92 + Kingfisher: 184d4d1a8c36666e663caf8e08abe87898595c53 lottie-ios: 6ac74dcc09904798f59b18cb3075c089d76be9ae Moya: 138f0573e53411fb3dc17016add0b748dfbd78ee nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 - PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 + PromisesObjC: 99b6f43f9e1044bd87a95a60beff28c2c44ddb72 SoundWave: d98ffaa863570b29d991da32a09b7ce1b4aaf2d4 SwiftLint: 2c16e8fa99dac2e440dc0c70ea74d2532048f6cf -PODFILE CHECKSUM: 640f234f4a6d932fb6b7c3d04eb0de6ae7be0efa +PODFILE CHECKSUM: 0d81b25143ab73ca41356b522dba16b7102d1e42 COCOAPODS: 1.10.1 diff --git a/VODA_iOS/VODA_iOS/Sources/MyPage/ViewController/PushSettingViewController.swift b/VODA_iOS/VODA_iOS/Sources/MyPage/ViewController/PushSettingViewController.swift index 32ec1b9..0d8814d 100644 --- a/VODA_iOS/VODA_iOS/Sources/MyPage/ViewController/PushSettingViewController.swift +++ b/VODA_iOS/VODA_iOS/Sources/MyPage/ViewController/PushSettingViewController.swift @@ -25,7 +25,7 @@ class PushSettingViewController: UIViewController { } private func setPushSettingSwitch() { - if UIApplication.shared.isRegisteredForRemoteNotifications { + if UserDefaults.standard.bool(forKey: "pushFlag") { pushSettingSwitch.isOn = true } else { pushSettingSwitch.isOn = false @@ -33,8 +33,11 @@ class PushSettingViewController: UIViewController { } @IBAction func togglePushSettingSwitch(_ sender: UISwitch) { + UserDefaults.standard.set(sender.isOn, forKey: "pushFlag") + if sender.isOn { - UIApplication.shared.registerForRemoteNotifications() + let appDelegate = UIApplication.shared.delegate as? AppDelegate + appDelegate?.registerNotification(application: UIApplication.shared) } else { UIApplication.shared.unregisterForRemoteNotifications() } diff --git a/VODA_iOS/VODA_iOS/Sources/Push/ViewController/PushViewController.swift b/VODA_iOS/VODA_iOS/Sources/Push/ViewController/PushViewController.swift index 3d5f789..13c35ad 100644 --- a/VODA_iOS/VODA_iOS/Sources/Push/ViewController/PushViewController.swift +++ b/VODA_iOS/VODA_iOS/Sources/Push/ViewController/PushViewController.swift @@ -17,8 +17,6 @@ class PushViewController: UIViewController { setUpNavigationUI() pushView.addShadow(width: 0, height: -4, radius: 8, opacity: 0.1) currentDateLabel.text = getCurrentDate() - - UIApplication.shared.applicationIconBadgeNumber = 0 } private func setUpNavigationUI() { diff --git a/VODA_iOS/VODA_iOS/SupportingFiles/AppDelegate.swift b/VODA_iOS/VODA_iOS/SupportingFiles/AppDelegate.swift index 4be9c37..22d375b 100644 --- a/VODA_iOS/VODA_iOS/SupportingFiles/AppDelegate.swift +++ b/VODA_iOS/VODA_iOS/SupportingFiles/AppDelegate.swift @@ -21,8 +21,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { KakaoSDKCommon.initSDK(appKey: SocialLoginType.kakao.appKey) - registerNotification(application: application) - + checkFirstAppLaunch(application: application) + if #available(iOS 13, *) { print("set in SceneDelegate") } else { @@ -53,8 +53,37 @@ class AppDelegate: UIResponder, UIApplicationDelegate { Messaging.messaging().apnsToken = deviceToken } - private func registerNotification(application: UIApplication) { - FirebaseApp.configure() + private func getAppLaunchCount() -> Int { + let appLaunchCount = UserDefaults.standard.integer(forKey: "appLaunchCount") + + return appLaunchCount + } + + private func setAppLaunchCount() { + let appLaunchCount = getAppLaunchCount() + UserDefaults.standard.set(appLaunchCount + 1, forKey: "appLaunchCount") + } + + private func checkFirstAppLaunch(application: UIApplication) { + let appLaunchCount = getAppLaunchCount() + + if appLaunchCount < 1 { + UserDefaults.standard.set(true, forKey: "pushFlag") + registerNotification(application: application) + } else { + if UIApplication.shared.isRegisteredForRemoteNotifications { + registerNotification(application: application) + } + } + + setAppLaunchCount() + } + + public func registerNotification(application: UIApplication) { + if FirebaseApp.app() == nil { + FirebaseApp.configure() + } + Messaging.messaging().delegate = self UNUserNotificationCenter.current().delegate = self