mirror of
https://github.com/supleed2/ELEC60013-ES-CW1.git
synced 2024-12-22 13:35:48 +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;
|
||||
|
||||
class AuthService{
|
||||
Future<List<String>> getUserDevices(String sessionToken) async {
|
||||
Future<List<String>> getUserDevices(String uid) async {
|
||||
final response = await http.get(
|
||||
Uri.parse(Endpoints.getUserDevices),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': sessionToken,
|
||||
'UID': uid,
|
||||
},
|
||||
);
|
||||
if (response.statusCode == 200){
|
||||
|
|
|
@ -26,8 +26,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
Navigator.pushNamed(context, "/login");
|
||||
} else {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String token = await user.getIdToken();
|
||||
final List<String> userDevices = await AuthService().getUserDevices(token);
|
||||
//final String token = await user.getIdToken();
|
||||
final List<String> userDevices = await AuthService().getUserDevices(user.uid);
|
||||
prefs.setStringList("devices", userDevices);
|
||||
prefs.setString("current_device", userDevices[0]);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
MetricsPage(),
|
||||
StepsPage(),
|
||||
MapPage(),
|
||||
SettingsPage()
|
||||
//SettingsPage()
|
||||
],
|
||||
onPageChanged: (page) {
|
||||
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.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: 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)),
|
||||
),
|
||||
*/
|
||||
|
||||
//TempChart(data)
|
||||
|
||||
|
|
Loading…
Reference in a new issue