From 82513fb03e6b7cd6f3baaa9a1ad8b2f703d8f50a Mon Sep 17 00:00:00 2001 From: Bossanyi Tibor Date: Mon, 23 Nov 2020 18:36:41 +0100 Subject: [PATCH] Flurry. ExerciseDevice --- lib/main.dart | 17 +++++++++++---- lib/model/exercise_device.dart | 22 +++++++++++++++++++ lib/service/firebase_api.dart | 8 ++----- lib/widgets/bmi_widget.dart | 2 ++ lib/widgets/bmr_widget.dart | 2 ++ lib/widgets/bottom_nav.dart | 6 +++++ pubspec.lock | 40 +++++++++++++++++----------------- pubspec.yaml | 26 ++++++++++++---------- 8 files changed, 81 insertions(+), 42 deletions(-) create mode 100644 lib/model/exercise_device.dart diff --git a/lib/main.dart b/lib/main.dart index 079c703..84b4d32 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -29,8 +29,7 @@ import 'package:aitrainer_app/view/registration.dart'; import 'package:aitrainer_app/view/reset_password.dart'; import 'package:aitrainer_app/view/settings.dart'; import 'package:aitrainer_app/widgets/home.dart'; -//import 'package:firebase_analytics/firebase_analytics.dart'; -//import 'package:firebase_analytics/observer.dart'; +import 'package:flurry/flurry.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -141,18 +140,28 @@ Future main() async { create: (BuildContext context) => BodyDevelopmentBloc(workoutTreeRepository: menuTreeRepository), ), ], - child: AitrainerApp(), + child: WorkoutTestApp(), )); }, (error, stackTrace) async { await _reportError(error, stackTrace); }); } -class AitrainerApp extends StatelessWidget { +Future initFlurry() async { + await Flurry.initialize( + androidKey: "JNYCTCWBT34FM3J8TV36", + iosKey: "3QBG7BSMGPDH24S8TRQP", + enableLog: true); + //await Flurry.setUserId("userId"); + //await Flurry.logEvent("eventName"); +} + +class WorkoutTestApp extends StatelessWidget { @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); //final FirebaseAnalytics analytics = FirebaseAnalytics(); + initFlurry(); PushNotificationsManager().init(); return MaterialApp( localizationsDelegates: [ diff --git a/lib/model/exercise_device.dart b/lib/model/exercise_device.dart new file mode 100644 index 0000000..0374ca9 --- /dev/null +++ b/lib/model/exercise_device.dart @@ -0,0 +1,22 @@ + +class ExerciseType { + int deviceId; + String name; + String description; + String imageUrl; + + + ExerciseType({this.name, this.description}); + + ExerciseType.fromJson(Map json) { + this.name = json['name']; + this.description = json['description']; + this.imageUrl = json['imageUrl']; + } + + Map toJson() => + { + "name": name, + "description": description, + }; +} \ No newline at end of file diff --git a/lib/service/firebase_api.dart b/lib/service/firebase_api.dart index 58b89c2..6e60c03 100644 --- a/lib/service/firebase_api.dart +++ b/lib/service/firebase_api.dart @@ -66,10 +66,6 @@ class FirebaseApi { print('The account already exists for that email.'); rc = REGISTER_EMAIL_IN_USE; throw Exception("The email address has been registered already"); - /* userCredential = await FirebaseAuth.instance.signInWithEmailAndPassword(email: email, password: password); - if (rc != null) { - rc = SIGN_IN_OK; - } */ } } catch (e) { print(e); @@ -78,7 +74,7 @@ class FirebaseApi { return rc; } - Future signInWithFacebook() async { + /*Future signInWithFacebook() async { // Trigger the sign-in flow final LoginResult result = await FacebookAuth.instance.login(); @@ -87,7 +83,7 @@ class FirebaseApi { // Once signed in, return the UserCredential return await FirebaseAuth.instance.signInWithCredential(facebookAuthCredential); - } + }*/ Future signOut() async { await FirebaseAuth.instance.signOut(); diff --git a/lib/widgets/bmi_widget.dart b/lib/widgets/bmi_widget.dart index 003355f..74548c2 100644 --- a/lib/widgets/bmi_widget.dart +++ b/lib/widgets/bmi_widget.dart @@ -2,6 +2,7 @@ import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart'; import 'package:aitrainer_app/localization/app_localization.dart'; import 'package:aitrainer_app/util/trans.dart'; import 'package:animated_widgets/widgets/rotation_animated.dart'; +import 'package:flurry/flurry.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -70,6 +71,7 @@ class _BMIState extends State with Trans { @override Widget build(BuildContext context) { setContext(context); + Flurry.logEvent("BMI"); widget.exerciseBloc.getBMI(); return Form( child: Scaffold( diff --git a/lib/widgets/bmr_widget.dart b/lib/widgets/bmr_widget.dart index e6eb547..80f2962 100644 --- a/lib/widgets/bmr_widget.dart +++ b/lib/widgets/bmr_widget.dart @@ -2,6 +2,7 @@ import 'package:aitrainer_app/bloc/exercise_new/exercise_new_bloc.dart'; import 'package:aitrainer_app/localization/app_localization.dart'; import 'package:aitrainer_app/model/fitness_state.dart'; import 'package:aitrainer_app/util/trans.dart'; +import 'package:flurry/flurry.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -74,6 +75,7 @@ class _BMRState extends State with Trans { @override Widget build(BuildContext context) { setContext(context); + Flurry.logEvent("BMR"); return Form( child: Scaffold( resizeToAvoidBottomInset: true, diff --git a/lib/widgets/bottom_nav.dart b/lib/widgets/bottom_nav.dart index dec6b2b..f544e8a 100644 --- a/lib/widgets/bottom_nav.dart +++ b/lib/widgets/bottom_nav.dart @@ -1,4 +1,5 @@ import 'package:aitrainer_app/localization/app_localization.dart'; +import 'package:flurry/flurry.dart'; import 'package:flutter/material.dart'; import 'package:gradient_bottom_navigation_bar/gradient_bottom_navigation_bar.dart'; @@ -106,25 +107,30 @@ class _NawDrawerWidget extends State { switch (index) { case 0: Navigator.of(context).pop(); + Flurry.logEvent("Home"); Navigator.of(context).pushNamed('home'); break; case 1: Navigator.of(context).pop(); + Flurry.logEvent("myDevelopment"); Navigator.of(context).pushNamed('myDevelopment'); break; case 2: Navigator.of(context).pop(); + Flurry.logEvent("myExercisePlan"); Navigator.of(context).pushNamed('myExercisePlan'); break; case 3: Navigator.of(context).pop(); + Flurry.logEvent("Account"); Navigator.of(context).pushNamed('account'); break; case 4: Navigator.of(context).pop(); + Flurry.logEvent("Settings"); Navigator.of(context).pushNamed('settings'); break; diff --git a/pubspec.lock b/pubspec.lock index e60be0f..4a4cac8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -70,14 +70,14 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "1.5.1" build_config: dependency: transitive description: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" build_daemon: dependency: transitive description: @@ -98,14 +98,14 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.10.4" + version: "1.10.6" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.0.3" + version: "6.1.1" built_collection: dependency: transitive description: @@ -203,7 +203,7 @@ packages: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.9" + version: "1.3.10" devicelocale: dependency: "direct main" description: @@ -217,7 +217,7 @@ packages: name: dropdown_search url: "https://pub.dartlang.org" source: hosted - version: "0.4.6" + version: "0.4.8" equatable: dependency: "direct main" description: @@ -246,41 +246,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.0.0-nullsafety.2" - firebase: - dependency: transitive - description: - name: firebase - url: "https://pub.dartlang.org" - source: hosted - version: "7.3.2" firebase_auth: dependency: "direct main" description: name: firebase_auth url: "https://pub.dartlang.org" source: hosted - version: "0.18.1+2" + version: "0.18.3" firebase_auth_platform_interface: dependency: transitive description: name: firebase_auth_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.3" firebase_auth_web: dependency: transitive description: name: firebase_auth_web url: "https://pub.dartlang.org" source: hosted - version: "0.3.1+1" + version: "0.3.2" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.0+1" + version: "0.5.2" firebase_core_platform_interface: dependency: transitive description: @@ -316,6 +309,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.0" + flurry: + dependency: "direct main" + description: + name: flurry + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.7" flutter: dependency: "direct main" description: flutter @@ -339,7 +339,7 @@ packages: name: flutter_facebook_auth url: "https://pub.dartlang.org" source: hosted - version: "0.3.3" + version: "1.0.1" flutter_form_bloc: dependency: "direct main" description: @@ -492,7 +492,7 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.1.1" json_rpc_2: dependency: transitive description: @@ -1001,7 +1001,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.3" + version: "1.7.4" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ae2cf60..4f0ad13 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,10 +15,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.1.2+2 +version: 1.1.2+32 environment: - sdk: ">=2.7.0 <3.1.0" + sdk: ">=2.10.0 <3.0.0" dependencies: flutter: @@ -28,9 +28,9 @@ dependencies: google_fonts: ^1.1.1 devicelocale: ^0.3.3 sentry: ^3.0.1 - flutter_bloc: ^6.0.6 + flutter_bloc: ^6.1.1 equatable: ^1.2.5 - freezed: ^0.12.1 + freezed: ^0.12.2 flutter_form_bloc: ^0.19.0 spider_chart: ^0.1.5 rainbow_color: ^0.1.1 @@ -40,16 +40,18 @@ dependencies: infinite_listview: ^1.0.1+1 toggle_switch: ^0.1.8 keyboard_actions: ^3.3.1+1 - dropdown_search: ^0.4.6 + dropdown_search: ^0.4.8 - firebase_core: 0.5.0+1 - #firebase_analytics: ^6.0.2 + firebase_core: 0.5.2 + #firebase_analytics: ^6.2.0 firebase_messaging: ^7.0.3 - firebase_auth: ^0.18.1+2 - flutter_facebook_auth: ^0.3.3 + firebase_auth: ^0.18.3 + flutter_facebook_auth: ^1.0.1 + flurry: ^0.0.7 + animated_widgets: ^1.0.6 - mockito: ^4.1.1 + mockito: ^4.1.3 flutter_localizations: sdk: flutter @@ -58,14 +60,14 @@ dev_dependencies: flutter_driver: sdk: flutter test: any - bloc_test: ^7.0.4 + bloc_test: ^7.1.0 build_runner: http: 0.12.1 intl: 0.16.1 - shared_preferences: ^0.5.12+2 + shared_preferences: ^0.5.12+4 flutter_launcher_icons: ^0.8.1