Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Vault/Sources/VaultSettings/OpenSourceStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ public enum OpenSourceStrings {
localized(key: "openSource.aboutLink")
}

public static let openSourceLink = URL(string: "https://github.com/bradleymackey/vault-ios")!
public static let openSourceLink = URL(string: "https://github.com/badbundle/vault-ios")!
}
29 changes: 26 additions & 3 deletions Vault/Sources/VaultiOS/Views/Settings/VaultAboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import VaultSettings

struct VaultAboutView: View {
@State private var viewModel: SettingsViewModel
private let appVersionText: String

init(viewModel: SettingsViewModel) {
init(viewModel: SettingsViewModel, appVersionText: String = Bundle.main.vaultAboutVersionText) {
self.viewModel = viewModel
self.appVersionText = appVersionText
}

var body: some View {
Expand Down Expand Up @@ -100,9 +102,12 @@ struct VaultAboutView: View {
Image("bad-bundle-logo", bundle: VaultFeedAssets.bundle)
.resizable(resizingMode: .stretch)
.scaledToFit()
.frame(height: 30)
.frame(height: 21.6)
Text("free and open since 2024 ✌️")
.font(.caption2.bold())
.font(.caption2)
Text(appVersionText)
.font(.caption2)
.padding(.top, 12)
}
.padding(.top, 24)
.containerRelativeFrame(.horizontal)
Expand All @@ -111,3 +116,21 @@ struct VaultAboutView: View {
}
}
}

extension Bundle {
fileprivate var vaultAboutVersionText: String {
let marketingVersion = object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
let buildNumber = object(forInfoDictionaryKey: "CFBundleVersion") as? String

switch (marketingVersion, buildNumber) {
case let (.some(marketingVersion), .some(buildNumber)):
return "Version \(marketingVersion) (Build \(buildNumber))"
case let (.some(marketingVersion), .none):
return "Version \(marketingVersion)"
case let (.none, .some(buildNumber)):
return "Build \(buildNumber)"
case (.none, .none):
return "Version unavailable"
}
}
}
7 changes: 5 additions & 2 deletions Vault/Tests/VaultiOSTests/VaultAboutViewSnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import Testing
struct VaultAboutViewSnapshotTests {
@Test
func layout() {
let sut = VaultAboutView(viewModel: .init())
.framedForTest(height: 1200)
let sut = VaultAboutView(
viewModel: .init(),
appVersionText: "Version 2.0 (Build 100001)",
)
.framedForTest(height: 1200)

assertSnapshot(of: sut, as: .image)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading