-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat [#181] 앱 버전 업데이트 알림 구현 #182
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
722d489
[Feat] #181 - AppStore 버전 체크 코드 구현
yeonsu0-0 7b2e94a
[Feat] #181 - 앱 버전 확인 후 알림 띄우는 기능 구현
yeonsu0-0 1b9a5e3
[Feat] #181 - 버전 업데이트 알림 메세지 Literals로 구현
yeonsu0-0 7b90879
[Delete] #181 - 테스트 코드 삭제
yeonsu0-0 41950b9
[Feat] #181 - 코드리뷰 반영
yeonsu0-0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
DontBe-iOS/DontBe-iOS/Global/Shared/AppStoreCheckManager.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// AppStoreCheckManager.swift | ||
// DontBe-iOS | ||
// | ||
// Created by yeonsu on 4/24/24. | ||
// | ||
|
||
import UIKit | ||
|
||
class AppStoreCheckManager { | ||
|
||
static let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String | ||
static let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String | ||
static let appStoreOpenUrlString = "itms-apps://itunes.apple.com/app/apple-store/6475622329" | ||
|
||
func latestVersion(completion: @escaping (String?) -> Void) { | ||
let appleID = "6475622329" | ||
guard let url = URL(string: "https://itunes.apple.com/lookup?id=\(appleID)&country=kr") else { | ||
completion(nil) | ||
return | ||
} | ||
|
||
URLSession.shared.dataTask(with: url) { (data, response, error) in | ||
guard let data = data, error == nil, | ||
let json = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any], | ||
let results = json["results"] as? [[String: Any]], | ||
let appStoreVersion = results[0]["version"] as? String else { | ||
completion(nil) | ||
return | ||
} | ||
|
||
completion(appStoreVersion) | ||
}.resume() | ||
} | ||
|
||
func openAppStore() { | ||
guard let url = URL(string: AppStoreCheckManager.appStoreOpenUrlString) else { return } | ||
if UIApplication.shared.canOpenURL(url) { | ||
UIApplication.shared.open(url, options: [:], completionHandler: nil) | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3
앱스토어 체크해주는 라이브러리가 있군요!!