Skip to content

Commit

Permalink
Show IME is up to date if manual check returns so
Browse files Browse the repository at this point in the history
This fixes a user experience issue where manual check did not give any
useful information when no new versions were available.

In addition, a "?manual=yes" is appended to the version check URL to
distinguish between periodic and manual checks.
  • Loading branch information
lukhnos committed Feb 28, 2023
1 parent 9816e1f commit 7153043
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 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) else {
let updateInfoURL = URL(string:(updateInfoURLString + (forced ? "?manual=yes" : ""))) else {
return nil
}

Expand Down Expand Up @@ -196,7 +196,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle

@objc(checkForUpdateForced:)
func checkForUpdate(forced: Bool) {

if checkTask != nil {
// busy
return
Expand Down Expand Up @@ -233,7 +232,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NonModalAlertWindowControlle
report.remoteVersion,
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, .ignored:
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)
case .ignored:
break
}
case .failure(let error):
Expand Down
4 changes: 4 additions & 0 deletions Source/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@
"Basic" = "Basic";

"Advanced" = "Advanced";

"Check for Update Completed" = "Check for Update Completed";

"McBopomofo is up to date." = "McBopomofo is up to date.";
3 changes: 3 additions & 0 deletions Source/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@

"Advanced" = "Advanced";

"Check for Update Completed" = "Check for Update Completed";

"McBopomofo is up to date." = "McBopomofo is up to date.";
4 changes: 4 additions & 0 deletions Source/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@
"Basic" = "基本";

"Advanced" = "進階";

"Check for Update Completed" = "版本檢查完成";

"McBopomofo is up to date." = "您的小麥注音不需要更新。";

0 comments on commit 7153043

Please sign in to comment.