# HG changeset patch # User Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> # Date 1614514733 0 # Node ID a99e97234012e0595298ccd4fac57b7b28af569a # Parent 3ab678160a722e626c866333923c9f115a233016 Update Settings diff -r 3ab678160a72 -r a99e97234012 LazyBear/UI/Settings.swift --- a/LazyBear/UI/Settings.swift Sun Feb 28 12:18:38 2021 +0000 +++ b/LazyBear/UI/Settings.swift Sun Feb 28 12:18:53 2021 +0000 @@ -12,6 +12,8 @@ @FetchRequest(entity: UserSettings.entity(), sortDescriptors: [NSSortDescriptor(keyPath: \UserSettings.changedAt, ascending: false)]) var userSettings: FetchedResults + let setting = SettingMetadata() + @Environment(\.colorScheme) var colorScheme // Detect dark mode var body: some View { NavigationView { @@ -25,10 +27,17 @@ } Section { - SettingRow(image: "at", text: "About", colour: .systemBlue) + ForEach((0...3), id: \.self) { index in + Link(destination: URL(string: setting.links[index])!) { + HStack { + SettingRow(image: setting.images[index], text: setting.texts[index], colour: setting.colours[index]) + FakeLinkArrow() + } + } + .foregroundColor(colorScheme == .dark ? .white: .black) + } + SettingRow(image: "bag.fill", text: "Tip jar", colour: .systemGreen) - SettingRow(image: "suit.heart.fill", text: "Rate Lazybear", colour: .systemRed) - } } .navigationTitle("Settings 👨🏻‍🔧") @@ -36,6 +45,27 @@ } } +struct FakeLinkArrow: View { + var body: some View { + Spacer() + Image(systemName: "chevron.right") + .font(Font.body.weight(.semibold)) + .imageScale(.small) + .opacity(0.2) + } +} + +class SettingMetadata { + var links = ["https://lazybear.app", + "https://lazybear.app", + "https://github.com/DennisTechnologies/Lazybear-App/issues", + "https://github.com/DennisTechnologies/Lazybear-App/discussions"] + + var images = ["at", "suit.heart.fill", "ladybug.fill", "message.fill"] + var texts = ["About", "Rate Lazybear", "Bug tracker", "Community"] + var colours: [UIColor] = [.systemBlue, .systemRed, .systemYellow, .systemTeal] +} + struct Settings_Previews: PreviewProvider { static var previews: some View {