Skip to content

Commit

Permalink
Revert Sample App changes from help MLH
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-metaplex committed Oct 26, 2022
1 parent abf82fe commit 6ff85ab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
26 changes: 13 additions & 13 deletions Sample/Sample/LogInViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ class LogInViewController: UIViewController {
}

@IBAction func onLogInWithPhantom(_ sender: Any) {
// let windowScene: SceneDelegate = self.view.window?.windowScene?.delegate as! SceneDelegate
// windowScene.phantom.connect()
// windowScene.phantom.onConnect = { result in
// self.ownerPublicKeyString = result.public_key
let windowScene: SceneDelegate = self.view.window?.windowScene?.delegate as! SceneDelegate
windowScene.phantom.connect()
windowScene.phantom.onConnect = { result in
self.ownerPublicKeyString = result.public_key
self.performSegue(withIdentifier: "goToWallet", sender: sender)
// }
}
}

// override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// if segue.identifier == "goToWallet",
// let walletViewController = segue.destination as? ViewController,
// let ownerPublicKeyString = self.ownerPublicKeyString,
// let ownerPublicKey = PublicKey(string: ownerPublicKeyString) {
// walletViewController.ownerPublicKey = ownerPublicKey
// }
// }
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "goToWallet",
let walletViewController = segue.destination as? ViewController,
let ownerPublicKeyString = self.ownerPublicKeyString,
let ownerPublicKey = PublicKey(string: ownerPublicKeyString) {
walletViewController.ownerPublicKey = ownerPublicKey
}
}
}
18 changes: 8 additions & 10 deletions Sample/Sample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ class ViewController: UIViewController {
*/
publicKeyLabel.text = ownerPublicKey.base58EncodedString
metaplex.nft.findAllByOwner(publicKey: ownerPublicKey) { [weak self] result in
DispatchQueue.main.async {
self?.loadingIndicator.stopAnimating()
switch result {
case .success(let nftList):
self?.nftList = nftList.compactMap{ $0 }
self?.collectionView.reloadData()
case .failure(let error):
print("###: \(error)")
}
self?.loadingIndicator.stopAnimating()
switch result {
case .success(let nftList):
self?.nftList = nftList.compactMap{ $0 }
self?.collectionView.reloadData()
case .failure:
break
}
}

}

}
Expand Down

0 comments on commit 6ff85ab

Please sign in to comment.