Giter Site home page Giter Site logo

ueman / passkit Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 1.0 2.35 MB

Various Dart & Flutter packages to work with Apple's PassKit

Ruby 1.17% Swift 3.26% Objective-C 0.02% Dart 81.48% Kotlin 0.08% CMake 5.86% C++ 7.12% C 0.45% HTML 0.57%
dart flutter passkit pkpass

passkit's Issues

bug(passkit): WebServiceUrl with path does not work

When the web service URL of the pass contains a path, it will currently get overriden.

This seems incorrect to me and I think we should fix it.
However, the spec doesn't mention any specific behavior, so the current implementation could be correct.

Add icons for all transit types

See

TransitType.air => PlaneIcon(color: color, width: width),
TransitType.boat => PlaneIcon(color: color, width: width),
TransitType.bus => PlaneIcon(color: color, width: width),
TransitType.generic => PlaneIcon(color: color, width: width),
TransitType.train => PlaneIcon(color: color, width: width),

Right now, the only icon used is the plane icon, but we need

  • bus
  • generic
  • boat
  • train

Ideally there's a CC0 SVG that can be used via

to create a Custom Painter out of it.

☂️ App features

Umbrella issue to collect various app feature ideas:

  • Export to calendar support
  • Group passes based on the grouping identifier
  • hide voided & no longer relevant passes
  • Add calendar view
  • Personalization & signup flow for supported passes
  • Automatic updates of passes that support it
  • Support semantic tags
  • Support for importing .pkpasses bundles
  • Support for .order files
  • Homewidget
    • With QR/barcodes for passes
    • order status for orders

Fix sizing of the passes

The passes seem like they have an aspect ratio of something around of 3 (width) to 4 (height) (310 to 400).
We need to figure out how to properly size the passes so that they're always following this aspect ratio while still having a good a11y.

PkPass creation

The WWDR certificate can be downloaded from here.

Compare signature for pass updates

When updating a pass via the HTTP client, we should check whether the pass is signed with the same certificate to check for its authenticity. This method should also be exposed, so that updates from other sources (downloads etc) can do the same check.

Make links/phone numbers/emails clickable in passes

Description

The text of the back fields is run through data detectors for URLs and phone numbers, which appear as live links. Users can tap the URL to launch it in Safari and can tap phone numbers to dial them. Text on the back of the card can include line breaks, escaped in the JSON file as \n.

This is currently unsupported in passkit_ui.
Maybe something like flutter_linkify can solve this problem.

Add an async method to parse PkPass files

Description

Synchronous parsing of the PkPass files can lead to skipped frames when this lib is used in Flutter. Provide an option to parse them on a background isolate

Support for localization in PkPass files

Text can be localized, but images can be localized too.

PkPass docs for localizations (text and images):

Docs for .strings file format description:

.strings files are UTF-16 not UTF-8, so the files have to be read like this StackOverflow post suggests. This issue dart-lang/convert#30 contains some hints too.


There are various approaches to parsing a .strings file:

  • use a regex (I believe strings files for pkpasses technically can't have placeholders)
  • write a custom parser using petiteparser
  • naive custom string parsing

Personally, I would like to see a custom parser based on petiteparser with all the bells and whistles, but I think using a RegEx at first should be sufficient.


The API could look like one of the following examples:

class PkPass {
  String getTranslated(String key, Locale locale) { ... }
}

// and then you can use it something like this:

PkPass pass = ...;
pass.getTranslated(pass.pass.description, locale);

With intl


pass.pass.description;
// provide a localized getter that makes use of Intl.defaultLocale or is alternatively set somehow
pass.pass.descriptionLocalized;

This paragraph is only relevant for passkit_UI

Language fallback rules (should be applied on a per field basis):

  1. No translations -> Nothing gets translated
  2. The users' language gets chosen if available (e.g. de_DE)
  3. The users' language without country code gets chosen if available (e.g. de instead of de_DE)
  4. Otherwise, fallback to what's reported via PlatformDispatcher.locales (while skipping already tried languages)
    • First the languages are tested with country codes (de_DE), then without (just de)
  5. If a translation is missing, fall back to the translation key

Formatted values like dates, numbers, etc are always localized to the users' current language (as described here)


The default localized value should be https://api.dart.dev/stable/3.4.4/dart-io/Platform/localeName.html on dart:io and whatever browser equivalent there is. On Flutter it should use the Localization.of().locale as default.

PassKit creation UI

It would be nice if it's possible to create PkPass files with a WYSIWYG editor.
Depends on #11

PkPass diffing for change messages

When a PkPass file is updated, the system is supposed to show a change message notification/hint (depending on whether it was updated in background/foreground).
This is done by comparing the fields of the old and updated pass.

Those fields with a change message should be returned with a properly formatted change message. Otherwise, a generic message should be returned.

An open question is whether those fields support localization, but I would assume so.

We could provide an API that looks something like this:

class PkPass {
  List<String> getChangeMessages(PkPass oldPass, String locale) {
    // ...
  }
}

final changeMessages = newPass.getChangeMessages(oldPass, 'de_DE');

Improve readme

  • explain limitations of the packages
  • add some motivation
    • why is it needed, what does it solve?
  • add images to packages (and maybe automate via golden image tests?)
  • Improve linking to Apple docs in the readme
  • Encourage people to contribute by directing them to relevant issues by making use of the tags
  • Add a contributors section to each readme
  • add cross references to each package
  • cross check readme guidance from here: https://dart.dev/tools/pub/writing-package-pages

Individual check marks can be done in separate PRs

Maintenance: Add JsonKey annotations

By adding JsonKey annotations, we ensure that deserialization is less prone to break due to refactorings. Additionally, we're able to give properties names that are idiomatic to Dart.
It probably also makes it easier to migrate to macros when the time comes.

UI for boarding passes

PassKit Web Service

General docs: https://developer.apple.com/documentation/walletpasses/adding_a_web_service_to_update_passes

Notes

Is there a test server that implements all of these thingies? Otherwise, I'm not sure how to properly end-to-end test this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.