From 3d9ad3a5f53fc84a3f390df7f7b2027c7f427442 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Sun, 14 Mar 2021 12:09:23 -0700 Subject: [PATCH] Add link to source code / issue tracker --- Localizations/Localizable.strings | 1 + .../ViewModels/View Models/NavigationViewModel.swift | 8 ++------ Views/SwiftUI/AboutView.swift | 12 +++++++++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Localizations/Localizable.strings b/Localizations/Localizable.strings index fc171db..8e3c3a7 100644 --- a/Localizations/Localizable.strings +++ b/Localizations/Localizable.strings @@ -4,6 +4,7 @@ "about.acknowledgments" = "Acknowledgments"; "about.made-by-metabolist" = "Made by Metabolist"; "about.official-account" = "Official Account"; +"about.source-code-and-issue-tracker" = "Source Code & Issue Tracker"; "about.website" = "Website"; "accessibility.activate-link-%@" = "Activate link: %@"; "accessibility.copy-text" = "Copy text"; diff --git a/ViewModels/Sources/ViewModels/View Models/NavigationViewModel.swift b/ViewModels/Sources/ViewModels/View Models/NavigationViewModel.swift index 6ee1160..daccc2d 100644 --- a/ViewModels/Sources/ViewModels/View Models/NavigationViewModel.swift +++ b/ViewModels/Sources/ViewModels/View Models/NavigationViewModel.swift @@ -130,10 +130,10 @@ public extension NavigationViewModel { titleComponents: ["preferences.blocked-users"]))) } - func navigateToOfficialAccount() { + func navigateToURL(_ url: URL) { presentingSecondaryNavigation = false presentedNewStatusViewModel = nil - identityContext.service.navigationService.item(url: Self.officialAccountURL) + identityContext.service.navigationService.item(url: url) .sink { [weak self] in self?.navigationsSubject.send($0) } .store(in: &cancellables) } @@ -192,7 +192,3 @@ public extension NavigationViewModel { return conversationsViewModel } } - -private extension NavigationViewModel { - static let officialAccountURL = URL(string: "https://mastodon.social/@metabolist")! -} diff --git a/Views/SwiftUI/AboutView.swift b/Views/SwiftUI/AboutView.swift index ff08abf..92891a3 100644 --- a/Views/SwiftUI/AboutView.swift +++ b/Views/SwiftUI/AboutView.swift @@ -19,7 +19,7 @@ struct AboutView: View { .frame(maxWidth: .infinity, alignment: .center) Section(header: Text("about.made-by-metabolist")) { Button { - viewModel.navigateToOfficialAccount() + viewModel.navigateToURL(Self.officialAccountURL) } label: { Label { Text("about.official-account").foregroundColor(.primary) @@ -34,6 +34,13 @@ struct AboutView: View { Image(systemName: "link") } } + Link(destination: Self.sourceCodeAndIssueTrackerURL) { + Label { + Text("about.source-code-and-issue-tracker").foregroundColor(.primary) + } icon: { + Image(systemName: "wrench.and.screwdriver") + } + } } Section { NavigationLink( @@ -48,6 +55,9 @@ struct AboutView: View { private extension AboutView { static let websiteURL = URL(string: "https://metabolist.org")! + static let officialAccountURL = URL(string: "https://mastodon.social/@metabolist")! + static let sourceCodeAndIssueTrackerURL = URL(string: "https://github.com/metabolist/metatext")! + static var version: String { Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" }