Giter VIP home page Giter VIP logo

pass-flutter's Introduction

Apple Wallet logo

Flutter GitHub Actions Pub Package

pass-flutter

A Flutter library for work with Apple Wallet passes.

How use it

Getting pass from URL to internal memory

import 'package:pass_flutter/pass_flutter.dart';

PassFile passFile = await Pass().saveFromUrl(url: 'https://link_to_pass/pass.pkpass');

Getting list of all saved passes

import 'package:pass_flutter/pass_flutter.dart';

List<PassFile> passes = await Pass().getAllSaved();

Fetch preview from url and save it

import 'package:pass_flutter/pass_flutter.dart';

PassFile passFile = await Pass().fetchPreviewFromUrl(url: 'https://link_to_pass/pass.pkpass');
passFile.save();

or delete it

import 'package:pass_flutter/pass_flutter.dart';

PassFile passFile = await Pass().fetchPreviewFromUrl(url: 'https://link_to_pass/pass.pkpass');
passFile.delete();

Delete pass file from internal memory

import 'package:pass_flutter/pass_flutter.dart';

Pass pass = Pass();
PassFile passFile = await pass.saveFromUrl(url: 'https://link_to_pass/pass.pkpass');
await pass.delete(passFile);

OR

passFile.delete();

Contribute

Please feel free to fork, improve, make pull requests or fill issues. I'll be glad to fix bugs you encountered or improve the extension.

Changelog

Refer to the Changelog to get all release notes.

pass-flutter's People

Contributors

alexey-nobody avatar eltiganiomar avatar sfraziergofan avatar srcnysf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pass-flutter's Issues

this.delete(passDirectory, passFile);

I'm getting this error after ZipDecoder().decodeBytes(passArchive). I tried with several pkpasses of different companies and get the same error every time.

I'm testing it on Android, should the plugin work on Android too?

Nfc Pass

Is there a way to add a nfc card to pass that have specific data to open doors that works on rfid

Android support

Hello, I see that this package supports Android as well, but I didn't see how. On what App does it add the passkit entries? Does it work with google wallet?

Thanks!

Error compiling in AndroidStudio for iOS

The last version is failing with the error "The plugin pass_flutter doesn't have a main class defined in /Users/fede/.pub-cache/hosted/pub.dartlang.org/pass_flutter-1.2.1/android/src/main/java/com/alexeynobody/pass_flutter/PassFlutterPlugin.java or /Users/fede/.pub-cache/hosted/pub.dartlang.org/pass_flutter-1.2.1/android/src/main/kotlin/com/alexeynobody/pass_flutter/PassFlutterPlugin.kt. This is likely to due to an incorrect androidPackage: com.alexeynobody.pass_flutter or mainClass entry in the plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage entry or move the main class to any of locations used above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile."

Please, tell me if you need more information about this error.

Thank you.

_convertToColor null exception

in Some case when I generate Event pass from https://www.passsource.com/ the labelColor comes null so

_convertToColor method throw excetion

It can be solved by adding

 static Color _convertToColor(String rgbCssColor) {
    if (rgbCssColor == null) {
      return Color.fromRGBO(255, 255, 255, 1);
    }
...
}

Unable to run application after adding flutter_pass dependency

Hi, Thank you for doing hardwork and provide this library. Unfortunately I am not yet succeeded to run the application with this dependency.
Here below is the log:

Launching lib/main.dart on iPhone 11 Pro in debug mode...
Running pod install... 0.7s
CocoaPods' output:

Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

Finding Podfile changes
  A pass_flutter
  A path_provider
  A path_provider_macos
  - Flutter

Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `pass_flutter` from `.symlinks/plugins/pass_flutter/ios`
[!] No podspec found for `pass_flutter` in `.symlinks/plugins/pass_flutter/ios`

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/external_sources/path_source.rb:14:in `block in fetch'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/external_sources/path_source.rb:11:in `fetch'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:901:in `fetch_external_source'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:880:in `block (2 levels) in fetch_external_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:879:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:879:in `block in fetch_external_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:878:in `fetch_external_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:117:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'

Error output from CocoaPods:

[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See
`https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone 11 Pro.

I tried reinstall pod and update pod but seems nothing works.

It looks like this plugin is not able to create/run pod file while fetching external sources in my app.

Let me know if there is solution for that.

Doctor report:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.12.13+hotfix.9, on Mac OS X 10.14.6 18G5015, locale en-GB)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

Color problems

Hello. I am using this package, and I managed to get pass from URL. Everything looks fine except the colors.
The passFile.pass.backgroundColor, the foregroundColor and the labelColor are all white(rgb(255, 255, 255)) but they should be colored. Can anyone help me please?

Field 'labelColor' from JSON should be optional

Although marked as optional in the PassJson object, the call to the constructor in _$PassJsonFromJson expects an explicit value. Since a Color cannot be constructed from NULL, it fails.

Text Alignment and Styling

Add ability to see the styling and alignment in the Fields. JSON structure of pass.json looks like this:

Date style

"auxiliaryFields" : [
      {
        "key" : "expiryDate",
        "dateStyle" : "PKDateStyleShort",
        "label" : "Expiry Date",
        "value" : "2013-12-31T00:00-23:59"
      }
    ],

Text alignment:

"secondaryFields": [
            {
                "key": "TicketTitle",
                "label": "2 Karten für",
                "textAlignment": "PKTextAlignmentLeft",
                "value": "A Quiet Place 2"
            }
        ],

Right now, only 4 props can be accessed. Idea:

Add new fields to the Field object:

const Fields({
    required this.key,
    required this.value,
    this.label,
    this.changeMessage,
    this.dateStyle,
    this.textAlignment,
  });

  /// Required. The key must be unique within the scope of the entire pass. For example, “departure-gate.”
  final String key;

  /// Optional. Label text for the field.
  final String? label;

  /// Required. Value of the field, for example, 42.
  final String value;

  /// Optional. Format string for the alert text that is displayed when the pass is updated.
  /// The format string must contain the escape %@, which is replaced with the field’s new value.
  /// For example, “Gate changed to %@.”
  /// If you don’t specify a change message, the user isn’t notified when the field changes.
  final String? changeMessage;

  /// Optional.
  final String textAlignment;

  /// Optional
  final String dateStyle;

  /// Convert to json
  Map<String, dynamic> toJson() => _$FieldsToJson(this);

  @override
  List<Object?> get props => [key, label, value, changeMessage, textAlignment, dateStyle];

Crashing on iOS after fetching preview or saving

Could not cast value of type '__NSArrayM' (0x1f397f190) to 'FlutterStandardTypedData' (0x1f397f178).
2022-02-09 00:44:14.720718+0500 Runner Dev[2961:154000] Could not cast value of type '__NSArrayM' (0x1f397f190) to 'FlutterStandardTypedData' (0x1f397f178).

  • thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001cd1ee7b0 libsystem_kernel.dylib__pthread_kill + 8 libsystem_kernel.dylib__pthread_kill:
    -> 0x1cd1ee7b0 <+8>: b.lo 0x1cd1ee7cc ; <+36>
    0x1cd1ee7b4 <+12>: stp x29, x30, [sp, #-0x10]!
    0x1cd1ee7b8 <+16>: mov x29, sp
    0x1cd1ee7bc <+20>: bl 0x1cd1cb1fc ; cerror_nocancel

Add into apple wallet

As already meantioned in #20

A feature where you can add directly with this package into the wallet app would be awesome.

Does not appear in Apple Wallet

Hello
In Xcode im added certificate to wallet.
When im take url to .pkpass, I use Pass().saveFromUrl, and yes, pass saved to internal memory, but im thinking that's it must be added to Apple Wallet.
Or I must do something more ?

Thanks

pass.json escape \n \t \r

image

in some pass i am using comes with \n \t \r chars inside json. It needs some replace method to taka the actual json.

I have been researching and trying to solve the issue for couple days but I haven't solved it yet. @alexeynobody can you help me with 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.