Skip to content

Commit e8e8616

Browse files
authored
Fix crashlytics (#158)
* Ignore all modification in the french readme in the CI * Enable crashlytics for Android * Enable crashlytics for iOS. * When an error is logged report it to crashlytics * Change badge url * Remove unused import. * Add stacktrace to the crashlytics report.
1 parent ed39d8a commit e8e8616

19 files changed

+172
-107
lines changed

.github/workflows/main-workflow.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- '.metadata'
99
- '.github/**'
1010
- 'README.md'
11+
- 'README.fr.md'
1112
pull_request:
1213
env:
1314
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -91,6 +92,7 @@ jobs:
9192
export COV="$(./scripts/determine_code_coverage.sh coverage/lcov.info)"
9293
echo "Coverage detected is: $COV"
9394
echo "::set-output name=percentage::$COV"
95+
9496
coverage:
9597
name: Update coverage
9698
needs: [ testing ]
@@ -114,7 +116,7 @@ jobs:
114116
uses: schneegans/dynamic-badges-action@v1.1.0
115117
with:
116118
auth: ${{ secrets.GIST_COVERAGE_BADGE_TOKEN }}
117-
gistID: 63e992d7042dbac4db9abaecb78df0eb
119+
gistID: ${{ secrets.GIST_ID_COVERAGE_BADGE }}
118120
filename: notre_dame_master_badge_coverage.json
119121
label: Code coverage
120122
message: ${{ needs.testing.outputs.coverage }}

README.fr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<br />
66
<br />
77
<a href="https://github.com/ApplETS/Notre-Dame/actions/workflows/main-workflow.yaml" style="text-decoration: none;">
8-
<img src="https://github.com/ApplETS/Notre-Dame/actions/workflows/main-workflow.yaml/badge.svg?event=push&branch=master" alt="Statut de la compilation"/>
9-
<img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/apomalyn/63e992d7042dbac4db9abaecb78df0eb/raw/notre_dame_master_badge_coverage.json" alt="Code coverage"/>
8+
<img src="https://github.com/ApplETS/Notre-Dame/actions/workflows/main-workflow.yaml/badge.svg?branch=master" alt="Statut de la compilation"/>
109
</a>
10+
<img src="https://img.shields.io/endpoint?url=https://gist.github.com/clubapplets-server/e51406de3b919a69f396642a2bcb413c/raw/notre_dame_master_badge_coverage.json" alt="Code coverage"/>
1111
<br />
1212
</p>
1313
</div>

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
<br />
66
<br />
77
<a href="https://github.com/ApplETS/Notre-Dame/actions/workflows/main-workflow.yaml" style="text-decoration: none;">
8-
<img src="https://github.com/ApplETS/Notre-Dame/actions/workflows/main-workflow.yaml/badge.svg?event=push&branch=master" alt="Build Status"/>
9-
<img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/apomalyn/63e992d7042dbac4db9abaecb78df0eb/raw/notre_dame_master_badge_coverage.json" alt="Code coverage"/>
8+
<img src="https://github.com/ApplETS/Notre-Dame/actions/workflows/main-workflow.yaml/badge.svg?branch=master" alt="Build Status"/>
109
</a>
10+
<img src="https://img.shields.io/endpoint?url=https://gist.github.com/clubapplets-server/e51406de3b919a69f396642a2bcb413c/raw/notre_dame_master_badge_coverage.json" alt="Code coverage"/>
1111
<br />
1212
</p>
1313
</div>
1414

15-
This project is the placeholder for the fourth version of ÉTSMobile, a mobile which application that is currently available for Android and iOS. ÉTSMobile is the main gateway between the user and the [École de technologie supérieure (ÉTS)](https://www.etsmtl.ca/) on mobile devices. ÉTSMobile is an open-source project and is developped by members of the student club [ApplETS](https://clubapplets.ca/). It offers:
15+
This project is the placeholder for the fourth version of ÉTSMobile, a mobile which application that is currently
16+
available for Android and iOS. ÉTSMobile is the main gateway between the user and
17+
the [École de technologie supérieure (ÉTS)](https://www.etsmtl.ca/) on mobile devices. ÉTSMobile is an open-source
18+
project and is developped by members of the student club [ApplETS](https://clubapplets.ca/). It offers:
1619

1720
* Access to evaluation grades
1821
* Access to the student's schedules
@@ -31,29 +34,38 @@ _Note: This guide is also available in: [Français](https://github.com/ApplETS/N
3134

3235
## Before running the code
3336

34-
- To access some features you will need the SignetsAPI certificate, these files are encrypted. To decrypt them you will need to execute the `env_variables.sh` script (only available on the Google Drive of the club), then run:
37+
- To access some features you will need the SignetsAPI certificate, these files are encrypted. To decrypt them you will
38+
need to execute the `env_variables.sh` script (only available on the Google Drive of the club), then run:
39+
3540
```
3641
chmod +x ./scripts/decrypt.sh
3742
./scripts/decrypt.sh
3843
```
3944

4045
## Run the code
4146

42-
- After cloning the repo, you will have to get the packages and generate the l10n classes. To do that run the following command:
47+
- After cloning the repo, you will have to get the packages and generate the l10n classes. To do that run the following
48+
command:
49+
4350
```
4451
flutter pub get
4552
```
4653

4754
## Add environment variable for API_KEY
48-
- To add the Google Maps API TOKEN and the GitHub API TOKEN, you need to rename the file `.env.template` into `.env`.
49-
In the `.env` file, you need to paste the Google Maps API TOKEN and the GitHub API TOKEN.
55+
56+
- To add the Google Maps API TOKEN and the GitHub API TOKEN, you need to rename the file `.env.template` into `.env`. In
57+
the `.env` file, you need to paste the Google Maps API TOKEN and the GitHub API TOKEN.
58+
5059
## Git hooks
5160

52-
You can find under the folder `.githooks` all the hooks needed for this project. To configure git to use this folder enter the following command:
61+
You can find under the folder `.githooks` all the hooks needed for this project. To configure git to use this folder
62+
enter the following command:
63+
5364
```bash
5465
git config core.hooksPath .githooks
5566
```
5667

57-
5868
## ⚖️ License
59-
This projet is licensed under the Apache License V2.0. See the [LICENSE](https://github.com/ApplETS/Notre-Dame/blob/master/LICENSE) file for more info.
69+
70+
This projet is licensed under the Apache License V2.0. See
71+
the [LICENSE](https://github.com/ApplETS/Notre-Dame/blob/master/LICENSE) file for more info.

android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ dependencies {
6767
}
6868

6969
apply plugin: 'com.google.gms.google-services'
70+
apply plugin: 'com.google.firebase.crashlytics'

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
classpath 'com.android.tools.build:gradle:4.0.1'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
classpath 'com.google.gms:google-services:4.3.3'
12-
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
12+
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
1313
}
1414
}
1515

ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ PODS:
1212
- Firebase/Crashlytics (8.0.0):
1313
- Firebase/CoreOnly
1414
- FirebaseCrashlytics (~> 8.0.0)
15-
- firebase_analytics (8.1.0):
15+
- firebase_analytics (8.1.2):
1616
- Firebase/Analytics (= 8.0.0)
1717
- firebase_core
1818
- Flutter
1919
- firebase_core (1.3.0):
2020
- Firebase/CoreOnly (= 8.0.0)
2121
- Flutter
22-
- firebase_crashlytics (2.0.4):
22+
- firebase_crashlytics (2.0.6):
2323
- Firebase/Crashlytics (= 8.0.0)
2424
- firebase_core
2525
- Flutter
@@ -229,9 +229,9 @@ EXTERNAL SOURCES:
229229
SPEC CHECKSUMS:
230230
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
231231
Firebase: 73c3e3b216ec1ecbc54d2ffdd4670c65c749edb1
232-
firebase_analytics: 221d3bc4e8f1b5144a4bd4cc6b33790ee51bd543
232+
firebase_analytics: 5e1820ff8ca6cc984fd4d1dedd2dd45965b91535
233233
firebase_core: cda81ae37eda6df2bc2d16027fda527987c4bd33
234-
firebase_crashlytics: 4f3ce855ce6116de954cde34f88003df8ed9de4a
234+
firebase_crashlytics: 1dad18971e1bac07bbd560c7a344df391a3a833c
235235
FirebaseAnalytics: dcb92c7c9ef4fa7ffac276e8f87bd4fc8c97f1b8
236236
FirebaseCore: 3f09591d51292843e2a46f18358d60bf4e996255
237237
FirebaseCoreDiagnostics: a31d987ba0fe16d59886a5dbadc2f1de871f88c8

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@
542542
ASSETCATALOG_COMPILER_APPICON_NAME = LaunchImage;
543543
CLANG_ENABLE_MODULES = YES;
544544
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
545+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
545546
DEVELOPMENT_TEAM = N742HF354K;
546547
ENABLE_BITCODE = NO;
547548
FRAMEWORK_SEARCH_PATHS = (

lib/core/managers/cache_manager.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ class CacheManager {
4646
try {
4747
await _cacheManager.putFile(
4848
key, UriData.fromString(value, encoding: utf8).contentAsBytes());
49-
} on Exception catch (e) {
49+
} on Exception catch (e, stacktrace) {
5050
_analyticsService.logError(
51-
tag, "Exception raised during cache update of $key: ${e.toString()}");
51+
tag,
52+
"Exception raised during cache update of $key: ${e.toString()}",
53+
e,
54+
stacktrace);
5255
rethrow;
5356
}
5457
}
@@ -57,19 +60,22 @@ class CacheManager {
5760
Future delete(String key) async {
5861
try {
5962
await _cacheManager.removeFile(key);
60-
} on Exception catch (e) {
63+
} on Exception catch (e, stacktrace) {
6164
_analyticsService.logError(
62-
tag, "Exception raised during cache delete of $key: ${e.toString()}");
65+
tag,
66+
"Exception raised during cache delete of $key: ${e.toString()}",
67+
e,
68+
stacktrace);
6369
}
6470
}
6571

6672
/// Empty the cache
6773
Future empty() async {
6874
try {
6975
await _cacheManager.emptyCache();
70-
} on Exception catch (e) {
76+
} on Exception catch (e, stacktrace) {
7177
_analyticsService.logError(
72-
tag, "Exception raised during emptying cache: $e");
78+
tag, "Exception raised during emptying cache: $e", e, stacktrace);
7379
rethrow;
7480
}
7581
}

lib/core/managers/course_repository.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ class CourseRepository {
132132
_logger.d(
133133
"$tag - getCoursesActivities: fetched ${fetchedCoursesActivities.length} activities.");
134134
}
135-
} on Exception catch (e) {
136-
_analyticsService.logError(
137-
tag, "Exception raised during getCoursesActivities: $e");
135+
} on Exception catch (e, stacktrace) {
136+
_analyticsService.logError(tag,
137+
"Exception raised during getCoursesActivities: $e", e, stacktrace);
138138
_logger.d("$tag - getCoursesActivities: Exception raised $e");
139139
rethrow;
140140
}
@@ -203,9 +203,9 @@ class CourseRepository {
203203
_logger.e(
204204
"$tag - getSessions: exception raised will trying to update the cache.");
205205
return _sessions;
206-
} on Exception catch (e) {
206+
} on Exception catch (e, stacktrace) {
207207
_analyticsService.logError(
208-
tag, "Exception raised during getSessions: $e");
208+
tag, "Exception raised during getSessions: $e", e, stacktrace);
209209
rethrow;
210210
}
211211

@@ -253,8 +253,9 @@ class CourseRepository {
253253
username: _userRepository.monETSUser.universalCode,
254254
password: password));
255255
_logger.d("$tag - getCourses: fetched ${fetchedCourses.length} courses.");
256-
} on Exception catch (e) {
257-
_analyticsService.logError(tag, "Exception raised during getCourses: $e");
256+
} on Exception catch (e, stacktrace) {
257+
_analyticsService.logError(
258+
tag, "Exception raised during getCourses: $e", e, stacktrace);
258259
_logger.e("$tag - getCourses: Exception raised $e");
259260
rethrow;
260261
}
@@ -315,15 +316,15 @@ class CourseRepository {
315316
password: password,
316317
course: course);
317318
_logger.d("$tag - getCourseSummary: fetched ${course.acronym} summary.");
318-
} on Exception catch (e) {
319+
} on Exception catch (e, stacktrace) {
319320
if (e is ApiException) {
320321
if (e.errorCode == SignetsError.gradesEmpty) {
321322
_logger.e(
322323
"$tag - getCourseSummary: Summary is empty for ${course.acronym}.");
323324
return null;
324325
}
325326
}
326-
_analyticsService.logError(tag, e.toString());
327+
_analyticsService.logError(tag, e.toString(), e, stacktrace);
327328
_logger.e("$tag - getCourseSummary: Exception raised $e");
328329
rethrow;
329330
}

lib/core/managers/user_repository.dart

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ class UserRepository {
8282
try {
8383
_monETSUser =
8484
await _monETSApi.authenticate(username: username, password: password);
85-
} catch (e) {
86-
_analyticsService.logError(tag, "Authenticate - ${e.toString()}");
85+
} on Exception catch (e, stacktrace) {
86+
_analyticsService.logError(
87+
tag, "Authenticate - ${e.toString()}", e, stacktrace);
8788
return false;
8889
}
8990

@@ -95,9 +96,12 @@ class UserRepository {
9596
try {
9697
await _secureStorage.write(key: usernameSecureKey, value: username);
9798
await _secureStorage.write(key: passwordSecureKey, value: password);
98-
} on PlatformException catch (e) {
99+
} on PlatformException catch (e, stacktrace) {
99100
_analyticsService.logError(
100-
tag, "Authenticate - PlatformException - ${e.toString()}");
101+
tag,
102+
"Authenticate - PlatformException - ${e.toString()}",
103+
e,
104+
stacktrace);
101105
return false;
102106
}
103107
}
@@ -128,9 +132,9 @@ class UserRepository {
128132
try {
129133
await _secureStorage.delete(key: usernameSecureKey);
130134
await _secureStorage.delete(key: passwordSecureKey);
131-
} on PlatformException catch (e) {
132-
_analyticsService.logError(
133-
tag, "Authenticate - PlatformException - ${e.toString()}");
135+
} on PlatformException catch (e, stacktrace) {
136+
_analyticsService.logError(tag,
137+
"Authenticate - PlatformException - ${e.toString()}", e, stacktrace);
134138
return false;
135139
}
136140
return true;
@@ -209,9 +213,9 @@ class UserRepository {
209213
_logger.e(
210214
"$tag - getPrograms: exception raised while trying to update the cache.");
211215
return _programs;
212-
} on Exception catch (e) {
216+
} on Exception catch (e, stacktrace) {
213217
_analyticsService.logError(
214-
tag, "Exception raised during getPrograms: $e");
218+
tag, "Exception raised during getPrograms: $e", e, stacktrace);
215219
rethrow;
216220
}
217221

@@ -265,8 +269,9 @@ class UserRepository {
265269
_logger.e(
266270
"$tag - getInfo: exception raised while trying to update the cache.");
267271
return _info;
268-
} on Exception catch (e) {
269-
_analyticsService.logError(tag, "Exception raised during getInfo: $e");
272+
} on Exception catch (e, stacktrace) {
273+
_analyticsService.logError(
274+
tag, "Exception raised during getInfo: $e", e, stacktrace);
270275
rethrow;
271276
}
272277

0 commit comments

Comments
 (0)