From 6fcfffafe7e2abcc2f11800351ab09ce67d2b11b Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Fri, 26 May 2023 16:52:40 +1000 Subject: [PATCH] Added logic to include the commit hash in the logs for debug builds --- Session.xcodeproj/project.pbxproj | 22 ++++++++++++++++++++++ Session/Settings/HelpViewModel.swift | 14 +++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index a09fceb75..775572c89 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -4626,6 +4626,7 @@ D221A085169C9E5E00537ABF /* Sources */, D221A086169C9E5E00537ABF /* Frameworks */, D221A087169C9E5E00537ABF /* Resources */, + FDD82C422A2085B900425F05 /* Add Commit Hash To Build Info Plist */, 453518771FC635DD00210559 /* Embed Foundation Extensions */, 4535189F1FC63DBF00210559 /* Embed Frameworks */, 90DF4725BB1271EBA2C66A12 /* [CP] Embed Pods Frameworks */, @@ -5319,6 +5320,27 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + FDD82C422A2085B900425F05 /* Add Commit Hash To Build Info Plist */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + $BUILT_PRODUCTS_DIR/$INFOPLIST_PATH, + $TARGET_BUILD_DIR/$INFOPLIST_PATH, + ); + name = "Add Commit Hash To Build Info Plist"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "INFO_PLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\n\n# Query and save the value; suppress any error message, if key not found.\nvalue=$(/usr/libexec/PlistBuddy -c 'print :GitCommitHash' \"${INFO_PLIST}\" 2>/dev/null)\n\n# Check if value is empty\nif [ -z \"$value\" ] \nthen\n /usr/libexec/PlistBuddy -c \"Add :GitCommitHash string\" \"${INFO_PLIST}\"\nfi\n\n/usr/libexec/PlistBuddy -c \"Set :GitCommitHash `git rev-parse --short=7 HEAD`\" \"${INFO_PLIST}\"\n"; + showEnvVarsInLog = 0; + }; FDE7214D287E50820093DF33 /* Lint Localizable.strings */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; diff --git a/Session/Settings/HelpViewModel.swift b/Session/Settings/HelpViewModel.swift index b93e0fcc4..1f8d6f89c 100644 --- a/Session/Settings/HelpViewModel.swift +++ b/Session/Settings/HelpViewModel.swift @@ -150,7 +150,19 @@ class HelpViewModel: SessionTableViewModel