From 3196e05078286bda9658724d7082bdac5b20209e Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Mon, 15 Jan 2024 16:34:33 +0000 Subject: [PATCH 01/11] display error on scanViewController if Beacon QRCode scanned --- Kukai Mobile/Controls/ScanViewController.swift | 16 +++++++++++++--- .../Localization/en.lproj/Localizable.strings | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Kukai Mobile/Controls/ScanViewController.swift b/Kukai Mobile/Controls/ScanViewController.swift index 330cd69c..6fbf5fcf 100644 --- a/Kukai Mobile/Controls/ScanViewController.swift +++ b/Kukai Mobile/Controls/ScanViewController.swift @@ -70,7 +70,7 @@ class ScanViewController: UIViewController, AVCaptureMetadataOutputObjectsDelega } @objc func textFieldDone() { - found(code: textfield.text ?? "") + checkForBeaconAndReport(stringToCheck: textfield.text ?? "") } func setupNav() { @@ -329,13 +329,23 @@ class ScanViewController: UIViewController, AVCaptureMetadataOutputObjectsDelega } func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) { - captureSession.stopRunning() if let metadataObject = metadataObjects.first { guard let readableObject = metadataObject as? AVMetadataMachineReadableCodeObject else { return } guard let stringValue = readableObject.stringValue else { return } AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate)) - found(code: stringValue) + checkForBeaconAndReport(stringToCheck: stringValue) + } + } + + private func checkForBeaconAndReport(stringToCheck: String) { + if let data = stringToCheck.base58CheckDecodedData, let json = try? JSONSerialization.jsonObject(with: data) as? [String: String], let _ = json["relayServer"], let _ = json["publicKey"] { + self.windowError(withTitle: "error".localized(), description: "error-beacon-not-supported".localized()) + self.textfield.text = "" + + } else { + captureSession.stopRunning() + found(code: stringToCheck) } } diff --git a/Kukai Mobile/Localization/en.lproj/Localizable.strings b/Kukai Mobile/Localization/en.lproj/Localizable.strings index d2a54a2a..af7d7b97 100644 --- a/Kukai Mobile/Localization/en.lproj/Localizable.strings +++ b/Kukai Mobile/Localization/en.lproj/Localizable.strings @@ -50,3 +50,4 @@ "error-unsupported-sign"="Unsupported signature request"; "error-wc2-unrecoverable"="An unknown error occured with the connection. This operation can't continue. Please check the other application and try agian"; "error-wc2-cant-continue"="Unable to continue with this request due to system error"; +"error-beacon-not-supported"="Beacon QRCodes are not supported, only Wallet Connect. Please make sure you are using the kukai option. If you are, please contact the dApp support team and ask them to update their beacon version"; From f6ed034f55c43ced67766b2d989f61ef44cd3036 Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Tue, 16 Jan 2024 12:03:28 +0000 Subject: [PATCH 02/11] - fix reorder favourite balances --- .../Account/FavouriteBalancesViewModel.swift | 19 ++++- Kukai Mobile/Services/TokenStateService.swift | 69 ++++++++++++++----- 2 files changed, 70 insertions(+), 18 deletions(-) diff --git a/Kukai Mobile/Modules/Account/FavouriteBalancesViewModel.swift b/Kukai Mobile/Modules/Account/FavouriteBalancesViewModel.swift index 65a79dae..99e9b729 100644 --- a/Kukai Mobile/Modules/Account/FavouriteBalancesViewModel.swift +++ b/Kukai Mobile/Modules/Account/FavouriteBalancesViewModel.swift @@ -64,10 +64,25 @@ class FavouriteBalancesViewModel: ViewModel, UITableViewDiffableDataSourceHandle return } + // Record the new state on disk if let address = DependencyManager.shared.selectedWalletAddress, let token = (itemIdentifier(for: sourceIndexPath) as? Token), - TokenStateService.shared.moveFavouriteBalance(forAddress: address, forToken: token, toIndex: destinationIndexPath.section-1) { + TokenStateService.shared.moveFavouriteBalance(forAddress: address, forToken: token, toIndex: destinationIndexPath.section) { + // We have 1 row per section (to acheive a certain UI). By default, move tries to take a row and move it to another section. We need to modify this to move sections around instead + // Get the section that its trying to be added too. If its at index 0, then user wants to move source, above destination, so instead assign it to the previous section + // If index is greater, then user wants it to be below destination section + var currentSnapshot = self.snapshot() + if destinationIndexPath.row == 0 { + // previous section + currentSnapshot.moveSection(sourceIndexPath.section, beforeSection: destinationIndexPath.section) + + } else { + // next section + currentSnapshot.moveSection(sourceIndexPath.section, afterSection: destinationIndexPath.section) + } + + self.apply(currentSnapshot) DependencyManager.shared.balanceService.updateTokenStates(forAddress: address, selectedAccount: true) } else { @@ -175,6 +190,7 @@ class FavouriteBalancesViewModel: ViewModel, UITableViewDiffableDataSourceHandle cell.setup(isFav: false, isLocked: false) DependencyManager.shared.balanceService.updateTokenStates(forAddress: address, selectedAccount: true) favouriteCount -= 1 + self.refresh(animate: true) } else { self.state = .failure(KukaiError.internalApplicationError(error: "Unable to remove favorite"), "Unable to remove favorite") @@ -185,6 +201,7 @@ class FavouriteBalancesViewModel: ViewModel, UITableViewDiffableDataSourceHandle cell.setup(isFav: true, isLocked: false) DependencyManager.shared.balanceService.updateTokenStates(forAddress: address, selectedAccount: true) favouriteCount += 1 + self.refresh(animate: true) } else { self.state = .failure(KukaiError.internalApplicationError(error: "Unable to add favorite"), "Unable to add favorite") diff --git a/Kukai Mobile/Services/TokenStateService.swift b/Kukai Mobile/Services/TokenStateService.swift index ff727687..62e8d4f7 100644 --- a/Kukai Mobile/Services/TokenStateService.swift +++ b/Kukai Mobile/Services/TokenStateService.swift @@ -137,11 +137,19 @@ public class TokenStateService { } public func removeFavourite(forAddress address: String, token: Token) -> Bool { - favouriteBalances[address]?.removeValue(forKey: balanceId(from: token)) + let balanceId = balanceId(from: token) + let currentSortIndex = favouriteBalances[address]?[balanceId] ?? -1 + reduceSortIndex(afterIndex: currentSortIndex, inDict: &favouriteBalances, withAddress: address) + + favouriteBalances[address]?.removeValue(forKey: balanceId) return writeFavouriteBalances() } public func removeFavourite(forAddress address: String, nft: NFT) -> Bool { + let balanceId = nftId(from: nft) + let currentSortIndex = favouriteCollectibles[address]?[balanceId] ?? -1 + reduceSortIndex(afterIndex: currentSortIndex, inDict: &favouriteCollectibles, withAddress: address) + favouriteCollectibles[address]?.removeValue(forKey: nftId(from: nft)) return writeFavouriteCollectibles() } @@ -151,32 +159,35 @@ public class TokenStateService { // MARK: Reorder public func moveFavouriteBalance(forAddress address: String, forToken token: Token, toIndex: Int) -> Bool { - var account = favouriteBalances[address] ?? [:] - let tokenId = balanceId(from: token) - account[tokenId] = toIndex + let balanceId = balanceId(from: token) + let currentSortIndex = favouriteBalances[address]?[balanceId] ?? -1 - for key in account.keys { - if key != tokenId, (account[key] ?? 1) >= toIndex { - account[key] = ((account[key] ?? 1) + 1) - } + if currentSortIndex < toIndex { + // moving down, decrease others + reduceSortIndex(afterIndex: currentSortIndex, inDict: &favouriteBalances, withAddress: address) + } else { + // moving up, increase others + increaseSortIndex(beforeIndex: currentSortIndex, inDict: &favouriteBalances, withAddress: address) } - favouriteBalances[address] = account + favouriteBalances[address]?[balanceId] = toIndex return writeFavouriteBalances() } public func moveFavouriteCollectible(forAddress address: String, forNft nft: NFT, toIndex: Int) -> Bool { - var account = favouriteCollectibles[address] ?? [:] - account[nftId(from: nft)] = toIndex + let balanceId = nftId(from: nft) + let currentSortIndex = favouriteCollectibles[address]?[balanceId] ?? -1 - for key in account.keys { - if (account[key] ?? 1) >= toIndex { - account[key] = ((account[key] ?? 1) + 1) - } + if currentSortIndex < toIndex { + // moving down, decrease others + reduceSortIndex(afterIndex: currentSortIndex, inDict: &favouriteCollectibles, withAddress: address) + } else { + // moving up, increase others + increaseSortIndex(beforeIndex: currentSortIndex, inDict: &favouriteCollectibles, withAddress: address) } - favouriteCollectibles[address] = account - return writeHiddenCollectibles() + favouriteCollectibles[address]?[balanceId] = toIndex + return writeFavouriteCollectibles() } @@ -205,6 +216,30 @@ public class TokenStateService { return DiskService.write(encodable: favouriteCollectibles, toFileName: TokenStateService.favouriteCollectiblesFilename) } + private func reduceSortIndex(afterIndex: Int, inDict dict: inout [String: [String: Int]], withAddress address: String) { + var tempDict: [String: Int] = (dict[address] ?? [:]) + + for key in tempDict.keys { + if let val = tempDict[key], val > afterIndex { + tempDict[key] = val-1 + } + } + + dict[address] = tempDict + } + + private func increaseSortIndex(beforeIndex: Int, inDict dict: inout [String: [String: Int]], withAddress address: String) { + var tempDict: [String: Int] = (dict[address] ?? [:]) + + for key in tempDict.keys { + if let val = tempDict[key], val < beforeIndex { + tempDict[key] = val+1 + } + } + + dict[address] = tempDict + } + // MARK: Delete From 6d384d58045a4d92e45ef0c175527a7766c7e083 Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Wed, 17 Jan 2024 12:15:34 +0000 Subject: [PATCH 03/11] - switch twitter bird to "X" logo - update app and library to support more torus verifiers and flows through their code --- Kukai Mobile.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Contents.json | 2 +- .../Social_Twitter_1color.svg | 10 -- .../Social_Twitter_color.svg | 15 +++ .../Contents.json | 2 +- .../Social_Twitter_1color.svg | 15 +++ .../Social_Twitter_color.svg | 3 - .../CreateWithSocialViewController.swift | 36 +++---- Kukai Mobile/Services/CloudKitService.swift | 102 ++++++++++++++++-- .../Services/TransactionService.swift | 8 +- 11 files changed, 152 insertions(+), 47 deletions(-) delete mode 100644 Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_1color.svg create mode 100644 Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_color.svg create mode 100644 Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_1color.svg delete mode 100644 Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_color.svg diff --git a/Kukai Mobile.xcodeproj/project.pbxproj b/Kukai Mobile.xcodeproj/project.pbxproj index a88b25c5..8b9fe189 100644 --- a/Kukai Mobile.xcodeproj/project.pbxproj +++ b/Kukai Mobile.xcodeproj/project.pbxproj @@ -2703,7 +2703,7 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/kukai-wallet/kukai-core-swift"; requirement = { - branch = develop; + branch = feature/torus_test; kind = branch; }; }; diff --git a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index de385198..a77540af 100644 --- a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -77,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kukai-wallet/kukai-core-swift", "state" : { - "branch" : "develop", - "revision" : "3c5e492f50d062cdc199622d63e826e640baec25" + "branch" : "feature/torus_test", + "revision" : "35bce1ad77e0e1d2a77c1a1766f45b8a686d9ffe" } }, { diff --git a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Contents.json b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Contents.json index 2cbddd6b..7f38b1ef 100644 --- a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Contents.json +++ b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "Social_Twitter_1color.svg", + "filename" : "Social_Twitter_color.svg", "idiom" : "universal" } ], diff --git a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_1color.svg b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_1color.svg deleted file mode 100644 index 3b5c3c9e..00000000 --- a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_1color.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_color.svg b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_color.svg new file mode 100644 index 00000000..dc8ef14b --- /dev/null +++ b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_1color.imageset/Social_Twitter_color.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Contents.json b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Contents.json index 4c060d45..e4cbd805 100644 --- a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Contents.json +++ b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "Social_Twitter_color.svg", + "filename" : "Social_Twitter_1color.svg", "idiom" : "universal" } ], diff --git a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_1color.svg b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_1color.svg new file mode 100644 index 00000000..3e840c96 --- /dev/null +++ b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_1color.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_color.svg b/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_color.svg deleted file mode 100644 index 976489e9..00000000 --- a/Kukai Mobile/Assets.xcassets/Icons/social/Social_Twitter_color.imageset/Social_Twitter_color.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/Kukai Mobile/Modules/Onboarding/CreateWithSocialViewController.swift b/Kukai Mobile/Modules/Onboarding/CreateWithSocialViewController.swift index 047345b7..bebb83a7 100644 --- a/Kukai Mobile/Modules/Onboarding/CreateWithSocialViewController.swift +++ b/Kukai Mobile/Modules/Onboarding/CreateWithSocialViewController.swift @@ -118,26 +118,11 @@ class CreateWithSocialViewController: UIViewController { } @IBAction func appleTapped(_ sender: Any) { - guard DependencyManager.shared.torusVerifiers[.apple] != nil else { - self.windowError(withTitle: "error".localized(), description: "error-missing-verifier".localized()) - return - } - - self.showLoadingView() // uses differetn callback structure to rest, need to pop loading here - DependencyManager.shared.torusAuthService.createWallet(from: .apple, displayOver: self.presentedViewController) { [weak self] result in - self?.handleResult(result: result) - } + createWallet(withVerifier: .apple) } @IBAction func googleTapped(_ sender: Any) { - guard DependencyManager.shared.torusVerifiers[.google] != nil else { - self.windowError(withTitle: "error".localized(), description: "error-missing-verifier".localized()) - return - } - - DependencyManager.shared.torusAuthService.createWallet(from: .google, displayOver: self) { [weak self] result in - self?.handleResult(result: result) - } + createWallet(withVerifier: .google) } @IBAction func facebookTapped(_ sender: Any) { @@ -145,11 +130,11 @@ class CreateWithSocialViewController: UIViewController { } @IBAction func twitterTapped(_ sender: Any) { - self.windowError(withTitle: "Not yet supported", description: "This feature is not yet enabled. Please wait for another release") + createWallet(withVerifier: .twitter) } @IBAction func redditTapped(_ sender: Any) { - self.windowError(withTitle: "Not yet supported", description: "This feature is not yet enabled. Please wait for another release") + createWallet(withVerifier: .reddit) } @IBAction func discordTapped(_ sender: Any) { @@ -169,7 +154,18 @@ class CreateWithSocialViewController: UIViewController { } @IBAction func continueWithEmailTapped(_ sender: Any) { - self.windowError(withTitle: "Not yet supported", description: "This feature is not yet enabled. Please wait for another release") + createWallet(withVerifier: .email) + } + + private func createWallet(withVerifier verifier: TorusAuthProvider) { + guard DependencyManager.shared.torusVerifiers[verifier] != nil else { + self.windowError(withTitle: "error".localized(), description: "error-missing-verifier".localized()) + return + } + + DependencyManager.shared.torusAuthService.createWallet(from: verifier, displayOver: self) { [weak self] result in + self?.handleResult(result: result) + } } @IBAction func viewMoreOptionsTapped(_ sender: Any) { diff --git a/Kukai Mobile/Services/CloudKitService.swift b/Kukai Mobile/Services/CloudKitService.swift index 98fc4f2f..528ba120 100644 --- a/Kukai Mobile/Services/CloudKitService.swift +++ b/Kukai Mobile/Services/CloudKitService.swift @@ -48,9 +48,11 @@ public class CloudKitService { guard let networkStr = record.stringForKey("network"), let network = TezosNodeClientConfig.NetworkType(rawValue: networkStr), let config = record.doubleStringArrayToDict(key1: "keys", key2: "values"), - let provider = config["loginProvider"], - let type = config["loginType"], - let authProvider = TorusAuthProvider(rawValue: provider) else { + let loginProviderString = config["loginProvider"], + let loginProvider = LoginProviders(rawValue: loginProviderString), + let authProviderString = config["authProvider"], + let authProvider = TorusAuthProvider(rawValue: authProviderString), + let type = config["loginType"] else { Logger.app.error("Skipping invalid torus config item: \(record.description)") continue } @@ -58,26 +60,37 @@ public class CloudKitService { // Option 1: // Required: loginType, loginProvider, verifierName, redirectURL // Optional: aggregateVerifierName, clientId - if let loginType = SubVerifierType(rawValue: type), let loginProvider = LoginProviders(rawValue: provider), let verifierName = config["verifierName"], let redirectURL = config["redirectURL"] { + if config["jwtDomain"] == nil, let loginType = SubVerifierType(rawValue: type), let verifierName = config["verifierName"], let redirectURL = config["redirectURL"] { let details = SubVerifierDetails(loginType: loginType, loginProvider: loginProvider, clientId: config["clientId"] ?? "", verifier: verifierName, redirectURL: redirectURL) let wrapper = SubverifierWrapper(aggregateVerifierName: config["aggregateVerifierName"], networkType: network, subverifier: details) verifiers[authProvider] = wrapper - } // Option 2: // Required: loginType, loginProvider, verifierName, redirectURL // Optional: aggregateVerifierName, clientId, browserRedirectURL, jwtDomain - else if let loginType = SubVerifierType(rawValue: type), let loginProvider = LoginProviders(rawValue: provider), let verifierName = config["verifierName"], let redirectURL = config["redirectURL"] { + else if let loginType = SubVerifierType(rawValue: type), let verifierName = config["verifierName"], let redirectURL = config["redirectURL"] { if let jwtDomain = config["jwtDomain"] { + var tempParams: [String: String] = [:] + tempParams["domain"] = jwtDomain + + // Check for other optional JWT params + if let jwtConnection = config["jwtConnection"] { + tempParams["connection"] = jwtConnection == " " ? "" : jwtConnection // CloudKit dashboard doesn't allow an empty string, Torus needs an empty string for some reason + } + if let jwtVerifierIdField = config["jwtVerifierIdField"] { + tempParams["verifierIdField"] = jwtVerifierIdField + } + + let details = SubVerifierDetails(loginType: loginType, loginProvider: loginProvider, clientId: config["clientId"] ?? "", verifier: verifierName, redirectURL: redirectURL, browserRedirectURL: config["browserRedirectURL"], - jwtParams: ["domain": jwtDomain]) + jwtParams: tempParams) let wrapper = SubverifierWrapper(aggregateVerifierName: config["aggregateVerifierName"], networkType: network, subverifier: details) verifiers[authProvider] = wrapper @@ -96,4 +109,79 @@ public class CloudKitService { return verifiers } + + + + // MARK: - CloudKit dashboard helpers tools + + /* + CloudKit dashboard offers no means of exporting / importing data. Below functions are a way to copy the contents of 1 env to another. + + Requires setting this setting in entitlements: https://stackoverflow.com/questions/30182521/use-production-cloudkit-during-development + + not working yet, upload fails. Ignoring for now + */ + + /* + private func writeRecordsTemporarily() { + let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + let docsDirectoryURL = urls[0] + let ckStyleURL = docsDirectoryURL.appendingPathComponent("ckstylerecords.data") + + do { + let data = try NSKeyedArchiver.archivedData(withRootObject: configItemRecords, requiringSecureCoding: true) + + try data.write(to: ckStyleURL, options: .atomic) + Logger.app.info("CKRecords written to disk") + + } catch { + Logger.app.error("Could not write CKRecords to disk") + } + } + + private func uploadRecordsIfAvaialble() { + let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + let docsDirectoryURL = urls[0] + let ckStyleURL = docsDirectoryURL.appendingPathComponent("ckstylerecords.data") + let dispatchGroup = DispatchGroup() + + var newRecords: [CKRecord] = [] + if FileManager.default.fileExists(atPath: ckStyleURL.path) { + + do { + + // unarchive + let data = try Data(contentsOf:ckStyleURL) + if let theRecords: [CKRecord] = try NSKeyedUnarchiver.unarchiveObject(with: data) as? [CKRecord] { + newRecords = theRecords + Logger.app.info("CKRecords unarchived. Count is \(newRecords.count)") + } + + + // upload + dispatchGroup.enter() + for record in newRecords { + dispatchGroup.enter() + + database.save(record) { record, error in + Logger.app.info("Record upload - error: \(error)") + dispatchGroup.leave() + } + } + dispatchGroup.leave() + + } catch { + Logger.app.error("Could not read CKRecords: \(error)") + } + } + + dispatchGroup.notify(queue: .main) { + Logger.app.info("All uploaded") + } + } + + private func deleteTempRecords() { + let _ = DiskService.delete(fileName: "ckstylerecords.data") + } + */ } diff --git a/Kukai Mobile/Services/TransactionService.swift b/Kukai Mobile/Services/TransactionService.swift index e7f8e24c..284aafa7 100644 --- a/Kukai Mobile/Services/TransactionService.swift +++ b/Kukai Mobile/Services/TransactionService.swift @@ -367,11 +367,11 @@ public class TransactionService { case .twitter: let image = UIImage(named: "Social_Twitter_color")?.resizedImage(size: imageSize) ?? UIImage() - return (image: image, title: metadata.socialUsername ?? "", subtitle: metadata.address.truncateTezosAddress()) + return (image: image, title: metadata.socialUsername ?? metadata.socialUserId ?? "", subtitle: metadata.address.truncateTezosAddress()) case .google: let image = UIImage(named: "Social_Google_color")?.resizedImage(size: imageSize) ?? UIImage() - return (image: image, title: metadata.socialUsername ?? "", subtitle: metadata.address.truncateTezosAddress()) + return (image: image, title: metadata.socialUserId ?? metadata.socialUsername ?? "", subtitle: metadata.address.truncateTezosAddress()) case .reddit: let image = UIImage(named: "Social_Reddit_Color")?.resizedImage(size: imageSize) ?? UIImage() @@ -397,6 +397,10 @@ public class TransactionService { let image = UIImage(named: "Social_Github_color")?.resizedImage(size: imageSize) ?? UIImage() return (image: image, title: metadata.socialUsername ?? "", subtitle: metadata.address.truncateTezosAddress()) + case .email: + let image = UIImage(named: "Social_Github_color")?.resizedImage(size: imageSize) ?? UIImage() + return (image: image, title: metadata.socialUsername ?? "", subtitle: metadata.address.truncateTezosAddress()) + case .none: let image = UIImage.unknownToken().resizedImage(size: imageSize) ?? UIImage() return (image: image, title: metadata.address.truncateTezosAddress(), subtitle: nil) From 04a45e5e4dd3a6013d3c37f1d541d52c936cc725 Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Wed, 17 Jan 2024 12:57:07 +0000 Subject: [PATCH 04/11] fetch twitter handle before creating wallet --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a77540af..c763b928 100644 --- a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -78,7 +78,7 @@ "location" : "https://github.com/kukai-wallet/kukai-core-swift", "state" : { "branch" : "feature/torus_test", - "revision" : "35bce1ad77e0e1d2a77c1a1766f45b8a686d9ffe" + "revision" : "0695e6f09cefd8ef00eb0ba640ec876845bc51a3" } }, { From 308b7a3028ee513f4280ec5d02761b56685f735e Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Wed, 17 Jan 2024 15:49:05 +0000 Subject: [PATCH 05/11] - remove default selection tint from token details - remove old buttonData from tokenDetails causing blank cell - increase collectibleDetails bottom spacing --- .../Modules/Account/Account.storyboard | 18 +++++++++--------- .../TokenDetailsBalanceAndBakerCell_baker.xib | 16 ++++++++-------- ...TokenDetailsBalanceAndBakerCell_nobaker.xib | 16 ++++++++-------- .../Account/TokenDetailsViewModel.swift | 5 ++--- .../Collectibles/CollectibleDetailLayout.swift | 7 ++++++- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Kukai Mobile/Modules/Account/Account.storyboard b/Kukai Mobile/Modules/Account/Account.storyboard index d84d3014..d2488a58 100644 --- a/Kukai Mobile/Modules/Account/Account.storyboard +++ b/Kukai Mobile/Modules/Account/Account.storyboard @@ -1,9 +1,9 @@ - + - + @@ -272,7 +272,7 @@ - +