Update + Maintaince Pages, closes #10
This commit is contained in:
parent
b6078ee99e
commit
6088cb1b22
|
|
@ -5,6 +5,8 @@ import 'package:http/http.dart' as http;
|
||||||
import 'DebugHelper.dart';
|
import 'DebugHelper.dart';
|
||||||
|
|
||||||
class DataManager{
|
class DataManager{
|
||||||
|
static int ClientVersion = 1;
|
||||||
|
|
||||||
static const String API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/api/";
|
static const String API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/api/";
|
||||||
static Map<String,String> Settings = {};
|
static Map<String,String> Settings = {};
|
||||||
|
|
||||||
|
|
@ -29,6 +31,18 @@ class DataManager{
|
||||||
GamesEarnings = CryptoEarnings = {};
|
GamesEarnings = CryptoEarnings = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<int> GetVersion() async{
|
||||||
|
var response = (await http.post(Uri.parse('${API_ENDPOINT}get_version.php')));
|
||||||
|
int v = -1;
|
||||||
|
try{
|
||||||
|
v = int.parse(response.body.toString());
|
||||||
|
}catch(e){
|
||||||
|
v=-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
static Future<bool> Init() async{
|
static Future<bool> Init() async{
|
||||||
bool isSettingsDone = await GetSettings();
|
bool isSettingsDone = await GetSettings();
|
||||||
bool isGamesDone = await GetGames();
|
bool isGamesDone = await GetGames();
|
||||||
|
|
|
||||||
121
lib/disabled_mode.dart
Normal file
121
lib/disabled_mode.dart
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
import 'package:external_app_launcher/external_app_launcher.dart';
|
||||||
|
import 'package:fhub/src/CustomWidgets.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class UpdatePage extends StatefulWidget {
|
||||||
|
const UpdatePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<UpdatePage> createState() => _UpdatePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UpdatePageState extends State<UpdatePage> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
kickstartAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
|
void kickstartAnimations() async {
|
||||||
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
op1 = 0.5;
|
||||||
|
op2 = 0.5;
|
||||||
|
op3 = 0.5;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
body: CustomBody(
|
||||||
|
context: context, onAnimEnd: (){setState(() {});},
|
||||||
|
child: SafeArea(
|
||||||
|
child: Center(
|
||||||
|
child: GlassCard(child: Container(width: 300,height: 300, child: Padding(
|
||||||
|
padding: const EdgeInsets.all(38.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
GradientText(text: "New Update", gradient: LinearGradient(colors: [Colors.white.withOpacity(0.7), Colors.white.withOpacity(0.2),]),style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),),
|
||||||
|
Icon(Icons.upcoming_outlined,size: 70,),
|
||||||
|
GlassButton(onTap: () async{
|
||||||
|
await LaunchApp.openApp(
|
||||||
|
androidPackageName: 'com.Xperience.FaucetHub',
|
||||||
|
// openStore: false
|
||||||
|
);
|
||||||
|
}, child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.install_mobile,size: 20,),
|
||||||
|
SizedBox(width: 20,),
|
||||||
|
Text("Update"),
|
||||||
|
SizedBox(width: 15,)
|
||||||
|
],
|
||||||
|
), width: 200,height: 40,color: Colors.greenAccent)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MaintaincePage extends StatefulWidget {
|
||||||
|
const MaintaincePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MaintaincePage> createState() => _MaintaincePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MaintaincePage extends State<MaintaincePage> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
kickstartAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
|
void kickstartAnimations() async {
|
||||||
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
op1 = 0.5;
|
||||||
|
op2 = 0.5;
|
||||||
|
op3 = 0.5;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
body: CustomBody(
|
||||||
|
context: context, onAnimEnd: (){setState(() {});},
|
||||||
|
child: SafeArea(
|
||||||
|
child: Center(
|
||||||
|
child: GlassCard(child: Container(width: 300,height: 300, child: Padding(
|
||||||
|
padding: const EdgeInsets.all(38.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
GradientText(text: "Under Maintaince", gradient: LinearGradient(colors: [Colors.white.withOpacity(0.7), Colors.white.withOpacity(0.2),]),style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),),
|
||||||
|
Icon(Icons.construction,size: 60,),
|
||||||
|
Text("This app is currently under maintaince, Please check back shortly",textAlign: TextAlign.center,),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:fhub/backend/DataManager.dart';
|
import 'package:fhub/backend/DataManager.dart';
|
||||||
import 'package:fhub/backend/Dialogs.dart';
|
import 'package:fhub/backend/Dialogs.dart';
|
||||||
import 'package:fhub/backend/login_mgr.dart';
|
import 'package:fhub/backend/login_mgr.dart';
|
||||||
|
import 'package:fhub/disabled_mode.dart';
|
||||||
import 'package:fhub/home.dart';
|
import 'package:fhub/home.dart';
|
||||||
import 'package:fhub/src/CustomWidgets.dart';
|
import 'package:fhub/src/CustomWidgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -27,6 +28,16 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() async{
|
void init() async{
|
||||||
|
int serverVersion = await DataManager.GetVersion();
|
||||||
|
if(serverVersion > 0 && serverVersion != DataManager.ClientVersion){
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> UpdatePage()));
|
||||||
|
return;
|
||||||
|
|
||||||
|
}else if(serverVersion <= 0){
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> MaintaincePage()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(await DataManager.Init() == false){
|
if(await DataManager.Init() == false){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user