Files
NetNewsWire/iOS/Settings/Help/AboutView.swift
Stuart Breckenridge ed6ff090be Merge branch 'ios-ui-settings-localised' into localize_strings
# Conflicts:
#	Mac/AppDelegate.swift
#	Mac/Base.lproj/Preferences.storyboard
#	NetNewsWire.xcodeproj/project.pbxproj
#	Shared/Localizations/LocalizedNetNewsWireError.swift
#	iOS/MasterFeed/MasterFeedViewController.swift
#	iOS/Settings/Appearance/ArticleThemeManagerView.swift
#	iOS/Settings/Appearance/DisplayAndBehaviorsView.swift
#	iOS/Settings/General/SettingsView.swift
2023-05-27 17:00:42 +08:00

111 lines
2.7 KiB
Swift

//
// AboutView.swift
// NetNewsWire-iOS
//
// Created by Stuart Breckenridge on 02/10/2022.
// Copyright © 2022 Ranchero Software. All rights reserved.
//
import SwiftUI
import RSCore
struct AboutView: View, LoadableAboutData {
var body: some View {
List {
Section(header: aboutHeaderView) {}
Section(header: Text("label.text.primary-contributors", comment: "Primary Contributors")) {
ForEach(0..<about.PrimaryContributors.count, id: \.self) { i in
contributorView(about.PrimaryContributors[i])
}
}
Section(header: Text("label.text.additional-contributors", comment: "Additional Contributors")) {
ForEach(0..<about.AdditionalContributors.count, id: \.self) { i in
contributorView(about.AdditionalContributors[i])
}
}
Section(header: Text("label.text.thanks", comment: "Thanks"), footer: thanks, content: {})
Section(footer: copyright, content: {})
}
.listStyle(.insetGrouped)
.navigationTitle(Text("navigation.title.about", comment: "About"))
.navigationBarTitleDisplayMode(.inline)
}
var aboutHeaderView: some View {
HStack {
Spacer()
VStack(alignment: .center, spacing: 8) {
Image(uiImage: RSImage.appIconImage!)
.resizable()
.frame(width: 75, height: 75)
.clipShape(RoundedRectangle(cornerRadius: 15, style: .continuous))
Text(Bundle.main.appName)
.font(.headline)
Text("\(Bundle.main.versionNumber) (\(Bundle.main.buildNumber))")
.foregroundColor(.secondary)
.font(.callout)
Text("label.text.netnewswire-byline", comment: "By Brent Simmons and the Ranchero Software team.")
.font(.subheadline)
Text("label.markdown.netnewswire-website", comment: "Markdown formatted link to netnewswire.com")
}
Spacer()
}
.textCase(.none)
.multilineTextAlignment(.center)
}
func contributorView(_ appCredit: AboutData.Contributor) -> some View {
HStack {
Text(appCredit.name)
Spacer()
if let role = appCredit.role {
Text(role)
.font(.footnote)
.foregroundColor(.secondary)
.multilineTextAlignment(.trailing)
}
if let _ = appCredit.url {
Image(systemName: "info.circle")
.foregroundColor(.secondary)
}
}
.onTapGesture {
guard let url = appCredit.url else { return }
if let creditURL = URL(string: url) {
UIApplication.shared.open(creditURL)
}
}
}
var thanks: some View {
Text(about.ThanksMarkdown)
.multilineTextAlignment(.center)
.font(.callout)
}
var copyright: some View {
HStack {
Spacer()
Text(verbatim: "Copyright © Brent Simmons 2002 - \(Calendar.current.component(.year, from: .now))")
Spacer()
}
}
}
struct AboutView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
AboutView()
}
}
}