Skip to content

Commit

Permalink
Merge pull request #4 from sncf-connect-tech/release-0.0.8
Browse files Browse the repository at this point in the history
Release 0.0.8
  • Loading branch information
jyardin authored Mar 16, 2023
2 parents 824518d + a54d7f9 commit 926ba86
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 44 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
## 0.0.8

* Fixed SVG in all supported locales
* Renamed Add*to*GoogleWalletButton to Add*To*GoogleWalletButton (with a capital T): AddToGoogleWalletButton still exists but is deprecated
* The `badgeButton` field is now the `buttonType` field, and is now of type `GoogleWalletButtonType` which has 2 possible values:
* `GoogleWalletButtonType.primary` which is equivalent to `badgeButton = false`
* `GoogleWalletButtonType.condensed` which is equivalent to `badgeButton = true`
* The field `removeSvgPackage` has been renamed to `useInternalAssetPackage`
* The field `langue` has been renamed to `locale`, and is now of type `Locale`

## 0.0.7

* Fix spain locale

## 0.0.6

* Fix asset path
Expand Down
67 changes: 55 additions & 12 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> {
final String _platformVersion = 'Unknown';

late Future<bool> _isWalletAvailable;

@override
void initState() {
super.initState();
widget.flutterGoogleWalletPlugin.initWalletClient();
_isWalletAvailable = Future(() async {
await widget.flutterGoogleWalletPlugin.initWalletClient();
return widget.flutterGoogleWalletPlugin.getWalletApiAvailabilityStatus();
});
}

@override
Expand All @@ -38,21 +43,22 @@ class _MyAppState extends State<MyApp> {
children: [
Text('Running on: $_platformVersion\n'),
FutureBuilder<bool>(
future: widget.flutterGoogleWalletPlugin
.getWalletApiAvailabilityStatus(),
future: _isWalletAvailable,
builder: (BuildContext context, AsyncSnapshot<bool> available) {
if (available.data ?? false) {
if (available.data == true) {
return Padding(
padding: const EdgeInsets.all(10),
child: Align(
alignment: Alignment.topCenter,
child: AddToGoogleWalletButton(
locale: const Locale('en', 'US'),
onPress: () {
widget.flutterGoogleWalletPlugin.savePasses(
jsonPass: '',
addToGoogleWalletRequestCode: 2);
})),
alignment: Alignment.topCenter,
child: AddToGoogleWalletButton(
locale: const Locale('fr', 'FR'),
onPress: () {
widget.flutterGoogleWalletPlugin.savePasses(
jsonPass: exampleJsonPass,
addToGoogleWalletRequestCode: 2);
},
),
),
);
} else {
return const SizedBox.shrink();
Expand All @@ -66,3 +72,40 @@ class _MyAppState extends State<MyApp> {
);
}
}

// This is a pass with fake data, and it will trigger an error when added to Google Wallet
// For a pass with real data, you must follow the Google developer guide here: https://developers.google.com/wallet
const exampleJsonPass = '''
{
"aud": "google",
"origins": [
"https://localhost:8080"
],
"iss": "[email protected]",
"iat": 123456789,
"typ": "savetowallet",
"payload": {
"loyaltyObjects": [
{
"barcode": {
"alternateText": "12345",
"type": "qrCode",
"value": "28343E3"
},
"id": "123456789.LoyaltyObject",
"loyaltyPoints": {
"balance": {
"string": "500"
},
"label": "Points"
},
"accountId": "1234567890",
"classId": "123456789.LoyaltyClass",
"accountName": "Jane Doe",
"state": "active",
"version": 1
}
]
}
}
''';
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.7"
version: "0.0.8"
flutter_lints:
dependency: "direct dev"
description:
Expand Down
35 changes: 5 additions & 30 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,8 @@ flutter:
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
assets:
- packages/flutter_google_wallet/assets/svg/button/frFR_add_to_google_wallet_wallet-button.svg
- packages/flutter_google_wallet/assets/svg/button/enUS_add_to_google_wallet_wallet-button.svg
- packages/flutter_google_wallet/assets/svg/button/esES_add_to_google_wallet_wallet-button.svg
- packages/flutter_google_wallet/assets/svg/button/zhHK_add_to_google_wallet_wallet-button.svg
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_google_wallet
description: A Flutter Google Wallet Plugin
version: 0.0.7
version: 0.0.8
homepage: https://github.com/voyages-sncf-technologies/flutter_google_wallet

environment:
Expand Down

0 comments on commit 926ba86

Please sign in to comment.