changeset 218:a99e97234012

Update Settings
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 28 Feb 2021 12:18:53 +0000
parents 3ab678160a72
children 317422422d1d
files LazyBear/UI/Settings.swift
diffstat 1 files changed, 33 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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<UserSettings>
+    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 {