Skip to content

Commit

Permalink
feat: add version upgrade notice
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengchen committed Jul 10, 2020
1 parent d621dc8 commit 58c851b
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 10 deletions.
8 changes: 4 additions & 4 deletions ClashX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.20.4;
CURRENT_PROJECT_VERSION = 1.30.0;
DEVELOPMENT_TEAM = MEWHFZ92DY;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -911,7 +911,7 @@
"$(PROJECT_DIR)/ClashX/goClash",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.20.4;
MARKETING_VERSION = 1.30.0;
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -931,7 +931,7 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.20.4;
CURRENT_PROJECT_VERSION = 1.30.0;
DEVELOPMENT_TEAM = MEWHFZ92DY;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -953,7 +953,7 @@
"$(PROJECT_DIR)/ClashX/goClash",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.20.4;
MARKETING_VERSION = 1.30.0;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
5 changes: 3 additions & 2 deletions ClashX/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet var copyExportCommandMenuItem: NSMenuItem!
@IBOutlet var copyExportCommandExternalMenuItem: NSMenuItem!
@IBOutlet var experimentalMenu: NSMenu!
@IBOutlet weak var externalControlSeparator: NSMenuItem!
@IBOutlet var externalControlSeparator: NSMenuItem!

var disposeBag = DisposeBag()
var statusItemView: StatusItemView!
var isSpeedTesting = false
Expand All @@ -75,6 +75,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
statusItemView.frame = CGRect(x: 0, y: 0, width: statusItemLengthWithSpeed, height: 22)
statusMenu.delegate = self
setupStatusMenuItemData()
AppVersionUtil.showUpgradeAlert()
DispatchQueue.main.async {
self.postFinishLaunching()
}
Expand Down
15 changes: 15 additions & 0 deletions ClashX/General/Utils/AppVersionUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,18 @@ class AppVersionUtil: NSObject {
return shared.lastVersionNumber != currentVersion
}
}

extension AppVersionUtil {
static func showUpgradeAlert() {
if hasVersionChanged && currentVersion.hasPrefix("1.30.0") && !isFirstLaunch {
let alert = NSAlert()
alert.messageText = NSLocalizedString("This version of ClashX contains a break change due to clash core 1.0 released. Check if your config is not working properly.", comment: "")
alert.alertStyle = .informational
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
alert.addButton(withTitle: NSLocalizedString("Details", comment: ""))
if alert.runModal() == .alertSecondButtonReturn {
NSWorkspace.shared.open(URL(string: "https://github.com/Dreamacro/clash/wiki/breaking-changes-in-1.0.0")!)
}
}
}
}
6 changes: 6 additions & 0 deletions ClashX/Support Files/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,9 @@

/* No comment provided by engineer. */
"Use reload config to try reconnect." = "Use reload config to try reconnect.";

/* No comment provided by engineer. */
"Details" = "Details";

/* No comment provided by engineer. */
"This version of ClashX contains a break change due to clash core 1.0 released. Check if your config is not working properly." = "This version of ClashX contains a break change due to clash core 1.0 released. Check if your config is not working properly.";
6 changes: 6 additions & 0 deletions ClashX/Support Files/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,9 @@

/* No comment provided by engineer. */
"Use reload config to try reconnect." = "使用重载配置文件按钮尝试重新连接";

/* No comment provided by engineer. */
"Details" = "查看详情";

/* No comment provided by engineer. */
"This version of ClashX contains a break change due to clash core 1.0 released. Check if your config is not working properly." = "由于Clash Core发布1.0版本,使用此版本的ClashX可能需要更新配置内容,前往 https://github.com/Dreamacro/clash/wiki/breaking-changes-in-1.0.0 查看详情";
2 changes: 1 addition & 1 deletion ClashX/goClash/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/yichengchen/clashX/ClashX

require (
github.com/Dreamacro/clash v0.20.1-0.20200611141947-1c760935f4e5
github.com/Dreamacro/clash v1.0.1-0.20200709022705-35449bfa177e
github.com/oschwald/geoip2-golang v1.4.0
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
)
Expand Down
4 changes: 2 additions & 2 deletions ClashX/goClash/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Dreamacro/clash v0.20.1-0.20200611141947-1c760935f4e5 h1:zSrtHXnU9CryAcHd/qii1MDOrEKXgdyfchHduttAraQ=
github.com/Dreamacro/clash v0.20.1-0.20200611141947-1c760935f4e5/go.mod h1:gwzl5HsWscK0+w+wqUq4SG4tYB1V8GFyGC6/OpN/98A=
github.com/Dreamacro/clash v1.0.1-0.20200709022705-35449bfa177e h1:+oNo5RETw7CMySEUfCpYyperd+XkyoDL9AwJmHMfxqs=
github.com/Dreamacro/clash v1.0.1-0.20200709022705-35449bfa177e/go.mod h1:gwzl5HsWscK0+w+wqUq4SG4tYB1V8GFyGC6/OpN/98A=
github.com/Dreamacro/go-shadowsocks2 v0.1.5 h1:BizWSjmwzAyQoslz6YhJYMiAGT99j9cnm9zlxVr+kyI=
github.com/Dreamacro/go-shadowsocks2 v0.1.5/go.mod h1:LSXCjyHesPY3pLjhwff1mQX72ItcBT/N2xNC685cYeU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
10 changes: 9 additions & 1 deletion ClashX/goClash/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ func parseDefaultConfigThenStart(checkPort, allowLan bool) (*config.Config, erro
cfg.General.MixedPort = 7890
}

if cfg.General.SocksPort == cfg.General.MixedPort {
cfg.General.SocksPort = 0
}

if cfg.General.Port == cfg.General.MixedPort {
cfg.General.Port = 0
}

}

if checkPort {
Expand Down Expand Up @@ -108,7 +116,7 @@ func verifyClashConfig(content *C.char) *C.char {

//export run
func run(checkConfig, allowLan bool) *C.char {
cfg, err := parseDefaultConfigThenStart(checkConfig,allowLan)
cfg, err := parseDefaultConfigThenStart(checkConfig, allowLan)
if err != nil {
return C.CString(err.Error())
}
Expand Down

0 comments on commit 58c851b

Please sign in to comment.