Permalink
Browse files

베타릴리즈는 베타 업데이트 알림 받음

  • Loading branch information...
youknowone committed Dec 28, 2018
1 parent ec7e615 commit a0aa68db4db9ff462676d4d88bd096a1a7f94250
Showing with 8 additions and 3 deletions.
  1. +8 −3 OSX/GureumAppDelegate.swift
@@ -70,7 +70,7 @@ class NotificationCenterDelegate: NSObject, NSUserNotificationCenterDelegate{
}

func checkUpdate() {
guard let info = (NSApp.delegate as! GureumAppDelegate).getRecentVersion() else {
guard let info = getRecentVersion() else {
return
}
guard info.recent != info.current else {
@@ -93,7 +93,13 @@ class NotificationCenterDelegate: NSObject, NSUserNotificationCenterDelegate{
}

func getRecentVersion() -> VersionInfo? {
let url = URL(string: "http://gureum.io/version.txt")!
let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as! String
var url: URL
if currentVersion.contains("-pre") {
url = URL(string: "http://gureum.io/version-pre.txt")!
} else {
url = URL(string: "http://gureum.io/version.txt")!
}
var request = URLRequest(url: url)
request.timeoutInterval = 0.5
request.cachePolicy = .reloadIgnoringCacheData
@@ -103,7 +109,6 @@ class NotificationCenterDelegate: NSObject, NSUserNotificationCenterDelegate{
if data.length == 0 { // 위에서 제대로 안걸림
return nil
}
let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as! String
let verstring = String(data: data as Data, encoding: String.Encoding.utf8)!
var components = verstring.components(separatedBy: "::")
let version = VersionInfo(recent: components[0], current: currentVersion, download: components[1], note: components[2])

0 comments on commit a0aa68d

Please sign in to comment.