Skip to content

Commit

Permalink
[trello.com/c/uDROSQJV] Show commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
just-software-dev committed Sep 19, 2024
1 parent 9f7db49 commit 3d46aeb
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ xcuserdata/

### Here we store Release password. It's super-secret, not for git. ###
AdamantSecret.swift
GitData.plist
runkit ex.rtf
to do.rtf
tz.rtf
Expand Down
31 changes: 26 additions & 5 deletions Adamant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2816,14 +2816,15 @@
buildConfigurationList = E913C9001FFFA51E001A83F7 /* Build configuration list for PBXNativeTarget "Adamant" */;
buildPhases = (
47866E9AB7D201F2CED0064C /* [CP] Check Pods Manifest.lock */,
418BBB14293752F800CAB719 /* Run Script - Load wallets */,
9372E0412C9BC178006DF0B3 /* Run Script - Git Data */,
E913C8EA1FFFA51D001A83F7 /* Sources */,
E913C8EB1FFFA51D001A83F7 /* Frameworks */,
E913C8EC1FFFA51D001A83F7 /* Resources */,
629616F00016639A2AFC5FC7 /* [CP] Embed Pods Frameworks */,
E96D64E62295CD4700CA5587 /* Embed App Extensions */,
A5AC8E01262E0B030053A7E2 /* Embed Frameworks */,
41079EBC28AE974300C32DAF /* ShellScript */,
418BBB14293752F800CAB719 /* Run Script - Load wallets */,
41079EBC28AE974300C32DAF /* Run Script - SwiftLint */,
);
buildRules = (
);
Expand Down Expand Up @@ -3173,7 +3174,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
41079EBC28AE974300C32DAF /* ShellScript */ = {
41079EBC28AE974300C32DAF /* Run Script - SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -3182,6 +3183,7 @@
);
inputPaths = (
);
name = "Run Script - SwiftLint";
outputFileListPaths = (
);
outputPaths = (
Expand All @@ -3192,7 +3194,7 @@
};
418BBB14293752F800CAB719 /* Run Script - Load wallets */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 12;
buildActionMask = 8;
files = (
);
inputFileListPaths = (
Expand All @@ -3206,7 +3208,7 @@
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "$SCRIPT_INPUT_FILE_0 xcode\n$SCRIPT_INPUT_FILE_1 xcode\n\nrm -r $PWD/scripts\n";
};
Expand Down Expand Up @@ -3252,6 +3254,25 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Adamant/Pods-Adamant-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9372E0412C9BC178006DF0B3 /* Run Script - Git Data */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"$(SRCROOT)/CommonKit/Scripts/GitDataScript.sh",
);
name = "Run Script - Git Data";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "$SCRIPT_INPUT_FILE_0 xcode\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
8 changes: 4 additions & 4 deletions Adamant.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"repositoryURL": "https://github.com/EFPrefix/EFQRCode.git",
"state": {
"branch": null,
"revision": "2991c2f318ad9529d93b2a73a382a3f9c72c64ce",
"revision": "97f66a5800dc272206be453ad19604548ff0e0e0",
"version": "6.2.2"
}
},
Expand Down Expand Up @@ -309,11 +309,11 @@
},
{
"package": "swift_qrcodejs",
"repositoryURL": "https://github.com/ApolloZhu/swift_qrcodejs.git",
"repositoryURL": "https://github.com/EFPrefix/swift_qrcodejs.git",
"state": {
"branch": null,
"revision": "374dc7f7b9e76c6aeb393f6a84590c6d387e1ecb",
"version": "2.2.2"
"revision": "817ba220a2eba840bae888e7eeb11207bec05f8c",
"version": "2.3.0"
}
},
{
Expand Down
20 changes: 17 additions & 3 deletions Adamant/Modules/Settings/AboutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ import CommonKit

// MARK: - Localization
extension String.adamant {
struct about {
enum about {
static var title: String {
String.localized("About.Title", comment: "About page: scene title")
}

private init() { }
static func commit(_ commit: String) -> String {
String.localizedStringWithFormat(
String.localized(
"About.Version.Commit",
comment: "Commit Hash"
),
commit
)
}
}
}

Expand Down Expand Up @@ -168,7 +176,13 @@ final class AboutViewController: FormViewController {

if let footer = UINib(nibName: "VersionFooter", bundle: nil).instantiate(withOwner: nil, options: nil).first as? UIView {
if let label = footer.viewWithTag(555) as? UILabel {
label.text = AdamantUtilities.applicationVersion
label.text = [
AdamantUtilities.applicationVersion,
AdamantUtilities.Git.commitHash.map {
.adamant.about.commit(.init($0.prefix(20)))
}
].compactMap { $0 }.joined(separator: "\n\n")

label.textColor = UIColor.adamant.primary
tableView.tableFooterView = footer
}
Expand Down
24 changes: 12 additions & 12 deletions Adamant/SharedViews/VersionFooter.xib
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -18,24 +16,26 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view opaque="NO" contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="60"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="80"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" tag="555" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iBJ-zF-U5k">
<rect key="frame" x="166" y="20" width="42" height="20"/>
<label opaque="NO" userInteractionEnabled="NO" tag="555" contentMode="top" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iBJ-zF-U5k">
<rect key="frame" x="0.0" y="20" width="375" height="20.5"/>
<fontDescription key="fontDescription" name="Exo2-Regular" family="Exo 2" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="iBJ-zF-U5k" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="Ucl-2m-3XZ"/>
<constraint firstItem="iBJ-zF-U5k" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="fuS-YA-s4s"/>
<constraint firstItem="iBJ-zF-U5k" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="B67-90-BpQ"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="iBJ-zF-U5k" secondAttribute="bottom" id="GAf-u8-bTm"/>
<constraint firstItem="iBJ-zF-U5k" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="Pmr-Fh-XVx"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="iBJ-zF-U5k" secondAttribute="trailing" id="ftP-oC-sVt"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<point key="canvasLocation" x="28.5" y="-256"/>
<point key="canvasLocation" x="45.600000000000001" y="-230.28485757121442"/>
</view>
</objects>
</document>
5 changes: 4 additions & 1 deletion CommonKit/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
.library(
name: "CommonKit",
targets: ["CommonKit"]
),
)
],
dependencies: [
.package(
Expand Down Expand Up @@ -67,6 +67,9 @@ let package = Package(
"RNCryptor",
"Alamofire",
"BitcoinKit"
],
resources: [
.process("./Assets/GitData.plist")
]
),
.testTarget(
Expand Down
10 changes: 10 additions & 0 deletions CommonKit/Scripts/GitDataScript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ROOT="$PWD"

echo """<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CommitHash</key>
<string>$(git rev-parse HEAD)</string>
</dict>
</plist>""" > $ROOT/CommonKit/Sources/CommonKit/Assets/GitData.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/* About scene: 'Contact us' section title. */
"About.Section.ContactUs" = "Kontaktieren Sie uns";

/* Commit Hash */
"About.Version.Commit" = "Commit: %@";

/* About scene: Website row */
"About.Row.Website" = "Webseite";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/* About scene: 'Contact us' section title. */
"About.Section.ContactUs" = "Contact us";

/* Commit Hash */
"About.Version.Commit" = "Commit: %@";

/* Contribute scene: 'Crashlytics' section title. */
"Contribute.Section.Crashlytics" = "Crashlytics";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/* About scene: 'Contact us' section title. */
"About.Section.ContactUs" = "Пишите нам";

/* Commit Hash */
"About.Version.Commit" = "Коммит: %@";

/* About scene: Website row */
"About.Row.Website" = "Вебсайт";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/* About scene: 'Contact us' section title. */
"About.Section.ContactUs" = "联系我们";

/* Commit Hash */
"About.Version.Commit" = "Commit: %@";

/* Contribute scene: 'Crashlytics' section title. */
"Contribute.Section.Crashlytics" = "Crashlytics";

Expand Down
9 changes: 9 additions & 0 deletions CommonKit/Sources/CommonKit/Helpers/AdamantUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import Foundation
import os

public enum AdamantUtilities {
public enum Git {}

public static let admCurrencyExponent: Int = -8

// MARK: - Dates
Expand Down Expand Up @@ -58,3 +60,10 @@ public enum AdamantUtilities {
os_log("adamant-console-log %{public}@", message)
}
}

public extension AdamantUtilities.Git {
static let commitHash = Bundle.module.url(
forResource: "GitData",
withExtension: "plist"
).flatMap { NSDictionary(contentsOf: $0)?.value(forKey: "CommitHash") as? String }
}
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: a30619b79caa4b5a7497b0600d449f34b5620eec

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2

0 comments on commit 3d46aeb

Please sign in to comment.