Skip to content

Commit f0b2ceb

Browse files
committed
Remove GitHash usage and refactor code
1 parent 80f0f82 commit f0b2ceb

7 files changed

Lines changed: 7 additions & 72 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ body:
4040
click on the version number on the welcome screen
4141
value: |
4242
CodeEdit: [e.g. 1.0]
43-
Hash: [e.g. 87a5b3f4c18238c0d06cbfce595e1ca9b11cfd8e]
44-
MacOS: [e.g. 12.3.0]
43+
macOS: [e.g. 12.3.0]
4544
Xcode: [e.g. 13.3]
4645
validations:
4746
required: true

CodeEdit.xcodeproj/project.pbxproj

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,6 @@
648648
B658FB2827DA9E0F00EA4DBD /* Sources */,
649649
B658FB2927DA9E0F00EA4DBD /* Frameworks */,
650650
B658FB2A27DA9E0F00EA4DBD /* Resources */,
651-
2B1A76FC27F628BD008ED4A2 /* Update commit hash */,
652651
2B18499A27F8A7A0005119F0 /* Mark // swiftlint:disable:all as errors | Run Script */,
653652
2BA119D327E5274D00A996FF /* SwiftLint Run Script */,
654653
04ADA0CC27E6043B00BF00B2 /* Add TODO/FIXME as warnings | Run Script */,
@@ -855,24 +854,6 @@
855854
shellPath = /bin/sh;
856855
shellScript = "TAGS=\"\\/\\/ swiftlint:disable all\"\necho \"searching ${SRCROOT} for ${TAGS}\"\nfind \"${SRCROOT}\" \\( -name \"*.swift\" \\) -print0 | xargs -0 egrep --with-filename --line-number --only-matching \"($TAGS).*\\$\" | perl -p -e \"s/($TAGS)/ error: Usage of \\$1 is prohibited/\"\n";
857856
};
858-
2B1A76FC27F628BD008ED4A2 /* Update commit hash */ = {
859-
isa = PBXShellScriptBuildPhase;
860-
buildActionMask = 2147483647;
861-
files = (
862-
);
863-
inputFileListPaths = (
864-
);
865-
inputPaths = (
866-
);
867-
name = "Update commit hash";
868-
outputFileListPaths = (
869-
);
870-
outputPaths = (
871-
);
872-
runOnlyForDeploymentPostprocessing = 0;
873-
shellPath = /bin/sh;
874-
shellScript = "# Hash (full length)\nGITHASH=$(git rev-parse HEAD)\n\necho \"${PROJECT_DIR}/${INFOPLIST_FILE}\"\necho $GITHASH\n# Set the hash.\n/usr/libexec/PlistBuddy -c \"Set :GitHash $GITHASH\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\"\n";
875-
};
876857
2BA119D327E5274D00A996FF /* SwiftLint Run Script */ = {
877858
isa = PBXShellScriptBuildPhase;
878859
buildActionMask = 2147483647;

CodeEdit/Info.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,8 +1239,6 @@
12391239
</array>
12401240
</dict>
12411241
</array>
1242-
<key>GitHash</key>
1243-
<string>92d4bf7f3ea8f1aa861dd6ad1c106f9e38ddd59a</string>
12441242
<key>SUEnableInstallerLauncherService</key>
12451243
<true/>
12461244
<key>SUFeedURL</key>

CodeEditCli/Sources/CodeEditCli/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func convertToAbsolutePath(_ path: String) -> String {
2525

2626
func openApp(paths: [String]? = nil) {
2727
let task = Process()
28-
task.launchPath = "/usr/bin/open" // This should be the same on all installations of MacOS
28+
task.launchPath = "/usr/bin/open" // This should be the same on all installations of macOS
2929

3030
task.arguments = ["-a", "CodeEdit"]
3131

CodeEditModules/Modules/About/src/AboutView.swift

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import Acknowledgements
1212
public struct AboutView: View {
1313
@Environment(\.openURL) private var openURL
1414

15-
@State private var hoveringOnCommitHash = false
16-
1715
public init() {}
1816

1917
private var appVersion: String {
@@ -24,17 +22,6 @@ public struct AboutView: View {
2422
Bundle.buildString ?? "No Build"
2523
}
2624

27-
private var commitHash: String {
28-
Bundle.commitHash ?? "No Hash"
29-
}
30-
31-
private var shortCommitHash: String {
32-
if commitHash.count > 7 {
33-
return String(commitHash[...commitHash.index(commitHash.startIndex, offsetBy: 7)])
34-
}
35-
return commitHash
36-
}
37-
3825
public var body: some View {
3926
HStack(spacing: 0) {
4027
logo
@@ -64,18 +51,6 @@ public struct AboutView: View {
6451
.textSelection(.enabled)
6552
.foregroundColor(.secondary)
6653
.font(.system(size: 13, weight: .light))
67-
HStack(spacing: 2.0) {
68-
Text("Commit:")
69-
Text(self.hoveringOnCommitHash ?
70-
commitHash : shortCommitHash)
71-
.textSelection(.enabled)
72-
.onHover { hovering in
73-
self.hoveringOnCommitHash = hovering
74-
}
75-
.animation(.easeInOut, value: self.hoveringOnCommitHash)
76-
}
77-
.foregroundColor(.secondary)
78-
.font(.system(size: 10, weight: .light))
7954
}
8055
}
8156

CodeEditModules/Modules/CodeEditUtils/src/Extensions/Bundle+Info.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,4 @@ public extension Bundle {
1818
static var buildString: String? {
1919
Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String
2020
}
21-
22-
/// Returns the main bundle's commitHash string if available (e.g. 7dbca499d2ae5e4a6d674c6cb498a862e930f4c3)
23-
static var commitHash: String? {
24-
Bundle.main.object(forInfoDictionaryKey: "GitHash") as? String
25-
}
2621
}

CodeEditModules/Modules/WelcomeModule/src/WelcomeView.swift

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ public struct WelcomeView: View {
3939
}
4040

4141
private var appVersion: String {
42-
Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? ""
42+
Bundle.versionString ?? ""
4343
}
4444

4545
private var appBuild: String {
46-
Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? ""
46+
Bundle.buildString ?? ""
4747
}
4848

49-
/// Get the MacOS version & build
50-
private var macOsVersion: String {
49+
/// Get the macOS version & build
50+
private var macOSVersion: String {
5151
let url = URL(fileURLWithPath: "/System/Library/CoreServices/SystemVersion.plist")
5252
guard let dict = NSDictionary(contentsOf: url),
5353
let version = dict["ProductUserVisibleVersion"],
@@ -75,24 +75,11 @@ public struct WelcomeView: View {
7575
return "\(version) (\(build))"
7676
}
7777

78-
/// Get the last commit hash.
79-
private var getGitHash: String? {
80-
if let hash = Bundle.main.infoDictionary?["GitHash"] as? String {
81-
return hash
82-
}
83-
84-
return nil
85-
}
86-
8778
/// Get program and operating system information
8879
private func copyInformation() {
8980
var copyString = "CodeEdit: \(appVersion) (\(appBuild))\n"
9081

91-
if let hash = getGitHash {
92-
copyString.append("Commit: \(hash)\n")
93-
}
94-
95-
copyString.append("MacOS: \(macOsVersion)\n")
82+
copyString.append("macOS: \(macOSVersion)\n")
9683

9784
if let xcodeVersion = xcodeVersion {
9885
copyString.append("Xcode: \(xcodeVersion)")

0 commit comments

Comments
 (0)