Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into MaaTools
Browse files Browse the repository at this point in the history
  • Loading branch information
hguandl committed Oct 10, 2024
2 parents f9086af + cfac467 commit 95617df
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
https://discord.gg/rMv5qxGTGC.
[https://discord.gg/RNCHsQHr3S](https://discord.gg/RNCHsQHr3S).
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "hguandl/PlayTools" "867c234efbae787b1ce22fdc61ffd73ed70da66b"
github "hguandl/PlayTools" "2dbc2f7578b708f617e9acf9bbd655f4ea7a6ee1"
6 changes: 3 additions & 3 deletions PlayCover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "set -euo pipefail\n\nif [ -x /usr/local/bin/carthage ]; then\n carthage=/usr/local/bin/carthage\nelif [ -x /opt/homebrew/bin/carthage ]; then\n carthage=/opt/homebrew/bin/carthage\nelif [ -x /opt/local/bin/carthage ]; then\n carthage=/opt/local/bin/carthage\nelse\n echo \"Cannot find carthage\"\n exit 1\nfi\n\necho \"Converting to maccatalyst\"\nvtool \\\n -set-build-version maccatalyst 11.0 14.0 \\\n -replace -output \\\n \"${SCRIPT_INPUT_FILE_0}/PlayTools\" \\\n \"${SCRIPT_INPUT_FILE_0}/PlayTools\"\n\necho \"Codesigning PlayTools\"\n\n$carthage copy-frameworks\n\necho cp -rf ${SRCROOT}/Carthage/Build/PlayTools.xcframework/ios-arm64/PlayTools.framework/PlugIns/AKInterface.bundle ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/PlayTools.framework/PlugIns/AKInterface.bundle\n\nrm -rf ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/PlayTools.framework/PlugIns/AKInterface.bundle\ncp -rf ${SRCROOT}/Carthage/Build/PlayTools.xcframework/ios-arm64/PlayTools.framework/PlugIns/AKInterface.bundle ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/PlayTools.framework/PlugIns/AKInterface.bundle\n";
shellScript = "set -euo pipefail\n\nif [ -x /usr/local/bin/carthage ]; then\n carthage=/usr/local/bin/carthage\nelif [ -x /opt/homebrew/bin/carthage ]; then\n carthage=/opt/homebrew/bin/carthage\nelif [ -x /opt/local/bin/carthage ]; then\n carthage=/opt/local/bin/carthage\nelse\n echo \"Cannot find carthage\"\n exit 1\nfi\n\necho \"Codesigning PlayTools\"\n\n$carthage copy-frameworks\n\necho cp -rf ${SCRIPT_INPUT_FILE_0}/PlugIns/AKInterface.bundle ${SCRIPT_OUTPUT_FILE_0}/PlugIns/AKInterface.bundle\n\nrm -rf ${SCRIPT_OUTPUT_FILE_0}/PlugIns/AKInterface.bundle\ncp -rf ${SCRIPT_INPUT_FILE_0}/PlugIns/AKInterface.bundle ${SCRIPT_OUTPUT_FILE_0}/PlugIns/AKInterface.bundle\n\necho \"Converting to maccatalyst\"\nvtool \\\n -set-build-version maccatalyst 11.0 14.0 \\\n -replace -output \\\n \"${SCRIPT_OUTPUT_FILE_0}/PlayTools\" \\\n \"${SCRIPT_OUTPUT_FILE_0}/PlayTools\"\n";
};
AAC28F222899A05B005057FB /* Codesign sparkle */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -794,7 +794,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 310;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "PlayCover/Preview\\ Content";
Expand Down Expand Up @@ -897,7 +897,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 310;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "PlayCover/Preview\\ Content";
Expand Down
4 changes: 2 additions & 2 deletions PlayCover/AppInstaller/Downloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class DownloadApp {
}
}

private func verifyChecksum(checksum: String?, file: URL?, completion: @escaping(Bool) -> Void) {
private func verifyChecksum(checksum: String?, file: URL?, completion: @escaping (Bool) -> Void) {
Task {
if let originalSum = checksum, !originalSum.isEmpty, let fileURL = file {
if let sha256 = fileURL.sha256, originalSum != sha256 {
Expand All @@ -155,7 +155,7 @@ class DownloadApp {
}
}

private func checksumAlert(originalSum: String, givenSum: String, completion: @escaping(Bool) -> Void) {
private func checksumAlert(originalSum: String, givenSum: String, completion: @escaping (Bool) -> Void) {
Task { @MainActor in
let alert = NSAlert()
alert.messageText = NSLocalizedString("playapp.download.differentChecksum", comment: "")
Expand Down
8 changes: 6 additions & 2 deletions PlayCover/Services/SoundDeviceService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class SoundDeviceService {
result: inout T
) -> OSStatus {
var size = UInt32(MemoryLayout<T>.size)
return AudioObjectGetPropertyData(objectID, &address, UInt32(0), nil, &size, &result)
return withUnsafeMutablePointer(to: &result) { result in
AudioObjectGetPropertyData(objectID, &address, UInt32(0), nil, &size, result)
}
}

private func setAudioPropertyData<T>(
Expand All @@ -36,7 +38,9 @@ class SoundDeviceService {
value: inout T)
-> OSStatus {
let size = UInt32(MemoryLayout<T>.size)
return AudioObjectSetPropertyData(objectID, &address, UInt32(0), nil, size, &value)
return withUnsafeMutablePointer(to: &value) { value in
AudioObjectSetPropertyData(objectID, &address, UInt32(0), nil, size, value)
}
}

private func getSoundDevice() -> AudioDeviceID? {
Expand Down
2 changes: 1 addition & 1 deletion PlayCover/Utils/Extensions/URLExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ extension URL {
func enumerateContents(blocking: Bool = true,
includingPropertiesForKeys keys: [URLResourceKey]? = nil,
options: FileManager.DirectoryEnumerationOptions? = nil,
_ callback: @escaping(URL, URLResourceValues) throws -> Void) {
_ callback: @escaping (URL, URLResourceValues) throws -> Void) {
guard let enumerator = FileManager.default.enumerator(
at: self,
includingPropertiesForKeys: keys ?? [.isRegularFileKey],
Expand Down
10 changes: 5 additions & 5 deletions PlayCover/Utils/Shell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class Shell: ObservableObject {

let output = try pipe.fileHandleForReading.readToEnd() ?? Data()
if print {
Log.shared.log(String(decoding: output, as: UTF8.self))
Log.shared.log(String(data: output, encoding: .utf8) ?? "Shell error occured")
}

process.waitUntilExit()
let status = process.terminationStatus
if status != 0 {
throw String(decoding: output, as: UTF8.self)
throw String(data: output, encoding: .utf8) ?? "Shell error occured"
}
return String(decoding: output, as: UTF8.self)
return String(data: output, encoding: .utf8) ?? "Shell error occured"
}

static func runSu(_ args: [String], _ argc: String) -> Bool {
Expand Down Expand Up @@ -121,8 +121,8 @@ class Shell: ObservableObject {
}
}

extension String: Error { }
extension Swift.String: Swift.Error { }

extension String: LocalizedError {
extension Swift.String: Foundation.LocalizedError {
public var errorDescription: String? { self }
}
9 changes: 5 additions & 4 deletions PlayCover/Views/AppSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,11 @@ struct MiscView: View {
app.info.applicationCategoryType = applicationCategoryType
Task.detached {
do {
try Shell.signApp(app.executable)
task = .none
try await Shell.signApp(app.executable)

Task { @MainActor in
task = .none
}
} catch {
Log.shared.error(error)
}
Expand Down Expand Up @@ -694,8 +697,6 @@ struct MiscView: View {
}
Spacer()
.frame(height: 20)
// swiftlint:disable:next todo
// TODO: Test and remove before 3.0 release
HStack {
Toggle("settings.toggle.rootWorkDir", isOn: $settings.settings.rootWorkDir)
.disabled(!(hasPlayTools ?? true))
Expand Down
2 changes: 1 addition & 1 deletion PlayCover/Views/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct MainView: View {
}
if showSourceFolders {
ForEach(store.sourcesData, id: \.hashValue) { source in
NavigationLink {
NavigationLink(tag: source.hashValue, selection: $selectedView) {
IPASourceView(storeVM: store,
selectedBackgroundColor: $selectedBackgroundColor,
selectedTextColor: $selectedTextColor,
Expand Down
12 changes: 6 additions & 6 deletions PlayCover/Views/MenuBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct PlayCoverHelpMenuView: Commands {
}
}
Button("menubar.discord") {
if let url = URL(string: "https://discord.gg/PlayCover") {
if let url = URL(string: "https://discord.gg/RNCHsQHr3S") {
NSWorkspace.shared.open(url)
}
}
Expand All @@ -73,6 +73,7 @@ struct PlayCoverViewMenuView: Commands {
} else if DownloadVM.shared.inProgress {
Log.shared.error(PlayCoverError.waitDownload)
} else {
// remove await for Swift 6 (no async operation occurs)
await NSOpenPanel.selectIPA { result in
if case .success(let url) = result {
Task {
Expand All @@ -86,11 +87,10 @@ struct PlayCoverViewMenuView: Commands {
config.promptsUserIfNeeded = true
let url = NSWorkspace.shared
.urlForApplication(withBundleIdentifier:
"com.sideloadly.sideloadly")
if url != nil {
let unwrap = url.unsafelyUnwrapped
try await NSWorkspace.shared
.open([ipa], withApplicationAt: unwrap, configuration: config)
"io.sideloadly.sideloadly")
if let url = url {
NSWorkspace.shared
.open([ipa], withApplicationAt: url, configuration: config)
} else {
Log.shared.error("Could not find Sideloadly!")
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<br />
<a href="https://playcover.github.io/PlayBook">Documentation</a>
·
<a href="https://discord.gg/rMv5qxGTGC">Discord</a>
<a href="https://discord.gg/RNCHsQHr3S">Discord</a>
·
<a href="https://playcover.io/">Website</a>
</p>
Expand Down

0 comments on commit 95617df

Please sign in to comment.