Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

feat(app): every error offers Report on GitHub and Show Log

raymondchinscb577dc169b5
diff --git a/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings b/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings
index 2457da5..7fad923 100644
--- a/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings
+++ b/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings
@@ -3858,6 +3858,38 @@
}
}
},
+ "Downloading from %@: %@" : {
+ "localizations" : {
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Download da %1$@: %2$@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "正在从 %1$@ 下载:%2$@"
+ }
+ }
+ }
+ },
+ "Downloading from %@: %@, about %@ left" : {
+ "localizations" : {
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Download da %1$@: %2$@, circa %3$@ rimanenti"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "正在从 %1$@ 下载:%2$@,大约还剩 %3$@"
+ }
+ }
+ }
+ },
"Downloading missing components" : {
"localizations" : {
"it" : {
@@ -6994,6 +7026,22 @@
}
}
},
+ "Report on GitHub" : {
+ "localizations" : {
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Segnala su GitHub"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "在 GitHub 上报告"
+ }
+ }
+ }
+ },
"Reports are posted publicly in Bridgeplay's GitHub Discussions and counted on the compatibility list. Each one has the game, how it ran, anything you write about it, your Mac's chip, memory and displays, the macOS and Bridgeplay versions, the engine and backend, and the game's logs. Your home folder, user and computer names, Steam account name, Steam ID and email addresses are removed from the logs first. You don't need a GitHub account." : {
"localizations" : {
"it" : {
@@ -7602,6 +7650,22 @@
}
}
},
+ "Show Log" : {
+ "localizations" : {
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mostra registro"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "显示日志"
+ }
+ }
+ }
+ },
"Show all compatibility tools" : {
"localizations" : {
"it" : {
diff --git a/app/Sources/BridgeplayApp/Support/ErrorReport.swift b/app/Sources/BridgeplayApp/Support/ErrorReport.swift
new file mode 100644
index 0000000..ab17802
--- /dev/null
+++ b/app/Sources/BridgeplayApp/Support/ErrorReport.swift
@@ -0,0 +1,35 @@
+import AppKit
+import BridgeplayUI
+
+// Any failure the app shows can go to GitHub as a bug report with the redacted end of
+// app.log, which the user reviews before posting.
+enum ErrorReport {
+ static let reportLabel = String(localized: "Report on GitHub")
+
+ @MainActor
+ static func actions(_ failure: String, in place: String) -> [StatusAction] {
+ [StatusAction(label: reportLabel) { open(failure, in: place) },
+ StatusAction(label: String(localized: "Show Log")) { showLog() }]
+ }
+
+ @MainActor
+ static func open(_ failure: String, in place: String) {
+ AppLog.note("reporting from \(place): \(failure)")
+ guard let url = url(failure, in: place) else { return }
+ NSWorkspace.shared.open(url)
+ }
+
+ @MainActor
+ static func showLog() {
+ NSWorkspace.shared.activateFileViewerSelecting([AppLog.file])
+ }
+
+ static func url(_ failure: String, in place: String) -> URL? {
+ GitHubIssue.bugReport(
+ title: "\(place): \(GitHubIssue.summary(failure))",
+ what: "\(place) showed:\n\n\(GameReport.redacted(failure))",
+ version: ProductVersion.display,
+ mac: [SetupChecks.chipName, SetupChecks.macOSDisplay].filter { !$0.isEmpty }.joined(separator: ", "),
+ logs: GameReport.redacted(GitHubIssue.tail(of: AppLog.file)))
+ }
+}
diff --git a/app/Sources/BridgeplayApp/Views/BackupsView.swift b/app/Sources/BridgeplayApp/Views/BackupsView.swift
index 18c47dc..3904f64 100644
--- a/app/Sources/BridgeplayApp/Views/BackupsView.swift
+++ b/app/Sources/BridgeplayApp/Views/BackupsView.swift
@@ -31,7 +31,8 @@ struct BackupsView: View {
tone: .bad,
action: failed.settingsPane.map { pane in
StatusAction(label: Remedy.settingsButton) { Remedy.openSettings(pane) }
- }
+ },
+ menu: ErrorReport.actions(failed.message, in: "Prefix Backups")
)
)
} else if let outcome = model.outcome {
diff --git a/app/Sources/BridgeplayApp/Views/PrefixesView.swift b/app/Sources/BridgeplayApp/Views/PrefixesView.swift
index d55fce5..6fb0510 100644
--- a/app/Sources/BridgeplayApp/Views/PrefixesView.swift
+++ b/app/Sources/BridgeplayApp/Views/PrefixesView.swift
@@ -38,7 +38,8 @@ struct PrefixesView: View {
tone: .bad,
action: failed.settingsPane.map { pane in
StatusAction(label: Remedy.settingsButton) { Remedy.openSettings(pane) }
- }
+ },
+ menu: ErrorReport.actions(failed.message, in: "Prefixes")
)
)
} else if let outcome = model.outcome {
diff --git a/app/Sources/BridgeplayApp/Views/SetupAssistantView.swift b/app/Sources/BridgeplayApp/Views/SetupAssistantView.swift
index a897363..16e0498 100644
--- a/app/Sources/BridgeplayApp/Views/SetupAssistantView.swift
+++ b/app/Sources/BridgeplayApp/Views/SetupAssistantView.swift
@@ -75,7 +75,8 @@ struct SetupAssistantView: View {
content
if let message = model.message {
SetupCard {
- WizardRow(row: StatusRow(title: String(localized: "Something went wrong"), value: message, tone: .bad))
+ WizardRow(row: StatusRow(title: String(localized: "Something went wrong"), value: message, tone: .bad,
+ action: StatusAction(label: ErrorReport.reportLabel) { ErrorReport.open(message, in: "Setup") }))
}
}
}
@@ -286,7 +287,8 @@ struct SetupAssistantView: View {
SetupCard {
ForEach(Array(model.tasks.enumerated()), id: \.element.id) { index, task in
if index > 0 { SetupHairline() }
- WizardRow(row: StatusRow(title: task.title, value: value(of: task), tone: tone(of: task)),
+ WizardRow(row: StatusRow(title: task.title, value: value(of: task), tone: tone(of: task),
+ action: report(task)),
pending: task.state == .running)
.animation(Self.rowSpring, value: task.state)
}
@@ -376,6 +378,12 @@ struct SetupAssistantView: View {
}
}
+ // App Management has its own card and button.
+ private func report(_ task: SetupAssistant.SetupTask) -> StatusAction? {
+ guard case .failed(let reason) = task.state, !model.needsAppManagement else { return nil }
+ return StatusAction(label: ErrorReport.reportLabel) { ErrorReport.open(reason, in: "Setup: \(task.title)") }
+ }
+
private func tone(of task: SetupAssistant.SetupTask) -> StatusTone {
switch task.state {
case .waiting: .neutral
diff --git a/app/Sources/BridgeplayApp/Views/StatusView.swift b/app/Sources/BridgeplayApp/Views/StatusView.swift
index 05f09b2..8e10286 100644
--- a/app/Sources/BridgeplayApp/Views/StatusView.swift
+++ b/app/Sources/BridgeplayApp/Views/StatusView.swift
@@ -304,7 +304,8 @@ struct StatusView: View {
StatusAction(label: Remedy.settingsButton) {
Remedy.openSettings(pane)
}
- }
+ },
+ menu: ErrorReport.actions(failure, in: "Status")
)
} else if let outcome = status.outcome {
StatusRow(title: String(localized: "Done"), value: outcome, tone: .ok)
@@ -398,7 +399,8 @@ struct StatusView: View {
label: String(localized: "Try Again"),
isProminent: true,
isEnabled: !migration.isRunning
- ) { Task { await migration.retry(status) } }
+ ) { Task { await migration.retry(status) } },
+ menu: ErrorReport.actions(failure, in: "Folder move")
)
}
if !migration.keptNotes.isEmpty {
@@ -452,7 +454,8 @@ struct StatusView: View {
value: String(localized: "Sharper on Retina displays, but games run slower."),
toggle: gameDefault(.highResolution, $highResolution))
if let gameDefaultsError {
- StatusRow(title: String(localized: "Something went wrong"), value: gameDefaultsError, tone: .bad)
+ StatusRow(title: String(localized: "Something went wrong"), value: gameDefaultsError, tone: .bad,
+ menu: ErrorReport.actions(gameDefaultsError, in: "Game settings"))
}
} header: {
Text("For Every Game")
diff --git a/app/Sources/BridgeplayInstaller/InstallerReport.swift b/app/Sources/BridgeplayInstaller/InstallerReport.swift
index 6b10b1b..513ce09 100644
--- a/app/Sources/BridgeplayInstaller/InstallerReport.swift
+++ b/app/Sources/BridgeplayInstaller/InstallerReport.swift
@@ -1,23 +1,14 @@
import Foundation
import BridgeplayInstallerCore
+import BridgeplayUI
-/// A GitHub issue prefilled from the bug report form. The user reviews it before posting.
enum InstallerReport {
static func issueURL(failure: String, version: String, installed: String?) -> URL? {
- let summary = failure.split(separator: "\n").first.map(String.init) ?? failure
- let fields = [
- ("template", "bug-report.yml"),
- ("title", "Installer: \(summary.prefix(80))"),
- ("what", "The installer stopped with:\n\n\(failure)"),
- ("version", "Installer, offering \(version)" + (installed.map { ", installed \($0)" } ?? "")),
- ("macos", InstallerLog.system),
- ("logs", InstallerLog.tail()),
- ]
- var allowed = CharacterSet.urlQueryAllowed
- allowed.remove(charactersIn: "&+=?#")
- let query = fields.compactMap { name, value in
- value.addingPercentEncoding(withAllowedCharacters: allowed).map { "\(name)=\($0)" }
- }.joined(separator: "&")
- return URL(string: "https://github.com/raymondchins/Bridgeplay/issues/new?\(query)")
+ GitHubIssue.bugReport(
+ title: "Installer: \(GitHubIssue.summary(failure))",
+ what: "The installer stopped with:\n\n\(failure)",
+ version: "Installer, offering \(version)" + (installed.map { ", installed \($0)" } ?? ""),
+ mac: InstallerLog.system,
+ logs: InstallerLog.tail())
}
}
diff --git a/app/Sources/BridgeplayUI/GitHubIssue.swift b/app/Sources/BridgeplayUI/GitHubIssue.swift
new file mode 100644
index 0000000..037d508
--- /dev/null
+++ b/app/Sources/BridgeplayUI/GitHubIssue.swift
@@ -0,0 +1,34 @@
+import Foundation
+
+/// A bug report on Bridgeplay's GitHub, prefilled from the issue form. The user reviews it
+/// and posts it with their own account.
+public enum GitHubIssue {
+ public static func bugReport(title: String, what: String, version: String, mac: String, logs: String) -> URL? {
+ let fields = [
+ ("template", "bug-report.yml"),
+ ("title", title),
+ ("what", what),
+ ("version", version),
+ ("macos", mac),
+ ("logs", logs),
+ ]
+ var allowed = CharacterSet.urlQueryAllowed
+ allowed.remove(charactersIn: "&+=?#")
+ let query = fields.compactMap { name, value in
+ value.addingPercentEncoding(withAllowedCharacters: allowed).map { "\(name)=\($0)" }
+ }.joined(separator: "&")
+ return URL(string: "https://github.com/raymondchins/Bridgeplay/issues/new?\(query)")
+ }
+
+ /// The first line of a failure, short enough for an issue title.
+ public static func summary(_ failure: String) -> String {
+ String((failure.split(separator: "\n").first.map(String.init) ?? failure).prefix(80))
+ }
+
+ /// The last lines of a log, capped so the link stays under GitHub's URL limit.
+ public static func tail(of url: URL, lines: Int = 40, maxCharacters: Int = 4000) -> String {
+ guard let text = try? String(contentsOf: url, encoding: .utf8) else { return "" }
+ let tail = text.split(separator: "\n", omittingEmptySubsequences: false).suffix(lines).joined(separator: "\n")
+ return tail.count > maxCharacters ? String(tail.suffix(maxCharacters)) : tail
+ }
+}