Begin to add the web interface page
This commit is contained in:
parent
37e5688842
commit
0b83eaaf3c
7 changed files with 165 additions and 6 deletions
|
@ -22,6 +22,7 @@ class SessionData {
|
|||
static late StreamSubscription<Position> _listener;
|
||||
static Callbacks Calls = Callbacks();
|
||||
static String LastSessionID = "";
|
||||
static String DisplayError = "";
|
||||
|
||||
/// This flag is usually set when data is loaded from a saved state. Or when accessed using the Web version of the app.
|
||||
static bool IsReadOnly = false;
|
||||
|
@ -222,8 +223,25 @@ class SessionData {
|
|||
return saveData;
|
||||
}
|
||||
|
||||
void LoadData(String js) {
|
||||
static Future<void> DownloadData() async {
|
||||
Dio dio = Dio();
|
||||
Map<String, dynamic> payload = {"cmd": "get", "id": LastSessionID};
|
||||
|
||||
// Send the data, and get the response
|
||||
var reply = await dio.post(
|
||||
TTConsts.SESSION_SERVER,
|
||||
data: json.encode(payload),
|
||||
);
|
||||
|
||||
LoadData(reply.data as String);
|
||||
}
|
||||
|
||||
static void LoadData(String js) {
|
||||
Map<String, dynamic> _js = json.decode(js);
|
||||
if (_js.containsKey("error")) {
|
||||
LastSessionID = "";
|
||||
return;
|
||||
}
|
||||
List<Map<String, dynamic>> _trips =
|
||||
_js['trips'] as List<Map<String, dynamic>>;
|
||||
List<Map<String, dynamic>> _pos =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue