Skip to content

Commit

Permalink
Merge pull request #403 from zonble/master
Browse files Browse the repository at this point in the history
Adds a setting to toggle Big5 code input on/off.
  • Loading branch information
lukhnos authored Dec 19, 2023
2 parents d4ebfae + df469c8 commit c7e8601
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 111 deletions.
10 changes: 4 additions & 6 deletions Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct VersionUpdateApi {
static func check(forced: Bool, callback: @escaping (Result<VersionUpdateApiResult, Error>) -> ()) -> URLSessionTask? {
guard let infoDict = Bundle.main.infoDictionary,
let updateInfoURLString = infoDict[kUpdateInfoEndpointKey] as? String,
let updateInfoURL = URL(string:(updateInfoURLString + (forced ? "?manual=yes" : ""))) else {
let updateInfoURL = URL(string: (updateInfoURLString + (forced ? "?manual=yes" : ""))) else {
return nil
}

Expand All @@ -80,8 +80,7 @@ struct VersionUpdateApi {
do {
guard let plist = try PropertyListSerialization.propertyList(from: data ?? Data(), options: [], format: nil) as? [AnyHashable: Any],
let remoteVersion = plist[kCFBundleVersionKey] as? String,
let infoDict = Bundle.main.infoDictionary
else {
let infoDict = Bundle.main.infoDictionary else {
DispatchQueue.main.async {
forced ? callback(.success(.noNeedToUpdate)) : callback(.success(.ignored))
}
Expand All @@ -102,8 +101,7 @@ struct VersionUpdateApi {
}

guard let siteInfoURLString = plist[kUpdateInfoSiteKey] as? String,
let siteInfoURL = URL(string: siteInfoURLString)
else {
let siteInfoURL = URL(string: siteInfoURLString) else {
DispatchQueue.main.async {
forced ? callback(.success(.noNeedToUpdate)) : callback(.success(.ignored))
}
Expand Down Expand Up @@ -235,7 +233,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle
report.versionDescription)
NonModalAlertWindowController.shared.show(title: NSLocalizedString("New Version Available", comment: ""), content: content, confirmButtonTitle: NSLocalizedString("Visit Website", comment: ""), cancelButtonTitle: NSLocalizedString("Not Now", comment: ""), cancelAsDefault: false, delegate: self)
case .noNeedToUpdate:
NonModalAlertWindowController.shared.show(title:NSLocalizedString("Check for Update Completed", comment: ""), content:NSLocalizedString("McBopomofo is up to date.", comment: ""), confirmButtonTitle:NSLocalizedString("OK", comment: ""), cancelButtonTitle:nil, cancelAsDefault: false, delegate: self)
NonModalAlertWindowController.shared.show(title: NSLocalizedString("Check for Update Completed", comment: ""), content: NSLocalizedString("McBopomofo is up to date.", comment: ""), confirmButtonTitle: NSLocalizedString("OK", comment: ""), cancelButtonTitle: nil, cancelAsDefault: false, delegate: self)
case .ignored:
break
}
Expand Down
Loading

0 comments on commit c7e8601

Please sign in to comment.