refilcplus things

This commit is contained in:
Kima 2024-03-03 20:14:41 +01:00
parent 673f02cdd0
commit 1ec226511c
9 changed files with 138 additions and 92 deletions

View File

@ -13,7 +13,6 @@ import 'package:flutter/services.dart';
import 'package:refilc_mobile_ui/screens/error_screen.dart'; import 'package:refilc_mobile_ui/screens/error_screen.dart';
import 'package:refilc_mobile_ui/screens/error_report_screen.dart'; import 'package:refilc_mobile_ui/screens/error_report_screen.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_stripe/flutter_stripe.dart' as stripe;
// import 'package:firebase_core/firebase_core.dart'; // import 'package:firebase_core/firebase_core.dart';
// import 'firebase_options.dart'; // import 'firebase_options.dart';
@ -33,10 +32,6 @@ void main() async {
BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask); BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask);
// initialize stripe key
stripe.Stripe.publishableKey =
'pk_test_51Oo7iUBS0FxsTGxKjGZSQqzDKWHY5ZFYM9XeI0qSdIh2w8jWy6GhHlYpT7GLTzgpl1xhE5YP4BXpA4gMZqPmgMId00cGFYFzbh';
// Run App // Run App
runApp(App( runApp(App(
database: startup.database, database: startup.database,

View File

@ -77,7 +77,6 @@ dependencies:
extension_google_sign_in_as_googleapis_auth: ^2.0.12 extension_google_sign_in_as_googleapis_auth: ^2.0.12
maps_launcher: ^2.2.0 maps_launcher: ^2.2.0
google_fonts: ^6.1.0 google_fonts: ^6.1.0
flutter_stripe: ^10.0.0
dev_dependencies: dev_dependencies:
flutter_lints: ^3.0.1 flutter_lints: ^3.0.1

View File

@ -1,8 +1,7 @@
import 'package:flutter_stripe/flutter_stripe.dart' as stripe; // import 'package:refilc/api/client.dart';
import 'package:refilc/api/client.dart'; // import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_plus/providers/premium_provider.dart'; import 'package:refilc_plus/providers/premium_provider.dart';
import 'package:refilc_plus/ui/mobile/premium/activation_view/activation_view.dart'; // import 'package:refilc_plus/ui/mobile/premium/activation_view/activation_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
@ -128,49 +127,49 @@ class GithubLoginButton extends StatelessWidget {
); );
} }
Future<bool> initPaymentSheet(BuildContext context) async { // Future<bool> initPaymentSheet(BuildContext context) async {
try { // try {
// 1. create payment intent on the server // // 1. create payment intent on the server
final data = await _createPaymentSheet(); // final data = await _createPaymentSheet();
if (data == null) { // if (data == null) {
throw "API error, can't create payment sheet!"; // throw "API error, can't create payment sheet!";
} // }
// 2. initialize the payment sheet // // 2. initialize the payment sheet
await stripe.Stripe.instance.initPaymentSheet( // await stripe.Stripe.instance.initPaymentSheet(
paymentSheetParameters: stripe.SetupPaymentSheetParameters( // paymentSheetParameters: stripe.SetupPaymentSheetParameters(
// Set to true for custom flow // // Set to true for custom flow
customFlow: false, // customFlow: false,
// Main params // // Main params
merchantDisplayName: 'reFilc', // merchantDisplayName: 'reFilc',
paymentIntentClientSecret: data['paymentIntent'], // paymentIntentClientSecret: data['paymentIntent'],
// Customer keys // // Customer keys
customerEphemeralKeySecret: data['ephemeralKey'], // customerEphemeralKeySecret: data['ephemeralKey'],
customerId: data['customer'], // customerId: data['customer'],
// Extra options // // Extra options
// applePay: const stripe.PaymentSheetApplePay( // // applePay: const stripe.PaymentSheetApplePay(
// merchantCountryCode: 'HU', // // merchantCountryCode: 'HU',
// ), // // ),
googlePay: const stripe.PaymentSheetGooglePay( // googlePay: const stripe.PaymentSheetGooglePay(
merchantCountryCode: 'HU', // merchantCountryCode: 'HU',
testEnv: true, // testEnv: true,
), // ),
style: ThemeMode.system, // style: ThemeMode.system,
), // ),
); // );
return true; // return true;
} catch (e) { // } catch (e) {
// ignore: use_build_context_synchronously // // ignore: use_build_context_synchronously
ScaffoldMessenger.of(context).showSnackBar( // ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $e')), // SnackBar(content: Text('Error: $e')),
); // );
rethrow; // rethrow;
} // }
} // }
Future<Map?> _createPaymentSheet() async { // Future<Map?> _createPaymentSheet() async {
Map? data = await FilcAPI.createPaymentSheet("refilcplus"); // Map? data = await FilcAPI.createPaymentSheet("refilcplus");
return data; // return data;
} // }
} }

View File

@ -1,6 +1,6 @@
import 'package:refilc/theme/colors/colors.dart'; import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_plus/providers/premium_provider.dart'; import 'package:refilc_plus/providers/premium_provider.dart';
import 'package:refilc_plus/ui/mobile/premium/activation_view/activation_view.dart'; // import 'package:refilc_plus/ui/mobile/premium/activation_view/activation_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';

View File

@ -173,8 +173,8 @@ class PlusPlanCard extends StatelessWidget {
), ),
TextSpan( TextSpan(
children: [ children: [
const TextSpan( TextSpan(
text: 'Minden ', text: 'every'.i18n,
), ),
e[1].startsWith('cap') e[1].startsWith('cap')
? const TextSpan( ? const TextSpan(
@ -186,9 +186,9 @@ class PlusPlanCard extends StatelessWidget {
FontWeight.w600, FontWeight.w600,
), ),
) )
: const TextSpan( : TextSpan(
children: [ children: [
TextSpan( const TextSpan(
text: 'reFilc+', text: 'reFilc+',
style: TextStyle( style: TextStyle(
color: Color( color: Color(
@ -198,9 +198,9 @@ class PlusPlanCard extends StatelessWidget {
), ),
), ),
TextSpan( TextSpan(
text: ' és ', text: 'and'.i18n,
), ),
TextSpan( const TextSpan(
text: 'reFilc+ Gold', text: 'reFilc+ Gold',
style: TextStyle( style: TextStyle(
color: Color( color: Color(
@ -211,7 +211,7 @@ class PlusPlanCard extends StatelessWidget {
), ),
], ],
), ),
const TextSpan(text: ' előny'), TextSpan(text: 'benefit'.i18n),
], ],
), ),
) )

View File

@ -35,11 +35,11 @@ class PlusScreen extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [ colors: [
const Color(0xffF4F9FF).withOpacity(0.1), const Color(0xffF4F9FF).withOpacity(0.30),
const Color(0xffF4F9FF).withOpacity(0.15), const Color(0xffF4F9FF).withOpacity(0.40),
const Color(0xffF4F9FF).withOpacity(0.25), const Color(0xffF4F9FF).withOpacity(0.50),
const Color(0xffF4F9FF).withOpacity(0.4), const Color(0xffF4F9FF).withOpacity(0.60),
const Color(0xffF4F9FF).withOpacity(0.5), const Color(0xffF4F9FF).withOpacity(0.70),
], ],
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
@ -53,8 +53,8 @@ class PlusScreen extends StatelessWidget {
gradient: LinearGradient( gradient: LinearGradient(
colors: [ colors: [
const Color(0xffF4F9FF).withOpacity(0.0), const Color(0xffF4F9FF).withOpacity(0.0),
const Color(0xffF4F9FF).withOpacity(0.4), const Color(0xffF4F9FF).withOpacity(0.7),
const Color(0xffF4F9FF).withOpacity(0.6), const Color(0xffF4F9FF).withOpacity(0.8),
const Color(0xffF4F9FF).withOpacity(0.9), const Color(0xffF4F9FF).withOpacity(0.9),
const Color(0xffF4F9FF), const Color(0xffF4F9FF),
], ],
@ -174,19 +174,13 @@ class PlusScreen extends StatelessWidget {
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
top: Radius.circular(16.0), top: Radius.circular(16.0),
bottom: Radius.circular(8.0)), bottom: Radius.circular(8.0)),
features: const [ features: [
['', 'Előzetes hozzáférés új verziókhoz'], ['', 'rfp_1'.i18n],
['👥', '2 fiók használata egyszerre'], ['👥', 'rfp_2'.i18n],
['👋', 'Egyedi üdvözlő üzenet'], ['👋', 'rfp_3'.i18n],
[ ['📓', 'rfp_4'.i18n],
'📓', ['1', 'rfp_5'.i18n],
'Korlátlan saját jegyzet és feladat a füzet oldalon' ['🎓', 'rfp_6'.i18n],
],
['1', 'Egyedi jegy ritkaságok'],
[
'',
'Összesített átlagszámoló',
],
], ],
), ),
const SizedBox( const SizedBox(
@ -205,16 +199,16 @@ class PlusScreen extends StatelessWidget {
borderRadius: const BorderRadius.vertical( borderRadius: const BorderRadius.vertical(
top: Radius.circular(8.0), top: Radius.circular(8.0),
bottom: Radius.circular(16.0)), bottom: Radius.circular(16.0)),
features: const [ features: [
['🕑', 'Órarend jegyzetek'], ['🕑', 'rfp_7'.i18n],
['🔤', 'Egyedi betütípusok'], ['🔤', 'rfp_8'.i18n],
['👥', 'Korlátlan fiók használata egyszerre'], ['👥', 'rfp_9'.i18n],
['🎓', 'Összesített átlagszámoló'], // ['🎓', 'Összesített átlagszámoló'],
['🟦', 'Live Activity szín'], ['📱', 'rfp_10'.i18n],
['📱', 'Alkalmazás ikonjának megváltoztatása'], ['🟦', 'rfp_11'.i18n],
['📒', 'Fejlettebb cél kitűzés'], ['📒', 'rfp_12'.i18n],
['📅', 'Naptár szinkronizálás'], ['📅', 'rfp_13'.i18n],
['🖋️', 'cap_tier_benefits'], const ['🖋️', 'cap_tier_benefits'],
], ],
), ),
// const SizedBox( // const SizedBox(

View File

@ -28,6 +28,26 @@ extension SettingsLocalization on String {
"eur": "eur":
"Prices are displayed in euros, which means it's dependant on the exchange rate. 1 EUR ≈ 390 HUF", "Prices are displayed in euros, which means it's dependant on the exchange rate. 1 EUR ≈ 390 HUF",
"active": "Active", "active": "Active",
// benefits
"rfp_1": "Early access to updates",
"rfp_2": "Use two accounts simaltaneously",
"rfp_3": "Custom welcome message",
"rfp_4": "Unlimited custom notes and tasks on the Notebook page",
"rfp_5": "Custom grade rarities",
"rfp_6": "Overall average calculator",
"rfp_7": "Timetable notes",
"rfp_8": "Custom font types",
"rfp_9": "Unlimited accounts",
"rfp_10": "Custom app icon",
"rfp_11": "Change Live Activity color",
"rfp_12": "Better goal planner",
"rfp_13": "Import your timetable into your calendar app",
"rfp_14": "",
"rfp_15": "",
// other
"and": " and ",
"every": "Every ",
"benefit": " benefit",
}, },
"hu_hu": { "hu_hu": {
"even_more_cheaper": "Még több reFilc, olcsóbban,\nmint bármi más!", "even_more_cheaper": "Még több reFilc, olcsóbban,\nmint bármi más!",
@ -54,6 +74,26 @@ extension SettingsLocalization on String {
"eur": "eur":
"Az árak euróban vannak feltüntetve, így az árfolyam befolyásolja, hogy mennyit kell fizetned a szolgáltatásért. 1 EUR ≈ 390 Ft", "Az árak euróban vannak feltüntetve, így az árfolyam befolyásolja, hogy mennyit kell fizetned a szolgáltatásért. 1 EUR ≈ 390 Ft",
"active": "Aktív", "active": "Aktív",
// benefits
"rfp_1": "Előzetes hozzáférés új verziókhoz",
"rfp_2": "2 fiók használata egyszerre",
"rfp_3": "Egyedi üdvözlő üzenet",
"rfp_4": "Korlátlan saját jegyzet és feladat a füzet oldalon",
"rfp_5": "Egyedi jegy ritkaságok",
"rfp_6": "Összesített átlagszámoló",
"rfp_7": "Órarend jegyzetek",
"rfp_8": "Egyedi betütípusok",
"rfp_9": "Korlátlan fiók használata egyszerre",
"rfp_10": "Alkalmazás ikonjának megváltoztatása",
"rfp_11": "Live Activity szín",
"rfp_12": "Fejlettebb cél kitűzés",
"rfp_13": "Naptár szinkronizálás",
"rfp_14": "",
"rfp_15": "",
// other
"and": " és ",
"every": "Minden ",
"benefit": " előny",
}, },
"de_de": { "de_de": {
"even_more_cheaper": "Mehr reFilc, günstiger\nals alles andere!", "even_more_cheaper": "Mehr reFilc, günstiger\nals alles andere!",
@ -81,6 +121,26 @@ extension SettingsLocalization on String {
"eur": "eur":
"Der Preis wird in Euro angegeben im Bezug zum aktuellen Wechselkurs. 1 EUR ≈ 390 HUF", "Der Preis wird in Euro angegeben im Bezug zum aktuellen Wechselkurs. 1 EUR ≈ 390 HUF",
"active": "Aktiv", "active": "Aktiv",
// benefits
"rfp_1": "Előzetes hozzáférés új verziókhoz",
"rfp_2": "2 fiók használata egyszerre",
"rfp_3": "Egyedi üdvözlő üzenet",
"rfp_4": "Korlátlan saját jegyzet és feladat a füzet oldalon",
"rfp_5": "Egyedi jegy ritkaságok",
"rfp_6": "Összesített átlagszámoló",
"rfp_7": "Órarend jegyzetek",
"rfp_8": "Egyedi betütípusok",
"rfp_9": "Korlátlan fiók használata egyszerre",
"rfp_10": "Alkalmazás ikonjának megváltoztatása",
"rfp_11": "Live Activity szín",
"rfp_12": "Fejlettebb cél kitűzés",
"rfp_13": "Naptár szinkronizálás",
"rfp_14": "",
"rfp_15": "",
// other
"and": " és ",
"every": "Minden ",
"benefit": " előny",
}, },
}; };

View File

@ -64,7 +64,6 @@ dependencies:
uuid: ^4.3.3 uuid: ^4.3.3
maps_launcher: ^2.2.0 maps_launcher: ^2.2.0
google_fonts: ^6.1.0 google_fonts: ^6.1.0
flutter_stripe: ^10.0.0
flutter_any_logo: ^1.1.1 flutter_any_logo: ^1.1.1
custom_sliding_segmented_control: ^1.8.1 custom_sliding_segmented_control: ^1.8.1

@ -1 +1 @@
Subproject commit a356f5db6403b3ba696009777b7ce65983c926e9 Subproject commit d3c1941c59fcd5c11aa2befefb2cb714c61b6309