Skip to content

Commit

Permalink
refactor: misc infoview refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrighetti committed Nov 5, 2023
1 parent db8b862 commit 9bbfb60
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Binary file not shown.
32 changes: 23 additions & 9 deletions HNReader/View/InfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,32 @@
// Created by Mattia Righetti on 05/11/23.
//

import AppKit
import StoreKit
import SwiftUI

struct InfoView: View {
var version: String {
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
/// Build version of the app, i.e. `64`
let appBundleVersion: String = Bundle.main.infoDictionary?["CFBundleVersion"] as! String

return "\(version) (\(appBundleVersion))"
}

var body: some View {
VStack {
Text("HNReader v1.2")
.font(.title2)
.padding(.bottom)
Text("HNReader v\(version)")
.font(.custom("IBMPlexSerif-SemiBold", size: 15))

Text("This project is open source")
Text("This project is open source, if you like it you can star it on GitHub.")
.lineLimit(4)
.font(.custom("IBMPlexSerif-Regular", size: 13))
.foregroundStyle(.secondary)
.multilineTextAlignment(.center)
.padding(.vertical)

BgButton(text: "Rate HNReader", icon: "star", minSize: CGSize(width: 200, height: 50), onHover: { h in
BgButton(text: "Rate HNReader", icon: "star", minSize: CGSize(width: 250, height: 50), onHover: { h in
DispatchQueue.main.async {
if (h) {
NSCursor.pointingHand.push()
Expand All @@ -25,10 +39,10 @@ struct InfoView: View {
}
}
}, action: {
NSWorkspace.shared.open(URL(string: "https://github.com/mattrighetti/HNReader.git")!)
NSWorkspace.shared.open(URL(string: "https://apps.apple.com/it/app/id1572480416?action=write-review")!)
})

BgButton(text: "Open on GitHub", icon: "arrow.up.right", minSize: CGSize(width: 200, height: 50), onHover: { h in
BgButton(text: "Open on GitHub", icon: "arrow.up.right", minSize: CGSize(width: 250, height: 50), onHover: { h in
DispatchQueue.main.async {
if (h) {
NSCursor.pointingHand.push()
Expand All @@ -37,11 +51,11 @@ struct InfoView: View {
}
}
}, action: {
NSWorkspace.shared.open(URL(string: "https://github.com/mattrighetti/HNReader.git")!)
NSWorkspace.shared.open(URL(string: "https://github.com/mattrighetti/HNReaderApp.git")!)
})
}
.padding()
.frame(minWidth: 300)
.frame(width: 300)
}
}

Expand Down

0 comments on commit 9bbfb60

Please sign in to comment.