diff --git a/assets/translations/de.json b/assets/translations/de.json index efaf926..d2d7997 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -244,13 +244,13 @@ "list_item_1": "Plane deine Workouts", "list_item_2": "Verfolge deinen Fortschritt", "list_item_3": "Bleibe motiviert", - "discount_description": "Wenn du die App noch während der Testzeit kaufst, bekommst du einen €{} Rabatt!", - "purchase_button_discount": "In der Testphase kaufen (€{})", - "purchase_button_normal": "Nach der Testphase kaufen (€{})", + "discount_description": "Wenn du die App noch während der Testzeit kaufst, bekommst du einen Rabatt!", + "purchase_button_discount": "In der Testphase kaufen ({})", + "purchase_button_normal": "Nach der Testphase kaufen ({})", "help_text": "Wenn du noch Fragen bezüglich des Kaufprozesses hast, schreib mir gerne eine E-Mail: neverskipfitness@icloud.com", "purchase_pending_text": "Zahlung erfolgt...\nBitte lass die App offen, bis die Zahlung bestätigt ist.", "day_free_trial_text": "{} Tage Testversion", - "trial_description": "Du kannst die App {} Tage lang gratis verwenden. Damit hast du genügend Zeit um alle Features zu testen.\n\nWenn du die App noch während der Testzeit kaufst, bekommst du einen €2 Rabatt!", + "trial_description": "Du kannst die App {} Tage lang gratis verwenden. Damit hast du genügend Zeit um alle Features zu testen.\n\nWenn du die App noch während der Testzeit kaufst, bekommst du einen kleinen Rabatt!", "start_trial_button": "Starte die Testphase", "trial_over_dialog": { "buy": "Kaufen", diff --git a/assets/translations/en.json b/assets/translations/en.json index bcc9c3c..7ea2567 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -244,13 +244,13 @@ "list_item_1": "Plan your workouts", "list_item_2": "See your progress", "list_item_3": "Stay motivated", - "discount_description": "If you purchase within the trial period you get a €{} discount!", - "purchase_button_discount": "Purchase during trial for €{}", - "purchase_button_normal": "Purchase after trial for €{}", + "discount_description": "If you purchase within the trial period you get a discount!", + "purchase_button_discount": "Purchase during trial for {}", + "purchase_button_normal": "Purchase after trial for {}", "help_text": "If you have any questions regarding the purchase process feel free to contact me at neverskipfitness@icloud.com.", "purchase_pending_text": "Purchase is pending, please keep the app open until the purchase is completed.", "day_free_trial_text": "{} day free trial", - "trial_description": "You get a generous {} day free trial, so you have enough time to test and use all features.\n\nIf you purchase the app within the trial period you get a €2 discount!", + "trial_description": "You get a generous {} day free trial, so you have enough time to test and use all features.\n\nIf you purchase the app within the trial period you get a small discount!", "start_trial_button": "Start your free trial", "trial_over_dialog": { "buy": "Buy", diff --git a/lib/backend/purchases/purchase_manager.dart b/lib/backend/purchases/purchase_manager.dart index d2e3bcd..29c00d8 100644 --- a/lib/backend/purchases/purchase_manager.dart +++ b/lib/backend/purchases/purchase_manager.dart @@ -23,6 +23,9 @@ class PurchaseManager { ProductDetails? purchaseAppProduct; ProductDetails? purchaseAppDiscountedProduct; + String normalPrice = ''; + String discountPrince = ''; + bool isAvailable = false; PurchaseManager(this._userManager) { @@ -45,10 +48,12 @@ class PurchaseManager { for (var product in products) { if (product.id == PURCHASE_APP_KEY) { purchaseAppProduct = product; + normalPrice = product.price; continue; } if (product.id == PURCHASE_APP_DISCOUNTED_KEY) { purchaseAppDiscountedProduct = product; + discountPrince = product.price; continue; } } diff --git a/lib/screens/purchase_screen.dart b/lib/screens/purchase_screen.dart index 1d408d4..a022c81 100644 --- a/lib/screens/purchase_screen.dart +++ b/lib/screens/purchase_screen.dart @@ -11,10 +11,6 @@ import 'package:frederic/widgets/standard_elements/frederic_scaffold.dart'; class PurchaseScreen extends StatelessWidget { const PurchaseScreen({Key? key}) : super(key: key); - final String normalPrice = "13,99"; - final String discountPrice = '11,99'; - final String discount = "2"; - @override Widget build(BuildContext context) { return FredericScaffold( @@ -86,7 +82,7 @@ class PurchaseScreen extends StatelessWidget { const SizedBox(height: 30), const SizedBox(height: 30), Text( - tr('trial.discount_description', args: [discount]), + tr('trial.discount_description'), textAlign: TextAlign.center, style: TextStyle( fontSize: 12, @@ -96,8 +92,10 @@ class PurchaseScreen extends StatelessWidget { ), const SizedBox(height: 18), FredericButton( - tr('trial.purchase_button_discount', - args: [discountPrice]), + tr('trial.purchase_button_discount', args: [ + FredericBackend + .instance.purchaseManager.discountPrince + ]), loading: user.hasActiveTrial && (user.tempPurchaseIsPending ?? false), mainColor: user.hasActiveTrial @@ -109,8 +107,9 @@ class PurchaseScreen extends StatelessWidget { }), const SizedBox(height: 18), FredericButton( - tr('trial.purchase_button_normal', - args: [normalPrice]), + tr('trial.purchase_button_normal', args: [ + FredericBackend.instance.purchaseManager.normalPrice + ]), loading: (!user.hasActiveTrial) && (user.tempPurchaseIsPending ?? false), mainColor: user.hasActiveTrial