diff --git a/.gitignore b/.gitignore index 7a7f97098..bdfc17fd2 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Adamant.xcodeproj/project.pbxproj b/Adamant.xcodeproj/project.pbxproj index deb924f3c..97dd63fc1 100644 --- a/Adamant.xcodeproj/project.pbxproj +++ b/Adamant.xcodeproj/project.pbxproj @@ -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 = ( ); @@ -3173,7 +3174,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 41079EBC28AE974300C32DAF /* ShellScript */ = { + 41079EBC28AE974300C32DAF /* Run Script - SwiftLint */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -3182,6 +3183,7 @@ ); inputPaths = ( ); + name = "Run Script - SwiftLint"; outputFileListPaths = ( ); outputPaths = ( @@ -3192,7 +3194,7 @@ }; 418BBB14293752F800CAB719 /* Run Script - Load wallets */ = { isa = PBXShellScriptBuildPhase; - buildActionMask = 12; + buildActionMask = 8; files = ( ); inputFileListPaths = ( @@ -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"; }; @@ -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 */ diff --git a/Adamant.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Adamant.xcworkspace/xcshareddata/swiftpm/Package.resolved index 88a2fda6f..84afaf1e9 100644 --- a/Adamant.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Adamant.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -60,7 +60,7 @@ "repositoryURL": "https://github.com/EFPrefix/EFQRCode.git", "state": { "branch": null, - "revision": "2991c2f318ad9529d93b2a73a382a3f9c72c64ce", + "revision": "97f66a5800dc272206be453ad19604548ff0e0e0", "version": "6.2.2" } }, @@ -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" } }, { diff --git a/Adamant/Modules/Settings/AboutViewController.swift b/Adamant/Modules/Settings/AboutViewController.swift index d69c88907..56a235f77 100644 --- a/Adamant/Modules/Settings/AboutViewController.swift +++ b/Adamant/Modules/Settings/AboutViewController.swift @@ -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 + ) + } } } @@ -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 } diff --git a/Adamant/SharedViews/VersionFooter.xib b/Adamant/SharedViews/VersionFooter.xib index a01667958..68a47a3d7 100644 --- a/Adamant/SharedViews/VersionFooter.xib +++ b/Adamant/SharedViews/VersionFooter.xib @@ -1,11 +1,9 @@ - - - - + + - + @@ -18,24 +16,26 @@ - + - + - - + + + + - - + diff --git a/CommonKit/Package.swift b/CommonKit/Package.swift index b2d1515aa..ded30abb6 100644 --- a/CommonKit/Package.swift +++ b/CommonKit/Package.swift @@ -15,7 +15,7 @@ let package = Package( .library( name: "CommonKit", targets: ["CommonKit"] - ), + ) ], dependencies: [ .package( @@ -67,6 +67,9 @@ let package = Package( "RNCryptor", "Alamofire", "BitcoinKit" + ], + resources: [ + .process("./Assets/GitData.plist") ] ), .testTarget( diff --git a/CommonKit/Scripts/GitDataScript.sh b/CommonKit/Scripts/GitDataScript.sh new file mode 100755 index 000000000..e2ce85461 --- /dev/null +++ b/CommonKit/Scripts/GitDataScript.sh @@ -0,0 +1,10 @@ +ROOT="$PWD" + +echo """ + + + + CommitHash + $(git rev-parse HEAD) + +""" > $ROOT/CommonKit/Sources/CommonKit/Assets/GitData.plist diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings index 86034c4c2..1a9f53c19 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings @@ -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"; diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings index db573172a..89e3429c4 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings @@ -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"; diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings index de3d032bd..b03173776 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings @@ -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" = "Вебсайт"; diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings index ca3ebcbbb..fa57aef0d 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings @@ -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"; diff --git a/CommonKit/Sources/CommonKit/Helpers/AdamantUtilities.swift b/CommonKit/Sources/CommonKit/Helpers/AdamantUtilities.swift index 10f91c1e9..c86213044 100644 --- a/CommonKit/Sources/CommonKit/Helpers/AdamantUtilities.swift +++ b/CommonKit/Sources/CommonKit/Helpers/AdamantUtilities.swift @@ -10,6 +10,8 @@ import Foundation import os public enum AdamantUtilities { + public enum Git {} + public static let admCurrencyExponent: Int = -8 // MARK: - Dates @@ -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 } +} diff --git a/Podfile.lock b/Podfile.lock index 22fee2d0a..4e31a8ce2 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -21,4 +21,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: a30619b79caa4b5a7497b0600d449f34b5620eec -COCOAPODS: 1.12.1 +COCOAPODS: 1.15.2