2022-04-12 13:09:14 +00:00
|
|
|
//
|
|
|
|
// AboutView.swift
|
|
|
|
// Passepartout
|
|
|
|
//
|
|
|
|
// Created by Davide De Rosa on 2/7/22.
|
2024-01-14 13:34:21 +00:00
|
|
|
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
|
2022-04-12 13:09:14 +00:00
|
|
|
//
|
|
|
|
// https://github.com/passepartoutvpn
|
|
|
|
//
|
|
|
|
// This file is part of Passepartout.
|
|
|
|
//
|
|
|
|
// Passepartout is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Passepartout is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct AboutView: View {
|
|
|
|
private let versionString = Constants.Global.appVersionString
|
2022-08-27 20:42:52 +00:00
|
|
|
|
|
|
|
private let redditURL = Constants.URLs.subreddit
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2022-08-27 20:42:52 +00:00
|
|
|
private let shareMessage = L10n.Global.Messages.share
|
|
|
|
|
2022-04-12 13:09:14 +00:00
|
|
|
private let readmeURL = Constants.URLs.readme
|
|
|
|
|
2022-04-19 12:18:26 +00:00
|
|
|
private let changelogURL = Constants.URLs.changelog
|
2022-04-12 13:09:14 +00:00
|
|
|
|
|
|
|
private let homeURL = Constants.URLs.website
|
|
|
|
|
|
|
|
private let faqURL = Constants.URLs.faq
|
|
|
|
|
|
|
|
private let disclaimerURL = Constants.URLs.disclaimer
|
|
|
|
|
|
|
|
private let privacyURL = Constants.URLs.privacyPolicy
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
List {
|
2022-08-27 20:42:52 +00:00
|
|
|
infoSection
|
|
|
|
supportSection
|
|
|
|
webSection
|
|
|
|
githubSection
|
2023-07-03 14:54:43 +00:00
|
|
|
}.navigationTitle(L10n.About.title)
|
|
|
|
.themeSecondaryView()
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
2023-07-03 14:54:43 +00:00
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2023-07-03 14:54:43 +00:00
|
|
|
// MARK: -
|
|
|
|
|
|
|
|
private extension AboutView {
|
|
|
|
var infoSection: some View {
|
2022-04-12 13:09:14 +00:00
|
|
|
Section {
|
|
|
|
NavigationLink {
|
|
|
|
VersionView()
|
|
|
|
} label: {
|
|
|
|
Text(L10n.Version.title)
|
|
|
|
.withTrailingText(versionString)
|
|
|
|
}
|
|
|
|
NavigationLink(L10n.Credits.title) {
|
|
|
|
CreditsView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-17 20:55:47 +00:00
|
|
|
|
2023-07-03 14:54:43 +00:00
|
|
|
var supportSection: some View {
|
2022-05-01 17:43:33 +00:00
|
|
|
Section {
|
2022-09-03 08:30:39 +00:00
|
|
|
Button(L10n.About.Items.JoinCommunity.caption) {
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(redditURL)
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
2022-09-03 08:30:39 +00:00
|
|
|
Button(L10n.About.Items.ShareTwitter.caption, action: shareOnTwitter)
|
|
|
|
Button(L10n.About.Items.WriteReview.caption, action: submitReview)
|
2022-05-01 17:43:33 +00:00
|
|
|
} header: {
|
2022-08-27 20:42:52 +00:00
|
|
|
Text(L10n.Menu.All.Support.title)
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-03 14:54:43 +00:00
|
|
|
var webSection: some View {
|
2022-05-01 17:43:33 +00:00
|
|
|
Section {
|
2022-04-12 13:09:14 +00:00
|
|
|
Button(L10n.About.Items.Website.caption) {
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(homeURL)
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
Button(Unlocalized.About.faq) {
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(faqURL)
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
Button(L10n.About.Items.Disclaimer.caption) {
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(disclaimerURL)
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
Button(L10n.About.Items.PrivacyPolicy.caption) {
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(privacyURL)
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
2022-05-01 17:43:33 +00:00
|
|
|
} header: {
|
|
|
|
Text(L10n.About.Sections.Web.header)
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-27 20:42:52 +00:00
|
|
|
|
2023-07-03 14:54:43 +00:00
|
|
|
var githubSection: some View {
|
2022-08-27 20:42:52 +00:00
|
|
|
Section {
|
|
|
|
Button(Unlocalized.About.readme) {
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(readmeURL)
|
2022-08-27 20:42:52 +00:00
|
|
|
}
|
|
|
|
Button(Unlocalized.About.changelog) {
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(changelogURL)
|
2022-08-27 20:42:52 +00:00
|
|
|
}
|
|
|
|
} header: {
|
|
|
|
Text(Unlocalized.About.github)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-03 14:54:43 +00:00
|
|
|
// MARK: -
|
|
|
|
|
|
|
|
private extension AboutView {
|
|
|
|
func shareOnTwitter() {
|
2022-08-27 20:42:52 +00:00
|
|
|
let url = Unlocalized.Social.twitterIntent(withMessage: shareMessage)
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(url)
|
2022-08-27 20:42:52 +00:00
|
|
|
}
|
|
|
|
|
2023-07-03 14:54:43 +00:00
|
|
|
func submitReview() {
|
2022-08-27 20:42:52 +00:00
|
|
|
let reviewURL = Reviewer.urlForReview(withAppId: Constants.App.appStoreId)
|
2023-04-04 07:50:45 +00:00
|
|
|
URL.open(reviewURL)
|
2022-08-27 20:42:52 +00:00
|
|
|
}
|
2022-04-12 13:09:14 +00:00
|
|
|
}
|