Commit 74410747 authored by Administrator's avatar Administrator

parse .fit-File, ready to analyse to store in db

parent e20633b6
......@@ -5,6 +5,9 @@ import 'package:strava_flutter/strava.dart';
import 'package:encrateia/secrets/secrets.dart';
import 'package:strava_flutter/Models/activity.dart' as StravaActivity;
import 'package:encrateia/models/athlete.dart';
import 'package:fit_parser/fit_parser.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:developer';
class Activity extends ChangeNotifier {
DbActivity db;
......@@ -44,6 +47,18 @@ class Activity extends ChangeNotifier {
notifyListeners();
}
parse({@required Athlete athlete}) async {
var appDocDir = await getApplicationDocumentsDirectory();
print("Starting to parse activity ${db.stravaId}.");
var fitFile = FitFile(path: appDocDir.path + '/${db.stravaId}.fit').parse();
print("Parsing activity ${db.stravaId} done.");
for (var dataMessage in fitFile.dataMessages) {
print(dataMessage);
debugger();
}
}
static queryStrava() async {
var strava = Strava(true, secret);
final prompt = 'auto';
......
......@@ -82,7 +82,7 @@ class _ListActivitiesScreenState extends State<ListActivitiesScreen> {
case "downloaded":
return IconButton(
icon: Icon(Icons.save_alt),
onPressed: () => activity.download(athlete: athlete),
onPressed: () => activity.parse(athlete: athlete),
tooltip: 'Parse .fit-file',
);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment