changeset 46:ce4eb7416b41

Add SubscriptionFeatureRow
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Mon, 26 Jul 2021 18:25:03 +0100
parents 1c7687d30373
children 75c1a05176f6
files Simoleon.xcodeproj/project.pbxproj Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Simoleon/Helpers/CurrencySelector.swift Simoleon/Helpers/SubscriptionFeature.swift Simoleon/Settings.swift Simoleon/SubscriptionPaywall.swift
diffstat 6 files changed, 69 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/Simoleon.xcodeproj/project.pbxproj	Mon Jul 26 18:24:27 2021 +0100
+++ b/Simoleon.xcodeproj/project.pbxproj	Mon Jul 26 18:25:03 2021 +0100
@@ -11,6 +11,7 @@
 		950A377826A820F800CAB175 /* DefaultCurrency+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950A377526A820F400CAB175 /* DefaultCurrency+CoreDataClass.swift */; };
 		9555933A269B0AB8000FD726 /* ParseJson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95559339269B0AB8000FD726 /* ParseJson.swift */; };
 		9555933D269B0E0A000FD726 /* CurrencyMetadata.json in Resources */ = {isa = PBXBuildFile; fileRef = 9555933C269B0E0A000FD726 /* CurrencyMetadata.json */; };
+		95561E3F26AF25EF00CCB543 /* SubscriptionFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95561E3E26AF25EF00CCB543 /* SubscriptionFeature.swift */; };
 		95562D4D26A8962A0047E778 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95562D4C26A8962A0047E778 /* StoreKit.framework */; };
 		95562D5226A8AEF60047E778 /* Purchases in Frameworks */ = {isa = PBXBuildFile; productRef = 95562D5126A8AEF60047E778 /* Purchases */; };
 		957065E226A5FE0400523E68 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957065E126A5FE0400523E68 /* Settings.swift */; };
@@ -74,6 +75,7 @@
 		950A377626A820F400CAB175 /* DefaultCurrency+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DefaultCurrency+CoreDataProperties.swift"; sourceTree = "<group>"; };
 		95559339269B0AB8000FD726 /* ParseJson.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseJson.swift; sourceTree = "<group>"; };
 		9555933C269B0E0A000FD726 /* CurrencyMetadata.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = CurrencyMetadata.json; sourceTree = "<group>"; };
+		95561E3E26AF25EF00CCB543 /* SubscriptionFeature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionFeature.swift; sourceTree = "<group>"; };
 		95562D4C26A8962A0047E778 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
 		957065E126A5FE0400523E68 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
 		9585BB0F26A6B58500E3193E /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
@@ -340,6 +342,7 @@
 				95D8C8CC26A9784500BCC188 /* SubscribeButton.swift */,
 				95D8C8CE26A98A7900BCC188 /* RestoreButton.swift */,
 				95D8C8D026A9BC6200BCC188 /* LockedCurrencyPicker.swift */,
+				95561E3E26AF25EF00CCB543 /* SubscriptionFeature.swift */,
 			);
 			path = Helpers;
 			sourceTree = "<group>";
@@ -516,6 +519,7 @@
 				95C5179126A5DC8E00BC2B24 /* ConditionalWrapper.swift in Sources */,
 				95B54F5126A4ACAC001DC0D8 /* Sidebar.swift in Sources */,
 				95B54F4626A48852001DC0D8 /* CurrencySelector.swift in Sources */,
+				95561E3F26AF25EF00CCB543 /* SubscriptionFeature.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
Binary file Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/Simoleon/Helpers/CurrencySelector.swift	Mon Jul 26 18:24:27 2021 +0100
+++ b/Simoleon/Helpers/CurrencySelector.swift	Mon Jul 26 18:25:03 2021 +0100
@@ -26,11 +26,9 @@
                         Button(action: { select(currencyPair) }) {
                             CurrencyRow(currencyPair: currencyPair)
                         }
-                        .accessibilityIdentifier("CurrencyRowButton")
                     }
                 }
             }
-            .accessibilityIdentifier("AllCurrencies")
             .gesture(DragGesture()
                  .onChanged({ _ in
                     UIApplication.shared.dismissKeyboard()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Simoleon/Helpers/SubscriptionFeature.swift	Mon Jul 26 18:25:03 2021 +0100
@@ -0,0 +1,41 @@
+//
+//  SubscriptionFeature.swift
+//  Simoleon
+//
+//  Created by Dennis Concepción Martín on 26/07/2021.
+//
+
+import SwiftUI
+
+struct SubscriptionFeature: View {
+    var symbol: LocalizedStringKey
+    var colour: Color
+    var title: LocalizedStringKey
+    var description: LocalizedStringKey
+    
+    var body: some View {
+        HStack(alignment:.top) {
+            Image(systemName: "\(symbol)")
+                .foregroundColor(colour)
+                .font(.title)
+            
+            VStack(alignment: .leading) {
+                Text(title)
+                    .font(.headline)
+                
+                Text(description)
+            }
+        }
+    }
+}
+
+struct SubscriptionFeature_Previews: PreviewProvider {
+    static var previews: some View {
+        SubscriptionFeature(
+            symbol: "star.circle.fill",
+            colour: Color(.systemYellow),
+            title: "Favourite currencies",
+            description: "Save your favourite currencies to access them quickly."
+        )
+    }
+}
--- a/Simoleon/Settings.swift	Mon Jul 26 18:24:27 2021 +0100
+++ b/Simoleon/Settings.swift	Mon Jul 26 18:25:03 2021 +0100
@@ -145,6 +145,5 @@
 struct Settings_Previews: PreviewProvider {
     static var previews: some View {
         Settings()
-            .environment(\.locale, .init(identifier: "es"))
     }
 }
--- a/Simoleon/SubscriptionPaywall.swift	Mon Jul 26 18:24:27 2021 +0100
+++ b/Simoleon/SubscriptionPaywall.swift	Mon Jul 26 18:25:03 2021 +0100
@@ -34,57 +34,33 @@
                     
                     Divider()
                     
-                    HStack(alignment:.top) {
-                        Image(systemName: "star.circle.fill")
-                            .foregroundColor(Color(.systemYellow))
-                            .font(.title)
-                        
-                        VStack(alignment: .leading) {
-                            Text("Favourite currencies", comment: "Subscription feature title")
-                                .font(.headline)
-                            
-                            Text("Save your favourite currencies to access them quickly.", comment: "Subscription feature description")
-                        }
-                    }
+                    SubscriptionFeature(
+                        symbol: "star.circle.fill",
+                        colour: Color(.systemYellow),
+                        title: "Favourite currencies",
+                        description: "Save your favourite currencies to access them quickly."
+                    )
                     
-                    HStack(alignment:.top) {
-                        Image(systemName: "flag.circle.fill")
-                            .foregroundColor(Color(.systemRed))
-                            .font(.title)
-                        
-                        VStack(alignment: .leading) {
-                            Text("Over 170 currencies", comment: "Subscription feature title")
-                                .font(.headline)
-                            
-                            Text("Have access to almost every currency of the world.", comment: "Subscription feature description")
-                        }
-                    }
+                    SubscriptionFeature(
+                        symbol: "flag.circle.fill",
+                        colour: Color(.systemRed),
+                        title: "Over 170 currencies",
+                        description: "Have access to almost every currency of the world."
+                    )
                     
-                    HStack(alignment:.top) {
-                        Image(systemName: "icloud.circle.fill")
-                            .foregroundColor(Color(.systemBlue))
-                            .font(.title)
-                        
-                        VStack(alignment: .leading) {
-                            Text("Simoleon on all your devices", comment: "Subscription feature title")
-                                .font(.headline)
-                            
-                            Text("Your settings and favourite currencies in all your devices.", comment: "Subscription feature description")
-                        }
-                    }
+                    SubscriptionFeature(
+                        symbol: "icloud.circle.fill",
+                        colour: Color(.systemBlue),
+                        title: "Simoleon on all your devices",
+                        description: "Your settings and favourite currencies in all your devices."
+                    )
                     
-                    HStack(alignment:.top) {
-                        Image(systemName: "bitcoinsign.circle.fill")
-                            .foregroundColor(Color(.systemOrange))
-                            .font(.title)
-                        
-                        VStack(alignment: .leading) {
-                            Text("Cryptos and commodities", comment: "Subscription feature title")
-                                .font(.headline)
-                            
-                            Text("Convert your currency between cryptos, gold, and silver.", comment: "Subscription feature description")
-                        }
-                    }
+                    SubscriptionFeature(
+                        symbol: "bitcoinsign.circle.fill",
+                        colour: Color(.systemOrange),
+                        title: "Cryptos and commodities",
+                        description: "Convert your currency between cryptos, gold, and silver."
+                    )
                     
                     Spacer()
                     SubscribeButton(showingSubscriptionPaywall: $showingSubscriptionPaywall)