misc: upgrade Sparkle version to 2.0 (#1162)

* misc: upgrade Sparkle version to 2.0

* ci: fix ci on pull request

* misc: remove sparkle codesign script and optimize github action script add export step

* misc: fix checkForUpdates don't work issue

* misc: Using `SPUStandardUpdaterController.checkForUpdates(_:)` replace `ontroller?.checkForUpdates(_:)`

* misc: Since SUUpdater is init by code, remove this judge ment

* misc: move judgement

---------

Co-authored-by: yicheng <11733500+yichengchen@users.noreply.github.com>
This commit is contained in:
miniLV 2023-06-14 13:37:53 +08:00 committed by GitHub
parent f266dbf8b7
commit dabbb5bb95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 185 additions and 119 deletions

View File

@ -1,6 +1,6 @@
name: ClashX
on: [ push, pull_request ]
on: [ push ]
env:
FASTLANE_SKIP_UPDATE_CHECK: true

29
.github/workflows/pull_request.yaml vendored Normal file
View File

@ -0,0 +1,29 @@
name: ClashX
on: [ pull_request ]
env:
FASTLANE_SKIP_UPDATE_CHECK: true
jobs:
build:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- name: setup Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: install deps
run: |
bash install_dependency.sh
- name: check
run: |
bundle exec fastlane check

2
.gitignore vendored
View File

@ -18,3 +18,5 @@ fastlane/report.xml
ClashX/Resources/Country.mmdb.gz
.bundle/config
*.app/**
ClashX.app.dSYM.zip
build_derived_data

View File

@ -576,7 +576,6 @@
49CF3B1B20CD7463001EBF94 /* Resources */,
A741C26F5755233F0D7CEC6F /* [CP] Embed Pods Frameworks */,
663E4677213FCDC4006F11BB /* Copy Files */,
494ED8F023EB0B36008D5D2F /* Run Script - Sparkle */,
318032FABBC2E552CB58B254 /* [CP] Copy Pods Resources */,
49B93AD42A3965B40080967C /* Swift Lint */,
);

View File

@ -22,7 +22,8 @@ let statusItemLengthWithSpeed: CGFloat = 72
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var statusItem: NSStatusItem!
@IBOutlet weak var checkForUpdateMenuItem: NSMenuItem!
@IBOutlet var statusMenu: NSMenu!
@IBOutlet var proxySettingMenuItem: NSMenuItem!
@IBOutlet var autoStartMenuItem: NSMenuItem!
@ -587,6 +588,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
AutoUpgardeManager.shared.setup()
AutoUpgardeManager.shared.addChanelMenuItem(&experimentalMenu)
AutoUpgardeManager.shared.setupCheckForUpdatesMenuItem(checkForUpdateMenuItem)
updateExperimentalFeatureStatus()
RemoteControlManager.setupMenuItem(separator: externalControlSeparator)
}

View File

@ -614,6 +614,7 @@
<outlet property="apiPortMenuItem" destination="hwG-qf-DeZ" id="d6K-i7-yCo"/>
<outlet property="autoStartMenuItem" destination="B1J-XB-BiZ" id="xaS-h5-qd0"/>
<outlet property="buildApiModeMenuitem" destination="xG5-B4-mlw" id="1Fy-UQ-jFs"/>
<outlet property="checkForUpdateMenuItem" destination="p0T-J8-Emx" id="9BN-2j-QNB"/>
<outlet property="configSeparatorLine" destination="WzG-og-OyZ" id="hhn-AP-zKJ"/>
<outlet property="copyExportCommandExternalMenuItem" destination="7wl-vK-5JO" id="1Lu-Tu-FJy"/>
<outlet property="copyExportCommandMenuItem" destination="Jmb-PK-rMW" id="tiF-vV-Sqh"/>
@ -817,9 +818,6 @@
</menuItem>
<menuItem title="Check Update" id="p0T-J8-Emx">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="checkForUpdates:" target="fth-rt-saN" id="gaF-35-d7h"/>
</connections>
</menuItem>
<menuItem title="Log level" id="3Da-fL-Mzr">
<modifierMask key="keyEquivalentModifierMask"/>
@ -908,7 +906,7 @@
</items>
</menu>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="fth-rt-saN" customClass="SUUpdater"/>
<customObject id="fth-rt-saN"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<userDefaultsController representsSharedInstance="YES" id="dwS-am-r7H"/>
</objects>

View File

@ -10,8 +10,9 @@ import Cocoa
import Sparkle
class AutoUpgardeManager: NSObject {
var checkForUpdatesMenuItem: NSMenuItem?
static let shared = AutoUpgardeManager()
private var controller:SPUStandardUpdaterController?
private var current: Channel = {
if let value = UserDefaults.standard.object(forKey: "AutoUpgardeManager.current") as? Int,
let channel = Channel(rawValue: value) { return channel }
@ -38,10 +39,14 @@ class AutoUpgardeManager: NSObject {
}
// MARK: Public
func setup() {
guard WebPortalManager.hasWebProtal == false, allowSelectChannel else { return }
SUUpdater.shared()?.delegate = self
controller = SPUStandardUpdaterController(updaterDelegate: self, userDriverDelegate: nil)
}
func setupCheckForUpdatesMenuItem(_ item: NSMenuItem) {
checkForUpdatesMenuItem = item
checkForUpdatesMenuItem?.target = controller
checkForUpdatesMenuItem?.action = #selector(SPUStandardUpdaterController.checkForUpdates(_:))
}
func addChanelMenuItem(_ menu: inout NSMenu) {
@ -72,12 +77,13 @@ extension AutoUpgardeManager {
}
}
extension AutoUpgardeManager: SUUpdaterDelegate {
func feedURLString(for updater: SUUpdater) -> String? {
extension AutoUpgardeManager: SPUUpdaterDelegate {
func feedURLString(for updater: SPUUpdater) -> String? {
guard WebPortalManager.hasWebProtal == false, allowSelectChannel else { return nil }
return current.urlString
}
func updaterWillRelaunchApplication(_ updater: SUUpdater) {
func updaterWillRelaunchApplication(_ updater: SPUUpdater) {
SystemProxyManager.shared.disableProxy(port: 0, socksPort: 0, forceDisable: true)
}
}

View File

@ -1,47 +1,47 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.3)
activesupport (6.1.4.1)
CFPropertyList (3.0.6)
rexml
activesupport (7.0.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.500.0)
aws-sdk-core (3.121.0)
aws-partitions (1.779.0)
aws-sdk-core (3.174.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.66.0)
aws-sdk-core (~> 3, >= 3.174.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.48.0)
aws-sdk-core (~> 3, >= 3.120.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.102.0)
aws-sdk-core (~> 3, >= 3.120.0)
aws-sdk-s3 (1.124.0)
aws-sdk-core (~> 3, >= 3.174.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.4.0)
aws-sigv4 (1.5.2)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.0.3)
cocoapods (1.11.0)
claide (1.1.0)
cocoapods (1.12.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.0)
cocoapods-core (= 1.12.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
@ -49,10 +49,10 @@ GEM
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.0)
activesupport (>= 5.0, < 7)
cocoapods-core (1.12.1)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
@ -62,7 +62,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-downloader (1.6.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
@ -74,28 +74,29 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.1.9)
concurrent-ruby (1.2.2)
declarative (0.0.20)
digest-crc (0.6.4)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
emoji_regex (3.2.2)
dotenv (2.8.1)
emoji_regex (3.2.3)
escape (0.0.4)
ethon (0.14.0)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.85.0)
faraday (1.7.1)
excon (0.100.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-cookie_jar (0.0.7)
faraday (>= 0.8.0)
@ -104,14 +105,17 @@ GEM
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday_middleware (1.1.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.5)
fastlane (2.193.1)
fastimage (2.2.7)
fastlane (2.213.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
@ -135,7 +139,7 @@ GEM
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (~> 2.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (~> 0.1.1)
plist (>= 3.1.0, < 4.0.0)
@ -150,16 +154,16 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-appcenter (1.11.0)
fastlane-plugin-appcenter (2.1.0)
fastlane-plugin-update_xcodeproj (1.0.1)
fastlane-plugin-versioning (0.4.4)
ffi (1.15.4)
fastlane-plugin-versioning (0.5.1)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.11.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-core (0.4.1)
google-apis-androidpublisher_v3 (0.43.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
@ -168,59 +172,59 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.7.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-playcustomapp_v1 (0.5.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-storage_v1 (0.6.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.19.0)
google-apis-core (>= 0.9.0, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.5.0)
faraday (>= 0.17.3, < 2.0)
google-cloud-errors (1.1.0)
google-cloud-storage (1.34.1)
addressable (~> 2.5)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.1)
google-cloud-storage (1.44.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.19.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (0.17.1)
faraday (>= 0.17.3, < 2.0)
googleauth (1.5.2)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.15)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.8.10)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jmespath (1.4.0)
json (2.5.1)
jwt (2.2.3)
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.1)
memoist (0.16.2)
mini_magick (4.11.0)
mini_mime (1.1.1)
minitest (5.14.4)
mini_magick (4.12.0)
mini_mime (1.1.2)
minitest (5.18.0)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.0.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
optparse (0.1.1)
os (1.1.1)
plist (3.6.0)
public_suffix (4.0.6)
os (1.1.4)
plist (3.7.0)
public_suffix (4.0.7)
rake (13.0.6)
representable (3.1.1)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
@ -231,34 +235,34 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.16.0)
signet (0.17.0)
addressable (~> 2.8)
faraday (>= 0.17.3, < 2.0)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.8)
simctl (1.6.10)
CFPropertyList
naturally
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
trailblazer-option (0.1.1)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
tty-spinner (0.9.3)
tty-cursor (~> 0.7)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
webrick (1.7.0)
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.21.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
@ -269,7 +273,6 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
zeitwerk (2.4.2)
PLATFORMS
ruby
@ -282,4 +285,4 @@ DEPENDENCIES
fastlane-plugin-versioning
BUNDLED WITH
2.2.27
2.2.32

View File

@ -28,7 +28,7 @@ target 'ClashX' do
pod 'Starscream','3.1.1'
pod 'AppCenter/Analytics'
pod 'AppCenter/Crashes'
pod 'Sparkle','~>1.0'
pod 'Sparkle','~>2.0'
pod "FlexibleDiff"
pod 'GzipSwift'
pod 'SwiftLint'

View File

@ -17,7 +17,7 @@ PODS:
- RxRelay (6.5.0):
- RxSwift (= 6.5.0)
- RxSwift (6.5.0)
- Sparkle (1.27.1)
- Sparkle (2.4.1)
- Starscream (3.1.1)
- SwiftLint (0.52.2)
- SwiftyJSON (5.0.1)
@ -33,7 +33,7 @@ DEPENDENCIES:
- LetsMove
- RxCocoa
- RxSwift
- Sparkle (~> 1.0)
- Sparkle (~> 2.0)
- Starscream (= 3.1.1)
- SwiftLint
- SwiftyJSON
@ -66,7 +66,7 @@ SPEC CHECKSUMS:
RxCocoa: 94f817b71c07517321eb4f9ad299112ca8af743b
RxRelay: 1de1523e604c72b6c68feadedd1af3b1b4d0ecbd
RxSwift: 5710a9e6b17f3c3d6e40d6e559b9fa1e813b2ef8
Sparkle: 23f98b268284c8c03e6228230fc8f1807ef041d5
Sparkle: 02038653ca2cb9b64bc68952657c28c4d4c8c75d
Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0
SwiftLint: 1ac76dac888ca05cb0cf24d0c85887ec1209961d
SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e

View File

@ -6,13 +6,24 @@ build_app(
workspace: "ClashX.xcworkspace",
scheme: "ClashX",
export_method: "developer-id",
skip_package_pkg: "true",
clean: "true"
skip_package_pkg: "false",
clean: "true",
derived_data_path: "./build_derived_data"
)
sh(command: "rm -vfr ~/Library/Developer/Xcode/Archives/*")
end
lane :check do
build_app(
workspace: "ClashX.xcworkspace",
scheme: "ClashX",
codesigning_identity: "-",
export_method: "developer-id",
skip_package_pkg: "true",
clean: "true",
derived_data_path: "./build_derived_data"
)
end
lane :beta do
current_version = get_version_number(
target: "ClashX"

View File

@ -1,38 +1,54 @@
fastlane documentation
================
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```
```sh
xcode-select --install
```
Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew install fastlane`
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
### build
```sh
[bundle exec] fastlane build
```
fastlane build
### check
```sh
[bundle exec] fastlane check
```
### beta
```
fastlane beta
```sh
[bundle exec] fastlane beta
```
### addKeyChain
```sh
[bundle exec] fastlane addKeyChain
```
fastlane addKeyChain
```
----
This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).