Wallet wip
This commit is contained in:
@@ -1,6 +1,27 @@
|
||||
import 'package:faucethub/Backend/DebugHelper.dart';
|
||||
import 'package:faucethub/Backend/hoarder.dart';
|
||||
|
||||
class Brain{
|
||||
static const String API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/api/";
|
||||
|
||||
|
||||
static dynamic UserJson;
|
||||
|
||||
static List<dynamic> LinkedGamesJson = [];
|
||||
static List<dynamic> NonLinkedGamesJson = [];
|
||||
|
||||
|
||||
static void InitUserData(){
|
||||
LinkedGamesJson = [];
|
||||
NonLinkedGamesJson = [];
|
||||
List<String> linkedGames = UserJson['linkedGames'].toString().split(',');
|
||||
Debug.Log("Going to filter linked games from ${Hoarder.GamesJson.length} games\nmy linked game ids : ${UserJson['linkedGames']}");
|
||||
Hoarder.GamesJson.forEach((game) {
|
||||
if(linkedGames.contains(game['id'])){
|
||||
LinkedGamesJson.add(game);
|
||||
}else{
|
||||
NonLinkedGamesJson.add(game);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
38
lib/Backend/helpers.dart
Normal file
38
lib/Backend/helpers.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:crypto_font_icons/crypto_font_icons.dart';
|
||||
import 'package:faucethub/Backend/hoarder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Helpers{
|
||||
|
||||
static IconData GetIconForCrypto(String val){
|
||||
switch(val){
|
||||
case "BTC":
|
||||
return CryptoFontIcons.BTC;
|
||||
break;
|
||||
case "ETH":
|
||||
return CryptoFontIcons.ETH;
|
||||
break;
|
||||
case "XRP":
|
||||
return CryptoFontIcons.XRP;
|
||||
break;
|
||||
case "DOGE":
|
||||
return CryptoFontIcons.DOGE;
|
||||
break;
|
||||
case "LTC":
|
||||
return CryptoFontIcons.LTC;
|
||||
break;
|
||||
}
|
||||
|
||||
return CryptoFontIcons.BTC;
|
||||
}
|
||||
|
||||
static String GetIconForGame(String name){
|
||||
Hoarder.GamesJson.forEach((element) {
|
||||
if(element['name'] == name){
|
||||
return element['thumbnail'];
|
||||
}
|
||||
});
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import 'package:http/http.dart' as http;
|
||||
class Hoarder{
|
||||
|
||||
static List<dynamic> GamesJson = [];
|
||||
|
||||
static Map<String,String> Settings = {};
|
||||
static List<dynamic> FeaturedGames = [];
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ class LoginManager {
|
||||
|
||||
try{
|
||||
Brain.UserJson = jsonDecode(loginResponse.body.toString());
|
||||
Brain.InitUserData();
|
||||
Debug.LogResponse(Brain.UserJson);
|
||||
prefs.setString("username", username);
|
||||
prefs.setString("password", password);
|
||||
|
||||
Reference in New Issue
Block a user