diff --git a/lib/android/config/mock_data_helper.dart b/lib/android/config/mock_data_helper.dart new file mode 100644 index 0000000..c1ddd45 --- /dev/null +++ b/lib/android/config/mock_data_helper.dart @@ -0,0 +1,63 @@ + +import 'package:ernaehrung/android/components/meal_page_text/days_component.dart'; +import 'package:ernaehrung/android/config/statistics.dart'; +import 'package:hive/hive.dart'; +import '../models/food.dart'; + +// TODO REMOVE IN PROD + +mockDataForWholeWeek(){ + StatisticsService statisticsService = StatisticsService.instance; + Box box = Hive.box('STATISTICS_MAIN'); + int timestamp = statisticsService.getTimestampFromNow(); + List currentWeek = statisticsService.getTimestampsByTimestampAndTimespan(TimeSpan.week, timestamp); + for(int i = 0;i < currentWeek.length;i++){ + print(mockFood(i)); + box.put(currentWeek[i], mockFood(i)); + } +} + + +mockFood(int i) { + List>> foods = [ + { + 'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + }, + { + 'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + }, + { + 'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + }, + { + 'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + }, + { + 'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + }, + { + 'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + }, + { + 'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + 'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),], + }, + ]; + return foods[i]; +} + + + diff --git a/lib/main.dart b/lib/main.dart index 2ec1e7f..0054c1c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,16 +12,12 @@ import 'android/config/setup_todaybox_config.dart'; void main() async { await dotenv.load(fileName: ".env"); await Hive.initFlutter(); - if (!Hive.isAdapterRegistered(0)) { Hive.registerAdapter(FoodAdapter()); } - if (!Hive.isAdapterRegistered(1)) { Hive.registerAdapter(UserAdapter()); } - - await Hive.openBox(dotenv.env['STATISTICS_TODAY_BOX'] ?? 'STATISTICS_TODAY_BOX'); await Hive.openBox( dotenv.env['STATISTICS_PROGRESS_BOX'] ?? 'STATISTICS_PROGRESS_BOX'); await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX'); @@ -29,6 +25,7 @@ void main() async { await Hive.openBox('USER_BOX'); //Hive.deleteFromDisk(); setupTodayBox(); + //mockDataForWholeWeek(); if (defaultTargetPlatform == TargetPlatform.android) { runApp(const AndroidApp());