From 609583e3950d45bb8d872f776309239a966aedf1 Mon Sep 17 00:00:00 2001 From: 513sojin <513sojin@naver.com> Date: Fri, 2 Feb 2024 02:32:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Feat]=20#206=20-=20remote=20config=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remote config 추가 및 alert 추가 --- Runnect-iOS/Podfile | 2 +- .../Runnect-iOS.xcodeproj/project.pbxproj | 8 +-- .../Global/Supports/AppDelegate.swift | 57 +++++++++++++++++++ 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/Runnect-iOS/Podfile b/Runnect-iOS/Podfile index 40453cee..60cb2e83 100644 --- a/Runnect-iOS/Podfile +++ b/Runnect-iOS/Podfile @@ -22,7 +22,7 @@ target 'Runnect-iOS' do pod 'FirebaseAnalytics' pod 'FirebaseAuth' pod 'FirebaseFirestore' - + pod 'Firebase/RemoteConfig' end diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 4e5f85cd..45dcb4ee 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 232686362B03AF4400675A17 /* NetworkProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232686352B03AF4400675A17 /* NetworkProvider.swift */; }; + 23628DDE2B6BCB9C00894B18 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 23628DDD2B6BCB9C00894B18 /* GoogleService-Info.plist */; }; 23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; }; 23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; }; 23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; }; @@ -21,7 +22,6 @@ 712DB0702B443ACC0013FD79 /* GAEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712DB06F2B443ACC0013FD79 /* GAEvent.swift */; }; 712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; }; 7136BF8A2AF921A900679364 /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */; }; - 713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */; }; 715D36E82B2CC64000CAA9D6 /* MyUploadedCourseResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 715D36E72B2CC64000CAA9D6 /* MyUploadedCourseResponseDto.swift */; }; 717916DA2B13613B009CEF97 /* MarathonListResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */; }; 71802C5C2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71802C5B2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift */; }; @@ -180,6 +180,7 @@ /* Begin PBXFileReference section */ 232686352B03AF4400675A17 /* NetworkProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProvider.swift; sourceTree = ""; }; + 23628DDD2B6BCB9C00894B18 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = ""; }; 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = ""; }; 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = ""; }; @@ -194,7 +195,6 @@ 712DB06F2B443ACC0013FD79 /* GAEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GAEvent.swift; sourceTree = ""; }; 712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = ""; }; - 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 715D36E72B2CC64000CAA9D6 /* MyUploadedCourseResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyUploadedCourseResponseDto.swift; sourceTree = ""; }; 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonListResponseDto.swift; sourceTree = ""; }; 71802C5B2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDetailScrapCountDto.swift; sourceTree = ""; }; @@ -869,7 +869,7 @@ CE6655A9295D7FAA00C64E12 /* Network */, CE6655A8295D7F7D00C64E12 /* Presentation */, CE4545D6295D7AF5003201E1 /* Info.plist */, - 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */, + 23628DDD2B6BCB9C00894B18 /* GoogleService-Info.plist */, ); path = "Runnect-iOS"; sourceTree = ""; @@ -1334,7 +1334,7 @@ files = ( CE665615295D989A00C64E12 /* .swiftlint.yml in Resources */, CE17F0342961BEF800E1DED0 /* Pretendard-Bold.otf in Resources */, - 713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */, + 23628DDE2B6BCB9C00894B18 /* GoogleService-Info.plist in Resources */, CE17F0352961BEF800E1DED0 /* Pretendard-SemiBold.otf in Resources */, CE17F0332961BEF800E1DED0 /* Pretendard-Medium.otf in Resources */, CE6655BF295D82E200C64E12 /* .gitkeep in Resources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift b/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift index b50f1bf8..c7959a13 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift @@ -13,6 +13,7 @@ import KakaoSDKCommon import FirebaseCore import FirebaseFirestore import FirebaseAuth +import FirebaseRemoteConfig @main class AppDelegate: UIResponder, UIApplicationDelegate { @@ -38,6 +39,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure() + setRemoteConfig() + NMFAuthManager.shared().clientId = Config.naverMapClientId KakaoSDK.initSDK(appKey: Config.kakaoNativeAppKey) @@ -58,3 +61,57 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } } + +extension AppDelegate { + func setRemoteConfig() { + let remoteConfig = RemoteConfig.remoteConfig() + let settings = RemoteConfigSettings() + + settings.minimumFetchInterval = 0 + remoteConfig.configSettings = settings + + remoteConfig.fetch() { (status, error) -> Void in + if status == .success { + remoteConfig.activate() { (changed, error) in + guard let info = Bundle.main.infoDictionary, + let currentVersion = info["CFBundleShortVersionString"] as? String, + let identifier = info["CFBundleIdentifier"] as? String, + let storeVersion = remoteConfig["iOS_current_market_version"].stringValue + else { return } + + if currentVersion.compare(storeVersion, options: .numeric) == .orderedAscending { + self.showUpdateAlert() + } + } + } else { + print("Error: \(error?.localizedDescription ?? "No error available.")") + } + } + } + + func showUpdateAlert() { + DispatchQueue.main.sync { + let alert = UIAlertController( + title: "업데이트 알림", + message: "새로운 기능이 추가된 'Runnect'의 최신 버전을 만나보세요!\n지금 바로 업데이트하고 개선된 사용자 경험을 즐겨보세요.", + preferredStyle: .alert + ) + + let updateAction = UIAlertAction(title: "업데이트 링크", style: .default) { _ in + let url = "itms-apps://itunes.apple.com/app/1663884202" + if let url = URL(string: url), UIApplication.shared.canOpenURL(url) { + if #available(iOS 13.0, *) { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } else { + UIApplication.shared.openURL(url) + } + } + } + + alert.addAction(updateAction) + if let vc = UIApplication.shared.keyWindow?.rootViewController { + vc.present(alert, animated: true, completion: nil) + } + } + } +} From 9f7a1f137694434c428d47838a16dce8a4081c4e Mon Sep 17 00:00:00 2001 From: SojinLee <513sojin@naver.com> Date: Fri, 2 Feb 2024 02:46:32 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Fix]=20#206=20-=20fetch=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=20=EC=B5=9C=EC=86=8C=20=EA=B0=84=EA=B2=A9=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift b/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift index c7959a13..fc807562 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift @@ -67,7 +67,8 @@ extension AppDelegate { let remoteConfig = RemoteConfig.remoteConfig() let settings = RemoteConfigSettings() - settings.minimumFetchInterval = 0 + /// 개발 중에는 0으로 설정 + settings.minimumFetchInterval = 86400 // 24hour remoteConfig.configSettings = settings remoteConfig.fetch() { (status, error) -> Void in