Skip to content

Commit

Permalink
fix: I made it so that I could take errors normally.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Feb 26, 2024
1 parent fe13dbb commit 9b94395
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 71 deletions.
106 changes: 81 additions & 25 deletions packages/masamune_purchase_mobile/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.1"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c
url: "https://pub.dev"
source: hosted
version: "2.0.9"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -422,154 +430,154 @@ packages:
path: "../../katana"
relative: true
source: path
version: "2.10.2"
version: "2.12.1"
katana_auth:
dependency: "direct overridden"
description:
path: "../../katana_auth"
relative: true
source: path
version: "2.3.2"
version: "2.5.3"
katana_form:
dependency: "direct overridden"
description:
path: "../../katana_form"
relative: true
source: path
version: "2.10.5"
version: "2.12.2"
katana_functions:
dependency: "direct overridden"
description:
path: "../../katana_functions"
relative: true
source: path
version: "2.4.29"
version: "2.5.2"
katana_indicator:
dependency: "direct overridden"
description:
path: "../../katana_indicator"
relative: true
source: path
version: "2.0.36"
version: "2.1.2"
katana_listenables:
dependency: "direct overridden"
description:
path: "../../katana_listenables"
relative: true
source: path
version: "2.0.36"
version: "2.2.2"
katana_listenables_annotation:
dependency: "direct overridden"
description:
path: "../../katana_listenables_annotation"
relative: true
source: path
version: "2.0.35"
version: "2.1.2"
katana_localization:
dependency: "direct overridden"
description:
path: "../../katana_localization"
relative: true
source: path
version: "2.1.11"
version: "2.3.2"
katana_localization_annotation:
dependency: "direct overridden"
description:
path: "../../katana_localization_annotation"
relative: true
source: path
version: "2.1.10"
version: "2.2.2"
katana_logger:
dependency: "direct overridden"
description:
path: "../../katana_logger"
relative: true
source: path
version: "2.0.33"
version: "2.1.2"
katana_model:
dependency: "direct overridden"
description:
path: "../../katana_model"
relative: true
source: path
version: "2.20.1"
version: "2.24.2"
katana_model_local:
dependency: "direct overridden"
description:
path: "../../katana_model_local"
relative: true
source: path
version: "2.10.2"
version: "2.13.3"
katana_prefs:
dependency: "direct overridden"
description:
path: "../../katana_prefs"
relative: true
source: path
version: "2.0.38"
version: "2.2.2"
katana_prefs_annotation:
dependency: "direct overridden"
description:
path: "../../katana_prefs_annotation"
relative: true
source: path
version: "2.0.35"
version: "2.1.2"
katana_router:
dependency: "direct overridden"
description:
path: "../../katana_router"
relative: true
source: path
version: "2.0.62"
version: "2.2.2"
katana_router_annotation:
dependency: "direct overridden"
description:
path: "../../katana_router_annotation"
relative: true
source: path
version: "2.0.40"
version: "2.1.2"
katana_scoped:
dependency: "direct overridden"
description:
path: "../../katana_scoped"
relative: true
source: path
version: "2.1.9"
version: "2.2.2"
katana_shorten:
dependency: "direct overridden"
description:
path: "../../katana_shorten"
relative: true
source: path
version: "2.0.33"
version: "2.1.2"
katana_storage:
dependency: "direct overridden"
description:
path: "../../katana_storage"
relative: true
source: path
version: "2.0.35"
version: "2.1.3"
katana_theme:
dependency: "direct overridden"
description:
path: "../../katana_theme"
relative: true
source: path
version: "2.2.11"
version: "2.4.3"
katana_theme_annotation:
dependency: "direct overridden"
description:
path: "../../katana_theme_annotation"
relative: true
source: path
version: "2.0.38"
version: "2.1.2"
katana_ui:
dependency: "direct overridden"
description:
path: "../../katana_ui"
relative: true
source: path
version: "2.5.26"
version: "2.6.2"
lints:
dependency: transitive
description:
Expand All @@ -592,21 +600,21 @@ packages:
path: "../../masamune"
relative: true
source: path
version: "2.7.1"
version: "2.9.12"
masamune_annotation:
dependency: "direct overridden"
description:
path: "../../masamune_annotation"
relative: true
source: path
version: "2.5.0"
version: "2.6.2"
masamune_purchase_mobile:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "2.5.140"
version: "2.7.14"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -655,6 +663,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.3"
path_parsing:
dependency: transitive
description:
name: path_parsing
sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
url: "https://pub.dev"
source: hosted
version: "1.0.1"
path_provider:
dependency: transitive
description:
Expand Down Expand Up @@ -703,6 +719,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.1"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "6.0.2"
pin_input_text_field:
dependency: transitive
description:
Expand Down Expand Up @@ -972,6 +996,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.2.1"
vector_graphics:
dependency: transitive
description:
name: vector_graphics
sha256: "4ac59808bbfca6da38c99f415ff2d3a5d7ca0a6b4809c71d9cf30fba5daf9752"
url: "https://pub.dev"
source: hosted
version: "1.1.10+1"
vector_graphics_codec:
dependency: transitive
description:
name: vector_graphics_codec
sha256: f3247e7ab0ec77dc759263e68394990edc608fb2b480b80db8aa86ed09279e33
url: "https://pub.dev"
source: hosted
version: "1.1.10+1"
vector_graphics_compiler:
dependency: transitive
description:
name: vector_graphics_compiler
sha256: "18489bdd8850de3dd7ca8a34e0c446f719ec63e2bab2e7a8cc66a9028dd76c5a"
url: "https://pub.dev"
source: hosted
version: "1.1.10+1"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -1020,6 +1068,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.3"
xml:
dependency: transitive
description:
name: xml
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.5.0"
yaml:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class IOSSubscriptionPurchaseFunctionsAction extends PurchaseFunctionsAction {
final latestReceiptInfo = response
.getAsList("latest_receipt_info")
.cast<Map>()
.firstOrNull as DynamicMap?;
.map((e) => e.map((key, value) => MapEntry(key.toString(), value)))
.firstOrNull;
final startTimeMillis =
latestReceiptInfo.get<int?>("purchase_date_ms", null) ??
latestReceiptInfo.get<double?>("purchase_date_ms", null)?.toInt() ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MobilePurchaseMasamuneAdapter extends PurchaseMasamuneAdapter {
required List<PurchaseProduct> products,
required VoidCallback onDone,
required VoidCallback onDisposed,
required void Function(Object e) onError,
required void Function(Object e, StackTrace? stacktrace) onError,
}) {
final functions = functionsAdapter ?? FunctionsAdapter.primary;
return _iap.purchaseStream.listen(
Expand Down Expand Up @@ -357,31 +357,31 @@ class MobilePurchaseMasamuneAdapter extends PurchaseMasamuneAdapter {
}
done = true;
}
} catch (e) {
} catch (e, stacktrace) {
if (purchase.pendingCompletePurchase) {
debugPrint("Purchase completed: ${purchase.productID}");
await _iap.completePurchase(purchase);
}
throw Exception(
"Purchase completed with error: ${purchase.productID}:${e.toString()}:${StackTrace.current.toString()}",
"Purchase completed with error: ${purchase.productID}:${e.toString()}:$stacktrace.toString()}",
);
}
}
if (done) {
onDone();
}
} catch (e) {
onError(e);
} catch (e, stacktrace) {
onError(e, stacktrace);
throw Exception(
"Purchase completed with error: ${e.toString()}:${StackTrace.current.toString()}",
"Purchase completed with error: ${e.toString()}:${stacktrace.toString()}",
);
}
},
onDone: onDisposed,
onError: (e) {
onError(e);
onError: (e, stacktrace) {
onError(e, stacktrace);
throw Exception(
"Purchase completed with error: ${e.toString()}:${StackTrace.current.toString()}",
"Purchase completed with error: ${e.toString()}:${stacktrace.toString()}",
);
},
);
Expand Down Expand Up @@ -461,6 +461,9 @@ class MobilePurchaseMasamuneAdapter extends PurchaseMasamuneAdapter {

Future<GooglePlayPurchaseDetails?> _getReplacedPurchaseDetails(
{PurchaseProduct? replacedProduct}) async {
if (!UniversalPlatform.isAndroid) {
return null;
}
if (replacedProduct == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class RuntimePurchaseMasamuneAdapter extends PurchaseMasamuneAdapter {
required List<PurchaseProduct> products,
required VoidCallback onDone,
required VoidCallback onDisposed,
required void Function(Object e) onError,
required void Function(Object e, StackTrace? stacktrace) onError,
}) =>
null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MobilePurchaseMasamuneAdapter extends PurchaseMasamuneAdapter {
required List<PurchaseProduct> products,
required VoidCallback onDone,
required VoidCallback onDisposed,
required void Function(Object e) onError,
required void Function(Object e, StackTrace? stacktrace) onError,
}) {
throw UnsupportedError("Purchasing function is not supported.");
}
Expand Down
2 changes: 1 addition & 1 deletion packages/masamune_purchase_mobile/lib/src/purchase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class Purchase extends MasamuneControllerBase<void, PurchaseMasamuneAdapter> {
_purchaseCompleter = null;
dispose();
},
onError: (e) {
onError: (e, stacktrace) {
_initializeCompleter?.completeError(e);
_initializeCompleter = null;
_purchaseCompleter?.completeError(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ abstract class PurchaseMasamuneAdapter extends MasamuneAdapter {
required List<PurchaseProduct> products,
required VoidCallback onDone,
required VoidCallback onDisposed,
required void Function(Object e) onError,
required void Function(Object e, StackTrace? stacktrace) onError,
});

/// Perform other initialization processes.
Expand Down
Loading

0 comments on commit 9b94395

Please sign in to comment.