Merge pull request #515 from ente-io/payment_detail
Fix handling of crypto subscription on UI
This commit is contained in:
commit
52d9dc647e
|
@ -222,6 +222,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
final String paymentProvider =
|
||||
_currentSubscription.paymentProvider;
|
||||
switch (_currentSubscription.paymentProvider) {
|
||||
case kStripe:
|
||||
await _launchStripePortal();
|
||||
|
@ -237,9 +239,14 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|||
launchUrlString("https://apps.apple.com/account/billing");
|
||||
break;
|
||||
default:
|
||||
_logger.severe(
|
||||
"unexpected payment provider ",
|
||||
_currentSubscription,
|
||||
final String capitalizedWord = paymentProvider.isNotEmpty
|
||||
? '${paymentProvider[0].toUpperCase()}${paymentProvider.substring(1).toLowerCase()}'
|
||||
: '';
|
||||
showErrorDialog(
|
||||
context,
|
||||
"Sorry",
|
||||
"Please contact us at support@ente.io to manage your "
|
||||
"$capitalizedWord subscription.",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -249,16 +256,12 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|||
children: [
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: !_isStripeSubscriber
|
||||
? "visit ${_currentSubscription.paymentProvider} to manage your subscription"
|
||||
: "Payment details",
|
||||
text: "Payment details",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontFamily: 'Inter-Medium',
|
||||
fontSize: 14,
|
||||
decoration: _isStripeSubscriber
|
||||
? TextDecoration.underline
|
||||
: TextDecoration.none,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
|
@ -442,7 +445,8 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|||
showErrorDialog(
|
||||
context,
|
||||
"Sorry",
|
||||
"please cancel your existing subscription from ${_currentSubscription.paymentProvider} first",
|
||||
"Please cancel your existing subscription from "
|
||||
"${_currentSubscription.paymentProvider} first",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -450,7 +454,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|||
showErrorDialog(
|
||||
context,
|
||||
"Sorry",
|
||||
"you cannot downgrade to this plan",
|
||||
"You cannot downgrade to this plan",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -224,17 +224,32 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
|
|||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (_isActiveStripeSubscriber) {
|
||||
return;
|
||||
}
|
||||
if (Platform.isAndroid) {
|
||||
final String paymentProvider =
|
||||
_currentSubscription.paymentProvider;
|
||||
if (paymentProvider == kAppStore && !Platform.isAndroid) {
|
||||
launchUrlString("https://apps.apple.com/account/billing");
|
||||
} else if (paymentProvider == kPlayStore && Platform.isAndroid) {
|
||||
launchUrlString(
|
||||
"https://play.google.com/store/account/subscriptions?sku=" +
|
||||
_currentSubscription.productID +
|
||||
"&package=io.ente.photos",
|
||||
);
|
||||
} else if (paymentProvider == kStripe) {
|
||||
showErrorDialog(
|
||||
context,
|
||||
"Sorry",
|
||||
"Visit web.ente.io to manage your subscription",
|
||||
);
|
||||
} else {
|
||||
launchUrlString("https://apps.apple.com/account/billing");
|
||||
final String capitalizedWord = paymentProvider.isNotEmpty
|
||||
? '${paymentProvider[0].toUpperCase()}${paymentProvider.substring(1).toLowerCase()}'
|
||||
: '';
|
||||
showErrorDialog(
|
||||
context,
|
||||
"Sorry",
|
||||
"Please contact us at support@ente.io to manage your "
|
||||
"$capitalizedWord subscription.",
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
|
Loading…
Reference in a new issue