mirror of
https://github.com/supleed2/ELEC60013-ES-CW1.git
synced 2024-11-10 01:35:50 +00:00
Minor fixes
This commit is contained in:
parent
7a9723bb34
commit
ce9786ab05
|
@ -3,12 +3,12 @@ import 'package:http/http.dart' as http;
|
||||||
import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints;
|
import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints;
|
||||||
|
|
||||||
class AuthService{
|
class AuthService{
|
||||||
Future<List<String>> getUserDevices(String sessionToken) async {
|
Future<List<String>> getUserDevices(String uid) async {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(Endpoints.getUserDevices),
|
Uri.parse(Endpoints.getUserDevices),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': sessionToken,
|
'UID': uid,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200){
|
if (response.statusCode == 200){
|
||||||
|
|
|
@ -26,8 +26,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||||
Navigator.pushNamed(context, "/login");
|
Navigator.pushNamed(context, "/login");
|
||||||
} else {
|
} else {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
final String token = await user.getIdToken();
|
//final String token = await user.getIdToken();
|
||||||
final List<String> userDevices = await AuthService().getUserDevices(token);
|
final List<String> userDevices = await AuthService().getUserDevices(user.uid);
|
||||||
prefs.setStringList("devices", userDevices);
|
prefs.setStringList("devices", userDevices);
|
||||||
prefs.setString("current_device", userDevices[0]);
|
prefs.setString("current_device", userDevices[0]);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||||
MetricsPage(),
|
MetricsPage(),
|
||||||
StepsPage(),
|
StepsPage(),
|
||||||
MapPage(),
|
MapPage(),
|
||||||
SettingsPage()
|
//SettingsPage()
|
||||||
],
|
],
|
||||||
onPageChanged: (page) {
|
onPageChanged: (page) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
|
@ -60,10 +60,12 @@ class _MetricsPageState extends State<MetricsPage> {
|
||||||
MetricsRow(new MetricsData(metricsResponse.lastHumidity, metricsResponse.minHumidity, metricsResponse.maxHumidity, Constants.MIN_HUMIDITY, Constants.MAX_HUMIDITY, Constants.LOW_HUMIDITY_DOG, Constants.HIGH_HUMIDITY_DOG, "Humidity", "%"), Colors.green, Colors.black, false),
|
MetricsRow(new MetricsData(metricsResponse.lastHumidity, metricsResponse.minHumidity, metricsResponse.maxHumidity, Constants.MIN_HUMIDITY, Constants.MAX_HUMIDITY, Constants.LOW_HUMIDITY_DOG, Constants.HIGH_HUMIDITY_DOG, "Humidity", "%"), Colors.green, Colors.black, false),
|
||||||
MetricsRow(new MetricsData(metricsResponse.lastAirTemp, metricsResponse.minAirTemp, metricsResponse.maxAirTemp, Constants.MIN_AIR_TEMP, Constants.MAX_AIR_TEMP, Constants.LOW_AIR_TEMP_DOG, Constants.HIGH_AIR_TEMP_DOG, "Air temperature", "°C"), Colors.white, Colors.green, true),
|
MetricsRow(new MetricsData(metricsResponse.lastAirTemp, metricsResponse.minAirTemp, metricsResponse.maxAirTemp, Constants.MIN_AIR_TEMP, Constants.MAX_AIR_TEMP, Constants.LOW_AIR_TEMP_DOG, Constants.HIGH_AIR_TEMP_DOG, "Air temperature", "°C"), Colors.white, Colors.green, true),
|
||||||
|
|
||||||
|
/*
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0),
|
padding: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0),
|
||||||
child: Text("Today's temperature", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 36, fontWeight: FontWeight.bold)),
|
child: Text("Today's temperature", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 36, fontWeight: FontWeight.bold)),
|
||||||
),
|
),
|
||||||
|
*/
|
||||||
|
|
||||||
//TempChart(data)
|
//TempChart(data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue