Skip to content

Commit

Permalink
- 시스템 로그 기능 추가
Browse files Browse the repository at this point in the history
- 이미 인증이 됐는지 확인하지 않음(일부 머신에서 정상적으로 동작하지 않음)
  • Loading branch information
taggon committed Jan 13, 2017
1 parent a3b09d5 commit 2ffbd2a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Coffeefy/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
DDLog.add(DDTTYLogger.sharedInstance())
#else
let fileLogger = DDFileLogger()
fileLogger?.rollingFrequency = 7 * 60 * 60 * 24 // a week
fileLogger?.rollingFrequency = TimeInterval( 7 * 60 * 60 * 24 )// a week
fileLogger?.logFileManager.maximumNumberOfLogFiles = 1
DDLog.add(fileLogger)
#endif
Expand Down
4 changes: 2 additions & 2 deletions Coffeefy/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.3.0</string>
<key>CFBundleVersion</key>
<string>11</string>
<string>17</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
Expand Down
28 changes: 16 additions & 12 deletions Coffeefy/LoginBot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,26 @@ class LoginBot: NSObject, WKScriptMessageHandler, WKNavigationDelegate {
}

func login() {
NSLog("Checking if in Startbucks network")
DDLogInfo("Checking if in Startbucks network")

Alamofire.request(firstURL).responseString { response in
if let content = response.result.value {
if !content.hasPrefix("<script") {
DDLogInfo("Moving to Google...")
// 다른 사이트로 먼저 이동해야 접속이 이루어짐 HTTP 프로토콜 필수
self.webview.load( URLRequest(url: URL(string: "http://google.com")!) )
// self.webview.load( URLRequest(url: URL(string: firstURL)!) ) // 에러가 발생하는 사례

return;
}
guard let content = response.result.value else {
DDLogWarn("Could not get content from the network.")
return
}

DDLogWarn("This application works only with Startbucks Wifi network.")
self.postResult(success: false)
// if !content.hasPrefix("<script") {
DDLogInfo("Moving to Google...")
// 다른 사이트로 먼저 이동해야 접속이 이루어짐 HTTP 프로토콜 필수
self.webview.load( URLRequest(url: URL(string: "http://google.com")!) )
// self.webview.load( URLRequest(url: URL(string: firstURL)!) ) // 에러가 발생하는 사례

return;
// } else {
// DDLogWarn("This application works only with Startbucks Wifi network.")
// }

// self.postResult(success: false)
}
}

Expand Down

0 comments on commit 2ffbd2a

Please sign in to comment.