Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Nov 13, 2022
2 parents fc4defd + 45a9d70 commit b5d2d60
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 76 deletions.
43 changes: 43 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Dart imports:
import 'dart:async';
import 'dart:convert';
import 'dart:io';

// Flutter imports:
import 'package:flutter/foundation.dart';
Expand Down Expand Up @@ -61,9 +62,51 @@ import 'package:window_manager/window_manager.dart';
import 'package:invoiceninja_flutter/utils/web_stub.dart'
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';

// https://github.com/dart-lang/io/issues/83#issuecomment-940617222
const isrgRootX1 = '''-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VM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qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
''';

void main({bool isTesting = false}) async {
WidgetsFlutterBinding.ensureInitialized();

try {
SecurityContext.defaultContext.setTrustedCertificatesBytes(
Uint8List.fromList(isrgRootX1.codeUnits),
);
} catch (e) {
// Ignore CERT_ALREADY_IN_HASH_TABLE
}

if (isDesktopOS()) {
await windowManager.ensureInitialized();

Expand Down
74 changes: 14 additions & 60 deletions lib/ui/app/review_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter_redux/flutter_redux.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
import 'package:invoiceninja_flutter/ui/app/menu_drawer.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:invoiceninja_flutter/utils/app_review.dart';
Expand All @@ -18,17 +17,6 @@ class ReviewApp extends StatefulWidget {
}

class _ReviewAppState extends State<ReviewApp> {
bool _likesTheApp;

@override
void initState() {
super.initState();

if (isApple()) {
_likesTheApp = true;
}
}

@override
Widget build(BuildContext context) {
final localization = AppLocalization.of(context);
Expand All @@ -38,25 +26,14 @@ class _ReviewAppState extends State<ReviewApp> {
return SizedBox();
}

// TODO remove this code
if (isWindows()) {
return SizedBox();
}

return Padding(
padding: const EdgeInsets.only(top: 8),
child: FormCard(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 12),
Text(
isApple()
? localization.wouldYouRateTheApp
: _likesTheApp == null
? localization.areYouEnjoyingTheApp
: _likesTheApp == true
? localization.wouldYouRateIt
: localization.wouldYouTellUsMore,
localization.wouldYouRateTheApp,
style: Theme.of(context).textTheme.subtitle1,
textAlign: TextAlign.center,
),
Expand All @@ -65,63 +42,40 @@ class _ReviewAppState extends State<ReviewApp> {
children: [
TextButton(
onPressed: () async {
if (_likesTheApp == null) {
setState(() {
_likesTheApp = true;
});
// TODO remove this code: https://github.com/britannio/in_app_review/issues/56
if (isAndroid()) {
AppReview.openStoreListing();
} else if (await AppReview.isAvailable()) {
AppReview.requestReview();
} else if (kIsWeb || isLinux()) {
launchUrl(Uri.parse(getRateAppURL(context)));
} else {
if (_likesTheApp == true) {
// TODO remove this code: https://github.com/britannio/in_app_review/issues/56
if (isAndroid()) {
AppReview.openStoreListing();
} else if (await AppReview.isAvailable()) {
AppReview.requestReview();
} else if (kIsWeb || isLinux()) {
launchUrl(Uri.parse(getRateAppURL(context)));
} else {
AppReview.openStoreListing();
}
} else {
showDialog<void>(
context: context,
builder: (BuildContext context) => ContactUsDialog(),
);
}

store.dispatch(DismissReviewAppPermanently());
AppReview.openStoreListing();
}

store.dispatch(DismissReviewAppPermanently());
},
child: ConstrainedBox(
constraints: const BoxConstraints(minWidth: 100),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Text(
_likesTheApp == null
? localization.yesItsGreat
: localization.sureHappyTo,
localization.sureHappyTo,
textAlign: TextAlign.center,
),
),
),
),
TextButton(
onPressed: () async {
if (_likesTheApp == null) {
setState(() {
_likesTheApp = false;
});
} else {
store.dispatch(DismissReviewAppPermanently());
}
store.dispatch(DismissReviewAppPermanently());
},
child: ConstrainedBox(
constraints: const BoxConstraints(minWidth: 100),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Text(
_likesTheApp == null
? localization.notSoMuch
: localization.noNotNow,
localization.noNotNow,
textAlign: TextAlign.center,
),
),
Expand Down
33 changes: 18 additions & 15 deletions lib/ui/app/upgrade_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,25 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
final List<Widget> stack = <Widget>[];
if (_queryProductError == null) {
stack.add(
Scrollbar(
thumbVisibility: true,
controller: _scrollController,
child: ListView(
Container(
width: double.maxFinite,
child: Scrollbar(
thumbVisibility: true,
controller: _scrollController,
children: <Widget>[
if (Platform.isIOS)
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(
'Payment will be charged to iTunes Account at confirmation of purchase. Subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period. Account will be charged for renewal within 24-hours prior to the end of the current period, and identify the cost of the renewal. Subscriptions may be managed by the user and auto-renewal may be turned off by going to the user\'s Account Settings after purchase.',
style: TextStyle(fontSize: 12, color: Colors.grey),
child: ListView(
controller: _scrollController,
children: <Widget>[
if (Platform.isIOS)
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(
'Payment will be charged to iTunes Account at confirmation of purchase. Subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period. Account will be charged for renewal within 24-hours prior to the end of the current period, and identify the cost of the renewal. Subscriptions may be managed by the user and auto-renewal may be turned off by going to the user\'s Account Settings after purchase.',
style: TextStyle(fontSize: 12, color: Colors.grey),
),
),
),
_buildProductList(),
],
_buildProductList(),
],
),
),
),
);
Expand Down Expand Up @@ -292,7 +295,7 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
final data = {
'inapp_transaction_id': purchaseDetails.purchaseID,
'key': state.account.key,
'plan': purchaseDetails.productID,
'plan': purchaseDetails.productID.replaceAll('-', '_'),
'plan_paid': (int.parse(purchaseDetails.transactionDate) / 1000).floor(),
};

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/platforms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool supportsInAppPurchase() {
return false;
}

return isIOS();
return isIOS() || isAndroid();
}

bool isDesktopOS() => isMacOS() || isWindows() || isLinux();
Expand Down

0 comments on commit b5d2d60

Please sign in to comment.