Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion in_app_purchases/.gitignore

This file was deleted.

108 changes: 18 additions & 90 deletions in_app_purchases/codelab_rebuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
patch-u: |
--- b/in_app_purchases/step_00/app/.gitignore
+++ a/in_app_purchases/step_00/app/.gitignore
@@ -43,3 +43,9 @@ app.*.map.json
@@ -43,3 +43,8 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
Expand All @@ -23,10 +23,9 @@ steps:
+GoogleService-Info.plist
+google-services.json
+ios/firebase_app_id_file.json
+lib/firebase_options.dart
- name: Add app dependencies
path: steps/app
flutter: pub add cloud_firestore cupertino_icons firebase_auth firebase_core google_sign_in http in_app_purchase in_app_purchase_platform_interface intl provider
flutter: pub add cloud_firestore cupertino_icons firebase_auth firebase_core google_sign_in http intl provider
- name: Patch app/pubspec.yaml
path: steps/app/pubspec.yaml
patch-u: |
Expand All @@ -39,7 +38,7 @@ steps:
publish_to: 'none'
version: 0.1.0

@@ -27,3 +27,6 @@ dev_dependencies:
@@ -25,3 +25,6 @@ dev_dependencies:

flutter:
uses-material-design: true
Expand Down Expand Up @@ -16734,7 +16733,6 @@ steps:
assets/*.p8
assets/appstore.token
assets/service-account*.json
lib/constants.dart
- name: Replace analysis_options.yaml
path: steps/dart-backend/analysis_options.yaml
replace-contents: |
Expand Down Expand Up @@ -17179,6 +17177,18 @@ steps:
from: steps
to: step_00

- name: step_03
steps:
- name: Remove step_03
rmdir: step_03
- name: Add dependencies
path: steps/app
flutter: pub add in_app_purchase dev:in_app_purchase_platform_interface
- name: Copy to step_03
copydir:
from: steps
to: step_03

- name: step_07
steps:
- name: Remove step_07
Expand Down Expand Up @@ -18550,91 +18560,9 @@ steps:
- name: Patch app/lib/logic/dash_purchases.dart
path: steps/app/lib/logic/dash_purchases.dart
patch-u: |
--- b/in_app_purchases/complete/app/lib/logic/dash_purchases.dart
+++ a/in_app_purchases/complete/app/lib/logic/dash_purchases.dart
@@ -1,3 +1,5 @@
+// ignore_for_file: avoid_print
+
import 'dart:async';
import 'dart:convert';

@@ -17,10 +19,10 @@ import 'firebase_notifier.dart';
class DashPurchases extends ChangeNotifier {
DashCounter counter;
FirebaseNotifier firebaseNotifier;
+ IAPRepo iapRepo;
StoreState storeState = StoreState.loading;
late StreamSubscription<List<PurchaseDetails>> _subscription;
List<PurchasableProduct> products = [];
- IAPRepo iapRepo;

bool get beautifiedDash => _beautifiedDashUpgrade;
bool _beautifiedDashUpgrade = false;
@@ -44,6 +46,7 @@ class DashPurchases extends ChangeNotifier {
notifyListeners();
return;
}
+
const ids = <String>{
storeKeyConsumable,
storeKeySubscription,
@@ -58,8 +61,8 @@ class DashPurchases extends ChangeNotifier {

@override
void dispose() {
- _subscription.cancel();
iapRepo.removeListener(purchasesUpdate);
+ _subscription.cancel();
super.dispose();
}

@@ -126,8 +129,10 @@ class DashPurchases extends ChangeNotifier {
headers: headers,
);
if (response.statusCode == 200) {
+ print('Successfully verified purchase');
return true;
} else {
+ print('failed request: ${response.statusCode} - ${response.body}');
return false;
}
}
@@ -137,7 +142,7 @@ class DashPurchases extends ChangeNotifier {
}

void _updateStreamOnError(dynamic error) {
- //Handle error here
+ print(error);
}

void purchasesUpdate() {
@@ -158,21 +163,21 @@ class DashPurchases extends ChangeNotifier {
// purchases page.
if (iapRepo.hasActiveSubscription) {
counter.applyPaidMultiplier();
- for (var element in subscriptions) {
+ for (final element in subscriptions) {
_updateStatus(element, ProductStatus.purchased);
}
} else {
counter.removePaidMultiplier();
- for (var element in subscriptions) {
+ for (final element in subscriptions) {
_updateStatus(element, ProductStatus.purchasable);
}
}

- // Set the Dash beautifier and show/hide purchased on
+ // Set the dash beautifier and show/hide purchased on
// the purchases page.
if (iapRepo.hasUpgrade != _beautifiedDashUpgrade) {
_beautifiedDashUpgrade = iapRepo.hasUpgrade;
- for (var element in upgrades) {
+ for (final element in upgrades) {
_updateStatus(
element,
_beautifiedDashUpgrade
@@ -184,8 +189,8 @@ class DashPurchases extends ChangeNotifier {
--- b/in_app_purchases/step_11/app/lib/logic/dash_purchases.dart
+++ a/in_app_purchases/step_11/app/lib/logic/dash_purchases.dart
@@ -184,8 +184,8 @@ class DashPurchases extends ChangeNotifier {
}

void _updateStatus(PurchasableProduct product, ProductStatus status) {
Expand Down
1 change: 0 additions & 1 deletion in_app_purchases/complete/app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ app.*.map.json
GoogleService-Info.plist
google-services.json
ios/firebase_app_id_file.json
lib/firebase_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TC87DMJLQP;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -542,7 +541,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TC87DMJLQP;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -565,7 +563,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TC87DMJLQP;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
19 changes: 7 additions & 12 deletions in_app_purchases/complete/app/lib/logic/dash_purchases.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: avoid_print

import 'dart:async';
import 'dart:convert';

Expand All @@ -19,10 +17,10 @@ import 'firebase_notifier.dart';
class DashPurchases extends ChangeNotifier {
DashCounter counter;
FirebaseNotifier firebaseNotifier;
IAPRepo iapRepo;
StoreState storeState = StoreState.loading;
late StreamSubscription<List<PurchaseDetails>> _subscription;
List<PurchasableProduct> products = [];
IAPRepo iapRepo;

bool get beautifiedDash => _beautifiedDashUpgrade;
bool _beautifiedDashUpgrade = false;
Expand All @@ -46,7 +44,6 @@ class DashPurchases extends ChangeNotifier {
notifyListeners();
return;
}

const ids = <String>{
storeKeyConsumable,
storeKeySubscription,
Expand All @@ -61,8 +58,8 @@ class DashPurchases extends ChangeNotifier {

@override
void dispose() {
iapRepo.removeListener(purchasesUpdate);
_subscription.cancel();
iapRepo.removeListener(purchasesUpdate);
super.dispose();
}

Expand Down Expand Up @@ -129,10 +126,8 @@ class DashPurchases extends ChangeNotifier {
headers: headers,
);
if (response.statusCode == 200) {
print('Successfully verified purchase');
return true;
} else {
print('failed request: ${response.statusCode} - ${response.body}');
return false;
}
}
Expand All @@ -142,7 +137,7 @@ class DashPurchases extends ChangeNotifier {
}

void _updateStreamOnError(dynamic error) {
print(error);
//Handle error here
}

void purchasesUpdate() {
Expand All @@ -163,21 +158,21 @@ class DashPurchases extends ChangeNotifier {
// purchases page.
if (iapRepo.hasActiveSubscription) {
counter.applyPaidMultiplier();
for (final element in subscriptions) {
for (var element in subscriptions) {
_updateStatus(element, ProductStatus.purchased);
}
} else {
counter.removePaidMultiplier();
for (final element in subscriptions) {
for (var element in subscriptions) {
_updateStatus(element, ProductStatus.purchasable);
}
}

// Set the dash beautifier and show/hide purchased on
// Set the Dash beautifier and show/hide purchased on
// the purchases page.
if (iapRepo.hasUpgrade != _beautifiedDashUpgrade) {
_beautifiedDashUpgrade = iapRepo.hasUpgrade;
for (final element in upgrades) {
for (var element in upgrades) {
_updateStatus(
element,
_beautifiedDashUpgrade
Expand Down
14 changes: 7 additions & 7 deletions in_app_purchases/complete/app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ publish_to: 'none'
version: 0.1.0

environment:
sdk: ^3.6.0-0
sdk: ^3.6.1

dependencies:
flutter:
sdk: flutter
cloud_firestore: ^5.5.1
cloud_firestore: ^5.6.2
cupertino_icons: ^1.0.8
firebase_auth: ^5.3.4
firebase_core: ^3.8.1
firebase_auth: ^5.4.1
firebase_core: ^3.10.1
google_sign_in: ^6.2.2
http: ^1.2.2
in_app_purchase: ^3.2.0
in_app_purchase_platform_interface: ^1.4.0
http: ^1.3.0
intl: ^0.20.1
provider: ^6.1.2
in_app_purchase: ^3.2.0

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
in_app_purchase_platform_interface: ^1.4.0

flutter:
uses-material-design: true
Expand Down
1 change: 0 additions & 1 deletion in_app_purchases/complete/dart-backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ build/
assets/*.p8
assets/appstore.token
assets/service-account*.json
lib/constants.dart
4 changes: 2 additions & 2 deletions in_app_purchases/complete/dart-backend/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ version: 1.0.0
# repository: https://github.com/my_org/my_repo

environment:
sdk: ^3.6.0-0
sdk: ^3.6.1

dependencies:
app_store_server_sdk: ^1.2.9
googleapis: ^13.2.0
googleapis_auth: ^1.6.0
http: ^1.2.2
http: ^1.3.0
shelf: ^1.4.0
shelf_router: ^1.1.0

Expand Down
1 change: 0 additions & 1 deletion in_app_purchases/step_00/app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ app.*.map.json
GoogleService-Info.plist
google-services.json
ios/firebase_app_id_file.json
lib/firebase_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TC87DMJLQP;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -542,7 +541,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TC87DMJLQP;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -565,7 +563,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = TC87DMJLQP;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
12 changes: 5 additions & 7 deletions in_app_purchases/step_00/app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ publish_to: 'none'
version: 0.1.0

environment:
sdk: ^3.6.0-0
sdk: ^3.6.1

dependencies:
flutter:
sdk: flutter
cloud_firestore: ^5.5.1
cloud_firestore: ^5.6.2
cupertino_icons: ^1.0.8
firebase_auth: ^5.3.4
firebase_core: ^3.8.1
firebase_auth: ^5.4.1
firebase_core: ^3.10.1
google_sign_in: ^6.2.2
http: ^1.2.2
in_app_purchase: ^3.2.0
in_app_purchase_platform_interface: ^1.4.0
http: ^1.3.0
intl: ^0.20.1
provider: ^6.1.2

Expand Down
1 change: 0 additions & 1 deletion in_app_purchases/step_00/dart-backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ build/
assets/*.p8
assets/appstore.token
assets/service-account*.json
lib/constants.dart
4 changes: 2 additions & 2 deletions in_app_purchases/step_00/dart-backend/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ version: 1.0.0
# repository: https://github.com/my_org/my_repo

environment:
sdk: ^3.6.0-0
sdk: ^3.6.1

dependencies:
app_store_server_sdk: ^1.2.9
googleapis: ^13.2.0
googleapis_auth: ^1.6.0
http: ^1.2.2
http: ^1.3.0
shelf: ^1.4.0
shelf_router: ^1.1.0

Expand Down
Loading
Loading