Commit 8aa79991 authored by Stefan Haslinger's avatar Stefan Haslinger

Merge branch 'master' of github.com:3schweinehunde/encrateia

parents ba8787c4 7a732f66
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/home/stefan/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/home/stefan/flutter/encrateia"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_ROOT=/Users/stefan/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/stefan/flutter/encrateia"
export "FLUTTER_TARGET=/Users/stefan/flutter/encrateia/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/home/stefan/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=0.1.3"
export "FLUTTER_BUILD_NUMBER=0.1.3"
export "FLUTTER_FRAMEWORK_DIR=/Users/stefan/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=0.2.0"
export "FLUTTER_BUILD_NUMBER=0.2.0"
export "TRACK_WIDGET_CREATION=true"
......@@ -49,7 +49,7 @@
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* encrateia.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = encrateia.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
......@@ -118,7 +118,7 @@
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* encrateia.app */,
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
......@@ -169,7 +169,7 @@
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* encrateia.app */;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
......@@ -379,7 +379,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
CURRENT_PROJECT_VERSION = 0.2.0;
DEVELOPMENT_TEAM = 79H3G49ZV2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -393,8 +393,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 0.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.informatom.encrateia;
PRODUCT_NAME = encrateia;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
};
......@@ -515,7 +516,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
CURRENT_PROJECT_VERSION = 0.2.0;
DEVELOPMENT_TEAM = 79H3G49ZV2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -529,8 +530,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 0.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.informatom.encrateia;
PRODUCT_NAME = encrateia;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
};
......@@ -543,7 +545,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
CURRENT_PROJECT_VERSION = 0.2.0;
DEVELOPMENT_TEAM = 79H3G49ZV2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -557,8 +559,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 0.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.informatom.encrateia;
PRODUCT_NAME = encrateia;
PRODUCT_NAME = Runner;
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
};
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1140"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
......@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "encrateia.app"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
......@@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "encrateia.app"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
......@@ -54,7 +54,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "encrateia.app"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
......@@ -71,7 +71,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "encrateia.app"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
......
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
......@@ -15,11 +15,24 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>strava</string>
<key>CFBundleURLSchemes</key>
<array>
<string>strava</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
......@@ -41,20 +54,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>strava</string>
<key>CFBundleURLSchemes</key>
<array>
<string>strava</string>
</array>
</dict>
</array>
</dict>
</plist>
......@@ -25,8 +25,15 @@ class MyApp extends StatelessWidget {
}
createHintFile() async {
var directories = await getExternalStorageDirectories();
var hintFile = File('${directories[0].path}/put_your_fit_files_here.txt');
await hintFile.writeAsString(
'This is the directory where Encrateia can pickup .fit-files from.');
if (Platform.isAndroid) {
var directories = await getExternalStorageDirectories();
var hintFile = File('${directories[0].path}/put_your_fit_files_here.txt');
await hintFile.writeAsString(
'This is the directory where Encrateia can pickup .fit-files from.');
} else {
var directory = await getApplicationDocumentsDirectory();
var hintFile = File('${directory.path}/put_your_fit_files_here.txt');
await hintFile.writeAsString(
'This is the directory where Encrateia can pickup .fit-files from.');
}
}
......@@ -100,24 +100,43 @@ class Activity extends ChangeNotifier {
}
static importFromLocalDirectory({Athlete athlete}) async {
var directories = await getExternalStorageDirectories();
var localDir = directories[0];
var appDocDir = await getApplicationDocumentsDirectory();
if (Platform.isAndroid) {
var directories = await getExternalStorageDirectories();
var localDir = directories[0];
var appDocDir = await getApplicationDocumentsDirectory();
var entityStream = localDir.list(
recursive: false,
followLinks: false,
);
await for (var entity in entityStream) {
var activity = Activity.fromLocalDirectory(athlete: athlete);
var isFile = await FileSystemEntity.isFile(entity.path);
if (isFile == true && entity.path.endsWith('.fit')) {
var sourceFile = File(entity.path);
await sourceFile.copy(
appDocDir.path + "/" + activity.db.stravaId.toString() + ".fit");
sourceFile.delete();
await activity.setState("downloaded");
}
}
} else {
var appDocDir = await getApplicationDocumentsDirectory();
var entityStream = appDocDir.list(
recursive: false,
followLinks: false,
);
var entityStream = localDir.list(
recursive: false,
followLinks: false,
);
await for (var entity in entityStream) {
var activity = Activity.fromLocalDirectory(athlete: athlete);
var isFile = await FileSystemEntity.isFile(entity.path);
if (isFile == true && entity.path.endsWith('.fit')) {
var sourceFile = File(entity.path);
await sourceFile.copy(
appDocDir.path + "/" + activity.db.stravaId.toString() + ".fit");
sourceFile.delete();
await activity.setState("downloaded");
await for (var entity in entityStream) {
var activity = Activity.fromLocalDirectory(athlete: athlete);
var isFile = await FileSystemEntity.isFile(entity.path);
if (isFile == true && entity.path.endsWith('.fit')) {
var sourceFile = File(entity.path);
await sourceFile.rename(
appDocDir.path + "/" + activity.db.stravaId.toString() + ".fit");
await activity.setState("downloaded");
}
}
}
}
......@@ -135,13 +154,13 @@ class Activity extends ChangeNotifier {
}
heartRateString() {
return db.avgHeartRate == null
return (db.avgHeartRate == null || db.avgHeartRate == 255)
? "- - -"
: db.avgHeartRate.toString() + " bpm";
}
averagePowerString() {
return db.avgPower == null
return (db.avgPower == null || db.avgPower == -1)
? "- - -"
: db.avgPower.toStringAsFixed(1) + " W";
}
......
......@@ -345,7 +345,11 @@ class Lap {
}
static double calculateAverageFormPower({List<Event> records}) {
var formPowers = records.map((record) => record.db.formPower).nonZeroInts();
var formPowers = records
.where((record) =>
record.db.formPower != null && record.db.formPower < 200)
.map((record) => record.db.formPower);
if (formPowers.length > 0) {
return formPowers.mean();
} else
......@@ -353,7 +357,10 @@ class Lap {
}
static double calculateSdevFormPower({List<Event> records}) {
var formPowers = records.map((record) => record.db.formPower).nonZeroInts();
var formPowers = records
.where((record) =>
record.db.formPower != null && record.db.formPower < 200)
.map((record) => record.db.formPower);
return formPowers.sdev();
}
......
......@@ -24,7 +24,7 @@ class ActivityOverviewWidget extends StatelessWidget {
),
ListTile(
leading: MyIcon.time,
title: Text(Duration(seconds: activity.db.movingTime).asString()),
title: Text(Duration(seconds: activity.db.movingTime ?? 0).asString()),
subtitle: Text('moving time'),
),
ListTile(
......
......@@ -31,7 +31,8 @@ class _AthletePowerPerHeartRateWidgetState
value.db.avgPower != null &&
value.db.avgPower > 0 &&
value.db.avgHeartRate != null &&
value.db.avgHeartRate > 0)
value.db.avgHeartRate > 0 &&
value.db.avgHeartRate != 255)
.toList();
if (powerPerHeartRateActivities.length > 0) {
......
......@@ -31,7 +31,8 @@ class _AthleteSpeedPerHeartRateWidgetState
value.db.avgSpeed != null &&
value.db.avgSpeed > 0 &&
value.db.avgHeartRate != null &&
value.db.avgHeartRate > 0)
value.db.avgHeartRate > 0 &&
value.db.avgHeartRate != 255)
.toList();
if (speedPerHeartRateActivities.length > 0) {
......
......@@ -20,7 +20,7 @@ class ActivityFormPowerChart extends StatelessWidget {
var smoothedRecords = Event.toIntDataPoints(
attribute: LapIntAttr.formPower,
records: records,
amount: 30,
amount: 10,
);
List<Series<dynamic, num>> data = [
......
......@@ -19,7 +19,7 @@ class ActivityGroundTimeChart extends StatelessWidget {
var smoothedRecords = Event.toDoubleDataPoints(
attribute: LapDoubleAttr.groundTime,
records: records,
amount: 30,
amount: 10,
);
List<Series<dynamic, num>> data = [
......
......@@ -19,7 +19,7 @@ class ActivityHeartRateChart extends StatelessWidget {
var smoothedRecords = Event.toIntDataPoints(
attribute: LapIntAttr.heartRate,
records: records,
amount: 30,
amount: 10,
);
List<Series<dynamic, num>> data = [
......
......@@ -19,7 +19,7 @@ class ActivityLegSpringStiffnessChart extends StatelessWidget {
var smoothedRecords = Event.toDoubleDataPoints(
attribute: LapDoubleAttr.legSpringStiffness,
records: records,
amount: 30,
amount: 10,
);
List<Series<dynamic, num>> data = [
......
......@@ -19,7 +19,7 @@ class ActivityPowerChart extends StatelessWidget {
var smoothedRecords = Event.toIntDataPoints(
attribute: LapIntAttr.power,
records: records,
amount: 30,
amount: 10,
);
List<Series<dynamic, num>> data = [
......
......@@ -19,7 +19,7 @@ class ActivityPowerPerHeartRateChart extends StatelessWidget {
var smoothedRecords = Event.toDoubleDataPoints(
attribute: LapDoubleAttr.powerPerHeartRate,
records: records,
amount: 30,
amount: 10,
);
List<Series<dynamic, num>> data = [
......
......@@ -19,7 +19,7 @@ class ActivityPowerRatioChart extends StatelessWidget {
var smoothedRecords = Event.toDoubleDataPoints(
attribute: LapDoubleAttr.powerRatio,
records: records,
amount: 30,
amount: 10,
);
List<Series<dynamic, num>> data = [
......
......@@ -19,7 +19,7 @@ class ActivitySpeedPerHeartRateChart extends StatelessWidget {