stuff
This commit is contained in:
parent
4aed336b51
commit
67cfa49e2d
8 changed files with 128 additions and 136 deletions
|
|
@ -3,7 +3,6 @@ import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_rustore_billing/pigeons/rustore.dart';
|
|
||||||
import 'package:in_app_purchase/in_app_purchase.dart';
|
import 'package:in_app_purchase/in_app_purchase.dart';
|
||||||
import 'package:mnemo_cards_common/mnemo_cards_common.dart';
|
import 'package:mnemo_cards_common/mnemo_cards_common.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
@ -31,7 +30,8 @@ class InAppPurchaseService {
|
||||||
Future<bool> buyPack(CardPackBuyDto dto) async {
|
Future<bool> buyPack(CardPackBuyDto dto) async {
|
||||||
try {
|
try {
|
||||||
if (RUSTORE_BUILD) {
|
if (RUSTORE_BUILD) {
|
||||||
return RustorePurchaseService().buyPack(dto);
|
// return RustorePurchaseService().buyPack(dto);
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
final pack = await _getPackStoreProduct(dto);
|
final pack = await _getPackStoreProduct(dto);
|
||||||
final result = await _buyItemInStore(pack.first);
|
final result = await _buyItemInStore(pack.first);
|
||||||
|
|
|
||||||
|
|
@ -1,112 +1,110 @@
|
||||||
import 'dart:developer';
|
// import 'dart:developer';
|
||||||
|
//
|
||||||
import 'package:auto_route/auto_route.dart';
|
// import 'package:flutter_rustore_billing/flutter_rustore_billing.dart';
|
||||||
import 'package:flutter_rustore_billing/flutter_rustore_billing.dart';
|
// import 'package:mnemo_cards/features/analytics/analytics.dart';
|
||||||
import 'package:mnemo_cards/features/analytics/analytics.dart';
|
// import 'package:mnemo_cards/flags.dart';
|
||||||
import 'package:mnemo_cards/flags.dart';
|
// import 'package:mnemo_cards_common/mnemo_cards_common.dart';
|
||||||
import 'package:mnemo_cards/main.dart';
|
//
|
||||||
import 'package:mnemo_cards_common/mnemo_cards_common.dart';
|
// import '../../../di/locator.dart';
|
||||||
|
// import '../../../domain/router/dialogs.dart';
|
||||||
import '../../../di/locator.dart';
|
//
|
||||||
import '../../../domain/router/dialogs.dart';
|
// class RustorePurchaseService {
|
||||||
|
// Future<bool> init() async {
|
||||||
class RustorePurchaseService {
|
// return RustoreBillingClient.initialize(
|
||||||
Future<bool> init() async {
|
// "2063563896",
|
||||||
return RustoreBillingClient.initialize(
|
// "mnemocards://iamback",
|
||||||
"2063563896",
|
// true,
|
||||||
"mnemocards://iamback",
|
// ).then((value) {
|
||||||
true,
|
// print("initialize success: $value");
|
||||||
).then((value) {
|
// return true;
|
||||||
print("initialize success: $value");
|
// }, onError: (err) {
|
||||||
return true;
|
// print("initialize err: $err");
|
||||||
}, onError: (err) {
|
// return false;
|
||||||
print("initialize err: $err");
|
// });
|
||||||
return false;
|
// }
|
||||||
});
|
//
|
||||||
}
|
// Future<bool> buyPack(CardPackBuyDto dto) async {
|
||||||
|
// if (dto.rustoreId == null) {
|
||||||
Future<bool> buyPack(CardPackBuyDto dto) async {
|
// return false;
|
||||||
if (dto.rustoreId == null) {
|
// }
|
||||||
return false;
|
// if (!await init()) {
|
||||||
}
|
// return false;
|
||||||
if (!await init()) {
|
// }
|
||||||
return false;
|
// if (!await RustoreBillingClient.available().then((value) {
|
||||||
}
|
// print("available success $value");
|
||||||
if (!await RustoreBillingClient.available().then((value) {
|
// return true;
|
||||||
print("available success $value");
|
// }, onError: (err) {
|
||||||
return true;
|
// print("available err: $err");
|
||||||
}, onError: (err) {
|
// return false;
|
||||||
print("available err: $err");
|
// })) {
|
||||||
return false;
|
// return false;
|
||||||
})) {
|
// }
|
||||||
return false;
|
// final product = (await RustoreBillingClient.products([dto.rustoreId]))
|
||||||
}
|
// .products
|
||||||
final product = (await RustoreBillingClient.products([dto.rustoreId]))
|
// .firstOrNull;
|
||||||
.products
|
// if (product == null) {
|
||||||
.firstOrNull;
|
// return false;
|
||||||
if (product == null) {
|
// }
|
||||||
return false;
|
// try {
|
||||||
}
|
// final result = await RustoreBillingClient.purchase(dto.rustoreId!, null);
|
||||||
try {
|
// try {
|
||||||
final result = await RustoreBillingClient.purchase(dto.rustoreId!, null);
|
// try {
|
||||||
try {
|
// // creating payment to check it later
|
||||||
try {
|
// // in case there will be an error after confirmation
|
||||||
// creating payment to check it later
|
// await locator.repository.checkPayment(
|
||||||
// in case there will be an error after confirmation
|
// itemId: result.successPurchase!.productId,
|
||||||
await locator.repository.checkPayment(
|
// key: result.successPurchase!.subscriptionToken!,
|
||||||
itemId: result.successPurchase!.productId,
|
// paymentSystem: androidPaymentSystem,
|
||||||
key: result.successPurchase!.subscriptionToken!,
|
// );
|
||||||
paymentSystem: androidPaymentSystem,
|
// } catch (e, s) {
|
||||||
);
|
// Analytics.buyError(
|
||||||
} catch (e, s) {
|
// dto,
|
||||||
Analytics.buyError(
|
// PaymentSystem.rustore,
|
||||||
dto,
|
// message: 'Error when creating payment',
|
||||||
PaymentSystem.rustore,
|
// );
|
||||||
message: 'Error when creating payment',
|
// log('Error when creating payment', error: e, stackTrace: s);
|
||||||
);
|
// showErrorDialog(
|
||||||
log('Error when creating payment', error: e, stackTrace: s);
|
// 'Технические шоколадки...\n\nПопробуйте позже или обновите приложение до последней версии');
|
||||||
showErrorDialog(
|
// return false;
|
||||||
'Технические шоколадки...\n\nПопробуйте позже или обновите приложение до последней версии');
|
// }
|
||||||
return false;
|
// final p = await RustoreBillingClient.confirm(
|
||||||
}
|
// result.successPurchase!.subscriptionToken!,
|
||||||
final p = await RustoreBillingClient.confirm(
|
// );
|
||||||
result.successPurchase!.subscriptionToken!,
|
// if (p.success) {
|
||||||
);
|
// final r = await locator.repository.checkPayment(
|
||||||
if (p.success) {
|
// itemId: result.successPurchase!.productId,
|
||||||
final r = await locator.repository.checkPayment(
|
// key: result.successPurchase!.subscriptionToken!,
|
||||||
itemId: result.successPurchase!.productId,
|
// paymentSystem: androidPaymentSystem,
|
||||||
key: result.successPurchase!.subscriptionToken!,
|
// );
|
||||||
paymentSystem: androidPaymentSystem,
|
// if (r) {
|
||||||
);
|
// return r;
|
||||||
if (r) {
|
// } else {
|
||||||
return r;
|
// Analytics.buyError(
|
||||||
} else {
|
// dto,
|
||||||
Analytics.buyError(
|
// PaymentSystem.rustore,
|
||||||
dto,
|
// message: 'Error when confirming payment',
|
||||||
PaymentSystem.rustore,
|
// );
|
||||||
message: 'Error when confirming payment',
|
// showErrorDialog(
|
||||||
);
|
// 'Технические шоколадки...\n\nДоступ откроется в течение 5 мин',
|
||||||
showErrorDialog(
|
// );
|
||||||
'Технические шоколадки...\n\nДоступ откроется в течение 5 мин',
|
// }
|
||||||
);
|
// }
|
||||||
}
|
// } catch (e, s) {
|
||||||
}
|
// log('Error when confirming purchase', error: e, stackTrace: s);
|
||||||
} catch (e, s) {
|
// Analytics.crashlyticsError(
|
||||||
log('Error when confirming purchase', error: e, stackTrace: s);
|
// e: e,
|
||||||
Analytics.crashlyticsError(
|
// s: s,
|
||||||
e: e,
|
// message: 'Error when confirming rustore purchase',
|
||||||
s: s,
|
// );
|
||||||
message: 'Error when confirming rustore purchase',
|
// }
|
||||||
);
|
// } catch (e, s) {
|
||||||
}
|
// log('Error when processing purchase', error: e, stackTrace: s);
|
||||||
} catch (e, s) {
|
// Analytics.crashlyticsError(
|
||||||
log('Error when processing purchase', error: e, stackTrace: s);
|
// e: e,
|
||||||
Analytics.crashlyticsError(
|
// s: s,
|
||||||
e: e,
|
// message: 'Error when processing rustore purchase',
|
||||||
s: s,
|
// );
|
||||||
message: 'Error when processing rustore purchase',
|
// }
|
||||||
);
|
// return false;
|
||||||
}
|
// }
|
||||||
return false;
|
// }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class _ProgressWidgetState extends State<ProgressWidget> {
|
||||||
widget.popText!,
|
widget.popText!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:mnemo_cards/managers/audio_player.dart';
|
import 'package:mnemo_cards/managers/audio_player.dart';
|
||||||
|
|
@ -73,7 +74,7 @@ class CommonTestQuestionWidget extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (text != null)
|
if (text != null && audio != null)
|
||||||
Container(
|
Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
|
|
@ -100,6 +101,16 @@ class CommonTestQuestionWidget extends StatelessWidget {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
else if (text != null)
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
|
child: AutoSizeText(
|
||||||
|
text!,
|
||||||
|
style: theme.headlineLarge,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class FirebaseRepository {
|
||||||
static ConfigModel? _lastConfig;
|
static ConfigModel? _lastConfig;
|
||||||
|
|
||||||
static ConfigModel get appConfig {
|
static ConfigModel get appConfig {
|
||||||
update();
|
// update();
|
||||||
return _lastConfig!;
|
return _lastConfig!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,6 @@ class _BuyButton extends StatelessWidget {
|
||||||
height: 120.h,
|
height: 120.h,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
|
||||||
border: Border.all(color: borderGray),
|
border: Border.all(color: borderGray),
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
16
pubspec.lock
16
pubspec.lock
|
|
@ -494,14 +494,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.20"
|
version: "2.0.20"
|
||||||
flutter_rustore_billing:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_rustore_billing
|
|
||||||
sha256: "95905fec5ab46f7d0e798469c847423aa4dac07461a6111892be3f34c48a5b75"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "6.0.1"
|
|
||||||
flutter_screenutil:
|
flutter_screenutil:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -624,14 +616,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.2"
|
||||||
go_router:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: go_router
|
|
||||||
sha256: b465e99ce64ba75e61c8c0ce3d87b66d8ac07f0b35d0a7e0263fcfc10f99e836
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "13.2.5"
|
|
||||||
google_identity_services_web:
|
google_identity_services_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ name: mnemo_cards
|
||||||
description: Mnemo
|
description: Mnemo
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.0.2+15
|
version: 1.0.2+16
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.1.3 <4.0.0'
|
sdk: '>=3.1.3 <4.0.0'
|
||||||
|
|
@ -65,7 +65,7 @@ dependencies:
|
||||||
url_launcher: ^6.2.6
|
url_launcher: ^6.2.6
|
||||||
|
|
||||||
# RUSTORE
|
# RUSTORE
|
||||||
flutter_rustore_billing: ^6.0.1
|
# flutter_rustore_billing: ^6.0.1
|
||||||
|
|
||||||
collection: any
|
collection: any
|
||||||
freezed_annotation: any
|
freezed_annotation: any
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue