From ef2f291d18e32f2002452ba2f201bc30f459c228 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Tue, 4 May 2021 13:51:53 +0100 Subject: [PATCH 01/11] Refactored file partner data - Added file structure --- loafwallet/PartnerData.swift | 72 +++++++++++++++++++ .../debug/GoogleService-Info.plist | 34 +++++++++ .../release/GoogleService-Info.plist | 38 ++++++++++ 3 files changed, 144 insertions(+) create mode 100644 loafwallet/file-resources/debug/GoogleService-Info.plist create mode 100644 loafwallet/file-resources/release/GoogleService-Info.plist diff --git a/loafwallet/PartnerData.swift b/loafwallet/PartnerData.swift index 9f21f46ef..33295b656 100644 --- a/loafwallet/PartnerData.swift +++ b/loafwallet/PartnerData.swift @@ -8,6 +8,12 @@ import Foundation import UIKit + + +enum PartnerName { + case infura + case changeNow +} struct Partner { @@ -20,6 +26,32 @@ struct Partner { let simplex = Partner(logo: UIImage(named: "simplexLogo")!, headerTitle: S.BuyCenter.Cells.simplexTitle, details: S.BuyCenter.Cells.simplexFinancialDetails) return [moonpay, simplex] } + + static func partnerKeyPath(name: PartnerName) -> String { + + switch name { + case .infura: + + if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), + let dictionary = NSDictionary(contentsOfFile:path) as? Dictionary, + let key = dictionary["infura-api"] as? String { + return "https://mainnet.infura.io/v3/" + key + } else { + return "ERROR-INFURA_KEY" + } + + case .changeNow: + + if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), + let dictionary = NSDictionary(contentsOfFile:path) as? Dictionary, + let key = dictionary["change-now-api"] as? String { + return key + } else { + return "ERROR-CHANGENOW_KEY" + } + } + + } //TODO: Uncomment as integration progresses, kcw-grunt // let coinbaseDictionary = @@ -39,3 +71,43 @@ struct Partner { // "logo":UIImage(named:"bitrefillLogo") ?? " ", // "baseColor":#colorLiteral(red: 0.2235294118, green: 0.5490196078, blue: 0.9333333333, alpha: 1)] as [String : AnyObject] } + +// +// +//private func fetchKeyPath() -> String? { +// +// if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), +// let dictionary = NSDictionary(contentsOfFile:path) as? Dictionary, +// let key = dictionary["infura-api"] as? String { +// return "https://mainnet.infura.io/v3/" + key +// } else { +// return nil +// } +// +// +// private func setFirebaseConfiguration() { +// +// var partnerFilePath: String = "" +// +// #if Release +// guard let releasePath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { return +// } +// +// filePath = releasePath +// +// #else +// guard let debugPath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { return +// return +// } +// +// filePath = debugPath +// +// #endif +// +// guard let fileopts = FirebaseOptions(contentsOfFile: filePath) else { +// assert(false, "Couldn't load config file") +// } +// +// FirebaseApp.configure(options: fileopts) +// } +//} diff --git a/loafwallet/file-resources/debug/GoogleService-Info.plist b/loafwallet/file-resources/debug/GoogleService-Info.plist new file mode 100644 index 000000000..50af245f8 --- /dev/null +++ b/loafwallet/file-resources/debug/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 594532048902-69ob24v7sve72qcakhb2bhin93e7r5c9.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.594532048902-69ob24v7sve72qcakhb2bhin93e7r5c9 + API_KEY + AIzaSyDRzd7Sk3xswcgfUlCH7fZ-A3OaSRuzF-g + GCM_SENDER_ID + 594532048902 + PLIST_VERSION + 1 + BUNDLE_ID + com.litecoin-foundation.litewallet-develop + PROJECT_ID + litewallet-develop + STORAGE_BUCKET + litewallet-develop.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:594532048902:ios:6aaaa085b80105bbb7a387 + + \ No newline at end of file diff --git a/loafwallet/file-resources/release/GoogleService-Info.plist b/loafwallet/file-resources/release/GoogleService-Info.plist new file mode 100644 index 000000000..4751e3750 --- /dev/null +++ b/loafwallet/file-resources/release/GoogleService-Info.plist @@ -0,0 +1,38 @@ + + + + + CLIENT_ID + 230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3 + ANDROID_CLIENT_ID + 230187998656-mvo0eadvv8cu98vhdtkku72olhvdjgao.apps.googleusercontent.com + API_KEY + AIzaSyDsR9RB5n7G_6xXxhNsYrfy00bUFE0pB8M + GCM_SENDER_ID + 230187998656 + PLIST_VERSION + 1 + BUNDLE_ID + com.litecoin.loafwallet + PROJECT_ID + litewallet-beta + STORAGE_BUCKET + litewallet-beta.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:230187998656:ios:2437e5740a4cb54570bc25 + DATABASE_URL + https://litewallet-beta.firebaseio.com + + \ No newline at end of file From cfb23e896c85a11e00bbddb4c3959608376e0a80 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Tue, 4 May 2021 13:52:38 +0100 Subject: [PATCH 02/11] Made calls to retrieve the keys - Checked UD Key usage - Checked GS Key Usage - Reset gitignore filitering --- .gitignore | 3 +- loafwallet.xcodeproj/project.pbxproj | 40 +++++++++++--- loafwallet/AppDelegate.swift | 54 +++++++++++++------ loafwallet/UnstoppableDomainViewModel.swift | 34 ++++-------- .../file-resources/debug/partner-keys.plist | 10 ++++ 5 files changed, 93 insertions(+), 48 deletions(-) create mode 100644 loafwallet/file-resources/debug/partner-keys.plist diff --git a/.gitignore b/.gitignore index 47e80f59a..88761c346 100644 --- a/.gitignore +++ b/.gitignore @@ -57,5 +57,4 @@ fastlane/screenshots fastlane/test_output Screenshots/shots .DS_Store -loafwallet/GoogleService-Info.plist -partner-keys.plist +loafwallet/file-resources/release/* diff --git a/loafwallet.xcodeproj/project.pbxproj b/loafwallet.xcodeproj/project.pbxproj index 1d268eda5..cdddb4650 100644 --- a/loafwallet.xcodeproj/project.pbxproj +++ b/loafwallet.xcodeproj/project.pbxproj @@ -59,7 +59,6 @@ 22A9A9641DF61FE7000F0016 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22A9A9631DF61FE7000F0016 /* Security.framework */; }; 22A9A9661DF61FEE000F0016 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22A9A9651DF61FEE000F0016 /* WebKit.framework */; }; 22A9A9A31DF63497000F0016 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 22A9A9671DF61FF8000F0016 /* libbz2.tbd */; }; - 24016D8E23F887C3006A6791 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 24016D8D23F887C2006A6791 /* GoogleService-Info.plist */; }; 24016D9023F913C1006A6791 /* LWAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24016D8F23F913C1006A6791 /* LWAnalytics.swift */; }; 2427342D2381C21800E2D22F /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2427342B2381C21800E2D22F /* MainViewController.swift */; }; 24306797238F3DF900EBEA99 /* BartyCrouch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24306796238F3DF900EBEA99 /* BartyCrouch.swift */; }; @@ -287,6 +286,8 @@ C35ABD232574070A002BB9BB /* PartnersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35ABD222574070A002BB9BB /* PartnersView.swift */; }; C35ABD332574073F002BB9BB /* PartnersViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35ABD322574073F002BB9BB /* PartnersViewModel.swift */; }; C379F228259B9BF000B25883 /* RegistrationAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C379F227259B9BF000B25883 /* RegistrationAlertView.swift */; }; + C383192D264169CF002EF205 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C383192826414E7B002EF205 /* GoogleService-Info.plist */; }; + C383192E264169DC002EF205 /* partner-keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = C383192A26414EC6002EF205 /* partner-keys.plist */; }; C39A71472608CB4300E7B640 /* EmptyTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C39A71462608CB4300E7B640 /* EmptyTableViewCell.swift */; }; C3A4647D259A646A00D74D81 /* DataValidation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A4647C259A646A00D74D81 /* DataValidation.swift */; }; C3B7C3B9255EABBF00E98A64 /* SupportSafariViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B7C3B8255EABBF00E98A64 /* SupportSafariViewModel.swift */; }; @@ -307,7 +308,6 @@ C3D783A72565EA4B0004FF70 /* UnstoppableDomainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D783A62565EA4A0004FF70 /* UnstoppableDomainView.swift */; }; C3D783B72565EA6B0004FF70 /* UnstoppableDomainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D783B62565EA6B0004FF70 /* UnstoppableDomainViewModel.swift */; }; C3D783C02565ECF60004FF70 /* UnstoppableDomainViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D783BF2565ECF60004FF70 /* UnstoppableDomainViewModelTests.swift */; }; - C3EB574C257D95B7003E3949 /* partner-keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3EB574B257D95B7003E3949 /* partner-keys.plist */; }; C3F55645255A193D005F786F /* SupportLitecoinFoundationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F55644255A193D005F786F /* SupportLitecoinFoundationView.swift */; }; C3F55655255A195B005F786F /* SupportLitecoinFoundationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F55654255A195B005F786F /* SupportLitecoinFoundationViewModel.swift */; }; C3F7BCDC25FEC6AD00694C28 /* FailedAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F7BCD925FEC6AC00694C28 /* FailedAlertView.swift */; }; @@ -1462,6 +1462,8 @@ C35ABD222574070A002BB9BB /* PartnersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartnersView.swift; sourceTree = ""; }; C35ABD322574073F002BB9BB /* PartnersViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartnersViewModel.swift; sourceTree = ""; }; C379F227259B9BF000B25883 /* RegistrationAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrationAlertView.swift; sourceTree = ""; }; + C383192826414E7B002EF205 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + C383192A26414EC6002EF205 /* partner-keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "partner-keys.plist"; sourceTree = ""; }; C39A71462608CB4300E7B640 /* EmptyTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyTableViewCell.swift; sourceTree = ""; }; C3A4647C259A646A00D74D81 /* DataValidation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataValidation.swift; sourceTree = ""; }; C3ACF2DE25DED601008671D4 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; }; @@ -2965,7 +2967,7 @@ 75A2A7921DA5934300A983D8 /* loafwallet */ = { isa = PBXGroup; children = ( - C3EB574B257D95B7003E3949 /* partner-keys.plist */, + C383192526414E07002EF205 /* file-resources */, C35ABD07257404C6002BB9BB /* SwiftUI+UIKit */, 75A2A87C1DA59E4E00A983D8 /* loafwallet.entitlements */, 75A2A7931DA5934300A983D8 /* AppDelegate.swift */, @@ -3007,7 +3009,6 @@ 75A2A79F1DA5934300A983D8 /* Info.plist */, 24B523AF238A53DC0030594D /* BIP39Words.plist */, 2485F7CE23728C19005962F1 /* RELEASE_NOTES.md */, - 24016D8D23F887C2006A6791 /* GoogleService-Info.plist */, C3ACF2DE25DED601008671D4 /* CHANGELOG.md */, ); path = loafwallet; @@ -3140,6 +3141,33 @@ name = About; sourceTree = ""; }; + C383192526414E07002EF205 /* file-resources */ = { + isa = PBXGroup; + children = ( + C383192726414E42002EF205 /* release */, + C383192626414E3C002EF205 /* debug */, + ); + path = "file-resources"; + sourceTree = ""; + }; + C383192626414E3C002EF205 /* debug */ = { + isa = PBXGroup; + children = ( + C383192826414E7B002EF205 /* GoogleService-Info.plist */, + C383192A26414EC6002EF205 /* partner-keys.plist */, + ); + path = debug; + sourceTree = ""; + }; + C383192726414E42002EF205 /* release */ = { + isa = PBXGroup; + children = ( + 24016D8D23F887C2006A6791 /* GoogleService-Info.plist */, + C3EB574B257D95B7003E3949 /* partner-keys.plist */, + ); + path = release; + sourceTree = ""; + }; C3B7C3EC255FF56100E98A64 /* Constants Tests */ = { isa = PBXGroup; children = ( @@ -3857,6 +3885,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + C383192E264169DC002EF205 /* partner-keys.plist in Resources */, + C383192D264169CF002EF205 /* GoogleService-Info.plist in Resources */, 24B8FAD72162B6FB00A155B1 /* bitrefill_index.html in Resources */, 75A2A79E1DA5934300A983D8 /* LaunchScreen.storyboard in Resources */, 24D5F23822599C0B00225462 /* BarlowSemiCondensed-Italic.ttf in Resources */, @@ -3883,10 +3913,8 @@ 24313CAA23824F9800A83F69 /* Main.storyboard in Resources */, 24D5F25F22599C0B00225462 /* BarlowSemiCondensed-Regular.ttf in Resources */, 24DFCE6823B89CDE001F17F8 /* Settings.storyboard in Resources */, - 24016D8E23F887C3006A6791 /* GoogleService-Info.plist in Resources */, 24393B5C23C259400075218D /* Phrase.storyboard in Resources */, 24313CA723824F5800A83F69 /* Card.storyboard in Resources */, - C3EB574C257D95B7003E3949 /* partner-keys.plist in Resources */, 75A2A79B1DA5934300A983D8 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/loafwallet/AppDelegate.swift b/loafwallet/AppDelegate.swift index be6d40c23..1a8e1a1a8 100644 --- a/loafwallet/AppDelegate.swift +++ b/loafwallet/AppDelegate.swift @@ -25,15 +25,15 @@ import UIKit import SwiftUI -import LocalAuthentication +import LocalAuthentication import Firebase @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? let applicationController = ApplicationController() - + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { setFirebaseConfiguration() @@ -46,47 +46,69 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } - + func applicationDidBecomeActive(_ application: UIApplication) { UIApplication.shared.applicationIconBadgeNumber = 0 } - + func applicationWillEnterForeground(_ application: UIApplication) { applicationController.willEnterForeground() } - + func applicationDidEnterBackground(_ application: UIApplication) { applicationController.didEnterBackground() } - + func applicationWillResignActive(_ application: UIApplication) { applicationController.willResignActive() } - + func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { applicationController.performFetch(completionHandler) } - + func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool { return false // disable extensions such as custom keyboards for security purposes } - + func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { return applicationController.open(url: url) } - + func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -> Bool { - return true + return true } func application(_ application: UIApplication, shouldRestoreApplicationState coder: NSCoder) -> Bool { return true } + + /// Sets the correct plist file private func setFirebaseConfiguration() { - //Conditional to pass the CircleCI checks - if Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist") != nil { - FirebaseApp.configure() + + var filePath: String = "" + + #if Release + guard let releasePath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { return + } + + filePath = releasePath + + #else + guard let debugPath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { + return + } + + filePath = debugPath + + #endif + + guard let fileopts = FirebaseOptions(contentsOfFile: filePath) else { + assert(false, "Couldn't load config file") } + + FirebaseApp.configure(options: fileopts) } -} +} + diff --git a/loafwallet/UnstoppableDomainViewModel.swift b/loafwallet/UnstoppableDomainViewModel.swift index dfa3e199b..ae3b4374f 100644 --- a/loafwallet/UnstoppableDomainViewModel.swift +++ b/loafwallet/UnstoppableDomainViewModel.swift @@ -10,7 +10,7 @@ import Foundation import SwiftUI import Combine import UnstoppableDomainsResolution - + class UnstoppableDomainViewModel: ObservableObject { //MARK: - Combine Variables @@ -25,9 +25,9 @@ class UnstoppableDomainViewModel: ObservableObject { //MARK: - Public Variables var didResolveUDAddress: ((String) -> Void)? - + var shouldClearAddressField: (() -> Void)? - + var didFailToResolve: ((String) -> Void)? //MARK: - Private Variables @@ -67,11 +67,8 @@ class UnstoppableDomainViewModel: ObservableObject { // Otherwise, we may never get in the callback relative to UDR v0.1.6 let group = DispatchGroup() - guard let keyPath = fetchKeyPath() else { - print ("Error: Key path not found") - return - } - + let keyPath = Partner.partnerKeyPath(name: .infura) + guard let resolution = try? Resolution(configs: Configurations( cns: NamingServiceConfig( providerUrl: keyPath, @@ -102,7 +99,7 @@ class UnstoppableDomainViewModel: ObservableObject { self.didResolveUDAddress?(self.ltcAddress) self.isDomainResolving = false } - + case .failure(let error): print(error) let errorMessage = DomainResolutionFailure().messageWith(error: error) @@ -118,9 +115,9 @@ class UnstoppableDomainViewModel: ObservableObject { ///Quicker resolution: When the resolution is done, the activity indicatior stops and the address is updated DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: { - - self.didFailToResolve?(error.localizedDescription) - + + self.didFailToResolve?(error.localizedDescription) + self.didFailToResolve?(errorMessage) self.isDomainResolving = false @@ -131,17 +128,6 @@ class UnstoppableDomainViewModel: ObservableObject { group.wait() } - /// Lookup the API Key - /// - Returns: String or nil - private func fetchKeyPath() -> String? { - - if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), - let dictionary = NSDictionary(contentsOfFile:path) as? Dictionary, - let key = dictionary["infura-api"] as? String { - return "https://mainnet.infura.io/v3/" + key - } else { - return nil - } - } } + diff --git a/loafwallet/file-resources/debug/partner-keys.plist b/loafwallet/file-resources/debug/partner-keys.plist new file mode 100644 index 000000000..0bc293969 --- /dev/null +++ b/loafwallet/file-resources/debug/partner-keys.plist @@ -0,0 +1,10 @@ + + + + + change-now-api + ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + infura-api + 45a00d3533644e92bb412d40e1a47bfa + + From 4f683ca41359ef118ce678570cfea786807d6b1e Mon Sep 17 00:00:00 2001 From: Kerry Washington Date: Tue, 4 May 2021 14:08:08 +0100 Subject: [PATCH 03/11] Delete GoogleService-Info.plist --- .../release/GoogleService-Info.plist | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 loafwallet/file-resources/release/GoogleService-Info.plist diff --git a/loafwallet/file-resources/release/GoogleService-Info.plist b/loafwallet/file-resources/release/GoogleService-Info.plist deleted file mode 100644 index 4751e3750..000000000 --- a/loafwallet/file-resources/release/GoogleService-Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CLIENT_ID - 230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3.apps.googleusercontent.com - REVERSED_CLIENT_ID - com.googleusercontent.apps.230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3 - ANDROID_CLIENT_ID - 230187998656-mvo0eadvv8cu98vhdtkku72olhvdjgao.apps.googleusercontent.com - API_KEY - AIzaSyDsR9RB5n7G_6xXxhNsYrfy00bUFE0pB8M - GCM_SENDER_ID - 230187998656 - PLIST_VERSION - 1 - BUNDLE_ID - com.litecoin.loafwallet - PROJECT_ID - litewallet-beta - STORAGE_BUCKET - litewallet-beta.appspot.com - IS_ADS_ENABLED - - IS_ANALYTICS_ENABLED - - IS_APPINVITE_ENABLED - - IS_GCM_ENABLED - - IS_SIGNIN_ENABLED - - GOOGLE_APP_ID - 1:230187998656:ios:2437e5740a4cb54570bc25 - DATABASE_URL - https://litewallet-beta.firebaseio.com - - \ No newline at end of file From f2826b0a765a869392c4628b6eff1f7d1aac2400 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Tue, 4 May 2021 14:38:58 +0100 Subject: [PATCH 04/11] Changed the files in .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 88761c346..f062713ab 100644 --- a/.gitignore +++ b/.gitignore @@ -57,4 +57,6 @@ fastlane/screenshots fastlane/test_output Screenshots/shots .DS_Store -loafwallet/file-resources/release/* +loafwallet/file-resources/release/partner-keys.plist +loafwallet/file-resources/release/GoogleService-Info.plist + From d785b9b0137bfbf13014edccf8dc68d69fc68557 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Tue, 4 May 2021 15:12:34 +0100 Subject: [PATCH 05/11] Added comments to the Partner Model --- loafwallet/PartnerData.swift | 71 +++++++----------------------------- 1 file changed, 13 insertions(+), 58 deletions(-) diff --git a/loafwallet/PartnerData.swift b/loafwallet/PartnerData.swift index 33295b656..207618095 100644 --- a/loafwallet/PartnerData.swift +++ b/loafwallet/PartnerData.swift @@ -20,16 +20,22 @@ struct Partner { let logo: UIImage let headerTitle: String let details: String - + + /// Fills partner data + /// - Returns: Array of Partner Data static func partnerDataArray() -> [Partner] { let moonpay = Partner(logo: UIImage(named: "moonpay-logo")!, headerTitle: S.BuyCenter.Cells.moonpayTitle, details: S.BuyCenter.Cells.moonpayFinancialDetails) let simplex = Partner(logo: UIImage(named: "simplexLogo")!, headerTitle: S.BuyCenter.Cells.simplexTitle, details: S.BuyCenter.Cells.simplexFinancialDetails) return [moonpay, simplex] } + /// Returns Partner Key + /// - Parameter name: Enum for the different partners + /// - Returns: Key string static func partnerKeyPath(name: PartnerName) -> String { switch name { + case .infura: if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), @@ -53,61 +59,10 @@ struct Partner { } -//TODO: Uncomment as integration progresses, kcw-grunt -// let coinbaseDictionary = -// ["title":S.BuyCenter.Cells.coinbaseTitle as AnyObject, -// "details":S.BuyCenter.Cells.coinbaseFinancialDetails, -// "logo":UIImage(named: "coinbaseLogo") ?? " ", -// "baseColor":#colorLiteral(red: 0.07843137255, green: 0.4156862745, blue: 0.8039215686, alpha: 1)] as [String : AnyObject] - -// let changellyDictionary = -// ["title":S.BuyCenter.Cells.changellyTitle as AnyObject, -// "details":S.BuyCenter.Cells.changellyFinancialDetails, -// "logo":UIImage(named:"changellyLogo") ?? " ", -// "baseColor":#colorLiteral(red: 0.07058823529, green: 0.7882352941, blue: 0.4274509804, alpha: 1)] as [String : AnyObject] -// let bitrefillDictionary = -// ["title":S.BuyCenter.Cells.bitrefillTitle as AnyObject, -// "details":S.BuyCenter.Cells.bitrefillFinancialDetails, -// "logo":UIImage(named:"bitrefillLogo") ?? " ", -// "baseColor":#colorLiteral(red: 0.2235294118, green: 0.5490196078, blue: 0.9333333333, alpha: 1)] as [String : AnyObject] + //TODO: Uncomment as integration progresses, kcw-grunt + // let bitrefillDictionary = + // ["title":S.BuyCenter.Cells.bitrefillTitle as AnyObject, + // "details":S.BuyCenter.Cells.bitrefillFinancialDetails, + // "logo":UIImage(named:"bitrefillLogo") ?? " ", + // "baseColor":#colorLiteral(red: 0.2235294118, green: 0.5490196078, blue: 0.9333333333, alpha: 1)] as [String : AnyObject] } - -// -// -//private func fetchKeyPath() -> String? { -// -// if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), -// let dictionary = NSDictionary(contentsOfFile:path) as? Dictionary, -// let key = dictionary["infura-api"] as? String { -// return "https://mainnet.infura.io/v3/" + key -// } else { -// return nil -// } -// -// -// private func setFirebaseConfiguration() { -// -// var partnerFilePath: String = "" -// -// #if Release -// guard let releasePath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { return -// } -// -// filePath = releasePath -// -// #else -// guard let debugPath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { return -// return -// } -// -// filePath = debugPath -// -// #endif -// -// guard let fileopts = FirebaseOptions(contentsOfFile: filePath) else { -// assert(false, "Couldn't load config file") -// } -// -// FirebaseApp.configure(options: fileopts) -// } -//} From 5c48e28cf61068ddfffcbefb62e6afb102dbcdc3 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Thu, 6 May 2021 17:03:59 +0100 Subject: [PATCH 06/11] Added description to the LWAnalytics events --- loafwallet/src/Constants/Constants.swift | 65 +++++++++++++++++-- .../ViewControllers/LoginViewController.swift | 6 +- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/loafwallet/src/Constants/Constants.swift b/loafwallet/src/Constants/Constants.swift index bd35ccaba..e4e334f76 100644 --- a/loafwallet/src/Constants/Constants.swift +++ b/loafwallet/src/Constants/Constants.swift @@ -9,37 +9,94 @@ import UIKit let π: CGFloat = .pi - + +/// Custom Event Enum: Events related to different user based actions enum CustomEvent: String { + /// App Launched case _20191105_AL = "APP_LAUNCHED" + + /// App Visit Send Controller case _20191105_VSC = "VISIT_SEND_CONTROLLER" + + /// Visit Receive Controller case _20202116_VRC = "VISIT_RECEIVE_CONTROLLER" + + /// Did Send LTC case _20191105_DSL = "DID_SEND_LTC" + + /// Updated LTC price case _20191105_DULP = "DID_UPDATE_LTC_PRICE" + + /// User tapped Buy tab case _20191105_DTBT = "DID_TAP_BUY_TAB" + + /// Entered dispatch group case _20200111_DEDG = "DID_ENTER_DISPATCH_GROUP" + + /// Left dispatch group case _20200111_DLDG = "DID_LEAVE_DISPATCH_GROUP" + + /// Rate not initialized case _20200111_RNI = "RATE_NOT_INITIALIZED" + + /// Fee per kb not initialized case _20200111_FNI = "FEEPERKB_NOT_INITIALIZED" + + /// Transaction not initialized case _20200111_TNI = "TRANSACTION_NOT_INITIALIZED" + + /// Wallet not initialized case _20200111_WNI = "WALLET_NOT_INITIALIZED" + + /// Phrase not initialized case _20200111_PNI = "PHRASE_NOT_INITIALIZED" + + /// Unable to sign transaction case _20200111_UTST = "UNABLE_TO_SIGN_TRANSACTION" + + /// Generalized Error case _20200112_ERR = "ERROR" + + /// Started resync case _20200112_DSR = "DID_START_RESYNC" + + /// Showed review request case _20200125_DSRR = "DID_SHOW_REVIEW_REQUEST" - case _20200217_DLWP = "DID_LOGIN_WITH_PIN" - case _20200217_DLWB = "DID_LOGIN_WITH_BIOMETRICS" + + /// Unlocked in with PIN + case _20200217_DUWP = "DID_UNLOCK_WITH_PIN" + + /// App Launched + case _20200217_DUWB = "DID_UNLOCK_WITH_BIOMETRICS" + + /// Did donate case _20200223_DD = "DID_DONATE" + + /// Did cancel donation case _20200225_DCD = "DID_CANCEL_DONATE" + + /// Did use default fee per kb case _20200301_DUDFPK = "DID_USE_DEFAULT_FEE_PER_KB" + + /// User tapped support LF case _20201118_DTS = "DID_TAP_SUPPORT_LF" + + /// Started IFPS Lookup case _20201121_SIL = "STARTED_IFPS_LOOKUP" + + /// Resolved IPFS Address case _20201121_DRIA = "DID_RESOLVE_IPFS_ADDRESS" + + /// Failed to resolve IPFS Address case _20201121_FRIA = "FAILED_RESOLVE_IPFS_ADDRESS" + + /// User tapped balance case _20200207_DTHB = "DID_TAP_HEADER_BALANCE" + + /// Ternio API Wallet details failure case _20210405_TAWDF = "TERNIO_API_WALLET_DETAILS_FAILURE" - //DEV: This is a way to see if the event that rarely happens. + + /// Heartbeat check If event even happens case _20210427_HCIEEH = "HEARTBEAT_CHECK_IF_EVENT_EVEN_HAPPENS" } diff --git a/loafwallet/src/ViewControllers/LoginViewController.swift b/loafwallet/src/ViewControllers/LoginViewController.swift index 927fb8d1d..80619c497 100644 --- a/loafwallet/src/ViewControllers/LoginViewController.swift +++ b/loafwallet/src/ViewControllers/LoginViewController.swift @@ -112,7 +112,7 @@ class LoginViewController : UIViewController, Subscriber, Trackable { } updatePin.resetFromDisabledSuccess = { self?.authenticationSucceded() - LWAnalytics.logEventWithParameters(itemName: ._20200217_DLWP) + LWAnalytics.logEventWithParameters(itemName: ._20200217_DUWP) } })) recover.addCloseNavigationItem() @@ -312,7 +312,7 @@ class LoginViewController : UIViewController, Subscriber, Trackable { guard !E.isScreenshots else { return authenticationSucceded() } guard walletManager.authenticate(pin: pin) else { return authenticationFailed() } authenticationSucceded() - LWAnalytics.logEventWithParameters(itemName: ._20200217_DLWP) + LWAnalytics.logEventWithParameters(itemName: ._20200217_DUWP) } private func authenticationSucceded() { @@ -387,7 +387,7 @@ class LoginViewController : UIViewController, Subscriber, Trackable { walletManager?.authenticate(biometricsPrompt: S.UnlockScreen.touchIdPrompt, completion: { result in if result == .success { self.authenticationSucceded() - LWAnalytics.logEventWithParameters(itemName: ._20200217_DLWB) + LWAnalytics.logEventWithParameters(itemName: ._20200217_DUWB) } }) } From 3c82f0ac7150a1da1ea59ab4a6956c5d781966c0 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Thu, 6 May 2021 18:23:20 +0100 Subject: [PATCH 07/11] Added code for debug and release config files --- loafwallet.xcodeproj/project.pbxproj | 52 ++++++------------ loafwallet/AppDelegate.swift | 31 ++++------- ...o.plist => Debug-GoogleService-Info.plist} | 0 loafwallet/GoogleService-Info.plist | 38 +++++++++++++ loafwallet/PartnerData.swift | 54 ++++++++++++++----- ...er-keys.plist => debug-partner-keys.plist} | 0 loafwallet/partner-keys.plist | 10 ++++ 7 files changed, 115 insertions(+), 70 deletions(-) rename loafwallet/{file-resources/debug/GoogleService-Info.plist => Debug-GoogleService-Info.plist} (100%) create mode 100644 loafwallet/GoogleService-Info.plist rename loafwallet/{file-resources/debug/partner-keys.plist => debug-partner-keys.plist} (100%) create mode 100644 loafwallet/partner-keys.plist diff --git a/loafwallet.xcodeproj/project.pbxproj b/loafwallet.xcodeproj/project.pbxproj index cdddb4650..8baf6948b 100644 --- a/loafwallet.xcodeproj/project.pbxproj +++ b/loafwallet.xcodeproj/project.pbxproj @@ -268,6 +268,10 @@ C30AFB4E2598FC1B00CDCF69 /* LitewalletPartnerAPI in Frameworks */ = {isa = PBXBuildFile; productRef = C30AFB4D2598FC1B00CDCF69 /* LitewalletPartnerAPI */; }; C30AFB642598FFB200CDCF69 /* PartnerAPIManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C30AFB632598FFB200CDCF69 /* PartnerAPIManager.swift */; }; C316CF49261887FC00E4C09B /* UIApplication+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C316CF48261887FC00E4C09B /* UIApplication+Extension.swift */; }; + C3188E2726431E750008ADD1 /* Debug-GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3188E2526431E750008ADD1 /* Debug-GoogleService-Info.plist */; }; + C3188E2826431E750008ADD1 /* debug-partner-keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3188E2626431E750008ADD1 /* debug-partner-keys.plist */; }; + C3188E2B26431E810008ADD1 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3188E2926431E810008ADD1 /* GoogleService-Info.plist */; }; + C3188E2C26431E810008ADD1 /* partner-keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3188E2A26431E810008ADD1 /* partner-keys.plist */; }; C32142EA25C97CD900BECCD0 /* TransactionCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32142E925C97CD900BECCD0 /* TransactionCellView.swift */; }; C32142FA25C988C800BECCD0 /* TransactionCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32142F925C988C800BECCD0 /* TransactionCellViewModel.swift */; }; C3270B99259BF7F20073DA7B /* LitecoinCardUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3270B98259BF7F20073DA7B /* LitecoinCardUser.swift */; }; @@ -286,8 +290,6 @@ C35ABD232574070A002BB9BB /* PartnersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35ABD222574070A002BB9BB /* PartnersView.swift */; }; C35ABD332574073F002BB9BB /* PartnersViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35ABD322574073F002BB9BB /* PartnersViewModel.swift */; }; C379F228259B9BF000B25883 /* RegistrationAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C379F227259B9BF000B25883 /* RegistrationAlertView.swift */; }; - C383192D264169CF002EF205 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C383192826414E7B002EF205 /* GoogleService-Info.plist */; }; - C383192E264169DC002EF205 /* partner-keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = C383192A26414EC6002EF205 /* partner-keys.plist */; }; C39A71472608CB4300E7B640 /* EmptyTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C39A71462608CB4300E7B640 /* EmptyTableViewCell.swift */; }; C3A4647D259A646A00D74D81 /* DataValidation.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A4647C259A646A00D74D81 /* DataValidation.swift */; }; C3B7C3B9255EABBF00E98A64 /* SupportSafariViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B7C3B8255EABBF00E98A64 /* SupportSafariViewModel.swift */; }; @@ -741,7 +743,6 @@ 22A9A9A91DF64B97000F0016 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Modules/libbz2/Info.plist; sourceTree = SOURCE_ROOT; }; 22A9A9AA1DF64B97000F0016 /* iphone.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; name = iphone.modulemap; path = Modules/libbz2/iphone.modulemap; sourceTree = SOURCE_ROOT; }; 22A9A9AB1DF64B97000F0016 /* iphonesim.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; name = iphonesim.modulemap; path = Modules/libbz2/iphonesim.modulemap; sourceTree = SOURCE_ROOT; }; - 24016D8D23F887C2006A6791 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 24016D8F23F913C1006A6791 /* LWAnalytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LWAnalytics.swift; sourceTree = ""; }; 2427342B2381C21800E2D22F /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; 24306796238F3DF900EBEA99 /* BartyCrouch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BartyCrouch.swift; sourceTree = ""; }; @@ -1444,6 +1445,10 @@ C30899782616426800EE6A40 /* ForgotAlertViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForgotAlertViewModel.swift; sourceTree = ""; }; C30AFB632598FFB200CDCF69 /* PartnerAPIManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartnerAPIManager.swift; sourceTree = ""; }; C316CF48261887FC00E4C09B /* UIApplication+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Extension.swift"; sourceTree = ""; }; + C3188E2526431E750008ADD1 /* Debug-GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Debug-GoogleService-Info.plist"; sourceTree = ""; }; + C3188E2626431E750008ADD1 /* debug-partner-keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "debug-partner-keys.plist"; sourceTree = ""; }; + C3188E2926431E810008ADD1 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + C3188E2A26431E810008ADD1 /* partner-keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "partner-keys.plist"; sourceTree = ""; }; C32142E925C97CD900BECCD0 /* TransactionCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionCellView.swift; sourceTree = ""; }; C32142F925C988C800BECCD0 /* TransactionCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionCellViewModel.swift; sourceTree = ""; }; C3270B98259BF7F20073DA7B /* LitecoinCardUser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LitecoinCardUser.swift; sourceTree = ""; }; @@ -1462,8 +1467,6 @@ C35ABD222574070A002BB9BB /* PartnersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartnersView.swift; sourceTree = ""; }; C35ABD322574073F002BB9BB /* PartnersViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartnersViewModel.swift; sourceTree = ""; }; C379F227259B9BF000B25883 /* RegistrationAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrationAlertView.swift; sourceTree = ""; }; - C383192826414E7B002EF205 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; - C383192A26414EC6002EF205 /* partner-keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "partner-keys.plist"; sourceTree = ""; }; C39A71462608CB4300E7B640 /* EmptyTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyTableViewCell.swift; sourceTree = ""; }; C3A4647C259A646A00D74D81 /* DataValidation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataValidation.swift; sourceTree = ""; }; C3ACF2DE25DED601008671D4 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; }; @@ -1485,7 +1488,6 @@ C3D783A62565EA4A0004FF70 /* UnstoppableDomainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnstoppableDomainView.swift; sourceTree = ""; }; C3D783B62565EA6B0004FF70 /* UnstoppableDomainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnstoppableDomainViewModel.swift; sourceTree = ""; }; C3D783BF2565ECF60004FF70 /* UnstoppableDomainViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnstoppableDomainViewModelTests.swift; sourceTree = ""; }; - C3EB574B257D95B7003E3949 /* partner-keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "partner-keys.plist"; sourceTree = ""; }; C3F55644255A193D005F786F /* SupportLitecoinFoundationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportLitecoinFoundationView.swift; sourceTree = ""; }; C3F55654255A195B005F786F /* SupportLitecoinFoundationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportLitecoinFoundationViewModel.swift; sourceTree = ""; }; C3F7BCD925FEC6AC00694C28 /* FailedAlertView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FailedAlertView.swift; sourceTree = ""; }; @@ -2967,7 +2969,10 @@ 75A2A7921DA5934300A983D8 /* loafwallet */ = { isa = PBXGroup; children = ( - C383192526414E07002EF205 /* file-resources */, + C3188E2526431E750008ADD1 /* Debug-GoogleService-Info.plist */, + C3188E2626431E750008ADD1 /* debug-partner-keys.plist */, + C3188E2926431E810008ADD1 /* GoogleService-Info.plist */, + C3188E2A26431E810008ADD1 /* partner-keys.plist */, C35ABD07257404C6002BB9BB /* SwiftUI+UIKit */, 75A2A87C1DA59E4E00A983D8 /* loafwallet.entitlements */, 75A2A7931DA5934300A983D8 /* AppDelegate.swift */, @@ -3141,33 +3146,6 @@ name = About; sourceTree = ""; }; - C383192526414E07002EF205 /* file-resources */ = { - isa = PBXGroup; - children = ( - C383192726414E42002EF205 /* release */, - C383192626414E3C002EF205 /* debug */, - ); - path = "file-resources"; - sourceTree = ""; - }; - C383192626414E3C002EF205 /* debug */ = { - isa = PBXGroup; - children = ( - C383192826414E7B002EF205 /* GoogleService-Info.plist */, - C383192A26414EC6002EF205 /* partner-keys.plist */, - ); - path = debug; - sourceTree = ""; - }; - C383192726414E42002EF205 /* release */ = { - isa = PBXGroup; - children = ( - 24016D8D23F887C2006A6791 /* GoogleService-Info.plist */, - C3EB574B257D95B7003E3949 /* partner-keys.plist */, - ); - path = release; - sourceTree = ""; - }; C3B7C3EC255FF56100E98A64 /* Constants Tests */ = { isa = PBXGroup; children = ( @@ -3885,8 +3863,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - C383192E264169DC002EF205 /* partner-keys.plist in Resources */, - C383192D264169CF002EF205 /* GoogleService-Info.plist in Resources */, 24B8FAD72162B6FB00A155B1 /* bitrefill_index.html in Resources */, 75A2A79E1DA5934300A983D8 /* LaunchScreen.storyboard in Resources */, 24D5F23822599C0B00225462 /* BarlowSemiCondensed-Italic.ttf in Resources */, @@ -3904,6 +3880,7 @@ CE5E6C9A1EB9135000A476DB /* Icon.xcassets in Resources */, 24D5F25022599C0B00225462 /* BarlowSemiCondensed-Light.ttf in Resources */, 2494037F23AE0C7100369261 /* SyncProgressHeaderView.xib in Resources */, + C3188E2726431E750008ADD1 /* Debug-GoogleService-Info.plist in Resources */, CE29901A1EFD6DE50093A0F2 /* Localizable.strings in Resources */, 24313C9F23824F5800A83F69 /* Animate.storyboard in Resources */, 24B8FADC2162D29100A155B1 /* general.css in Resources */, @@ -3911,10 +3888,13 @@ 2485F7D023728C19005962F1 /* RELEASE_NOTES.md in Resources */, 24B523AD238A53DC0030594D /* BIP39Words.plist in Resources */, 24313CAA23824F9800A83F69 /* Main.storyboard in Resources */, + C3188E2B26431E810008ADD1 /* GoogleService-Info.plist in Resources */, 24D5F25F22599C0B00225462 /* BarlowSemiCondensed-Regular.ttf in Resources */, 24DFCE6823B89CDE001F17F8 /* Settings.storyboard in Resources */, 24393B5C23C259400075218D /* Phrase.storyboard in Resources */, 24313CA723824F5800A83F69 /* Card.storyboard in Resources */, + C3188E2826431E750008ADD1 /* debug-partner-keys.plist in Resources */, + C3188E2C26431E810008ADD1 /* partner-keys.plist in Resources */, 75A2A79B1DA5934300A983D8 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/loafwallet/AppDelegate.swift b/loafwallet/AppDelegate.swift index 1a8e1a1a8..7f1291f5b 100644 --- a/loafwallet/AppDelegate.swift +++ b/loafwallet/AppDelegate.swift @@ -83,32 +83,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } - - /// Sets the correct plist file + /// Sets the correct Google Services plist file private func setFirebaseConfiguration() { - var filePath: String = "" - #if Release - guard let releasePath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { return - } - - filePath = releasePath - + // Loads the release Firebase config file. + FirebaseApp.configure() #else - guard let debugPath = Bundle.main.path(forResource: "file-resource/release/GoogleService-Info", ofType: "plist") else { - return - } - - filePath = debugPath - + // Load a Firebase debug config file. + let filePath = Bundle.main.path(forResource: "Debug-GoogleService-Info", ofType: "plist") + guard let fileopts = FirebaseOptions(contentsOfFile: filePath!) + else { assert(false, "Couldn't load Firebase config file") } + FirebaseApp.configure(options: fileopts) #endif - - guard let fileopts = FirebaseOptions(contentsOfFile: filePath) else { - assert(false, "Couldn't load config file") - } - - FirebaseApp.configure(options: fileopts) } } + + diff --git a/loafwallet/file-resources/debug/GoogleService-Info.plist b/loafwallet/Debug-GoogleService-Info.plist similarity index 100% rename from loafwallet/file-resources/debug/GoogleService-Info.plist rename to loafwallet/Debug-GoogleService-Info.plist diff --git a/loafwallet/GoogleService-Info.plist b/loafwallet/GoogleService-Info.plist new file mode 100644 index 000000000..4751e3750 --- /dev/null +++ b/loafwallet/GoogleService-Info.plist @@ -0,0 +1,38 @@ + + + + + CLIENT_ID + 230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3 + ANDROID_CLIENT_ID + 230187998656-mvo0eadvv8cu98vhdtkku72olhvdjgao.apps.googleusercontent.com + API_KEY + AIzaSyDsR9RB5n7G_6xXxhNsYrfy00bUFE0pB8M + GCM_SENDER_ID + 230187998656 + PLIST_VERSION + 1 + BUNDLE_ID + com.litecoin.loafwallet + PROJECT_ID + litewallet-beta + STORAGE_BUCKET + litewallet-beta.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:230187998656:ios:2437e5740a4cb54570bc25 + DATABASE_URL + https://litewallet-beta.firebaseio.com + + \ No newline at end of file diff --git a/loafwallet/PartnerData.swift b/loafwallet/PartnerData.swift index 207618095..ae763c884 100644 --- a/loafwallet/PartnerData.swift +++ b/loafwallet/PartnerData.swift @@ -14,7 +14,7 @@ enum PartnerName { case infura case changeNow } - + struct Partner { let logo: UIImage @@ -34,31 +34,58 @@ struct Partner { /// - Returns: Key string static func partnerKeyPath(name: PartnerName) -> String { + /// Switch the config file based on the environment + var filePath: String + #if Release + + // Loads the release Partner Keys config file. + guard let releasePath = Bundle.main.path(forResource: "partner-keys", + ofType: "plist") else { + return "ERROR: FILE-NOT-FOUND" + } + filePath = releasePath + + #else + + // Loads the debug Partner Keys config file. + guard let debugPath = Bundle.main.path(forResource: "debug-partner-keys", + ofType: "plist") else { + return "ERROR: FILE-NOT-FOUND" + } + + filePath = debugPath + + #endif + switch name { case .infura: - if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), - let dictionary = NSDictionary(contentsOfFile:path) as? Dictionary, - let key = dictionary["infura-api"] as? String { - return "https://mainnet.infura.io/v3/" + key - } else { - return "ERROR-INFURA_KEY" - } - + if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary, + let key = dictionary["infura-api"] as? String { + return "https://mainnet.infura.io/v3/" + key + } else { + + let errorDescription = "ERROR-INFURA_KEY" + LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription]) + return errorDescription + } + case .changeNow: - if let path = Bundle.main.path(forResource: "partner-keys", ofType: "plist"), - let dictionary = NSDictionary(contentsOfFile:path) as? Dictionary, + if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary, let key = dictionary["change-now-api"] as? String { return key } else { - return "ERROR-CHANGENOW_KEY" + + let errorDescription = "ERROR-CHANGENOW_KEY" + LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription]) + return errorDescription } } } - + //TODO: Uncomment as integration progresses, kcw-grunt // let bitrefillDictionary = // ["title":S.BuyCenter.Cells.bitrefillTitle as AnyObject, @@ -66,3 +93,4 @@ struct Partner { // "logo":UIImage(named:"bitrefillLogo") ?? " ", // "baseColor":#colorLiteral(red: 0.2235294118, green: 0.5490196078, blue: 0.9333333333, alpha: 1)] as [String : AnyObject] } + diff --git a/loafwallet/file-resources/debug/partner-keys.plist b/loafwallet/debug-partner-keys.plist similarity index 100% rename from loafwallet/file-resources/debug/partner-keys.plist rename to loafwallet/debug-partner-keys.plist diff --git a/loafwallet/partner-keys.plist b/loafwallet/partner-keys.plist new file mode 100644 index 000000000..60061f677 --- /dev/null +++ b/loafwallet/partner-keys.plist @@ -0,0 +1,10 @@ + + + + + change-now-api + 7b83a10fb3fe19af99b443299cf09c264719d2aeb9a13d069334f24e102e79ea + infura-api + 133cd3eb9adb448ebbe811ca08cfcbdf + + From f81acd44a6faa7465a78b9be1fb5c86427746143 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Thu, 6 May 2021 18:23:55 +0100 Subject: [PATCH 08/11] Updated the CHANGELOG draft --- loafwallet/CHANGELOG.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/loafwallet/CHANGELOG.md b/loafwallet/CHANGELOG.md index f2f01a0f0..5e8a06ce4 100644 --- a/loafwallet/CHANGELOG.md +++ b/loafwallet/CHANGELOG.md @@ -1,6 +1,35 @@ # Changelog +## Draft Release v3.5.0 + +The list of changes are below: + +### 🦟 Bugfixes + +### 🦺 Tech Debt + +### 🥳 Improvements + --- + +## Release v3.4.0 +This release is the long-awaited addition of Moonpay!! +The list of changes are below: + +### 🦟 Bugfixes + * Bugfixes + * Fixed transactions full sync freeze + +### 🦺 Tech Debt + * Tech Debt: Polishes + * Upgraded UD version to 0.3.5 + * Added UD Error Codes + * Opened Card Login password range + +### 🥳 Improvements + * Added Moonpay +--- + ## Release v3.3.0 This release is the interim to the v2 of the Litecoin Card and fixes mainly bugs. From 11987109df1c968b0545c38f3b3a0332e6877f93 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Thu, 6 May 2021 18:59:01 +0100 Subject: [PATCH 09/11] Added config files tests --- loafwallet.xcodeproj/project.pbxproj | 12 +++++++++ loafwalletTests/File Tests/FileTests.swift | 30 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 loafwalletTests/File Tests/FileTests.swift diff --git a/loafwallet.xcodeproj/project.pbxproj b/loafwallet.xcodeproj/project.pbxproj index 8baf6948b..c63f97b8b 100644 --- a/loafwallet.xcodeproj/project.pbxproj +++ b/loafwallet.xcodeproj/project.pbxproj @@ -272,6 +272,7 @@ C3188E2826431E750008ADD1 /* debug-partner-keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3188E2626431E750008ADD1 /* debug-partner-keys.plist */; }; C3188E2B26431E810008ADD1 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3188E2926431E810008ADD1 /* GoogleService-Info.plist */; }; C3188E2C26431E810008ADD1 /* partner-keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3188E2A26431E810008ADD1 /* partner-keys.plist */; }; + C3188E3326445EA20008ADD1 /* FileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3188E3226445EA20008ADD1 /* FileTests.swift */; }; C32142EA25C97CD900BECCD0 /* TransactionCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32142E925C97CD900BECCD0 /* TransactionCellView.swift */; }; C32142FA25C988C800BECCD0 /* TransactionCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32142F925C988C800BECCD0 /* TransactionCellViewModel.swift */; }; C3270B99259BF7F20073DA7B /* LitecoinCardUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3270B98259BF7F20073DA7B /* LitecoinCardUser.swift */; }; @@ -1449,6 +1450,7 @@ C3188E2626431E750008ADD1 /* debug-partner-keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "debug-partner-keys.plist"; sourceTree = ""; }; C3188E2926431E810008ADD1 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; C3188E2A26431E810008ADD1 /* partner-keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "partner-keys.plist"; sourceTree = ""; }; + C3188E3226445EA20008ADD1 /* FileTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileTests.swift; sourceTree = ""; }; C32142E925C97CD900BECCD0 /* TransactionCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionCellView.swift; sourceTree = ""; }; C32142F925C988C800BECCD0 /* TransactionCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionCellViewModel.swift; sourceTree = ""; }; C3270B98259BF7F20073DA7B /* LitecoinCardUser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LitecoinCardUser.swift; sourceTree = ""; }; @@ -2173,6 +2175,7 @@ 2465873723A5AAD100A32E9E /* loafwalletTests */ = { isa = PBXGroup; children = ( + C3188E3126445E5E0008ADD1 /* File Tests */, C3B7C3EC255FF56100E98A64 /* Constants Tests */, 24470E3923A5FF5700ADDA27 /* TestHelpers.swift */, 24470E4323A6088700ADDA27 /* Class Tests */, @@ -3081,6 +3084,14 @@ path = Modules/sqlite3; sourceTree = ""; }; + C3188E3126445E5E0008ADD1 /* File Tests */ = { + isa = PBXGroup; + children = ( + C3188E3226445EA20008ADD1 /* FileTests.swift */, + ); + path = "File Tests"; + sourceTree = ""; + }; C32142E825C97CB900BECCD0 /* Transactions */ = { isa = PBXGroup; children = ( @@ -4018,6 +4029,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C3188E3326445EA20008ADD1 /* FileTests.swift in Sources */, 24470E4223A6007200ADDA27 /* WalletInfoTest.swift in Sources */, 24470E2123A5DA9700ADDA27 /* APIManagerTests.swift in Sources */, 24470E3423A5F5E600ADDA27 /* PaymentRequestTests.swift in Sources */, diff --git a/loafwalletTests/File Tests/FileTests.swift b/loafwalletTests/File Tests/FileTests.swift new file mode 100644 index 000000000..ff7df8cc4 --- /dev/null +++ b/loafwalletTests/File Tests/FileTests.swift @@ -0,0 +1,30 @@ +// +// FileTests.swift +// loafwalletTests +// +// Created by Kerry Washington on 5/6/21. +// Copyright © 2021 Litecoin Foundation. All rights reserved. +// +import XCTest +import Firebase +@testable import loafwallet + +class FileTests: XCTestCase { + + func testChangeNowKeyExists() throws { + XCTAssertTrue(!Partner.partnerKeyPath(name: .changeNow).isEmpty) + } + + func testInfuraKeyExists() throws { + XCTAssertTrue(!Partner.partnerKeyPath(name: .infura).isEmpty) + } + + func testGoogleServicesFileExists() throws { + + let filePath = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist") + + XCTAssertNotNil(FirebaseOptions(contentsOfFile: filePath!)) + + } + +} From 803374b34f1d5727bf231b4034759d344c947c14 Mon Sep 17 00:00:00 2001 From: Kerry Washington Date: Thu, 6 May 2021 19:25:11 +0100 Subject: [PATCH 10/11] Updated the gitignore --- .gitignore | 4 +-- loafwallet/GoogleService-Info.plist | 38 ----------------------------- loafwallet/partner-keys.plist | 10 -------- 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 loafwallet/GoogleService-Info.plist delete mode 100644 loafwallet/partner-keys.plist diff --git a/.gitignore b/.gitignore index f062713ab..cf5d612cc 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,6 @@ fastlane/screenshots fastlane/test_output Screenshots/shots .DS_Store -loafwallet/file-resources/release/partner-keys.plist -loafwallet/file-resources/release/GoogleService-Info.plist +loafwallet/partner-keys.plist +loafwallet/GoogleService-Info.plist diff --git a/loafwallet/GoogleService-Info.plist b/loafwallet/GoogleService-Info.plist deleted file mode 100644 index 4751e3750..000000000 --- a/loafwallet/GoogleService-Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CLIENT_ID - 230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3.apps.googleusercontent.com - REVERSED_CLIENT_ID - com.googleusercontent.apps.230187998656-s6tf5antivdoid0pmbt6qkmo5lnipiq3 - ANDROID_CLIENT_ID - 230187998656-mvo0eadvv8cu98vhdtkku72olhvdjgao.apps.googleusercontent.com - API_KEY - AIzaSyDsR9RB5n7G_6xXxhNsYrfy00bUFE0pB8M - GCM_SENDER_ID - 230187998656 - PLIST_VERSION - 1 - BUNDLE_ID - com.litecoin.loafwallet - PROJECT_ID - litewallet-beta - STORAGE_BUCKET - litewallet-beta.appspot.com - IS_ADS_ENABLED - - IS_ANALYTICS_ENABLED - - IS_APPINVITE_ENABLED - - IS_GCM_ENABLED - - IS_SIGNIN_ENABLED - - GOOGLE_APP_ID - 1:230187998656:ios:2437e5740a4cb54570bc25 - DATABASE_URL - https://litewallet-beta.firebaseio.com - - \ No newline at end of file diff --git a/loafwallet/partner-keys.plist b/loafwallet/partner-keys.plist deleted file mode 100644 index 60061f677..000000000 --- a/loafwallet/partner-keys.plist +++ /dev/null @@ -1,10 +0,0 @@ - - - - - change-now-api - 7b83a10fb3fe19af99b443299cf09c264719d2aeb9a13d069334f24e102e79ea - infura-api - 133cd3eb9adb448ebbe811ca08cfcbdf - - From 1a9d6ce4bc512e5b382458f36fb0a26b149cfd17 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Sat, 8 May 2021 12:44:02 +0100 Subject: [PATCH 11/11] per review notes --- loafwallet/AppDelegate.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loafwallet/AppDelegate.swift b/loafwallet/AppDelegate.swift index 7f1291f5b..0dc14a9bb 100644 --- a/loafwallet/AppDelegate.swift +++ b/loafwallet/AppDelegate.swift @@ -92,9 +92,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { #else // Load a Firebase debug config file. let filePath = Bundle.main.path(forResource: "Debug-GoogleService-Info", ofType: "plist") - guard let fileopts = FirebaseOptions(contentsOfFile: filePath!) + guard let fileOpts = FirebaseOptions(contentsOfFile: filePath!) else { assert(false, "Couldn't load Firebase config file") } - FirebaseApp.configure(options: fileopts) + FirebaseApp.configure(options: fileOpts) #endif } }