Skip to content

Commit

Permalink
Feature/68 migration to null safety (#939)
Browse files Browse the repository at this point in the history
* Migrate service classes to null safety

* Migrate constants to null safety

* Migrate utils to null safety

* Remove late from GetIt

* Change @required to required

* Migrate models to null safety

* Migrate main to null safety

* Migrate managers to null safety

* Migrate ViewModels to null safety

* Migrate utils to null safety

* Migrate views to null safety

* Migrate Views to null safety

* Migrate mocks to null safety

* Use late for all tests

* Fix service tests

* Migrate helpers to null safety

* Migrate managers tests to null safety

* Migrate ViewModel tests to null safety

* Managers use mocks for managers

* Migrate widget tests to null safety

* Migrate views tests to null safety

* Fix course_repository_test

* Fix QuickLinkRepository tests

* Fix SettingsManagerTests

* Fix user repository tests

* Fix GradeEvaluationTile tests

* Fix code problems

* Fix DashboardViewModel tests

* Fix FeedbackViewModelTest

* Fix GradeViewModel tests

* Fix UserRepositoryMock tests

* Fix ScheduleSettingsViewModel tests

* Fix ScheduleViewModel tests

* Fix GradeDetailsView tests

* Fix NotFoundView test

* Fix GradeDetailsViewModel tests

* Fix ScheduleViewModel tests

* Remove use of Future OnError

* Fix ScheduleSettingTest tests

* test: Fix settings loading issue

refs: #68

* Fix DashboardViewModelTest tests

* test: Fix settings loading issue

refs: #68

* test: Remove useless test

refs: #68

* Fix ScheduleViewModel marker not appearing

* Fix courses not appearing when no review

* Update CI and documentation

* [BOT] Applying version.

* [BOT] Applying format.

* Fix analyze

* Fix Golden

* [BOT] Applying format.

* Update pumpAndSettle duration

* [BOT] Update golden files

* Fix workflows

* Try to fix grades_details_view_test golden

* [BOT] Applying format.

* Try fixing grade_details_view_test

* Fix course evaluation bug and set appVersion

* [BOT] Applying format.

* Add analytics

* Chang log

* Add analytics

---------

Co-authored-by: apomalyn <[email protected]>
Co-authored-by: XavierPaquet-Rapold <[email protected]>
Co-authored-by: clubapplets-server <[email protected]>
  • Loading branch information
4 people authored Mar 14, 2024
1 parent 81e1f7e commit 22e104c
Show file tree
Hide file tree
Showing 158 changed files with 3,295 additions and 3,504 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/dev-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ jobs:
ENCRYPTED_GOOGLE_SERVICE_PASSWORD: ${{ secrets.ENCRYPTED_GOOGLE_SERVICE_PASSWORD }}

# Get flutter dependencies.
- run: flutter pub get
- run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
# Check the format of the code and commit the formatted files.
- name: Format files in lib and test directories
Expand Down Expand Up @@ -174,6 +176,7 @@ jobs:
if: matrix.target == 'iOS'
run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
cd ios
pod update
flutter clean
Expand All @@ -197,7 +200,9 @@ jobs:
exit 1
# Get dependencies and decrypt needed files.
- run: flutter pub get
- run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
- name: Decrypt SignETS certificate and Google Services files
run: |
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/master-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ jobs:
ENCRYPTED_GOOGLE_SERVICE_PASSWORD: ${{ secrets.ENCRYPTED_GOOGLE_SERVICE_PASSWORD }}

# Get flutter dependencies.
- run: flutter pub get
- run : |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
# Check if the code has any errors/warnings
- name: Analyze code
Expand Down Expand Up @@ -176,12 +178,15 @@ jobs:
if: matrix.target == 'iOS'
run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
cd ios
pod install
flutter clean
# Get dependencies and decrypt needed files.
- run: flutter pub get
- run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
- name: Decrypt SignETS certificate and Google Services files
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ jobs:
if: matrix.target == 'iOS'
run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
cd ios
pod install
flutter clean
- run: flutter doctor -v

# Get dependencies and decrypt needed files.
- run: flutter pub get
- run: |
flutter pub get
dart run build_runner build --delete-conflicting-outputs
- name: Decrypt certificates files
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ app_untranslated_messages.yaml

# Flutter test
test/**/failures/
test/mock/**/*.mocks.dart

# Certificates and secrets
assets/certificates/
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ chmod +x ./env_variables.sh
flutter pub get
```

- To generate the mocks:
```
dart run build_runner build
```

## Add environment variable for API_KEY

- To add the Google Maps API TOKEN and the GitHub API TOKEN, you need to rename the file `.env.template` into `.env`. In
Expand Down
7 changes: 2 additions & 5 deletions lib/core/constants/preferences_flags.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Flutter imports:
import 'package:flutter/cupertino.dart';

// Package imports:
import 'package:enum_to_string/enum_to_string.dart';

Expand Down Expand Up @@ -62,8 +59,8 @@ class DynamicPreferencesFlag {
PreferencesFlag groupAssociationFlag;

DynamicPreferencesFlag(
{@required this.groupAssociationFlag,
@required this.uniqueKey,
{required this.groupAssociationFlag,
required this.uniqueKey,
this.separator = "_"});

String get data => groupAssociationFlag.toString() + separator + uniqueKey;
Expand Down
4 changes: 2 additions & 2 deletions lib/core/constants/widget_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ enum WidgetType { progress, grades }
/// The extension corresponding to WidgetType to get associated constants
extension WidgetTypeExtension on WidgetType {
/// ID used by iOS systems to update the corresponding widget
String get iOSname {
String? get iOSname {
switch (this) {
case WidgetType.progress:
return 'ETSMobile_ProgressWidget';
Expand All @@ -22,7 +22,7 @@ extension WidgetTypeExtension on WidgetType {
///
/// Another option would be to use qualifiedAndroidName instead of androidName
/// (see home_widget's updateWidget method for more info)
String get androidName {
String? get androidName {
switch (this) {
case WidgetType.progress:
return 'ProgressWidgetProvider';
Expand Down
2 changes: 1 addition & 1 deletion lib/core/managers/cache_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CacheManager {
/// Get from the cache the value associated with [key].
/// Throw a [CacheException] if the [key] doesn't exist.
Future<String> get(String key) async {
final lib.FileInfo fileInfo = await _cacheManager.getFileFromCache(key);
final lib.FileInfo? fileInfo = await _cacheManager.getFileFromCache(key);

if (fileInfo == null) {
_analyticsService.logEvent(
Expand Down
Loading

0 comments on commit 22e104c

Please sign in to comment.