# HG changeset patch # User Dennis Concepción Martín # Date 1627375491 -3600 # Node ID b0bce2c8e4a98f618594f3048faa7623310a57c2 # Parent 3fa127885e6095f6a6a156170d710e52a746ebfa Refactor UK spelling to US diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon.xcodeproj/project.pbxproj --- a/Simoleon.xcodeproj/project.pbxproj Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon.xcodeproj/project.pbxproj Tue Jul 27 09:44:51 2021 +0100 @@ -32,10 +32,10 @@ 95B5F53326AADE4B00BDCE89 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 95B5F52D26AADE4B00BDCE89 /* Localizable.strings */; }; 95B5F53426AADE4B00BDCE89 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 95B5F52F26AADE4B00BDCE89 /* InfoPlist.strings */; }; 95C5179126A5DC8E00BC2B24 /* ConditionalWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179026A5DC8E00BC2B24 /* ConditionalWrapper.swift */; }; - 95C5179926A5EC9F00BC2B24 /* FavouriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179826A5EC9F00BC2B24 /* FavouriteButton.swift */; }; - 95C5179C26A5EFBE00BC2B24 /* Favourite+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179A26A5EFBE00BC2B24 /* Favourite+CoreDataClass.swift */; }; - 95C5179D26A5EFBE00BC2B24 /* Favourite+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179B26A5EFBE00BC2B24 /* Favourite+CoreDataProperties.swift */; }; - 95C5179F26A5F34200BC2B24 /* Favourites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179E26A5F34200BC2B24 /* Favourites.swift */; }; + 95C5179926A5EC9F00BC2B24 /* FavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179826A5EC9F00BC2B24 /* FavoriteButton.swift */; }; + 95C5179C26A5EFBE00BC2B24 /* Favorite+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179A26A5EFBE00BC2B24 /* Favorite+CoreDataClass.swift */; }; + 95C5179D26A5EFBE00BC2B24 /* Favorite+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179B26A5EFBE00BC2B24 /* Favorite+CoreDataProperties.swift */; }; + 95C5179F26A5F34200BC2B24 /* Favorites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5179E26A5F34200BC2B24 /* Favorites.swift */; }; 95C517A126A5F6C000BC2B24 /* ResignKeyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C517A026A5F6C000BC2B24 /* ResignKeyboard.swift */; }; 95C5B2282697752600941585 /* SimoleonApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95C5B2272697752600941585 /* SimoleonApp.swift */; }; 95C5B22C2697752700941585 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95C5B22B2697752700941585 /* Assets.xcassets */; }; @@ -98,10 +98,10 @@ 95B5F53526AADE5200BDCE89 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; 95B5F53626AADE5500BDCE89 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; 95C5179026A5DC8E00BC2B24 /* ConditionalWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConditionalWrapper.swift; sourceTree = ""; }; - 95C5179826A5EC9F00BC2B24 /* FavouriteButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavouriteButton.swift; sourceTree = ""; }; - 95C5179A26A5EFBE00BC2B24 /* Favourite+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Favourite+CoreDataClass.swift"; sourceTree = ""; }; - 95C5179B26A5EFBE00BC2B24 /* Favourite+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Favourite+CoreDataProperties.swift"; sourceTree = ""; }; - 95C5179E26A5F34200BC2B24 /* Favourites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Favourites.swift; sourceTree = ""; }; + 95C5179826A5EC9F00BC2B24 /* FavoriteButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteButton.swift; sourceTree = ""; }; + 95C5179A26A5EFBE00BC2B24 /* Favorite+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Favorite+CoreDataClass.swift"; sourceTree = ""; }; + 95C5179B26A5EFBE00BC2B24 /* Favorite+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Favorite+CoreDataProperties.swift"; sourceTree = ""; }; + 95C5179E26A5F34200BC2B24 /* Favorites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Favorites.swift; sourceTree = ""; }; 95C517A026A5F6C000BC2B24 /* ResignKeyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResignKeyboard.swift; sourceTree = ""; }; 95C5B2242697752600941585 /* Simoleon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Simoleon.app; sourceTree = BUILT_PRODUCTS_DIR; }; 95C5B2272697752600941585 /* SimoleonApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimoleonApp.swift; sourceTree = ""; }; @@ -159,8 +159,8 @@ children = ( 950A377526A820F400CAB175 /* DefaultCurrency+CoreDataClass.swift */, 950A377626A820F400CAB175 /* DefaultCurrency+CoreDataProperties.swift */, - 95C5179A26A5EFBE00BC2B24 /* Favourite+CoreDataClass.swift */, - 95C5179B26A5EFBE00BC2B24 /* Favourite+CoreDataProperties.swift */, + 95C5179A26A5EFBE00BC2B24 /* Favorite+CoreDataClass.swift */, + 95C5179B26A5EFBE00BC2B24 /* Favorite+CoreDataProperties.swift */, 95AEBC9A26A04A4200613729 /* CurrencyMetadataModel.swift */, 95AEBCA226A0900E00613729 /* CurrencyQuoteModel.swift */, ); @@ -187,12 +187,12 @@ path = Resources; sourceTree = ""; }; - 95B5F52526AADE4B00BDCE89 /* Localisation */ = { + 95B5F52526AADE4B00BDCE89 /* Localization */ = { isa = PBXGroup; children = ( 95B5F52626AADE4B00BDCE89 /* en.xcloc */, ); - path = Localisation; + path = Localization; sourceTree = ""; }; 95B5F52626AADE4B00BDCE89 /* en.xcloc */ = { @@ -268,7 +268,7 @@ 95AEBC9426A03ECB00613729 /* ContentView.swift */, 95B54F4E26A4AC52001DC0D8 /* ContentViewPad.swift */, 95B54F4326A4842C001DC0D8 /* Conversion.swift */, - 95C5179E26A5F34200BC2B24 /* Favourites.swift */, + 95C5179E26A5F34200BC2B24 /* Favorites.swift */, 957065E126A5FE0400523E68 /* Settings.swift */, 95D8C8C626A95D2900BCC188 /* SubscriptionPaywall.swift */, 95C5B22B2697752700941585 /* Assets.xcassets */, @@ -280,7 +280,7 @@ 95559331269B094A000FD726 /* Models */, 95559338269B0AAA000FD726 /* Functions */, 9555933B269B0DF9000FD726 /* Resources */, - 95B5F52526AADE4B00BDCE89 /* Localisation */, + 95B5F52526AADE4B00BDCE89 /* Localization */, 95C5B22D2697752700941585 /* Preview Content */, ); path = Simoleon; @@ -329,7 +329,7 @@ 95B54F4926A4A450001DC0D8 /* ConversionBox.swift */, 95B54F5026A4ACAC001DC0D8 /* Sidebar.swift */, 95C5179026A5DC8E00BC2B24 /* ConditionalWrapper.swift */, - 95C5179826A5EC9F00BC2B24 /* FavouriteButton.swift */, + 95C5179826A5EC9F00BC2B24 /* FavoriteButton.swift */, 95C517A026A5F6C000BC2B24 /* ResignKeyboard.swift */, 95D8C8CC26A9784500BCC188 /* SubscribeButton.swift */, 95D8C8CE26A98A7900BCC188 /* RestoreButton.swift */, @@ -482,8 +482,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 95C5179926A5EC9F00BC2B24 /* FavouriteButton.swift in Sources */, - 95C5179C26A5EFBE00BC2B24 /* Favourite+CoreDataClass.swift in Sources */, + 95C5179926A5EC9F00BC2B24 /* FavoriteButton.swift in Sources */, + 95C5179C26A5EFBE00BC2B24 /* Favorite+CoreDataClass.swift in Sources */, 950A377826A820F800CAB175 /* DefaultCurrency+CoreDataClass.swift in Sources */, 95C5B2312697752700941585 /* Persistence.swift in Sources */, 9585BB1226A6B71B00E3193E /* ReadConfig.swift in Sources */, @@ -494,8 +494,8 @@ 9585BB1A26A6E8FD00E3193E /* SimpleSuccess.swift in Sources */, 9555933A269B0AB8000FD726 /* ParseJson.swift in Sources */, 95D8C8CF26A98A7900BCC188 /* RestoreButton.swift in Sources */, - 95C5179D26A5EFBE00BC2B24 /* Favourite+CoreDataProperties.swift in Sources */, - 95C5179F26A5F34200BC2B24 /* Favourites.swift in Sources */, + 95C5179D26A5EFBE00BC2B24 /* Favorite+CoreDataProperties.swift in Sources */, + 95C5179F26A5F34200BC2B24 /* Favorites.swift in Sources */, 95C5B2282697752600941585 /* SimoleonApp.swift in Sources */, 95B54F4A26A4A450001DC0D8 /* ConversionBox.swift in Sources */, 95D8C8C726A95D2900BCC188 /* SubscriptionPaywall.swift in Sources */, @@ -695,7 +695,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Simoleon/Simoleon.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"Simoleon/Preview Content\""; DEVELOPMENT_TEAM = MTX83R5H8X; ENABLE_PREVIEWS = YES; @@ -705,7 +705,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2; + MARKETING_VERSION = 1.3; PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.Simoleon; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -720,7 +720,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Simoleon/Simoleon.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"Simoleon/Preview Content\""; DEVELOPMENT_TEAM = MTX83R5H8X; ENABLE_PREVIEWS = YES; @@ -730,7 +730,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2; + MARKETING_VERSION = 1.3; PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.Simoleon; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Binary file Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/ContentView.swift --- a/Simoleon/ContentView.swift Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon/ContentView.swift Tue Jul 27 09:44:51 2021 +0100 @@ -13,41 +13,39 @@ @State private var tab: Tab = .convert + private enum Tab { + case convert, favorites, settings + } + var body: some View { TabView(selection: $tab) { Conversion(currencyPair: defaultCurrency.first?.pair ?? "USD/GBP") .tabItem { - Text("Convert", comment: "Tab bar button to show conversion") - Image(systemName: "arrow.counterclockwise.circle") + Label("Convert", systemImage: "arrow.counterclockwise.circle") } .tag(Tab.convert) .accessibilityIdentifier("Convert") - Favourites() + Favorites() .tabItem { - Text("Favourites", comment: "Tab bar button to show favourites") - Image(systemName: "star") + Label("Favorites", systemImage: "star") } - .tag(Tab.favourites) - .accessibilityIdentifier("Favourites") + .tag(Tab.favorites) + .accessibilityIdentifier("Favorites") Settings() .tabItem { - Text("Settings", comment: "Tab bar button to show settings") - Image(systemName: "gear") + Label("Settings", systemImage: "gear") } .tag(Tab.settings) .accessibilityIdentifier("Settings") } } - - private enum Tab { - case convert, favourites, settings - } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() + .environment(\.locale, Locale(identifier: "es")) } } diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Conversion.swift --- a/Simoleon/Conversion.swift Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon/Conversion.swift Tue Jul 27 09:44:51 2021 +0100 @@ -33,9 +33,8 @@ .padding(.horizontal) ) } - .accessibilityIdentifier("CurrencySelector") - FavouriteButton(currencyPair: currencyPair) + FavoriteButton(currencyPair: currencyPair) } ConversionBox( @@ -52,7 +51,7 @@ } } .onAppear(perform: request) - .navigationTitle(Text("Convert", comment: "Navigation title")) + .navigationTitle("Convert") .toolbar { ToolbarItem(placement: .navigationBarTrailing) { if amountIsEditing { @@ -60,7 +59,7 @@ UIApplication.shared.dismissKeyboard() amountIsEditing = false }) { - Text("Cancel", comment: "Button to stop editing textfield") + Text("Cancel") } } } diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Favorites.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Favorites.swift Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,67 @@ +// +// Favorites.swift +// Simoleon +// +// Created by Dennis Concepción Martín on 19/07/2021. +// + +import SwiftUI + +struct Favorites: View { + @Environment(\.managedObjectContext) private var viewContext + @FetchRequest( + sortDescriptors: [NSSortDescriptor(keyPath: \Favorite.currencyPair, ascending: true)], + animation: .default) private var favorite: FetchedResults + + var body: some View { + VStack { + if favorite.isEmpty { + Group { + Text("Tap ") + Text(Image(systemName: "star")) + Text("to add a currency pair to favorites") + .padding(.top, 5) + } + .foregroundColor(Color(.systemGray)) + } else { + List { + ForEach(favorite) { favorite in + NavigationLink(destination: Conversion(showNavigationView: false, currencyPair: favorite.currencyPair)) { + CurrencyRow(currencyPair: favorite.currencyPair) + } + } + .onDelete(perform: removeFromFavorites) + } + .listStyle(PlainListStyle()) + } + } + .navigationTitle("Favorites") + .toolbar { + #if os(iOS) + EditButton() + #endif + } + .if(UIDevice.current.userInterfaceIdiom == .phone) { content in + NavigationView { content } + } + } + + private func removeFromFavorites(offsets: IndexSet) { + withAnimation { + offsets.map { favorite[$0] }.forEach(viewContext.delete) + + do { + try viewContext.save() + } catch { + let nsError = error as NSError + fatalError("Unresolved error \(nsError), \(nsError.userInfo)") + } + } + } +} + +struct Favorites_Previews: PreviewProvider { + static var previews: some View { + Favorites() + .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) + } +} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Favourites.swift --- a/Simoleon/Favourites.swift Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -// -// Favourites.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 19/07/2021. -// - -import SwiftUI - -struct Favourites: View { - @Environment(\.managedObjectContext) private var viewContext - @FetchRequest( - sortDescriptors: [NSSortDescriptor(keyPath: \Favourite.currencyPair, ascending: true)], - animation: .default) private var favourite: FetchedResults - - var body: some View { - VStack { - if favourite.isEmpty { - Group { - Text("Tap ", comment: "First line when favourites are empty") + Text(Image(systemName: "star")) - Text("to add a currency pair to favourites", comment: "Finish line when favourites are empty") - .padding(.top, 5) - } - .foregroundColor(Color(.systemGray)) - } else { - List { - ForEach(favourite) { favourite in - NavigationLink(destination: Conversion(showNavigationView: false, currencyPair: favourite.currencyPair)) { - CurrencyRow(currencyPair: favourite.currencyPair) - } - } - .onDelete(perform: removeFromFavourites) - } - .listStyle(PlainListStyle()) - } - } - .navigationTitle(Text("Favourites", comment: "Navigation title")) - .toolbar { - #if os(iOS) - EditButton() - #endif - } - .if(UIDevice.current.userInterfaceIdiom == .phone) { content in - NavigationView { content } - } - } - - private func removeFromFavourites(offsets: IndexSet) { - withAnimation { - offsets.map { favourite[$0] }.forEach(viewContext.delete) - - do { - try viewContext.save() - } catch { - let nsError = error as NSError - fatalError("Unresolved error \(nsError), \(nsError.userInfo)") - } - } - } -} - -struct Favourites_Previews: PreviewProvider { - static var previews: some View { - Favourites() - .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) - } -} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Helpers/FavoriteButton.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Helpers/FavoriteButton.swift Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,103 @@ +// +// FavoriteButton.swift +// Simoleon +// +// Created by Dennis Concepción Martín on 19/07/2021. +// + +import SwiftUI + +struct FavoriteButton: View { + var currencyPair: String + + @Environment(\.managedObjectContext) private var viewContext + @FetchRequest(sortDescriptors: []) private var favorite: FetchedResults + + @State private var starSymbol = "star" + + var body: some View { + let favoriteCurrencyPairs = favorite.map { $0.currencyPair } + Button(action: { favoriteAction(favoriteCurrencyPairs) }) { + RoundedRectangle(cornerRadius: 15) + .foregroundColor(Color(.secondarySystemBackground)) + .frame(width: 60, height: 60) + .overlay( + Image(systemName: generateStar(favoriteCurrencyPairs)) + .font(.system(size: 28)) + .foregroundColor(Color(.systemYellow)) + ) + } + } + + /* + If currency pair is favorite: + * Button action is to remove from favorites + else: + * Button action is to add to favorites + */ + private func favoriteAction(_ favoriteCurrencyPairs: [String]) { + if favoriteCurrencyPairs.contains(currencyPair) { + removeFromFavorites() + } else { + addToFavorites() + } + + simpleSuccess() + } + + /* + if currency pair is favorite: + * Return "star.fill" symbol + else: + * Return "star" + */ + private func generateStar(_ favoriteCurrencyPairs: [String]) -> String { + if favoriteCurrencyPairs.contains(currencyPair) { + return "star.fill" + } else { + return "star" + } + } + + /* + * Get first favorite core data object that matches the specified currency pair + * Delete it + */ + private func removeFromFavorites() { + withAnimation { + let favoriteObject = favorite.first(where: { $0.currencyPair == currencyPair }) + viewContext.delete(favoriteObject ?? Favorite()) + + do { + try viewContext.save() + } catch { + let nsError = error as NSError + fatalError("Unresolved error \(nsError), \(nsError.userInfo)") + } + } + } + + /* + * Create a favorite core data object + * Save it + */ + private func addToFavorites() { + withAnimation { + let favorite = Favorite(context: viewContext) + favorite.currencyPair = currencyPair + + do { + try viewContext.save() + } catch { + let nsError = error as NSError + fatalError("Unresolved error \(nsError), \(nsError.userInfo)") + } + } + } +} + +struct FavoriteButton_Previews: PreviewProvider { + static var previews: some View { + FavoriteButton(currencyPair: "USD/GBP") + } +} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Helpers/FavouriteButton.swift --- a/Simoleon/Helpers/FavouriteButton.swift Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -// -// FavouriteButton.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 19/07/2021. -// - -import SwiftUI - -struct FavouriteButton: View { - var currencyPair: String - - @Environment(\.managedObjectContext) private var viewContext - @FetchRequest(sortDescriptors: []) private var favourite: FetchedResults - - @State private var starSymbol = "star" - - var body: some View { - let favouriteCurrencyPairs = favourite.map { $0.currencyPair } - Button(action: { favouriteAction(favouriteCurrencyPairs) }) { - RoundedRectangle(cornerRadius: 15) - .foregroundColor(Color(.secondarySystemBackground)) - .frame(width: 60, height: 60) - .overlay( - Image(systemName: generateStar(favouriteCurrencyPairs)) - .font(.system(size: 28)) - .foregroundColor(Color(.systemYellow)) - ) - } - } - - /* - If currency pair is favourite: - * Button action is to remove from favourites - else: - * Button action is to add to favourites - */ - private func favouriteAction(_ favouriteCurrencyPairs: [String]) { - if favouriteCurrencyPairs.contains(currencyPair) { - removeFromFavourites() - } else { - addToFavourites() - } - - simpleSuccess() - } - - /* - if currency pair is favourite: - * Return "star.fill" symbol - else: - * Return "star" - */ - private func generateStar(_ favouriteCurrencyPairs: [String]) -> String { - if favouriteCurrencyPairs.contains(currencyPair) { - return "star.fill" - } else { - return "star" - } - } - - /* - * Get first favourite core data object that matches the specified currency pair - * Delete it - */ - private func removeFromFavourites() { - withAnimation { - let favouriteObject = favourite.first(where: { $0.currencyPair == currencyPair }) - viewContext.delete(favouriteObject ?? Favourite()) - - do { - try viewContext.save() - } catch { - let nsError = error as NSError - fatalError("Unresolved error \(nsError), \(nsError.userInfo)") - } - } - } - - /* - * Create a favourite core data object - * Save it - */ - private func addToFavourites() { - withAnimation { - let favourite = Favourite(context: viewContext) - favourite.currencyPair = currencyPair - - do { - try viewContext.save() - } catch { - let nsError = error as NSError - fatalError("Unresolved error \(nsError), \(nsError.userInfo)") - } - } - } -} - -struct FavouriteButton_Previews: PreviewProvider { - static var previews: some View { - FavouriteButton(currencyPair: "USD/GBP") - } -} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Helpers/Sidebar.swift --- a/Simoleon/Helpers/Sidebar.swift Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon/Helpers/Sidebar.swift Tue Jul 27 09:44:51 2021 +0100 @@ -14,8 +14,8 @@ Label("Convert", systemImage: "arrow.counterclockwise.circle") } - NavigationLink(destination: Favourites()) { - Label("Favourites", systemImage: "star") + NavigationLink(destination: Favorites()) { + Label("Favorites", systemImage: "star") } NavigationLink(destination: Settings()) { @@ -23,7 +23,7 @@ } } .listStyle(SidebarListStyle()) - .navigationTitle(Text("Categories", comment: "Side bar navigation title")) + .navigationTitle("Categories") } } diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Helpers/SubscriptionFeature.swift --- a/Simoleon/Helpers/SubscriptionFeature.swift Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon/Helpers/SubscriptionFeature.swift Tue Jul 27 09:44:51 2021 +0100 @@ -34,8 +34,8 @@ SubscriptionFeature( symbol: "star.circle.fill", colour: Color(.systemYellow), - title: "Favourite currencies", - description: "Save your favourite currencies to access them quickly." + title: "Favorite currencies", + description: "Save your favorite currencies to access them quickly." ) } } diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localisation/en.xcloc/Localized Contents/en.xliff --- a/Simoleon/Localisation/en.xcloc/Localized Contents/en.xliff Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,251 +0,0 @@ - - - -
- -
- - - Simoleon - Simoleon - Bundle display name - - - Simoleon - Simoleon - Bundle name - - -
- -
- -
- - - %.2f - %.2f - No comment provided by engineer. - - - %1$@ (%2$@) - %1$@ (%2$@) - No comment provided by engineer. - - - - - - - No comment provided by engineer. - - - About - About - No comment provided by engineer. - - - All currencies - All currencies - Section header in currency selector - - - Cancel - Cancel - Button to dismiss currency selector - Button to dismiss paywall modal sheet - Button to stop editing textfield - - - Categories - Categories - Side bar navigation title - - - Contact - Contact - Button to contact in Settings - - - Convert - Convert - Navigation title - Tab bar button to show conversion - - - Convert your currency between cryptos, gold, and silver. - Convert your currency between cryptos, gold, and silver. - Subscription feature description - - - Cryptos and commodities - Cryptos and commodities - Subscription feature title - - - Currencies - Currencies - Navigation title - - - Default currency - Default currency - Label in locked picker - Picker to select default currency - - - Developer's Twitter - Developer's Twitter - Button to go to Twitter in Settings - - - Enter amount - Enter amount - No comment provided by engineer. - - - Expires at %@ - Expires at %@ - Subscriber information - - - Favourite currencies - Favourite currencies - Subscription feature title - - - Favourites - Favourites - Navigation title - Tab bar button to show favourites - - - From %1$@ to %2$@ - From %1$@ to %2$@ - Conversion from one currency to another - - - Have access to almost every currency of the world. - Have access to almost every currency of the world. - Subscription feature description - - - Information - Information - Button to show subscription information in settings - Navigation title - - - Latest purchase %@ - Latest purchase %@ - Subscriber information - - - Member since %@ - Member since %@ - Subscriber information - - - Ok - Ok - Button to dismiss alert - Button to stop searching in currency selector - Dismiss alert - - - Over 170 currencies - Over 170 currencies - Subscription feature title - - - Preferences - Preferences - Section header in settings - - - Privacy Policy - Privacy Policy - Button to go to app privacy policy - - - Rate Simoleon - Rate Simoleon - Button to rate app in Settings - - - Restore purchases - Restore purchases - Button to restore in-App purchases - - - Save your favourite currencies to access them quickly. - Save your favourite currencies to access them quickly. - Subscription feature description - - - Search ... - Search ... - No comment provided by engineer. - - - Settings - Settings - Navigation title - Tab bar button to show settings - - - Simoleon on all your devices - Simoleon on all your devices - Subscription feature title - - - Stay in touch - Stay in touch - Section header in settings - - - Subscribe - Subscribe - Button to suscribe in settings - - - Subscribe for %@ / month - Subscribe for %@ / month - Subscribe button - - - Subscription - Subscription - Section header in settings - - - Tap - Tap - First line when favourites are empty - - - USD/GBP - USD/GBP - Default currency in locked picker - - - Unlock all access - Unlock all access - Headline in Subscription paywall - - - Website - Website - Button to go to Dennis Tech website - - - Your settings and favourite currencies in all your devices. - Your settings and favourite currencies in all your devices. - Subscription feature description - - - to add a currency pair to favourites - to add a currency pair to favourites - Finish line when favourites are empty - - -
-
diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/en.lproj/InfoPlist.strings --- a/Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/en.lproj/InfoPlist.strings Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -/* Bundle display name */ -"CFBundleDisplayName" = "Simoleon"; -/* Bundle name */ -"CFBundleName" = "Simoleon"; diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/en.lproj/Localizable.strings Binary file Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/en.lproj/Localizable.strings has changed diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/es.lproj/InfoPlist.strings --- a/Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/es.lproj/InfoPlist.strings Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -/* Bundle display name */ -"CFBundleDisplayName" = "Simoleon"; -/* Bundle name */ -"CFBundleName" = "Simoleon"; diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/es.lproj/Localizable.strings Binary file Simoleon/Localisation/en.xcloc/Source Contents/Simoleon/es.lproj/Localizable.strings has changed diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localisation/en.xcloc/contents.json --- a/Simoleon/Localisation/en.xcloc/contents.json Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -{ - "developmentRegion" : "en", - "project" : "Simoleon.xcodeproj", - "targetLocale" : "en", - "toolInfo" : { - "toolBuildNumber" : "12E507", - "toolID" : "com.apple.dt.xcode", - "toolName" : "Xcode", - "toolVersion" : "12.5.1" - }, - "version" : "1.0" -} \ No newline at end of file diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localization/en.xcloc/Localized Contents/en.xliff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Localization/en.xcloc/Localized Contents/en.xliff Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,251 @@ + + + +
+ +
+ + + Simoleon + Simoleon + Bundle display name + + + Simoleon + Simoleon + Bundle name + + +
+ +
+ +
+ + + %.2f + %.2f + No comment provided by engineer. + + + %1$@ (%2$@) + %1$@ (%2$@) + No comment provided by engineer. + + + - + - + No comment provided by engineer. + + + About + About + No comment provided by engineer. + + + All currencies + All currencies + Section header in currency selector + + + Cancel + Cancel + Button to dismiss currency selector + Button to dismiss paywall modal sheet + Button to stop editing textfield + + + Categories + Categories + Side bar navigation title + + + Contact + Contact + Button to contact in Settings + + + Convert + Convert + Navigation title + Tab bar button to show conversion + + + Convert your currency between cryptos, gold, and silver. + Convert your currency between cryptos, gold, and silver. + Subscription feature description + + + Cryptos and commodities + Cryptos and commodities + Subscription feature title + + + Currencies + Currencies + Navigation title + + + Default currency + Default currency + Label in locked picker + Picker to select default currency + + + Developer's Twitter + Developer's Twitter + Button to go to Twitter in Settings + + + Enter amount + Enter amount + No comment provided by engineer. + + + Expires at %@ + Expires at %@ + Subscriber information + + + Favorite currencies + Favorite currencies + Subscription feature title + + + Favorite + Favorite + Navigation title + Tab bar button to show favorites + + + From %1$@ to %2$@ + From %1$@ to %2$@ + Conversion from one currency to another + + + Have access to almost every currency of the world. + Have access to almost every currency of the world. + Subscription feature description + + + Information + Information + Button to show subscription information in settings + Navigation title + + + Latest purchase %@ + Latest purchase %@ + Subscriber information + + + Member since %@ + Member since %@ + Subscriber information + + + Ok + Ok + Button to dismiss alert + Button to stop searching in currency selector + Dismiss alert + + + Over 170 currencies + Over 170 currencies + Subscription feature title + + + Preferences + Preferences + Section header in settings + + + Privacy Policy + Privacy Policy + Button to go to app privacy policy + + + Rate Simoleon + Rate Simoleon + Button to rate app in Settings + + + Restore purchases + Restore purchases + Button to restore in-App purchases + + + Save your favorite currencies to access them quickly. + Save your favorite currencies to access them quickly. + Subscription feature description + + + Search ... + Search ... + No comment provided by engineer. + + + Settings + Settings + Navigation title + Tab bar button to show settings + + + Simoleon on all your devices + Simoleon on all your devices + Subscription feature title + + + Stay in touch + Stay in touch + Section header in settings + + + Subscribe + Subscribe + Button to suscribe in settings + + + Subscribe for %@ / month + Subscribe for %@ / month + Subscribe button + + + Subscription + Subscription + Section header in settings + + + Tap + Tap + First line when favorites are empty + + + USD/GBP + USD/GBP + Default currency in locked picker + + + Unlock all access + Unlock all access + Headline in Subscription paywall + + + Website + Website + Button to go to Dennis Tech website + + + Your settings and favorite currencies in all your devices. + Your settings and favorite currencies in all your devices. + Subscription feature description + + + to add a currency pair to favorites + to add a currency pair to favorites + Finish line when favorites are empty + + +
+
diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localization/en.xcloc/Source Contents/Simoleon/en.lproj/InfoPlist.strings --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Localization/en.xcloc/Source Contents/Simoleon/en.lproj/InfoPlist.strings Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,4 @@ +/* Bundle display name */ +"CFBundleDisplayName" = "Simoleon"; +/* Bundle name */ +"CFBundleName" = "Simoleon"; diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localization/en.xcloc/Source Contents/Simoleon/en.lproj/Localizable.strings Binary file Simoleon/Localization/en.xcloc/Source Contents/Simoleon/en.lproj/Localizable.strings has changed diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localization/en.xcloc/Source Contents/Simoleon/es.lproj/InfoPlist.strings --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Localization/en.xcloc/Source Contents/Simoleon/es.lproj/InfoPlist.strings Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,4 @@ +/* Bundle display name */ +"CFBundleDisplayName" = "Simoleon"; +/* Bundle name */ +"CFBundleName" = "Simoleon"; diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localization/en.xcloc/Source Contents/Simoleon/es.lproj/Localizable.strings Binary file Simoleon/Localization/en.xcloc/Source Contents/Simoleon/es.lproj/Localizable.strings has changed diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Localization/en.xcloc/contents.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Localization/en.xcloc/contents.json Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,12 @@ +{ + "developmentRegion" : "en", + "project" : "Simoleon.xcodeproj", + "targetLocale" : "en", + "toolInfo" : { + "toolBuildNumber" : "12E507", + "toolID" : "com.apple.dt.xcode", + "toolName" : "Xcode", + "toolVersion" : "12.5.1" + }, + "version" : "1.0" +} \ No newline at end of file diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Models/Favorite+CoreDataClass.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Models/Favorite+CoreDataClass.swift Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,15 @@ +// +// Favorite+CoreDataClass.swift +// Simoleon +// +// Created by Dennis Concepción Martín on 19/07/2021. +// +// + +import Foundation +import CoreData + +@objc(Favorite) +public class Favorite: NSManagedObject { + +} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Models/Favorite+CoreDataProperties.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/Models/Favorite+CoreDataProperties.swift Tue Jul 27 09:44:51 2021 +0100 @@ -0,0 +1,25 @@ +// +// Favorite+CoreDataProperties.swift +// Simoleon +// +// Created by Dennis Concepción Martín on 19/07/2021. +// +// + +import Foundation +import CoreData + + +extension Favorite { + + @nonobjc public class func fetchRequest() -> NSFetchRequest { + return NSFetchRequest(entityName: "Favorite") + } + + @NSManaged public var currencyPair: String + +} + +extension Favorite : Identifiable { + +} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Models/Favourite+CoreDataClass.swift --- a/Simoleon/Models/Favourite+CoreDataClass.swift Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -// -// Favourite+CoreDataClass.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 19/07/2021. -// -// - -import Foundation -import CoreData - -@objc(Favourite) -public class Favourite: NSManagedObject { - -} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Models/Favourite+CoreDataProperties.swift --- a/Simoleon/Models/Favourite+CoreDataProperties.swift Mon Jul 26 21:54:30 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// -// Favourite+CoreDataProperties.swift -// Simoleon -// -// Created by Dennis Concepción Martín on 19/07/2021. -// -// - -import Foundation -import CoreData - - -extension Favourite { - - @nonobjc public class func fetchRequest() -> NSFetchRequest { - return NSFetchRequest(entityName: "Favourite") - } - - @NSManaged public var currencyPair: String - -} - -extension Favourite : Identifiable { - -} diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Persistence.swift --- a/Simoleon/Persistence.swift Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon/Persistence.swift Tue Jul 27 09:44:51 2021 +0100 @@ -19,8 +19,8 @@ } for _ in 0..<10 { - let favourite = Favourite(context: viewContext) - favourite.currencyPair = "USD/GBP" + let favorite = Favorite(context: viewContext) + favorite.currencyPair = "USD/GBP" } do { try viewContext.save() diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/Simoleon.xcdatamodeld/Simoleon.xcdatamodel/contents --- a/Simoleon/Simoleon.xcdatamodeld/Simoleon.xcdatamodel/contents Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon/Simoleon.xcdatamodeld/Simoleon.xcdatamodel/contents Tue Jul 27 09:44:51 2021 +0100 @@ -1,17 +1,17 @@ - + - + - - - + + + \ No newline at end of file diff -r 3fa127885e60 -r b0bce2c8e4a9 Simoleon/SubscriptionPaywall.swift --- a/Simoleon/SubscriptionPaywall.swift Mon Jul 26 21:54:30 2021 +0100 +++ b/Simoleon/SubscriptionPaywall.swift Tue Jul 27 09:44:51 2021 +0100 @@ -37,8 +37,8 @@ SubscriptionFeature( symbol: "star.circle.fill", colour: Color(.systemYellow), - title: "Favourite currencies", - description: "Save your favourite currencies to access them quickly." + title: "Favorite currencies", + description: "Save your favorite currencies to access them quickly." ) SubscriptionFeature( @@ -52,7 +52,7 @@ symbol: "icloud.circle.fill", colour: Color(.systemBlue), title: "Simoleon on all your devices", - description: "Your settings and favourite currencies in all your devices." + description: "Your settings and favorite currencies in all your devices." ) SubscriptionFeature( diff -r 3fa127885e60 -r b0bce2c8e4a9 SimoleonUITests/SimoleonUITests.swift --- a/SimoleonUITests/SimoleonUITests.swift Mon Jul 26 21:54:30 2021 +0100 +++ b/SimoleonUITests/SimoleonUITests.swift Tue Jul 27 09:44:51 2021 +0100 @@ -27,8 +27,8 @@ let app = XCUIApplication() app.launch() - app.tabBars.buttons["Favourites"].tap() - XCTAssertTrue(app.navigationBars["Favourites"].exists) + app.tabBars.buttons["Favorites"].tap() + XCTAssertTrue(app.navigationBars["Favorites"].exists) app.tabBars.buttons["Settings"].tap() XCTAssertTrue(app.navigationBars["Settings"].exists)