rfplus things again
This commit is contained in:
parent
d1d5f0ee11
commit
8ac99d0163
@ -62,7 +62,8 @@ class PremiumAuth {
|
|||||||
);
|
);
|
||||||
|
|
||||||
launchUrl(
|
launchUrl(
|
||||||
Uri.parse("${FilcAPI.payment}/stripe-create-checkout?product=$product"),
|
Uri.parse(
|
||||||
|
"${FilcAPI.payment}/stripe-create-checkout?product=$product&rf_uinid=${_settings.xFilcId}"),
|
||||||
mode: LaunchMode.externalApplication,
|
mode: LaunchMode.externalApplication,
|
||||||
);
|
);
|
||||||
} catch (err, sta) {
|
} catch (err, sta) {
|
||||||
@ -145,6 +146,7 @@ class PremiumAuth {
|
|||||||
|
|
||||||
final res = await http.post(Uri.parse(FilcAPI.plusActivation), body: {
|
final res = await http.post(Uri.parse(FilcAPI.plusActivation), body: {
|
||||||
"session_id": _settings.plusSessionId,
|
"session_id": _settings.plusSessionId,
|
||||||
|
"rf_uinid": _settings.xFilcId,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (kDebugMode) print(res.body);
|
if (kDebugMode) print(res.body);
|
||||||
@ -162,6 +164,9 @@ class PremiumAuth {
|
|||||||
if (res.body == "no_subscription") {
|
if (res.body == "no_subscription") {
|
||||||
throw "This user isn't a subscriber!";
|
throw "This user isn't a subscriber!";
|
||||||
}
|
}
|
||||||
|
if (res.body == "unknown_device") {
|
||||||
|
throw "This device is not recognized, please contact support!";
|
||||||
|
}
|
||||||
|
|
||||||
final premium = PremiumResult.fromJson(jsonDecode(res.body) as Map);
|
final premium = PremiumResult.fromJson(jsonDecode(res.body) as Map);
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class PremiumScopes {
|
|||||||
static const unlimitedSelfNotes = "refilc.plus.UNLIMITED_SELF_NOTES";
|
static const unlimitedSelfNotes = "refilc.plus.UNLIMITED_SELF_NOTES";
|
||||||
static const customGradeRarities = "refilc.plus.CUSTOM_GRADE_RARITIES";
|
static const customGradeRarities = "refilc.plus.CUSTOM_GRADE_RARITIES";
|
||||||
// tier scope
|
// tier scope
|
||||||
static const tierCap = "refilc.plus.tier.CAP";
|
// static const tierCap = "refilc.plus.tier.CAP";
|
||||||
|
|
||||||
// tier 2 (Tinta) (reFilc+ Gold)
|
// tier 2 (Tinta) (reFilc+ Gold)
|
||||||
static const noAccountLimit = "refilc.plus.NO_ACCOUNT_LIMIT";
|
static const noAccountLimit = "refilc.plus.NO_ACCOUNT_LIMIT";
|
||||||
@ -26,7 +26,7 @@ class PremiumScopes {
|
|||||||
static const unlimitedGoalPlanner = "refilc.plus.UNLIMITED_GOAL_PLANNER";
|
static const unlimitedGoalPlanner = "refilc.plus.UNLIMITED_GOAL_PLANNER";
|
||||||
static const calendarSync = "refilc.plus.CALENDAR_SYNC";
|
static const calendarSync = "refilc.plus.CALENDAR_SYNC";
|
||||||
// tier scope
|
// tier scope
|
||||||
static const tierInk = "refilc.plus.tier.INK";
|
// static const tierInk = "refilc.plus.tier.INK";
|
||||||
|
|
||||||
// tier 3 (Szivacs)
|
// tier 3 (Szivacs)
|
||||||
// cancelled
|
// cancelled
|
||||||
@ -43,4 +43,8 @@ class PremiumScopes {
|
|||||||
static const renameSubjects = "refilc.plus.RENAME_SUBJECTS";
|
static const renameSubjects = "refilc.plus.RENAME_SUBJECTS";
|
||||||
static const timetableWidget = "refilc.plus.TIMETALBE_WIDGET";
|
static const timetableWidget = "refilc.plus.TIMETALBE_WIDGET";
|
||||||
static const fsTimetable = "refilc.plus.FS_TIMETABLE";
|
static const fsTimetable = "refilc.plus.FS_TIMETABLE";
|
||||||
|
|
||||||
|
// new new tier scopes
|
||||||
|
static const tierBasic = "refilc.plus.tier.BASIC";
|
||||||
|
static const tierGold = "refilc.plus.tier.GOLD";
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import 'package:animations/animations.dart';
|
import 'package:animations/animations.dart';
|
||||||
|
import 'package:refilc/theme/colors/colors.dart';
|
||||||
import 'package:refilc_plus/providers/plus_provider.dart';
|
import 'package:refilc_plus/providers/plus_provider.dart';
|
||||||
import 'package:refilc_plus/ui/mobile/plus/activation_view/activation_dashboard.dart';
|
import 'package:refilc_plus/ui/mobile/plus/activation_view/activation_dashboard.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lottie/lottie.dart';
|
import 'package:lottie/lottie.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:refilc_plus/ui/mobile/plus/plus_things.i18n.dart';
|
||||||
|
|
||||||
class PremiumActivationView extends StatefulWidget {
|
class PremiumActivationView extends StatefulWidget {
|
||||||
const PremiumActivationView({super.key, required this.product});
|
const PremiumActivationView({super.key, required this.product});
|
||||||
@ -42,8 +44,28 @@ class _PremiumActivationViewState extends State<PremiumActivationView>
|
|||||||
activated = true;
|
activated = true;
|
||||||
animation.forward();
|
animation.forward();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
Future.delayed(const Duration(seconds: 2)).then((value) {
|
Future.delayed(const Duration(seconds: 5)).then((value) {
|
||||||
if (mounted) Navigator.of(context).pop();
|
if (mounted) {
|
||||||
|
// pop the anim
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
// pop the plus view
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
// show alert to save code
|
||||||
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
"copy_code_asap".i18n,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.of(context).text,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: AppColors.of(context).background,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -63,8 +85,9 @@ class _PremiumActivationViewState extends State<PremiumActivationView>
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
child: Lottie.network(
|
child: Lottie.network(
|
||||||
"https://assets2.lottiefiles.com/packages/lf20_wkebwzpz.json",
|
"https://assets2.lottiefiles.com/packages/lf20_wkebwzpz.json",
|
||||||
controller: animation),
|
controller: animation,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const SafeArea(child: ActivationDashboard()),
|
: const SafeArea(child: ActivationDashboard()),
|
||||||
|
@ -37,6 +37,10 @@ extension Localization on String {
|
|||||||
"u_desc_12": "Sync your time-table with reFilc+ Gold!",
|
"u_desc_12": "Sync your time-table with reFilc+ Gold!",
|
||||||
// button
|
// button
|
||||||
"subscribe": "Subscribe",
|
"subscribe": "Subscribe",
|
||||||
|
"subscriber": "Subscribed",
|
||||||
|
// other
|
||||||
|
"copy_code_asap":
|
||||||
|
"Copy your reFilc+ ID, in case you loose your device!",
|
||||||
},
|
},
|
||||||
"hu_hu": {
|
"hu_hu": {
|
||||||
// upsell titles
|
// upsell titles
|
||||||
@ -71,6 +75,10 @@ extension Localization on String {
|
|||||||
"u_desc_12": "Szinkronizáld az órarended reFilc+ Gold-al!",
|
"u_desc_12": "Szinkronizáld az órarended reFilc+ Gold-al!",
|
||||||
// button
|
// button
|
||||||
"subscribe": "Előfizetés",
|
"subscribe": "Előfizetés",
|
||||||
|
"subscriber": "Előfizetve",
|
||||||
|
// other
|
||||||
|
"copy_code_asap":
|
||||||
|
"Másold ki a reFilc+ ID-t, mielőtt elveszítenéd a telefonod!",
|
||||||
},
|
},
|
||||||
"de_de": {
|
"de_de": {
|
||||||
// upsell titles
|
// upsell titles
|
||||||
@ -110,6 +118,10 @@ extension Localization on String {
|
|||||||
"u_desc_12": "Synchronisiere deinen Stundenplan mit reFilc+ Gold!",
|
"u_desc_12": "Synchronisiere deinen Stundenplan mit reFilc+ Gold!",
|
||||||
// button
|
// button
|
||||||
"subscribe": "Abonnieren",
|
"subscribe": "Abonnieren",
|
||||||
|
"subscriber": "im Abonnement",
|
||||||
|
// other
|
||||||
|
"copy_code_asap":
|
||||||
|
"Kopieren Sie Ihre reFilc+ ID, bevor Sie Ihr Handy verlieren!",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -1,25 +1,43 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:refilc_mobile_ui/plus/plus_screen.dart';
|
import 'package:refilc_mobile_ui/plus/plus_screen.dart';
|
||||||
|
import 'package:refilc_plus/models/premium_scopes.dart';
|
||||||
|
import 'package:refilc_plus/providers/plus_provider.dart';
|
||||||
|
import 'plus_things.i18n.dart';
|
||||||
|
import 'package:refilc_mobile_ui/screens/settings/settings_helper.dart';
|
||||||
|
|
||||||
class PlusSettingsInline extends StatelessWidget {
|
class PlusSettingsInline extends StatelessWidget {
|
||||||
const PlusSettingsInline({super.key});
|
const PlusSettingsInline({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final String plusTier = Provider.of<PlusProvider>(context)
|
||||||
|
.hasScope(PremiumScopes.tierGold)
|
||||||
|
? 'gold'
|
||||||
|
: (Provider.of<PlusProvider>(context).hasScope(PremiumScopes.tierBasic)
|
||||||
|
? 'basic'
|
||||||
|
: 'none');
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context, rootNavigator: true)
|
if (plusTier == 'none') {
|
||||||
.push(MaterialPageRoute(builder: (context) {
|
Navigator.of(context, rootNavigator: true)
|
||||||
return const PlusScreen();
|
.push(MaterialPageRoute(builder: (context) {
|
||||||
}));
|
return const PlusScreen();
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
SettingsHelper.plusOptions(context);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: const DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('assets/images/btn_plus_standard.png'),
|
image: plusTier == 'gold'
|
||||||
|
? const AssetImage('assets/images/btn_plus_gold.png')
|
||||||
|
: const AssetImage('assets/images/btn_plus_standard.png'),
|
||||||
fit: BoxFit.fitWidth,
|
fit: BoxFit.fitWidth,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
@ -35,26 +53,30 @@ class PlusSettingsInline extends StatelessWidget {
|
|||||||
width: 2.0,
|
width: 2.0,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'assets/images/plus_tier_cap.png',
|
plusTier == 'gold'
|
||||||
|
? 'assets/images/plus_tier_ink.png'
|
||||||
|
: 'assets/images/plus_tier_cap.png',
|
||||||
width: 23.0,
|
width: 23.0,
|
||||||
height: 23.0,
|
height: 23.0,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 14.0,
|
width: 14.0,
|
||||||
),
|
),
|
||||||
const Text(
|
Text(
|
||||||
'reFilc+',
|
'reFilc+',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFF150D4E),
|
color: plusTier == 'gold'
|
||||||
|
? const Color(0xFF341C01)
|
||||||
|
: const Color(0xFF150D4E),
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Text(
|
Text(
|
||||||
'0.99 €',
|
plusTier == 'none' ? '0.99 €' : 'subscriber'.i18n,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
color: Color(0xFF150D4E),
|
color: Color(0xFF150D4E),
|
||||||
fontSize: 15.0,
|
fontSize: 15.0,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
@ -2,7 +2,7 @@ import 'package:flutter_svg/svg.dart';
|
|||||||
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart';
|
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart';
|
||||||
import 'package:refilc_mobile_ui/plus/plus_screen.dart';
|
import 'package:refilc_mobile_ui/plus/plus_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'upsell.i18n.dart';
|
import 'plus_things.i18n.dart';
|
||||||
|
|
||||||
enum PremiumFeature {
|
enum PremiumFeature {
|
||||||
// old things
|
// old things
|
||||||
|
Loading…
x
Reference in New Issue
Block a user