Skip to content

Commit 9699b1f

Browse files
committed
Changes to conform Apple rules
1 parent 36479b8 commit 9699b1f

File tree

5 files changed

+98
-72
lines changed

5 files changed

+98
-72
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ CHANGELOG
1010
## Upcoming version ##
1111

1212

13-
## 2.1.0 (2024-04-20) ##
13+
## 2.1.0 (2024-05-03) ##
1414

15+
- 🧹 Add terms & privacy also to purchase screen to conform Apple review rules
16+
- 🧹 Replace subscriptions by one-time purchases to conform Apple review rules
1517
- 🐞 Fix hanging map when re-open from background (Android only)
1618
- 🌟 Show station IDs on details page
1719
- 🐞 Fix not-overlapping MapLibre symbols

app/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: tankste
22
description: Finde die günstigste Tankstelle in deiner Nähe!
33
publish_to: 'none'
44

5-
version: 2.1.0+29
5+
version: 2.1.0+32
66

77
environment:
88
sdk: ">=3.0.0 <4.0.0"

sponsor/lib/ui/offer/cubit/offer_cubit.dart

Lines changed: 60 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,78 +21,76 @@ class OfferCubit extends Cubit<OfferState> {
2121
void _fetchItems() {
2222
emit(LoadingOfferState());
2323

24-
CombineLatestStream.combine6(
24+
CombineLatestStream.combine7(
2525
_sponsorshipRepository.get(),
26-
_productRepository.get('app.tankste.sponsor.sub.yearly.12'),
27-
_productRepository.get('app.tankste.sponsor.sub.monthly.2'),
26+
_productRepository.get('app.tankste.sponsor.product.50'),
27+
_productRepository.get('app.tankste.sponsor.product.20'),
2828
_productRepository.get('app.tankste.sponsor.product.10'),
29+
_productRepository.get('app.tankste.sponsor.product.5'),
2930
_productRepository.get('app.tankste.sponsor.product.2'),
3031
_productRepository.get('app.tankste.sponsor.product.1'),
3132
(sponsorshipResult,
32-
yearlySubscriptionProductResult,
33-
monthlySubscriptionProductResult,
33+
onceFiftyProductResult,
34+
onceTwentyProductResult,
3435
onceTenProductResult,
36+
onceFiveProductResult,
3537
onceTwoProductResult,
3638
onceOneProductResult) {
3739
return sponsorshipResult.when((sponsorship) {
38-
return yearlySubscriptionProductResult.when(
39-
(yearlySubscriptionProduct) {
40-
return monthlySubscriptionProductResult.when(
41-
(monthlySubscriptionProduct) {
40+
return onceFiftyProductResult.when((onceFiftyProduct) {
41+
return onceTwentyProductResult.when((onceTwentyProduct) {
4242
return onceTenProductResult.when((onceTenProduct) {
43-
return onceTwoProductResult.when((onceTwoProduct) {
44-
return onceOneProductResult.when((onceOneProduct) {
45-
List<OfferItem> items = [];
46-
if (sponsorship.activeSubscriptionId == null) {
47-
items.add(OfferItem(
48-
id: yearlySubscriptionProduct.id,
49-
labelPrice: yearlySubscriptionProduct.priceLabel,
50-
labelType: tr('sponsor.overview.options.year.by'),
51-
hint: tr('sponsor.overview.options.year.hint', args: [yearlySubscriptionProduct.priceLabel])));
52-
53-
items.add(OfferItem(
54-
id: monthlySubscriptionProduct.id,
55-
labelPrice: monthlySubscriptionProduct.priceLabel,
56-
labelType: tr('sponsor.overview.options.month.by'),
57-
hint: tr('sponsor.overview.options.month.hint', args: [monthlySubscriptionProduct.priceLabel])));
58-
59-
items.add(OfferItem(
60-
id: onceTenProduct.id,
61-
labelPrice: onceTenProduct.priceLabel,
62-
labelType: tr('sponsor.overview.options.single.by'),
63-
hint: tr('sponsor.overview.options.single.hint', args: [onceTenProduct.priceLabel])));
64-
65-
items.add(OfferItem(
66-
id: onceTwoProduct.id,
67-
labelPrice: onceTwoProduct.priceLabel,
68-
labelType: tr('sponsor.overview.options.single.by'),
69-
hint: tr('sponsor.overview.options.single.hint', args: [onceTwoProduct.priceLabel])));
70-
71-
items.add(OfferItem(
72-
id: onceOneProduct.id,
73-
labelPrice: onceOneProduct.priceLabel,
74-
labelType: tr('sponsor.overview.options.single.by'),
75-
hint: tr('sponsor.overview.options.single.hint', args: [onceOneProduct.priceLabel])));
76-
}
77-
78-
return OffersOfferState(
79-
title: sponsorship.activeSubscriptionId != null
80-
? tr('sponsor.overview.options.title.extended')
81-
: tr('sponsor.overview.options.title.new'),
82-
isSponsorshipInfoVisible: sponsorship.value > 0,
83-
sponsoredValue: "${sponsorship.value.round()} €",
84-
activeSubscription:
85-
sponsorship.activeSubscriptionId != null
86-
? [
87-
yearlySubscriptionProduct,
88-
monthlySubscriptionProduct
89-
]
90-
.firstWhereOrNull((element) =>
91-
element.id ==
92-
sponsorship.activeSubscriptionId)
93-
?.title
94-
: null,
95-
items: items);
43+
return onceFiveProductResult.when((onceFiveProduct) {
44+
return onceTwoProductResult.when((onceTwoProduct) {
45+
return onceOneProductResult.when((onceOneProduct) {
46+
List<OfferItem> items = [
47+
OfferItem(
48+
id: onceFiftyProduct.id,
49+
labelPrice: onceFiftyProduct.priceLabel,
50+
labelType: tr('sponsor.overview.options.single.by'),
51+
hint: tr('sponsor.overview.options.single.hint',
52+
args: [onceFiftyProduct.priceLabel])),
53+
OfferItem(
54+
id: onceTwentyProduct.id,
55+
labelPrice: onceTwentyProduct.priceLabel,
56+
labelType: tr('sponsor.overview.options.single.by'),
57+
hint: tr('sponsor.overview.options.single.hint',
58+
args: [onceTwentyProduct.priceLabel])),
59+
OfferItem(
60+
id: onceTenProduct.id,
61+
labelPrice: onceTenProduct.priceLabel,
62+
labelType: tr('sponsor.overview.options.single.by'),
63+
hint: tr('sponsor.overview.options.single.hint',
64+
args: [onceTenProduct.priceLabel])),
65+
OfferItem(
66+
id: onceFiveProduct.id,
67+
labelPrice: onceFiveProduct.priceLabel,
68+
labelType: tr('sponsor.overview.options.single.by'),
69+
hint: tr('sponsor.overview.options.single.hint',
70+
args: [onceFiveProduct.priceLabel])),
71+
OfferItem(
72+
id: onceTwoProduct.id,
73+
labelPrice: onceTwoProduct.priceLabel,
74+
labelType: tr('sponsor.overview.options.single.by'),
75+
hint: tr('sponsor.overview.options.single.hint',
76+
args: [onceTwoProduct.priceLabel])),
77+
OfferItem(
78+
id: onceOneProduct.id,
79+
labelPrice: onceOneProduct.priceLabel,
80+
labelType: tr('sponsor.overview.options.single.by'),
81+
hint: tr('sponsor.overview.options.single.hint',
82+
args: [onceOneProduct.priceLabel])),
83+
];
84+
85+
return OffersOfferState(
86+
title: tr('sponsor.overview.options.title.new'),
87+
isSponsorshipInfoVisible: sponsorship.value > 0,
88+
sponsoredValue: "${sponsorship.value.round()} €",
89+
activeSubscription: null,
90+
items: items);
91+
},
92+
(error) =>
93+
ErrorOfferState(errorDetails: error.toString()));
9694
}, (error) => ErrorOfferState(errorDetails: error.toString()));
9795
}, (error) => ErrorOfferState(errorDetails: error.toString()));
9896
}, (error) => ErrorOfferState(errorDetails: error.toString()));

sponsor/lib/ui/offer/offer_container.dart

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
66
import 'package:lottie/lottie.dart';
77
import 'package:sponsor/ui/offer/cubit/offer_cubit.dart';
88
import 'package:sponsor/ui/offer/cubit/offer_state.dart';
9+
import 'package:url_launcher/url_launcher.dart';
910

1011
class OfferContainer extends StatelessWidget {
1112
const OfferContainer({super.key});
@@ -121,7 +122,8 @@ class OfferContainer extends StatelessWidget {
121122
crossAxisAlignment: CrossAxisAlignment.start,
122123
children: [
123124
Padding(
124-
padding: const EdgeInsets.only(top: 16, left: 16, right: 16),
125+
padding:
126+
const EdgeInsets.only(top: 16, left: 16, right: 16),
125127
child: Text(tr('sponsor.overview.info.new.title'),
126128
textAlign: TextAlign.start,
127129
style: Theme.of(context).textTheme.titleLarge),
@@ -185,16 +187,37 @@ class OfferContainer extends StatelessWidget {
185187
},
186188
child: Text(tr('sponsor.overview.restore')))))
187189
: Container(),
188-
//TODO: add later more options to sponsor
189-
// Center(
190-
// child: Padding(
191-
// padding: EdgeInsets.only(left: 8, right: 8),
192-
// child: TextButton(
193-
// onPressed: () {},
194-
// child: Text("Weitere Möglichkeiten anzeigen")))),
190+
Padding(padding: const EdgeInsets.only(top: 16), child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround,
191+
children: [
192+
Flexible(
193+
flex: 1,
194+
child: TextButton(
195+
onPressed: () {
196+
_openUrl("https://tankste.app/datenschutz");
197+
},
198+
child: Text(tr('settings.legal.privacy.title')))),
199+
Flexible(
200+
flex: 1,
201+
child: TextButton(
202+
onPressed: () {
203+
_openUrl("https://tankste.app/nutzungsbedingungen/");
204+
},
205+
child: Text(tr('settings.legal.terms.title')))),
206+
],
207+
))
195208
]);
196209
} else {
197210
return Container();
198211
}
199212
}
213+
214+
void _openUrl(String url) async {
215+
Uri uri = Uri.tryParse(url)!;
216+
if (await canLaunchUrl(uri)) {
217+
await launchUrl(uri, mode: LaunchMode.externalApplication);
218+
} else {
219+
//TODO: handle this case
220+
// throw 'Could not launch $url';
221+
}
222+
}
200223
}

sponsor/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ dependencies:
4444
# Easy Localization - https://pub.dev/packages/easy_localization
4545
easy_localization: ^3.0.5
4646

47+
# URL Launcher - https://pub.dev/packages/url_launcher
48+
url_launcher: ^6.2.5
49+
4750
dependency_overrides:
4851
# Force `package_info_plus` using newest `web` version (see: https://github.com/fluttercommunity/plus_plugins/issues/2653)
4952
web: ^0.5.0

0 commit comments

Comments
 (0)