Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds method passes to retrieve any available passes #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adambutler
Copy link

Adds the ability to receive passes by calling Wallet.passes(callback).

self.passLibrary = [[PKPassLibrary alloc] init];
NSArray *passes = [self.passLibrary passes];

NSDictionary *dict = [NSDictionary dictionaryWithObjects:passes forKeys:[passes valueForKey:@"serialNumber"]];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel this is very readable

NSDictionary *dict = [NSDictionary dictionaryWithObjects:passes forKeys:[passes valueForKey:@"serialNumber"]];
NSArray*serials=[dict allKeys];

callback(@[[NSNull null], serials]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use the Node convention of passing null instead on an error in this project.
Either use a callback for a call that always succeeds or us a promise :)

_showAddPassControllerFromURL,
_showAddPassControllerFromFile,
_passes
} from './platform-specific'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Respecting the print line 🕺

@@ -17,7 +22,7 @@ function canAddPasses(callback) {
* @return Promise Passing a boolean
*/
function showAddPassControllerFromURL(passURL) {
return _showAddPassControllerFromURL(RNWalletModule, passURL);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤨
I guess what I want to say is: Don't change someone's code style in a PR?

NSArray *passes = [self.passLibrary passes];

NSDictionary *dict = [NSDictionary dictionaryWithObjects:passes forKeys:[passes valueForKey:@"serialNumber"]];
NSArray*serials=[dict allKeys];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're trying to reduce an array of passes to an array of serialnumbers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants