Skip to content

Commit

Permalink
Add MaaTools
Browse files Browse the repository at this point in the history
Disable Sparkle updates
  • Loading branch information
hguandl committed Mar 30, 2023
1 parent b92a813 commit 5446811
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "PlayCover/PlayTools" "3.0.0-staging"
github "hguandl/PlayTools" "MaaTools"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "PlayCover/PlayTools" "3.0.0-staging"
github "hguandl/PlayTools" "a93656743041d60d2d0a3f779a1c51f7f10ef1af"
18 changes: 9 additions & 9 deletions PlayCover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ -z \"$FASTLANE\" ]]; then\n\tset -euo pipefail\n\techo \"Bootstraping carthage\"\n\n\tif [ -x /usr/local/bin/carthage ]; then\n\t\tcarthage=/usr/local/bin/carthage\n\telif [ -x /opt/homebrew/bin/carthage ]; then\n\t\tcarthage=/opt/homebrew/bin/carthage\n\telse\n\t\techo \"Cannot find carthage\"\n\t\texit 1\n\tfi\n\n\t$carthage update --use-xcframeworks\nfi\n";
shellScript = "if [ -x /usr/local/bin/gh ]; then\n gh=/usr/local/bin/gh\nelif [ -x /opt/homebrew/bin/gh ]; then\n gh=/opt/homebrew/bin/gh\nfi\n\nif [[ -n $gh ]]; then\n echo \"Checking dependency\"\n\n LOCAL_SHA=$(cat Cartfile.resolved | grep \"hguandl/PlayTools\" | awk '{print $3}' | tr -d '\"\\n')\n REMOTE_SHA=$($gh api /repos/hguandl/PlayTools/commits/MaaTools\"?per_page=1\" -q .sha | tr -d '\\n')\n\n if [[ \"$LOCAL_SHA\" = \"$REMOTE_SHA\" ]]; then\n echo \"Up-to-date.\"\n exit 0\n fi\nfi\n\nif [[ -z \"$FASTLANE\" ]]; then\n\tset -euo pipefail\n\techo \"Bootstraping carthage\"\n\n\tif [ -x /usr/local/bin/carthage ]; then\n\t\tcarthage=/usr/local/bin/carthage\n\telif [ -x /opt/homebrew/bin/carthage ]; then\n\t\tcarthage=/opt/homebrew/bin/carthage\n\telse\n\t\techo \"Cannot find carthage\"\n\t\texit 1\n\tfi\n\n\t$carthage update --use-xcframeworks\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -784,14 +784,14 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
BUNDLE_ID_SUFFIX = "";
CODE_SIGN_ENTITLEMENTS = PlayCover/PlayCoverRelease.entitlements;
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 233;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "PlayCover/Preview\\ Content";
DEVELOPMENT_TEAM = 792V9HMJW3;
DEVELOPMENT_TEAM = 29V29Y67P2;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
EXCLUDED_ARCHS = x86_64;
Expand All @@ -807,7 +807,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = io.playcover.PlayCover;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match Direct io.playcover.PlayCover macos";
PROVISIONING_PROFILE_SPECIFIER = "";
RUN_DOCUMENTATION_COMPILER = YES;
SWIFT_ENFORCE_EXCLUSIVE_ACCESS = off;
SWIFT_OBJC_BRIDGING_HEADER = "./PlayCover/PlayCover-Bridging-Header.h";
Expand Down Expand Up @@ -887,14 +887,14 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
BUNDLE_ID_SUFFIX = .dev;
CODE_SIGN_ENTITLEMENTS = PlayCover/PlayCoverRelease.entitlements;
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 233;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "PlayCover/Preview\\ Content";
DEVELOPMENT_TEAM = 792V9HMJW3;
DEVELOPMENT_TEAM = 29V29Y67P2;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
EXCLUDED_ARCHS = x86_64;
Expand All @@ -910,7 +910,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = io.playcover.PlayCover;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match Direct io.playcover.PlayCover macos";
PROVISIONING_PROFILE_SPECIFIER = "";
RUN_DOCUMENTATION_COMPILER = YES;
SWIFT_ENFORCE_EXCLUSIVE_ACCESS = off;
SWIFT_OBJC_BRIDGING_HEADER = "./PlayCover/PlayCover-Bridging-Header.h";
Expand Down
6 changes: 6 additions & 0 deletions PlayCover/Model/AppSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ struct AppSettingsData: Codable {
var windowFixMethod = 0
var injectIntrospection = false

var maaTools = false
var maaToolsPort = 1717

init() {}

// handle old 2.x settings where PlayChain did not exist yet
Expand All @@ -54,6 +57,9 @@ struct AppSettingsData: Codable {
metalHUD = try container.decodeIfPresent(Bool.self, forKey: .metalHUD) ?? false
windowFixMethod = try container.decodeIfPresent(Int.self, forKey: .windowFixMethod) ?? 0
injectIntrospection = try container.decodeIfPresent(Bool.self, forKey: .injectIntrospection) ?? false

maaTools = try container.decodeIfPresent(Bool.self, forKey: .maaTools) ?? false
maaToolsPort = try container.decodeIfPresent(Int.self, forKey: .maaToolsPort) ?? 1717
}
}

Expand Down
15 changes: 15 additions & 0 deletions PlayCover/Views/AppSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,21 @@ struct BypassesView: View {
.help("settings.toggle.introspection.help")
Spacer()
}
Spacer()
.frame(height: 20)
HStack {
Toggle("MaaTools", isOn: $settings.settings.maaTools)
Spacer()
Text("Port:")
Stepper(value: $settings.settings.maaToolsPort, in: 1024 ... 65535) {
TextField("MaaTools Port",
value: $settings.settings.maaToolsPort,
formatter: GraphicsView.number)
.frame(width: 125)
}
.disabled(!settings.settings.maaTools)
Spacer()
}
}
.padding()
}
Expand Down
9 changes: 6 additions & 3 deletions PlayCover/Views/Sparkle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ final class UpdaterViewModel: ObservableObject {

var automaticallyCheckForUpdates: Bool {
get {
updaterController.updater.automaticallyChecksForUpdates
// updaterController.updater.automaticallyChecksForUpdates
false
}
set(newValue) {
updaterController.updater.automaticallyChecksForUpdates = newValue
// updaterController.updater.automaticallyChecksForUpdates = newValue
_ = newValue
updaterController.updater.automaticallyChecksForUpdates = false
}
}

Expand All @@ -41,7 +44,7 @@ final class UpdaterViewModel: ObservableObject {
}

func checkForUpdates() {
updaterController.checkForUpdates(nil)
// updaterController.checkForUpdates(nil)
}
}

Expand Down
20 changes: 20 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
set -eu -o pipefail

xcodebuild clean archive -scheme PlayCover -configuration Release -archivePath build/PlayCover.xcarchive

APP_BUNDLE="build/PlayCover.xcarchive/Products/Applications/PlayCover.app"
codesign -s "Developer ID Application: Hao Guan (29V29Y67P2)" -f -o runtime --deep --timestamp $APP_BUNDLE/Contents/Frameworks/PlayTools.framework/PlugIns/AKInterface.bundle
codesign -s "Developer ID Application: Hao Guan (29V29Y67P2)" -f -o runtime --deep --timestamp $APP_BUNDLE/Contents/Frameworks/PlayTools.framework
codesign -s "Developer ID Application: Hao Guan (29V29Y67P2)" -f -o runtime --deep --timestamp $APP_BUNDLE/Contents/Frameworks/Sparkle.framework
codesign -s "Developer ID Application: Hao Guan (29V29Y67P2)" -f -o runtime --deep --timestamp $APP_BUNDLE

mkdir -p build/PlayCover
ln -sfh /Applications build/PlayCover/Applications
mv $APP_BUNDLE build/PlayCover
hdiutil create -srcfolder build/PlayCover -format UDBZ build/PlayCover.dmg

xcrun notarytool submit build/PlayCover.dmg --keychain-profile "HG_NOTARY_PWD" --wait
xcrun stapler staple build/PlayCover.dmg
mv build/PlayCover.dmg build/PlayCover-$(date -u +"%Y%m%dT%H%M%SZ").dmg
open build

0 comments on commit 5446811

Please sign in to comment.