Skip to content

Commit 609583e

Browse files
committed
[Feat] #206 - remote config 추가
remote config 추가 및 alert 추가
1 parent bf46e56 commit 609583e

File tree

3 files changed

+62
-5
lines changed

3 files changed

+62
-5
lines changed

Runnect-iOS/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ target 'Runnect-iOS' do
2222
pod 'FirebaseAnalytics'
2323
pod 'FirebaseAuth'
2424
pod 'FirebaseFirestore'
25-
25+
pod 'Firebase/RemoteConfig'
2626

2727

2828
end

Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
232686362B03AF4400675A17 /* NetworkProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232686352B03AF4400675A17 /* NetworkProvider.swift */; };
11+
23628DDE2B6BCB9C00894B18 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 23628DDD2B6BCB9C00894B18 /* GoogleService-Info.plist */; };
1112
23EE06C12AC1AD5200CB3FF8 /* LocationSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */; };
1213
23EE06C52AC1AE1900CB3FF8 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */; };
1314
23EE06C92AC1DED100CB3FF8 /* GesturePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */; };
@@ -21,7 +22,6 @@
2122
712DB0702B443ACC0013FD79 /* GAEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712DB06F2B443ACC0013FD79 /* GAEvent.swift */; };
2223
712F661D2A7B7BAB00D9539B /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 712F661C2A7B7BAB00D9539B /* Config.swift */; };
2324
7136BF8A2AF921A900679364 /* CustomBottomSheetVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */; };
24-
713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */; };
2525
715D36E82B2CC64000CAA9D6 /* MyUploadedCourseResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 715D36E72B2CC64000CAA9D6 /* MyUploadedCourseResponseDto.swift */; };
2626
717916DA2B13613B009CEF97 /* MarathonListResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */; };
2727
71802C5C2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71802C5B2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift */; };
@@ -180,6 +180,7 @@
180180

181181
/* Begin PBXFileReference section */
182182
232686352B03AF4400675A17 /* NetworkProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProvider.swift; sourceTree = "<group>"; };
183+
23628DDD2B6BCB9C00894B18 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
183184
23EE06C02AC1AD5200CB3FF8 /* LocationSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSelectView.swift; sourceTree = "<group>"; };
184185
23EE06C42AC1AE1900CB3FF8 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = "<group>"; };
185186
23EE06C82AC1DED100CB3FF8 /* GesturePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePublisher.swift; sourceTree = "<group>"; };
@@ -194,7 +195,6 @@
194195
712DB06F2B443ACC0013FD79 /* GAEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GAEvent.swift; sourceTree = "<group>"; };
195196
712F661C2A7B7BAB00D9539B /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = "<group>"; };
196197
7136BF892AF921A900679364 /* CustomBottomSheetVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomBottomSheetVC.swift; sourceTree = "<group>"; };
197-
713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
198198
715D36E72B2CC64000CAA9D6 /* MyUploadedCourseResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyUploadedCourseResponseDto.swift; sourceTree = "<group>"; };
199199
717916D92B13613B009CEF97 /* MarathonListResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarathonListResponseDto.swift; sourceTree = "<group>"; };
200200
71802C5B2B3364C2008DBCEE /* CourseDetailScrapCountDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDetailScrapCountDto.swift; sourceTree = "<group>"; };
@@ -869,7 +869,7 @@
869869
CE6655A9295D7FAA00C64E12 /* Network */,
870870
CE6655A8295D7F7D00C64E12 /* Presentation */,
871871
CE4545D6295D7AF5003201E1 /* Info.plist */,
872-
713A98EF2B29DD9900189B3C /* GoogleService-Info.plist */,
872+
23628DDD2B6BCB9C00894B18 /* GoogleService-Info.plist */,
873873
);
874874
path = "Runnect-iOS";
875875
sourceTree = "<group>";
@@ -1334,7 +1334,7 @@
13341334
files = (
13351335
CE665615295D989A00C64E12 /* .swiftlint.yml in Resources */,
13361336
CE17F0342961BEF800E1DED0 /* Pretendard-Bold.otf in Resources */,
1337-
713A98F02B29DD9900189B3C /* GoogleService-Info.plist in Resources */,
1337+
23628DDE2B6BCB9C00894B18 /* GoogleService-Info.plist in Resources */,
13381338
CE17F0352961BEF800E1DED0 /* Pretendard-SemiBold.otf in Resources */,
13391339
CE17F0332961BEF800E1DED0 /* Pretendard-Medium.otf in Resources */,
13401340
CE6655BF295D82E200C64E12 /* .gitkeep in Resources */,

Runnect-iOS/Runnect-iOS/Global/Supports/AppDelegate.swift

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import KakaoSDKCommon
1313
import FirebaseCore
1414
import FirebaseFirestore
1515
import FirebaseAuth
16+
import FirebaseRemoteConfig
1617

1718
@main
1819
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -38,6 +39,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3839
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3940

4041
FirebaseApp.configure()
42+
setRemoteConfig()
43+
4144
NMFAuthManager.shared().clientId = Config.naverMapClientId
4245
KakaoSDK.initSDK(appKey: Config.kakaoNativeAppKey)
4346

@@ -58,3 +61,57 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5861
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
5962
}
6063
}
64+
65+
extension AppDelegate {
66+
func setRemoteConfig() {
67+
let remoteConfig = RemoteConfig.remoteConfig()
68+
let settings = RemoteConfigSettings()
69+
70+
settings.minimumFetchInterval = 0
71+
remoteConfig.configSettings = settings
72+
73+
remoteConfig.fetch() { (status, error) -> Void in
74+
if status == .success {
75+
remoteConfig.activate() { (changed, error) in
76+
guard let info = Bundle.main.infoDictionary,
77+
let currentVersion = info["CFBundleShortVersionString"] as? String,
78+
let identifier = info["CFBundleIdentifier"] as? String,
79+
let storeVersion = remoteConfig["iOS_current_market_version"].stringValue
80+
else { return }
81+
82+
if currentVersion.compare(storeVersion, options: .numeric) == .orderedAscending {
83+
self.showUpdateAlert()
84+
}
85+
}
86+
} else {
87+
print("Error: \(error?.localizedDescription ?? "No error available.")")
88+
}
89+
}
90+
}
91+
92+
func showUpdateAlert() {
93+
DispatchQueue.main.sync {
94+
let alert = UIAlertController(
95+
title: "업데이트 알림",
96+
message: "새로운 기능이 추가된 'Runnect'의 최신 버전을 만나보세요!\n지금 바로 업데이트하고 개선된 사용자 경험을 즐겨보세요.",
97+
preferredStyle: .alert
98+
)
99+
100+
let updateAction = UIAlertAction(title: "업데이트 링크", style: .default) { _ in
101+
let url = "itms-apps://itunes.apple.com/app/1663884202"
102+
if let url = URL(string: url), UIApplication.shared.canOpenURL(url) {
103+
if #available(iOS 13.0, *) {
104+
UIApplication.shared.open(url, options: [:], completionHandler: nil)
105+
} else {
106+
UIApplication.shared.openURL(url)
107+
}
108+
}
109+
}
110+
111+
alert.addAction(updateAction)
112+
if let vc = UIApplication.shared.keyWindow?.rootViewController {
113+
vc.present(alert, animated: true, completion: nil)
114+
}
115+
}
116+
}
117+
}

0 commit comments

Comments
 (0)