Skip to content

Commit ecf6e89

Browse files
committed
Merge remote-tracking branch 'origin/develop' into pr/271
# Conflicts: # lib/features/edit_meal/presentation/edit_meal_screen.dart
2 parents e70d250 + 52a56c2 commit ecf6e89

189 files changed

Lines changed: 8286 additions & 3974 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/default_workflow.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
steps:
2020
- name: Checkout code
2121
uses: actions/checkout@v3
22+
2223
- uses: actions/setup-java@v2
2324
with:
2425
distribution: 'zulu'
@@ -30,6 +31,9 @@ jobs:
3031
flutter-version: '3.27.1'
3132
channel: 'stable'
3233
cache: true
34+
35+
- name: Setup Just
36+
uses: taiki-e/install-action@just
3337

3438
- name: Cache Flutter packages
3539
uses: actions/cache@v4
@@ -39,19 +43,10 @@ jobs:
3943
restore-keys: |
4044
${{ runner.os }}-pub-cache-
4145
42-
- name: Install Pub Dependencies
43-
run: flutter pub get
44-
45-
- name: Build with secrets
46-
run: flutter pub run build_runner build --delete-conflicting-outputs
47-
env:
48-
FDC_API_KEY: ${{ secrets.FDC_API_KEY }}
49-
SENTRY_DNS: ${{ secrets.SENTRY_DNS }}
50-
SUPABASE_PROJECT_ANON_KEY: ${{ secrets.SUPABASE_PROJECT_ANON_KEY }}
51-
SUPABASE_PROJECT_URL: ${{ secrets.SUPABASE_PROJECT_URL }}
52-
53-
- name: Analyze Code
54-
run: flutter analyze
55-
56-
- name: Run Tests
57-
run: flutter test
46+
# - name: Run CI
47+
# run: just ci
48+
# env:
49+
# FDC_API_KEY: ${{ secrets.FDC_API_KEY }}
50+
# SENTRY_DNS: ${{ secrets.SENTRY_DNS }}
51+
# SUPABASE_PROJECT_ANON_KEY: ${{ secrets.SUPABASE_PROJECT_ANON_KEY }}
52+
# SUPABASE_PROJECT_URL: ${{ secrets.SUPABASE_PROJECT_URL }}

.metadata

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
8-
channel: stable
7+
revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1"
8+
channel: "[user-branch]"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
17-
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
18-
- platform: android
19-
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
20-
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
21-
- platform: ios
22-
create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
23-
base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
16+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
17+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
18+
- platform: web
19+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
20+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
2421

2522
# User provided section
2623

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ See [Data Protection](https://www.iubenda.com/privacy-policy/53501884)
5656
## Contribution
5757
Contributions to OpenNutriTracker are welcome! If you find any issues or have suggestions for new features, please open an issue or submit a pull request. Make sure to follow the project's code style and guidelines.
5858

59+
Thanks to all the contributors:
60+
<a href="https://github.com/simonoppowa/OpenNutriTracker/graphs/contributors">
61+
<img src="https://contrib.rocks/image?repo=simonoppowa/OpenNutriTracker" />
62+
</a>
63+
5964
## Getting Started
6065
See the [Getting Started](GettingStarted.md) file for more information.
6166

analysis_options.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
# packages, and plugins designed to encourage good coding practices.
1010
include: package:flutter_lints/flutter.yaml
1111

12+
analyzer:
13+
# generated files throw `unnecessary_string_escapes` lint so we ignore warnings.
14+
# TODO: inject `ignore_for_file` as described below.
15+
exclude:
16+
- lib/generated/intl/*.dart
17+
1218
linter:
1319
# The lint rules applied to this project can be customized in the
1420
# section below to disable rules from the `package:flutter_lints/flutter.yaml`

justfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
intl_output_dir := "./lib/generated/intl/"
2+
3+
# Install dependencies
4+
install:
5+
flutter pub get
6+
7+
# Build OpenNutriTracker
8+
build:
9+
flutter pub run build_runner build --delete-conflicting-outputs
10+
11+
# Format dart code
12+
format *OPTIONS:
13+
dart format {{OPTIONS}} ./lib ./test
14+
15+
# Regenerate intl files
16+
run_intl: && format
17+
dart run intl_translation:generate_from_arb --output-dir {{intl_output_dir}} lib/**/*.dart ./lib/l10n/*.arb
18+
19+
# Check if intl files are correctly generated
20+
check_intl: run_intl
21+
git diff --exit-code {{intl_output_dir}}
22+
23+
# Run tests
24+
test:
25+
flutter test
26+
27+
# Run CI checks
28+
ci: install (format "--set-exit-if-changed") check_intl build && test
29+
flutter analyze

lib/core/data/data_source/config_data_source.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ class ConfigDataSource {
2323

2424
Future<void> setConfigDisclaimer(bool hasAcceptedDisclaimer) async {
2525
_log.fine(
26-
'Updating config hasAcceptedDisclaimer to $hasAcceptedDisclaimer');
26+
'Updating config hasAcceptedDisclaimer to $hasAcceptedDisclaimer',
27+
);
2728
final config = _configBox.get(_configKey);
2829
config?.hasAcceptedDisclaimer = hasAcceptedDisclaimer;
2930
config?.save();
3031
}
3132

3233
Future<void> setConfigAcceptedAnonymousData(
33-
bool hasAcceptedAnonymousData) async {
34+
bool hasAcceptedAnonymousData,
35+
) async {
3436
_log.fine(
35-
'Updating config hasAcceptedAnonymousData to $hasAcceptedAnonymousData');
37+
'Updating config hasAcceptedAnonymousData to $hasAcceptedAnonymousData',
38+
);
3639
final config = _configBox.get(_configKey);
3740
config?.hasAcceptedSendAnonymousData = hasAcceptedAnonymousData;
3841
config?.save();

lib/core/data/data_source/intake_data_source.dart

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,24 @@ class IntakeDataSource {
2323

2424
Future<void> deleteIntakeFromId(String intakeId) async {
2525
log.fine('Deleting intake item from db');
26-
_intakeBox.values
27-
.where((dbo) => dbo.id == intakeId)
28-
.toList()
29-
.forEach((element) {
26+
_intakeBox.values.where((dbo) => dbo.id == intakeId).toList().forEach((
27+
element,
28+
) {
3029
element.delete();
3130
});
3231
}
3332

34-
Future<IntakeDBO?> updateIntake(String intakeId, Map<String, dynamic> fields) async {
35-
log.fine('Updating intake $intakeId with fields ${fields.toString()} in db');
33+
Future<IntakeDBO?> updateIntake(
34+
String intakeId,
35+
Map<String, dynamic> fields,
36+
) async {
37+
log.fine(
38+
'Updating intake $intakeId with fields ${fields.toString()} in db',
39+
);
3640
var intakeObject = _intakeBox.values.indexed
37-
.where((indexedDbo) => indexedDbo.$2.id == intakeId).firstOrNull;
38-
if(intakeObject == null) {
41+
.where((indexedDbo) => indexedDbo.$2.id == intakeId)
42+
.firstOrNull;
43+
if (intakeObject == null) {
3944
log.fine('Cannot update intake $intakeId as it is non existent');
4045
return null;
4146
}
@@ -46,7 +51,7 @@ class IntakeDataSource {
4651

4752
Future<IntakeDBO?> getIntakeById(String intakeId) async {
4853
return _intakeBox.values.firstWhereOrNull(
49-
(intake) => intake.id == intakeId
54+
(intake) => intake.id == intakeId,
5055
);
5156
}
5257

@@ -55,25 +60,30 @@ class IntakeDataSource {
5560
}
5661

5762
Future<List<IntakeDBO>> getAllIntakesByDate(
58-
IntakeTypeDBO intakeType, DateTime dateTime) async {
63+
IntakeTypeDBO intakeType,
64+
DateTime dateTime,
65+
) async {
5966
return _intakeBox.values
60-
.where((intake) =>
61-
DateUtils.isSameDay(dateTime, intake.dateTime) &&
62-
intake.type == intakeType)
67+
.where(
68+
(intake) =>
69+
DateUtils.isSameDay(dateTime, intake.dateTime) &&
70+
intake.type == intakeType,
71+
)
6372
.toList();
6473
}
6574

66-
Future<List<IntakeDBO>> getRecentlyAddedIntake({int number = 100}) async {
75+
Future<List<IntakeDBO>> getRecentlyAddedIntake({int number = 100000}) async {
6776
final intakeList = _intakeBox.values.toList();
6877

6978
// sort list by date (newest first) and filter unique intake
70-
intakeList
71-
.sort((a, b) => (-1) * a.dateTime.compareTo(b.dateTime));
79+
intakeList.sort((a, b) => (-1) * a.dateTime.compareTo(b.dateTime));
7280

7381
final filterCodes = <String>{};
7482
final uniqueIntake = intakeList
75-
.where((intake) =>
76-
filterCodes.add(intake.meal.code ?? intake.meal.name ?? ""))
83+
.where(
84+
(intake) =>
85+
filterCodes.add(intake.meal.code ?? intake.meal.name ?? ""),
86+
)
7787
.toList();
7888

7989
return uniqueIntake.take(number).toList();

0 commit comments

Comments
 (0)