Skip to content

Commit

Permalink
Merge pull request #24 from morishin/show-dev
Browse files Browse the repository at this point in the history
Show dev label
  • Loading branch information
morishin authored Feb 25, 2025
2 parents c1d9dab + c72ec35 commit 63bf9cb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions XDeck/View/UpdateButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ struct UpdateButton: View {
return Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
}

private static var isDebug: Bool {
#if DEBUG
return true
#else
return false
#endif
}

var body: some View {
if let currentVersion = Self.currentVersion {
HStack {
Expand All @@ -21,7 +29,7 @@ struct UpdateButton: View {
.buttonStyle(.bordered)
}
} else {
Button("v\(currentVersion)", action: {
Button("v\(currentVersion)" + (Self.isDebug ? " (dev)" : ""), action: {
openURL(URL(string: "https://github.com/morishin/XDeck/releases/tag/\(currentVersion)")!)
}).buttonStyle(.plain)
}
Expand Down Expand Up @@ -53,7 +61,7 @@ struct UpdateButton: View {
let (_, response) = try await URLSession.shared.data(for: request)
if let latestReleaseUrlString = response.url?.absoluteString {
let latestVersion = extractVersion(from: latestReleaseUrlString)
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "0.0"
let currentVersion = Self.currentVersion ?? "0.0"
if currentVersion.compare(latestVersion, options: .numeric) == .orderedAscending {
DispatchQueue.main.async {
self.latestVersion = latestVersion
Expand Down

0 comments on commit 63bf9cb

Please sign in to comment.