passslot / cordova-plugin-passbook

Passbook Plugin for Cordova/PhoneGap
www.passslot.com
Apache License 2.0
26 stars 31 forks source link

determine if pass is installed in passbook #9

Open thurt opened 7 years ago

thurt commented 7 years ago

Suppose I am distributing barcodes at stores which encodes a url to a .pkpass file. I will also have the same url as a pressable button in our cordova mobile app.

When a user opens the mobile app, I would like to know whether they already added the pass (via scanning from a store).

It is not clear to me how that is possible? Will I need to download the .pkpass file in the mobile app first before I can check whether its in the passbook?

Any ideas appreciated

passslot commented 7 years ago

Yes you need to have a local PKPass instance to check if it is contained in the Wallet app (see https://developer.apple.com/documentation/passkit/pkpasslibrary/1617110-containspass). Our plugin however does not expose that iOS functionality at the moment

thurt commented 7 years ago

Thanks for the info 👍

This is something i am hoping to do and i have started looking at extending the obj-c code in this plugin.

It looks pretty straightforward, we would just need a function that take a javascript Pass object, https://github.com/passslot/cordova-plugin-passbook/blob/master/www/passbook.js#L13, which should be enough to create a PKPass object in obj-c? Then send PKPass object to containsPass: method, as you mentioned.

I'm also wondering if passWithPassTypeIdentifier:serialNumber: method would accomplish the same goal as containsPass: https://developer.apple.com/documentation/passkit/pkpasslibrary/1617104-passwithpasstypeidentifier?language=objc

thurt commented 7 years ago

I think I need to add entitlement, com.apple.developer.pass-type-identifiers, into the app before I can read passes from user's phone https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/ApplePayandPassKitEntitlements/ApplePayandPassKitEntitlements.html#//apple_ref/doc/uid/TP40011195-CH7-SW2

@passslot are you aware of a way to add this entitlement in phonegap build? The apple documentation only provides instructions for Xcode native app.

more discussion here: https://forums.adobe.com/message/9659251#9659251

thurt commented 7 years ago

i have found that phonegap build will use the entitlements listed in the apple provisioning profile. So in order to get com.apple.developer.pass-type-identifiers entitlement added to your built app, you must make sure that the provisioning profile is properly setup (ie linked to an app id which has wallet pass enabled)

pzarudnii commented 6 years ago

Hello, @thurt I`m looking for same functionality. Did you get a working version of the verification function?