Skip to content

Commit

Permalink
Simplified donation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Mar 2, 2022
1 parent 5e343ba commit 7f2cb60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/application/donations/donations_bloc.dart
Expand Up @@ -16,7 +16,7 @@ class DonationsBloc extends Bloc<DonationsEvent, DonationsState> {
static int maxUserIdLength = 20;

//The user id must be something like 12345_xyz
static String appUserIdRegex = '([0-9]{5,10}[_][A-Za-z])';
static String appUserIdRegex = '([a-zA-Z0-9]{5,20})';

DonationsBloc(this._purchaseService, this._networkService) : super(const DonationsState.loading());

Expand Down
11 changes: 4 additions & 7 deletions lib/l10n/intl_en.arb
Expand Up @@ -405,15 +405,12 @@
"donateXAmount": "Donate {amount}",
"purchase": "Purchase",
"restorePurchases": "Restore Purchases",
"uid": "UID",
"userId": "User ID",
"paymentSucceed": "Payment succeed. Thank you for your support.",
"paymentError": "Payment could not be completed.",
"donationMsgA": "Your UID will be used to make / restore your purchases.",
"purchaseMsgA": "Make sure to add a custom suffix to your UID (e.g: 12345678_suffix).",
"purchaseMsgB": "Make sure to remember the used suffix, you will need it later in case you need to restore your purchases.",
"purchaseMsgC": "The custom suffix is recommended for security reasons.",
"restorePurchaseMsgA": "Type the UID + custom suffix that you previously used.",
"restorePurchaseMsgB": "The restore process will only work if you previously made a purchase.",
"purchaseMsgA": "Please enter a custom user id, use letters and numbers. Do not use passwords, secret codes, pins, etc.",
"purchaseMsgB": "You may need it later in case you need to restore your purchases.",
"restorePurchaseMsgA": "Type the User ID that you previously used.",
"restorePurchaseSucceed": "Purchases were successfully restored",
"restorePurchaseError": "Purchases could not be restored"
}
15 changes: 4 additions & 11 deletions lib/presentation/donations/donations_bottom_sheet.dart
Expand Up @@ -74,13 +74,6 @@ class _BodyState extends State<_Body> {
onTap: () => setState(() => _selected = e),
),
),
BulletList(
iconSize: 16,
addTooltip: false,
items: [
s.donationMsgA,
],
),
CommonButtonBar(
children: <Widget>[
OutlinedButton(
Expand Down Expand Up @@ -112,13 +105,13 @@ class _BodyState extends State<_Body> {
context: context,
builder: (_) => TextDialog.create(
title: s.purchase,
hintText: s.uid,
hintText: s.userId,
maxLength: DonationsBloc.maxUserIdLength,
regexPattern: DonationsBloc.appUserIdRegex,
child: BulletList(
iconSize: 16,
addTooltip: false,
items: [s.purchaseMsgA, s.purchaseMsgB, s.purchaseMsgC],
items: [s.purchaseMsgA, s.purchaseMsgB],
),
onSave: (val) => context
.read<DonationsBloc>()
Expand All @@ -133,13 +126,13 @@ class _BodyState extends State<_Body> {
context: context,
builder: (_) => TextDialog.create(
title: s.restorePurchases,
hintText: s.uid,
hintText: s.userId,
maxLength: DonationsBloc.maxUserIdLength,
regexPattern: DonationsBloc.appUserIdRegex,
child: BulletList(
iconSize: 16,
addTooltip: false,
items: [s.restorePurchaseMsgA, s.restorePurchaseMsgB],
items: [s.restorePurchaseMsgA],
),
onSave: (val) => context.read<DonationsBloc>().add(DonationsEvent.restorePurchases(userId: val)),
),
Expand Down

0 comments on commit 7f2cb60

Please sign in to comment.