Compare commits
10 Commits
4321fbafaa
...
9786bcdfce
| Author | SHA1 | Date | |
|---|---|---|---|
| 9786bcdfce | |||
| f2f8bddedf | |||
| 3d6d051bf4 | |||
| 73d7155109 | |||
| 68d313de01 | |||
| 0ada78e781 | |||
| 9c70330803 | |||
| 6088cb1b22 | |||
| b6078ee99e | |||
| bc3ea4aa34 |
|
|
@ -54,7 +54,7 @@ android {
|
|||
applicationId "com.Xperience.FaucetHub"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
minSdkVersion 19
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 30 KiB |
|
|
@ -5,7 +5,9 @@ import 'package:http/http.dart' as http;
|
|||
import 'DebugHelper.dart';
|
||||
|
||||
class DataManager{
|
||||
static const String API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/api/";
|
||||
static int ClientVersion = 2;
|
||||
|
||||
static const String API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/api/v2/";
|
||||
static Map<String,String> Settings = {};
|
||||
|
||||
static List<dynamic> AllGames = [];
|
||||
|
|
@ -29,6 +31,18 @@ class DataManager{
|
|||
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{
|
||||
bool isSettingsDone = await GetSettings();
|
||||
bool isGamesDone = await GetGames();
|
||||
|
|
@ -90,14 +104,14 @@ class DataManager{
|
|||
Debug.Log("err044 : $UserJson");
|
||||
LinkedGamesJson = [];
|
||||
NonLinkedGamesJson = [];
|
||||
if (UserJson['linkedGames']
|
||||
if (UserJson['linked_games']
|
||||
.toString()
|
||||
.length < 3) {
|
||||
NonLinkedGamesJson = AllGames;
|
||||
return;
|
||||
}
|
||||
List<Map<String, dynamic>> linkedGames = jsonDecode(
|
||||
UserJson['linkedGames']).cast<Map<String, dynamic>>();
|
||||
UserJson['linked_games']).cast<Map<String, dynamic>>();
|
||||
|
||||
AllGames.forEach((element) {
|
||||
bool foundLink = false;
|
||||
|
|
@ -311,6 +325,31 @@ class DataManager{
|
|||
}
|
||||
}
|
||||
|
||||
static Future<int> Review() async{
|
||||
var loginResponse = null;
|
||||
try {
|
||||
loginResponse = (await http.post(
|
||||
Uri.parse('${DataManager.API_ENDPOINT}review.php'),
|
||||
body: <String, String>{
|
||||
"username": username,
|
||||
"password": password
|
||||
}));
|
||||
Debug.LogResponse(loginResponse.body.toString(),src: "review.php");
|
||||
|
||||
try{
|
||||
DataManager.UserJson = jsonDecode(loginResponse.body.toString());
|
||||
await DataManager.GetGamesProgress();
|
||||
return 0;
|
||||
}catch(e){
|
||||
return 5;
|
||||
}
|
||||
} catch (e) {
|
||||
Debug.LogError("Error while review $e");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static Future<List<dynamic>> GetWithdrawalHistory() async{
|
||||
Map<String,String> body = <String, String>{
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class Debug{
|
|||
if(!enableLogging){return;}
|
||||
if(!enableErrorLoggin) {return;}
|
||||
print('\x1B[31m$msg\x1B[0m');
|
||||
print(StackTrace.current);
|
||||
}
|
||||
|
||||
static void Log(Object? msg){
|
||||
|
|
|
|||
|
|
@ -120,6 +120,8 @@ class LoginManager {
|
|||
prefs.setString("username", username);
|
||||
prefs.setString("password", username);
|
||||
prefs.setBool("googleLogin", true);
|
||||
DataManager.username = username;
|
||||
DataManager.password = username;
|
||||
return 0;
|
||||
}catch(e){
|
||||
return 5;
|
||||
|
|
|
|||
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,3 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:external_app_launcher/external_app_launcher.dart';
|
||||
import 'package:fhub/backend/DataManager.dart';
|
||||
import 'package:fhub/backend/Dialogs.dart';
|
||||
|
|
@ -93,7 +94,10 @@ class _GameInfoPageState extends State<GameInfoPage> with WidgetsBindingObserver
|
|||
width: 120,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Image.network(widget.gameJson['icon']))),
|
||||
child: CachedNetworkImage(imageUrl: widget.gameJson['icon'],)
|
||||
|
||||
// child: Image.network(widget.gameJson['icon'])
|
||||
)),
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
|
|
|
|||
591
lib/home.dart
|
|
@ -1,8 +1,12 @@
|
|||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:external_app_launcher/external_app_launcher.dart';
|
||||
import 'package:fhub/backend/DataManager.dart';
|
||||
import 'package:fhub/backend/DebugHelper.dart';
|
||||
import 'package:fhub/backend/Dialogs.dart';
|
||||
import 'package:fhub/gameInfo.dart';
|
||||
import 'package:fhub/off_screen.dart';
|
||||
import 'package:fhub/src/CustomWidgets.dart';
|
||||
import 'package:fhub/wd_history.dart';
|
||||
import 'package:fhub/wd_portal.dart';
|
||||
|
|
@ -10,6 +14,7 @@ import 'package:fhub/welcome.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'backend/helpers.dart';
|
||||
|
|
@ -31,6 +36,24 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
TxtCoinbaseAddress.text = DataManager.UserJson['wd_address'] ?? "";
|
||||
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
||||
subscription = Connectivity()
|
||||
.onConnectivityChanged
|
||||
.listen((ConnectivityResult result) async {
|
||||
// Got a new connectivity status!
|
||||
try {
|
||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
Debug.Log(connectivityResult);
|
||||
if (connectivityResult != ConnectivityResult.mobile &&
|
||||
connectivityResult != ConnectivityResult.mobile &&
|
||||
connectivityResult != ConnectivityResult.ethernet) {
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(builder: (_) => OfflinePage(id: 0)));
|
||||
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -39,6 +62,7 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
super.dispose();
|
||||
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
subscription.cancel();
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -47,20 +71,17 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
super.didChangeAppLifecycleState(state);
|
||||
// Debug.Log(state);
|
||||
|
||||
if(state == AppLifecycleState.resumed){
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void Refresh()async{
|
||||
void Refresh() async {
|
||||
await DataManager.GrabOnce();
|
||||
|
||||
setState(() {
|
||||
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
|
||||
void kickstartAnimations() async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
|
|
@ -73,6 +94,8 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
|
||||
int selectedPageId = 0;
|
||||
String TitleText = "Home";
|
||||
var subscription;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
|
|
@ -90,12 +113,12 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
},
|
||||
bottomNav: [
|
||||
BottomNavBarItem(
|
||||
icon: Icons.home,
|
||||
active: selectedPageId == 0,
|
||||
icon: Icons.people,
|
||||
active: selectedPageId == 4,
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
TitleText = "Home";
|
||||
selectedPageId = 0;
|
||||
TitleText = "Share";
|
||||
selectedPageId = 4;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
|
@ -108,6 +131,16 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
selectedPageId = 3;
|
||||
});
|
||||
}),
|
||||
BottomNavBarItem(
|
||||
icon: Icons.home,
|
||||
active: selectedPageId == 0,
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
TitleText = "Home";
|
||||
selectedPageId = 0;
|
||||
});
|
||||
},
|
||||
),
|
||||
BottomNavBarItem(
|
||||
icon: Icons.wallet,
|
||||
active: selectedPageId == 1,
|
||||
|
|
@ -170,6 +203,8 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
return games();
|
||||
case 2:
|
||||
return settings();
|
||||
case 4:
|
||||
return share();
|
||||
default:
|
||||
return home();
|
||||
}
|
||||
|
|
@ -186,6 +221,7 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
InkWell(
|
||||
onTap: () {
|
||||
selectedPageId = 1;
|
||||
TitleText = "Wallet";
|
||||
setState(() {});
|
||||
},
|
||||
child: TotalEarningsCard()),
|
||||
|
|
@ -239,7 +275,7 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
),
|
||||
SizedBox(height: 20),
|
||||
GlassButton(
|
||||
color: Colors.lightBlueAccent,
|
||||
color: Colors.lightBlueAccent,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedPageId = 3;
|
||||
|
|
@ -288,7 +324,9 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Text(
|
||||
"Install a game from the list below and Link it to FaucetHub(FH) to Start Earning!",style: TextStyle(color: Colors.blue.withGreen(150).withRed(100)),
|
||||
"Install a game from the list below and Link it to FaucetHub(FH) to Start Earning!",
|
||||
style:
|
||||
TextStyle(color: Colors.blue.withGreen(150).withRed(100)),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
)),
|
||||
|
|
@ -315,10 +353,13 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
Widget GameCard({required int index, required List<dynamic> list}) {
|
||||
return GlassCard(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
onTap: () async {
|
||||
await Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (BuildContext context) =>
|
||||
GameInfoPage(gameJson: list[index])));
|
||||
|
||||
await DataManager.GrabOnce();
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
|
|
@ -336,7 +377,11 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
width: 50,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Image.network(list[index]['icon']))),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: list[index]['icon'],
|
||||
)
|
||||
// child: Image.network(list[index]['icon'])
|
||||
)),
|
||||
Icon(Helpers.GetIconForCrypto(list[index]['coin']))
|
||||
],
|
||||
),
|
||||
|
|
@ -385,138 +430,290 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
),
|
||||
Text('~ \$${DataManager.currentEarnings.toStringAsFixed(2)} ',
|
||||
style: TextStyle(fontSize: 50)),
|
||||
|
||||
SizedBox(height: 20,),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
GlassButton(onTap: (){
|
||||
if(DataManager.currentEarnings <= 1){
|
||||
Dialogs.showAlertDialog(context, "Not Enough To Withdraw", "You need atleast \$1 to initiate a withdraw.");
|
||||
return;
|
||||
}
|
||||
GlassButton(
|
||||
onTap: () {
|
||||
if (DataManager.currentEarnings <= 1) {
|
||||
Dialogs.showAlertDialog(
|
||||
context,
|
||||
"Not Enough To Withdraw",
|
||||
"You need atleast \$1 to initiate a withdraw.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!DataManager.UserJson['wd_address'].toString().contains("@")){
|
||||
Dialogs.showAlertDialog(context, "Invalid Withdrawal Address", "Please enter a valid email address for coinbase address. Your earnings will be sent to that address via coinbase");
|
||||
return;
|
||||
}
|
||||
if (!DataManager.UserJson['wd_address']
|
||||
.toString()
|
||||
.contains("@")) {
|
||||
Dialogs.showAlertDialog(
|
||||
context,
|
||||
"Invalid Withdrawal Address",
|
||||
"Please enter a valid email address for coinbase address. Your earnings will be sent to that address via coinbase");
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.of(context).push(wdRoute);
|
||||
}, child: Text("Withdraw"),height: 40, width: 200, color: Colors.greenAccent),
|
||||
GlassButton(onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (BuildContext context) =>
|
||||
WithdrawalHistoryPage()));
|
||||
}, child: Icon(Icons.history), width: 60, height: 40)
|
||||
Navigator.of(context).push(wdRoute);
|
||||
},
|
||||
child: Text("Withdraw"),
|
||||
height: 40,
|
||||
width: 200,
|
||||
color: Colors.greenAccent),
|
||||
GlassButton(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (BuildContext context) =>
|
||||
WithdrawalHistoryPage()));
|
||||
},
|
||||
child: Icon(Icons.history),
|
||||
width: 60,
|
||||
height: 40)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
(DataManager.currentEarnings <=0) ? Container() : Column(children: [
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Sort earnings by "),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
GlassCard(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8.0, horizontal: 15),
|
||||
child: Row(
|
||||
(DataManager.currentEarnings <= 0)
|
||||
? Container()
|
||||
: Column(children: [
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
sortByGames = true;
|
||||
});
|
||||
},
|
||||
child: GlassCard(
|
||||
highlighted: sortByGames,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 20),
|
||||
child: Text("Game"),
|
||||
))),
|
||||
Text("Sort earnings by "),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
width: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
sortByGames = false;
|
||||
});
|
||||
},
|
||||
child: GlassCard(
|
||||
highlighted: !sortByGames,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 20),
|
||||
child: Text("Crypto"),
|
||||
))),
|
||||
GlassCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0, horizontal: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
sortByGames = true;
|
||||
});
|
||||
},
|
||||
child: GlassCard(
|
||||
highlighted: sortByGames,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 20),
|
||||
child: Text("Game"),
|
||||
))),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
sortByGames = false;
|
||||
});
|
||||
},
|
||||
child: GlassCard(
|
||||
highlighted: !sortByGames,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 20),
|
||||
child: Text("Crypto"),
|
||||
))),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
GlassCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
sortByGames
|
||||
? ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: scrollController,
|
||||
itemCount: DataManager.GamesEarnings.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
String gameName =
|
||||
DataManager.GamesEarnings.keys.elementAt(index);
|
||||
dynamic GameJson = Helpers.GetGameFromCode(gameName);
|
||||
if (GameJson == null) {
|
||||
Debug.LogError(
|
||||
("Error getting game json from ${gameName}. returned:\n$GameJson"));
|
||||
return GlassCard(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
"Error",
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
));
|
||||
}
|
||||
double amount = Helpers.SatsToCoin(DataManager
|
||||
.GamesEarnings.values
|
||||
.elementAt(index));
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
GlassCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
sortByGames
|
||||
? ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: scrollController,
|
||||
itemCount: DataManager.GamesEarnings.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
String gameName = DataManager.GamesEarnings.keys
|
||||
.elementAt(index);
|
||||
dynamic GameJson =
|
||||
Helpers.GetGameFromCode(gameName);
|
||||
if (GameJson == null) {
|
||||
Debug.LogError(
|
||||
("Error getting game json from ${gameName}. returned:\n$GameJson"));
|
||||
return GlassCard(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
"Error",
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
));
|
||||
}
|
||||
double amount = Helpers.SatsToCoin(DataManager
|
||||
.GamesEarnings.values
|
||||
.elementAt(index));
|
||||
|
||||
return WalletGameListItem(GameJson, amount);
|
||||
})
|
||||
: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: scrollController,
|
||||
itemCount: DataManager.CryptoEarnings.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return WalletCurrencyListItem(
|
||||
DataManager.CryptoEarnings.keys.elementAt(index));
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
))
|
||||
])
|
||||
return WalletGameListItem(GameJson, amount);
|
||||
})
|
||||
: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: scrollController,
|
||||
itemCount: DataManager.CryptoEarnings.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return WalletCurrencyListItem(DataManager
|
||||
.CryptoEarnings.keys
|
||||
.elementAt(index));
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
))
|
||||
])
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
TextEditingController TxtRefId = TextEditingController();
|
||||
|
||||
Widget share() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
GlassCard(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Referral Program", style: TextStyle(fontSize: 18)),
|
||||
SizedBox(width: 10,),
|
||||
InkWell(child: Container(padding: EdgeInsets.all(5),child: Icon(Icons.help),),
|
||||
onTap: (){
|
||||
Dialogs.showAlertDialog(context, "Referral Program", "Share your Referral ID among your friends.\nFor each submission of your Referral ID, You'll receive a Reward!");
|
||||
},)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
// Text("Earn 0.00000500 ETH for sharing with each friend."),//${DataManager.Settings['ref_reward']}
|
||||
Text("Earn"),
|
||||
SizedBox(height: 5,),
|
||||
Text("0.00000100 BTC", style: TextStyle(fontWeight: FontWeight.bold,color: Colors.greenAccent,fontSize: 16)),
|
||||
Text("For Sharing with each Friend"),
|
||||
|
||||
SizedBox(height: 30,),
|
||||
Text("Your Referral ID"),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Share.share('Join this platform with my referral ${DataManager.UserJson['id']}\nhttps://play.google.com/store/apps/details?id=com.Xperience.FaucetHub');
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(DataManager.UserJson['id'].toString(),style: TextStyle(fontSize: 50,fontWeight: FontWeight.bold),),
|
||||
SizedBox(width: 15,),
|
||||
Icon(Icons.share,size: 40)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
GlassButton(onTap: (){
|
||||
if(DataManager.UserJson["refer"] != "0"){
|
||||
return;
|
||||
}
|
||||
AlertDialog alert = AlertDialog(
|
||||
backgroundColor: Color(0xFF1F1F1F),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)),
|
||||
title: Text("Enter a Referral",textAlign: TextAlign.center,),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("Enter your friends Referral ID",textAlign: TextAlign.center,),
|
||||
TextField(controller: refController,)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text("Submit"),
|
||||
onPressed: () async{
|
||||
Navigator.of(context).pop();
|
||||
Dialogs.waiting();
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
Dialogs.hide();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
)
|
||||
],
|
||||
|
||||
);
|
||||
|
||||
showDialog(context: context, builder: (BuildContext context){return alert;});
|
||||
}, child: Text((DataManager.UserJson["refer"] == "0") ? "Use Referral" : "Already Reffered to ${DataManager.UserJson["refer"]}"), width: 200,height: 40, color: Colors.greenAccent),
|
||||
SizedBox(height: 10,)
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 20,),
|
||||
InkWell(
|
||||
onTap: () async{
|
||||
|
||||
await LaunchApp.openApp(
|
||||
androidPackageName: 'https://play.google.com/store/apps/details?id=com.Xperience.FaucetHub',
|
||||
// openStore: false
|
||||
);
|
||||
await DataManager.Review();
|
||||
|
||||
setState(() {
|
||||
|
||||
});
|
||||
},
|
||||
child: GlassCard(child: Container(padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Review on Playstore", style: TextStyle(fontSize: 18)),
|
||||
SizedBox(width: 10,),
|
||||
Container(padding: EdgeInsets.all(5),child: Icon(Icons.star)),
|
||||
Text("5"),
|
||||
|
||||
],
|
||||
),
|
||||
(DataManager.UserJson["review"] == "0") ? Text("Get 0.00000300 BTC", style: TextStyle(color: Colors.greenAccent, fontWeight: FontWeight.bold)) : Container()
|
||||
],
|
||||
),)),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TextEditingController refController = TextEditingController();
|
||||
|
||||
Widget WalletGameListItem(dynamic GameJson, double amount) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
|
|
@ -575,56 +772,84 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
)),
|
||||
);
|
||||
}
|
||||
|
||||
TextEditingController TxtCoinbaseAddress = TextEditingController();
|
||||
Widget settings() {
|
||||
return Column(
|
||||
children: [
|
||||
GlassCard(child: AnimatedSize(
|
||||
GlassCard(
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: Padding(padding: EdgeInsets.all(15), child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("Coinbase Address"),
|
||||
InkWell(onTap: (){Dialogs.ShowCoinbaseDialog(context);},child: Icon(Icons.help))
|
||||
],
|
||||
),
|
||||
TextField(controller: TxtCoinbaseAddress, onChanged: (e){setState(() {
|
||||
|
||||
});},),
|
||||
(TxtCoinbaseAddress.text != (DataManager.UserJson['wd_address'] ?? "") )? Container(padding: EdgeInsets.all(10), child: GlassButton(onTap: () async{
|
||||
String response = await DataManager.SetWdAddress(TxtCoinbaseAddress.text);
|
||||
bool success = response == TxtCoinbaseAddress.text;
|
||||
// DataManager.UserJson['wd_address'] = TxtCoinbaseAddress.text;
|
||||
if(!success){
|
||||
Dialogs.showAlertDialog(context, "Error saving Coinbase Address", response);
|
||||
}
|
||||
setState(() {
|
||||
|
||||
});
|
||||
}, child: Text("Save"), width: 250),) : Container()
|
||||
],
|
||||
),),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("Coinbase Address"),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Dialogs.ShowCoinbaseDialog(context);
|
||||
},
|
||||
child: Icon(Icons.help))
|
||||
],
|
||||
),
|
||||
TextField(
|
||||
controller: TxtCoinbaseAddress,
|
||||
onChanged: (e) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
(TxtCoinbaseAddress.text !=
|
||||
(DataManager.UserJson['wd_address'] ?? ""))
|
||||
? Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: GlassButton(
|
||||
onTap: () async {
|
||||
String response = await DataManager.SetWdAddress(
|
||||
TxtCoinbaseAddress.text);
|
||||
bool success =
|
||||
response == TxtCoinbaseAddress.text;
|
||||
// DataManager.UserJson['wd_address'] = TxtCoinbaseAddress.text;
|
||||
if (!success) {
|
||||
Dialogs.showAlertDialog(context,
|
||||
"Error saving Coinbase Address", response);
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Text("Save"),
|
||||
width: 250),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 10,),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
InkWell(
|
||||
onTap: ()async{
|
||||
onTap: () async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
prefs.clear();
|
||||
|
||||
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) =>
|
||||
MyHomePage()), (Route<dynamic> route) => false);
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(builder: (context) => MyHomePage()),
|
||||
(Route<dynamic> route) => false);
|
||||
DataManager.Reset();
|
||||
},
|
||||
child: GlassCard(child: Padding(
|
||||
child: GlassCard(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.logout),
|
||||
SizedBox(width: 10,),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text("Signout"),
|
||||
],
|
||||
)
|
||||
|
|
@ -640,28 +865,34 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
{required String gameName,
|
||||
required String coin,
|
||||
required List<Widget> challengesInfo}) {
|
||||
return GlassCard(
|
||||
child: Container(
|
||||
width: screenWidth * 0.8,
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(gameName, style: TextStyle(fontSize: 16)),
|
||||
Row(
|
||||
children: [Icon(Helpers.GetIconForCrypto(coin)), Text(" $coin")],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Column(
|
||||
children: challengesInfo,
|
||||
)
|
||||
]),
|
||||
));
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: GlassCard(
|
||||
child: Container(
|
||||
width: screenWidth * 0.8,
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(gameName, style: TextStyle(fontSize: 16)),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Helpers.GetIconForCrypto(coin)),
|
||||
Text(" $coin")
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Column(
|
||||
children: challengesInfo,
|
||||
)
|
||||
]),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget ChallengeProgress(dynamic ChallengeData) {
|
||||
|
|
|
|||
143
lib/off_screen.dart
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:external_app_launcher/external_app_launcher.dart';
|
||||
import 'package:fhub/backend/DebugHelper.dart';
|
||||
import 'package:fhub/home.dart';
|
||||
import 'package:fhub/src/CustomWidgets.dart';
|
||||
import 'package:fhub/welcome.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OfflinePage extends StatefulWidget {
|
||||
OfflinePage({super.key,required this.id});
|
||||
int id=0;
|
||||
@override
|
||||
State<OfflinePage> createState() => _OfflinePageState();
|
||||
}
|
||||
var subscription;
|
||||
class _OfflinePageState extends State<OfflinePage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
kickstartAnimations();
|
||||
|
||||
subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) async{
|
||||
// Got a new connectivity status!
|
||||
try{
|
||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
Debug.Log(connectivityResult);
|
||||
if(connectivityResult == ConnectivityResult.mobile || connectivityResult == ConnectivityResult.wifi || connectivityResult == ConnectivityResult.ethernet || connectivityResult == ConnectivityResult.vpn){
|
||||
Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_)=>MyHomePage()));
|
||||
|
||||
return;
|
||||
}
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
|
||||
subscription.cancel();
|
||||
}
|
||||
|
||||
void kickstartAnimations() async {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
setState(() {
|
||||
op1 = 1;
|
||||
op2 = 1;
|
||||
op3 = 1;
|
||||
});
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int id = widget.id;
|
||||
// id = ;
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
extendBody: true,
|
||||
body: CustomBody(
|
||||
onAnimEnd: () {
|
||||
setState(() {});
|
||||
|
||||
},
|
||||
context: context,
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: id == 0 ? NoInternet() : ( id == 1 ? NewUpdate():Maintaince())
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget NoInternet(){
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween
|
||||
,children: [
|
||||
Center(child: GradientText(text:"No Internet", gradient: LinearGradient(colors: [Colors.white.withOpacity(0.6),Colors.white.withOpacity(0.2)]),style: TextStyle(fontSize: 50,fontWeight: FontWeight.bold),)),
|
||||
Column(children:
|
||||
[
|
||||
Icon(Icons.signal_wifi_connected_no_internet_4,size: 105,color: Colors.white.withOpacity(0.4),),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Text("This app need an active internet connection to funtion.\nPlease Connect to Internet to continue.",textAlign: TextAlign.center,),
|
||||
)
|
||||
|
||||
]
|
||||
),
|
||||
Column()
|
||||
],);
|
||||
}
|
||||
|
||||
Widget NewUpdate(){
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween
|
||||
,children: [
|
||||
Center(child: GradientText(text:"New Update!", gradient: LinearGradient(colors: [Colors.white.withOpacity(0.6),Colors.white.withOpacity(0.2)]),style: TextStyle(fontSize: 50,fontWeight: FontWeight.bold),)),
|
||||
Column(children:
|
||||
[
|
||||
Icon(Icons.download_outlined,size: 100,color: Colors.white.withOpacity(0.4),),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Text("Please Update to continue.",textAlign: TextAlign.center,),
|
||||
),
|
||||
SizedBox(height: 30,),
|
||||
GlassButton(onTap: () async{
|
||||
await LaunchApp.openApp(
|
||||
androidPackageName: "https://play.google.com/store/apps/details?id=com.Xperience.FaucetHub",
|
||||
// openStore: false
|
||||
);
|
||||
}, child: Text("Update",style: TextStyle(fontSize: 18,fontWeight: FontWeight.bold),), width: 200,height: 50,color: Colors.greenAccent)
|
||||
|
||||
]
|
||||
),
|
||||
Column()
|
||||
],);
|
||||
}
|
||||
|
||||
Widget Maintaince(){
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween
|
||||
,children: [
|
||||
Center(child: GradientText(text:"Under Maintaince!", gradient: LinearGradient(colors: [Colors.white.withOpacity(0.6),Colors.white.withOpacity(0.2)]),style: TextStyle(fontSize: 38,fontWeight: FontWeight.bold),)),
|
||||
Column(children:
|
||||
[
|
||||
Icon(Icons.developer_mode_outlined,size: 100,color: Colors.white.withOpacity(0.4),),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
child: Text("Please Check back in later.",textAlign: TextAlign.center,),
|
||||
),
|
||||
|
||||
]
|
||||
),
|
||||
Column()
|
||||
],);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,15 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:fhub/backend/DataManager.dart';
|
||||
import 'package:fhub/backend/Dialogs.dart';
|
||||
import 'package:fhub/backend/login_mgr.dart';
|
||||
import 'package:fhub/disabled_mode.dart';
|
||||
import 'package:fhub/home.dart';
|
||||
import 'package:fhub/off_screen.dart';
|
||||
import 'package:fhub/src/CustomWidgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_sign_in/google_sign_in.dart';
|
||||
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'backend/DebugHelper.dart';
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
|
|
@ -14,7 +18,7 @@ class MyHomePage extends StatefulWidget {
|
|||
@override
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
var subscription;
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int counter = -1;
|
||||
bool loginLoading = false;
|
||||
|
|
@ -24,9 +28,43 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
super.initState();
|
||||
kickstartAnimations();
|
||||
init();
|
||||
|
||||
subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) async{
|
||||
// Got a new connectivity status!
|
||||
try{
|
||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
Debug.Log(connectivityResult);
|
||||
if(connectivityResult != ConnectivityResult.mobile && connectivityResult != ConnectivityResult.wifi && connectivityResult != ConnectivityResult.ethernet && connectivityResult != ConnectivityResult.vpn){
|
||||
Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_)=>OfflinePage(id:0)));
|
||||
|
||||
return;
|
||||
}
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
|
||||
subscription.cancel();
|
||||
}
|
||||
|
||||
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){
|
||||
return;
|
||||
}
|
||||
|
|
@ -278,7 +316,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
GoogleSignIn _googleSignIn = GoogleSignIn(
|
||||
scopes: [
|
||||
'email',
|
||||
'https://www.googleapis.com/auth/contacts.readonly',
|
||||
],
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,22 @@
|
|||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import connectivity_plus
|
||||
import firebase_auth
|
||||
import firebase_core
|
||||
import path_provider_foundation
|
||||
import share_plus
|
||||
import shared_preferences_foundation
|
||||
import sqflite
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
|
||||
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
|
|
|||
208
pubspec.lock
|
|
@ -17,6 +17,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.2"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.2"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -33,6 +41,30 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
cached_network_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cached_network_image
|
||||
sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.3"
|
||||
cached_network_image_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_platform_interface
|
||||
sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
cached_network_image_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_web
|
||||
sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
change_app_package_name:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
@ -65,6 +97,38 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.1"
|
||||
connectivity_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: connectivity_plus
|
||||
sha256: "77a180d6938f78ca7d2382d2240eb626c0f6a735d0bfdce227d8ffb80f95c48b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
connectivity_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: connectivity_plus_platform_interface
|
||||
sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.4"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cross_file
|
||||
sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.3+4"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
crypto_font_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -81,6 +145,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
dbus:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dbus
|
||||
sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.8"
|
||||
external_app_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -166,6 +238,22 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_blurhash:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_blurhash
|
||||
sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
flutter_cache_manager:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_cache_manager
|
||||
sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.3.1"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
@ -296,6 +384,30 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: mime
|
||||
sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
nm:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nm
|
||||
sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: octo_image
|
||||
sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -304,6 +416,30 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.3"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.15"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.27"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.3"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -328,6 +464,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.7"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.4.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -360,6 +504,30 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.1"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: rxdart
|
||||
sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.27.7"
|
||||
share_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: share_plus
|
||||
sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.1.0"
|
||||
share_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_platform_interface
|
||||
sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.3.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -429,6 +597,22 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite
|
||||
sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.8+4"
|
||||
sqflite_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite_common
|
||||
sha256: "8f7603f3f8f126740bc55c4ca2d1027aab4b74a1267a3e31ce51fe40e3b65b8f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.5+1"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -453,6 +637,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: synchronized
|
||||
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -541,6 +733,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.6"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: uuid
|
||||
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.7"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -565,6 +765,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
sdks:
|
||||
dart: ">=3.0.1 <4.0.0"
|
||||
flutter: ">=3.3.0"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
version: 1.0.6+6
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.1 <4.0.0'
|
||||
|
|
@ -42,6 +42,9 @@ dependencies:
|
|||
external_app_launcher: ^3.1.0
|
||||
url_launcher: ^6.1.11
|
||||
intl: ^0.18.1
|
||||
cached_network_image: ^3.2.3
|
||||
connectivity_plus: ^4.0.2
|
||||
share_plus: ^7.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
|
|
@ -6,12 +6,18 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
||||
#include <share_plus/share_plus_windows_plugin_c_api.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
||||
FirebaseCorePluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
||||
SharePlusWindowsPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
connectivity_plus
|
||||
firebase_core
|
||||
share_plus
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
|
|
|
|||