v.1.28.2 save exercise async
This commit is contained in:
@@ -174,10 +174,10 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> with Logg
|
||||
}
|
||||
|
||||
exerciseRepository.end = DateTime.now();
|
||||
await exerciseRepository.addExercise();
|
||||
exerciseRepository.addExercise();
|
||||
if (kReleaseMode) {
|
||||
MauticRepository mauticRepository = MauticRepository(customerRepository: customerRepository);
|
||||
await mauticRepository.sendMauticExercise();
|
||||
mauticRepository.sendMauticExercise();
|
||||
}
|
||||
menuBloc.add(MenuTreeDown(parent: 0));
|
||||
Cache().initBadges();
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:math' as math;
|
||||
import 'dart:convert';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart' as logging;
|
||||
import 'package:aitrainer_app/service/logging.dart' as logger;
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
@@ -12,7 +12,7 @@ import 'package:firebase_remote_config/firebase_remote_config.dart';
|
||||
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
|
||||
import 'package:google_sign_in/google_sign_in.dart';
|
||||
|
||||
class FirebaseApi with logging.Logging {
|
||||
class FirebaseApi with logger.Logging {
|
||||
bool appleSignInAvailable = false;
|
||||
|
||||
static final FirebaseAuth auth = FirebaseAuth.instance;
|
||||
@@ -199,9 +199,9 @@ class FirebaseApi with logging.Logging {
|
||||
throw Exception(e);
|
||||
}
|
||||
|
||||
Cache().firebaseUid = userCredential!.user!.uid;
|
||||
Cache().firebaseUid = userCredential.user!.uid;
|
||||
|
||||
userData['email'] = userCredential!.user!.email;
|
||||
userData['email'] = userCredential.user!.email;
|
||||
|
||||
return userData;
|
||||
}
|
||||
|
||||
@@ -145,6 +145,21 @@ mixin Common {
|
||||
return average;
|
||||
}
|
||||
|
||||
double getRepeatByOneRepMax(double oneRepMax, double weight) {
|
||||
double repeats = ( 80 * oneRepMax - 80 * weight ) / ( weight * ( 40 * 0.0333 + 1) );
|
||||
//print("getRepeatsByOneRepMax: $repeats");
|
||||
return repeats;
|
||||
}
|
||||
|
||||
int calculateRepeatBy1RMPercent(double oneRepMax, double weight, double percent) {
|
||||
return getRepeatByOneRepMax(oneRepMax , weight * percent).round();
|
||||
}
|
||||
|
||||
double calculate1RMPercentByRepeat(double oneRepMax, double weight, double repeat) {
|
||||
double percent = 80 * oneRepMax / (weight * ( repeat * ( 40 * 0.0333 + 1 ) + 80));
|
||||
return percent;
|
||||
}
|
||||
|
||||
static double get1RMPercent(int repeats) {
|
||||
double percent = 1;
|
||||
|
||||
@@ -231,3 +246,5 @@ mixin Common {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
class CommonHoldingClass with Common {}
|
||||
Reference in New Issue
Block a user