Skip to content

Adds method passes to retrieve any available passes#9

Open
adambutler wants to merge 2 commits intoerikpoort:masterfrom
ordoo:add-passes-method
Open

Adds method passes to retrieve any available passes#9
adambutler wants to merge 2 commits intoerikpoort:masterfrom
ordoo:add-passes-method

Conversation

@adambutler
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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 :)

Comment thread src/index.js
_showAddPassControllerFromURL,
_showAddPassControllerFromFile,
_passes
} from './platform-specific'
Copy link
Copy Markdown
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 🕺

Comment thread src/index.js
* @return Promise Passing a boolean
*/
function showAddPassControllerFromURL(passURL) {
return _showAddPassControllerFromURL(RNWalletModule, passURL);
Copy link
Copy Markdown
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
Copy Markdown
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