Skip to content

Commit b5d2d60

Browse files
committed
Merge branch 'develop'
2 parents fc4defd + 45a9d70 commit b5d2d60

File tree

4 files changed

+76
-76
lines changed

4 files changed

+76
-76
lines changed

lib/main.dart

+43
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Dart imports:
22
import 'dart:async';
33
import 'dart:convert';
4+
import 'dart:io';
45

56
// Flutter imports:
67
import 'package:flutter/foundation.dart';
@@ -61,9 +62,51 @@ import 'package:window_manager/window_manager.dart';
6162
import 'package:invoiceninja_flutter/utils/web_stub.dart'
6263
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
6364

65+
// https://github.com/dart-lang/io/issues/83#issuecomment-940617222
66+
const isrgRootX1 = '''-----BEGIN CERTIFICATE-----
67+
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
68+
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
69+
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
70+
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
71+
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
72+
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
73+
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
74+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
75+
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
76+
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ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1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
93+
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
94+
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
95+
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
96+
-----END CERTIFICATE-----
97+
''';
98+
6499
void main({bool isTesting = false}) async {
65100
WidgetsFlutterBinding.ensureInitialized();
66101

102+
try {
103+
SecurityContext.defaultContext.setTrustedCertificatesBytes(
104+
Uint8List.fromList(isrgRootX1.codeUnits),
105+
);
106+
} catch (e) {
107+
// Ignore CERT_ALREADY_IN_HASH_TABLE
108+
}
109+
67110
if (isDesktopOS()) {
68111
await windowManager.ensureInitialized();
69112

lib/ui/app/review_app.dart

+14-60
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'package:flutter_redux/flutter_redux.dart';
44
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
55
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
66
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
7-
import 'package:invoiceninja_flutter/ui/app/menu_drawer.dart';
87
import 'package:invoiceninja_flutter/utils/localization.dart';
98
import 'package:invoiceninja_flutter/utils/platforms.dart';
109
import 'package:invoiceninja_flutter/utils/app_review.dart';
@@ -18,17 +17,6 @@ class ReviewApp extends StatefulWidget {
1817
}
1918

2019
class _ReviewAppState extends State<ReviewApp> {
21-
bool _likesTheApp;
22-
23-
@override
24-
void initState() {
25-
super.initState();
26-
27-
if (isApple()) {
28-
_likesTheApp = true;
29-
}
30-
}
31-
3220
@override
3321
Widget build(BuildContext context) {
3422
final localization = AppLocalization.of(context);
@@ -38,25 +26,14 @@ class _ReviewAppState extends State<ReviewApp> {
3826
return SizedBox();
3927
}
4028

41-
// TODO remove this code
42-
if (isWindows()) {
43-
return SizedBox();
44-
}
45-
4629
return Padding(
4730
padding: const EdgeInsets.only(top: 8),
4831
child: FormCard(
4932
crossAxisAlignment: CrossAxisAlignment.center,
5033
children: [
5134
SizedBox(height: 12),
5235
Text(
53-
isApple()
54-
? localization.wouldYouRateTheApp
55-
: _likesTheApp == null
56-
? localization.areYouEnjoyingTheApp
57-
: _likesTheApp == true
58-
? localization.wouldYouRateIt
59-
: localization.wouldYouTellUsMore,
36+
localization.wouldYouRateTheApp,
6037
style: Theme.of(context).textTheme.subtitle1,
6138
textAlign: TextAlign.center,
6239
),
@@ -65,63 +42,40 @@ class _ReviewAppState extends State<ReviewApp> {
6542
children: [
6643
TextButton(
6744
onPressed: () async {
68-
if (_likesTheApp == null) {
69-
setState(() {
70-
_likesTheApp = true;
71-
});
45+
// TODO remove this code: https://github.com/britannio/in_app_review/issues/56
46+
if (isAndroid()) {
47+
AppReview.openStoreListing();
48+
} else if (await AppReview.isAvailable()) {
49+
AppReview.requestReview();
50+
} else if (kIsWeb || isLinux()) {
51+
launchUrl(Uri.parse(getRateAppURL(context)));
7252
} else {
73-
if (_likesTheApp == true) {
74-
// TODO remove this code: https://github.com/britannio/in_app_review/issues/56
75-
if (isAndroid()) {
76-
AppReview.openStoreListing();
77-
} else if (await AppReview.isAvailable()) {
78-
AppReview.requestReview();
79-
} else if (kIsWeb || isLinux()) {
80-
launchUrl(Uri.parse(getRateAppURL(context)));
81-
} else {
82-
AppReview.openStoreListing();
83-
}
84-
} else {
85-
showDialog<void>(
86-
context: context,
87-
builder: (BuildContext context) => ContactUsDialog(),
88-
);
89-
}
90-
91-
store.dispatch(DismissReviewAppPermanently());
53+
AppReview.openStoreListing();
9254
}
55+
56+
store.dispatch(DismissReviewAppPermanently());
9357
},
9458
child: ConstrainedBox(
9559
constraints: const BoxConstraints(minWidth: 100),
9660
child: Padding(
9761
padding: const EdgeInsets.symmetric(vertical: 16),
9862
child: Text(
99-
_likesTheApp == null
100-
? localization.yesItsGreat
101-
: localization.sureHappyTo,
63+
localization.sureHappyTo,
10264
textAlign: TextAlign.center,
10365
),
10466
),
10567
),
10668
),
10769
TextButton(
10870
onPressed: () async {
109-
if (_likesTheApp == null) {
110-
setState(() {
111-
_likesTheApp = false;
112-
});
113-
} else {
114-
store.dispatch(DismissReviewAppPermanently());
115-
}
71+
store.dispatch(DismissReviewAppPermanently());
11672
},
11773
child: ConstrainedBox(
11874
constraints: const BoxConstraints(minWidth: 100),
11975
child: Padding(
12076
padding: const EdgeInsets.symmetric(vertical: 16),
12177
child: Text(
122-
_likesTheApp == null
123-
? localization.notSoMuch
124-
: localization.noNotNow,
78+
localization.noNotNow,
12579
textAlign: TextAlign.center,
12680
),
12781
),

lib/ui/app/upgrade_dialog.dart

+18-15
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,25 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
126126
final List<Widget> stack = <Widget>[];
127127
if (_queryProductError == null) {
128128
stack.add(
129-
Scrollbar(
130-
thumbVisibility: true,
131-
controller: _scrollController,
132-
child: ListView(
129+
Container(
130+
width: double.maxFinite,
131+
child: Scrollbar(
132+
thumbVisibility: true,
133133
controller: _scrollController,
134-
children: <Widget>[
135-
if (Platform.isIOS)
136-
Padding(
137-
padding: const EdgeInsets.only(bottom: 16),
138-
child: Text(
139-
'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.',
140-
style: TextStyle(fontSize: 12, color: Colors.grey),
134+
child: ListView(
135+
controller: _scrollController,
136+
children: <Widget>[
137+
if (Platform.isIOS)
138+
Padding(
139+
padding: const EdgeInsets.only(bottom: 16),
140+
child: Text(
141+
'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.',
142+
style: TextStyle(fontSize: 12, color: Colors.grey),
143+
),
141144
),
142-
),
143-
_buildProductList(),
144-
],
145+
_buildProductList(),
146+
],
147+
),
145148
),
146149
),
147150
);
@@ -292,7 +295,7 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
292295
final data = {
293296
'inapp_transaction_id': purchaseDetails.purchaseID,
294297
'key': state.account.key,
295-
'plan': purchaseDetails.productID,
298+
'plan': purchaseDetails.productID.replaceAll('-', '_'),
296299
'plan_paid': (int.parse(purchaseDetails.transactionDate) / 1000).floor(),
297300
};
298301

lib/utils/platforms.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bool supportsInAppPurchase() {
3737
return false;
3838
}
3939

40-
return isIOS();
40+
return isIOS() || isAndroid();
4141
}
4242

4343
bool isDesktopOS() => isMacOS() || isWindows() || isLinux();

0 commit comments

Comments
 (0)