Merge pull request #705 from DobleV55/660-add-supp…item-to-menu

Add support link item in side bar
This commit is contained in:
Kelson 2024-03-29 10:59:58 +01:00 committed by GitHub
commit bd992e690b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 0 deletions

View File

@ -102,6 +102,20 @@ struct RootView: View {
}
}
}
.safeAreaInset(edge: .bottom) {
if let url = URL(string: Brand.supportURLString) {
Link(destination: url) {
HStack {
Image(systemName: "heart")
Text("common.support.app_name".localizedWithFormat(withArgs: Brand.appName))
.foregroundColor(.primary)
.multilineTextAlignment(.leading)
Spacer()
}
}
.padding()
}
}
.frame(minWidth: 150)
.toolbar {
Button {

View File

@ -36,6 +36,7 @@ enum Brand {
static let welcomeLogoImageName: String = "welcomeLogo"
static let aboutText: String = Config.value(for: .aboutText) ?? "settings.about.description".localized
static let aboutWebsite: String = Config.value(for: .aboutWebsite) ?? "https://www.kiwix.org"
static let supportURLString: String = Config.value(for: .supportURL) ?? "https://kiwix.org/get-involved/"
static var defaultExternalLinkPolicy: ExternalLinkLoadingPolicy {
guard let policyString: String = Config.value(for: .externalLinkDefaultPolicy),
@ -66,6 +67,7 @@ enum Config: String {
case showSearchSnippetInSettings = "SETTINGS_SHOW_SEARCH_SNIPPET"
case aboutText = "CUSTOM_ABOUT_TEXT"
case aboutWebsite = "CUSTOM_ABOUT_WEBSITE"
case supportURL = "SUPPORT_URL"
static func value<T>(for key: Config) -> T? where T: LosslessStringConvertible {
guard let object = Bundle.main.object(forInfoDictionaryKey: key.rawValue) else {

View File

@ -23,6 +23,7 @@
"common.button.yes" = "Ja";
"common.button.no" = "nein";
"common.search" = "Suchen";
"common.support.app_name" = "%@ unterstützen";
"common.tab.manager.title" = "Tabs-Manager";
"common.tab.navigation.title" = "Tabs";
"common.tab.menu.new_tab" = "Neuer Tab";

View File

@ -39,6 +39,7 @@
"common.tab.list.close" = "Close Tab";
"common.tab.menu.library" = "Library";
"common.tab.menu.settings" = "Settings";
"common.support.app_name" = "Support %@";
"outline_button.outline.title" = "Outline";
"outline_button.outline.help" = "Show article outline";

View File

@ -21,6 +21,7 @@
"common.button.yes" = "It is a title in the summary table on macOS: we list the attributes of a ZIM file: does it contain pictures yes/no, does it contain Videos yes/no, Details? yes/no";
"common.button.no" = "It is a title in the summary table on macOS: we list the attributes of a ZIM file: does it contain pictures yes/no, does it contain Videos yes/no, Details? yes/no";
"common.search" = "The default placeholder text for searchbars, when the search input field is empty";
"common.support.app_name" = "Button title, opening the external browser to support the app. The App Name being the argument, eg: Support Kiwix";
"common.tab.manager.title" = "Accessibility label for button tab bar button that opens an overlay menu.";
"common.tab.navigation.title" = "On iPad it is a title in the sidemenu grouping tabs related buttons";
"common.tab.menu.new_tab" = "Button title of an item in the overflow menu on iOS, the default title for a new tab (that has no content loaded yet) on iPad";

View File

@ -228,6 +228,10 @@ struct Settings: View {
appStoreID: Brand.appStoreId)
UIApplication.shared.open(url)
}
if let url = URL(string: Brand.supportURLString) {
Link("common.support.app_name".localizedWithFormat(withArgs: Brand.appName),
destination: url)
}
NavigationLink("settings.miscellaneous.navigation.about".localized) { About() }
}
}