Skip to content

Commit

Permalink
Integrate firebase crashlytics (#122)
Browse files Browse the repository at this point in the history
* Integrate firebase crashlytics

* Add crash app type

* native implementation

---------

Co-authored-by: kaushik <[email protected]>
Co-authored-by: cp-ishita-g <[email protected]>
  • Loading branch information
3 people authored Oct 29, 2024
1 parent 8779e9c commit 0e88ea6
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
id 'com.google.firebase.crashlytics'
}

def localProperties = new Properties()
Expand Down
1 change: 1 addition & 0 deletions app/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.google.gms.google-services" version "4.3.15" apply false
id "com.google.firebase.crashlytics" version "2.8.1" apply false
}

include ":app"
40 changes: 40 additions & 0 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,9 @@ PODS:
- FirebaseAuth (~> 10.25.0)
- Firebase/CoreOnly (10.25.0):
- FirebaseCore (= 10.25.0)
- Firebase/Crashlytics (10.25.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 10.25.0)
- Firebase/Firestore (10.25.0):
- Firebase/CoreOnly
- FirebaseFirestore (~> 10.25.0)
Expand All @@ -997,6 +1000,10 @@ PODS:
- firebase_core (2.32.0):
- Firebase/CoreOnly (= 10.25.0)
- Flutter
- firebase_crashlytics (3.5.7):
- Firebase/Crashlytics (= 10.25.0)
- firebase_core
- Flutter
- firebase_messaging (14.9.4):
- Firebase/Messaging (= 10.25.0)
- firebase_core
Expand All @@ -1022,6 +1029,15 @@ PODS:
- FirebaseCore (~> 10.0)
- FirebaseCoreInternal (10.27.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseCrashlytics (10.25.0):
- FirebaseCore (~> 10.5)
- FirebaseInstallations (~> 10.0)
- FirebaseRemoteConfigInterop (~> 10.23)
- FirebaseSessions (~> 10.5)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (~> 2.1)
- FirebaseFirestore (10.25.0):
- FirebaseCore (~> 10.0)
- FirebaseCoreExtension (~> 10.0)
Expand Down Expand Up @@ -1065,6 +1081,16 @@ PODS:
- GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseMessagingInterop (10.27.0)
- FirebaseRemoteConfigInterop (10.27.0)
- FirebaseSessions (10.27.0):
- FirebaseCore (~> 10.5)
- FirebaseCoreExtension (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.13)
- GoogleUtilities/UserDefaults (~> 7.13)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (10.27.0)
- FirebaseStorage (10.25.0):
- FirebaseAppCheckInterop (~> 10.0)
Expand Down Expand Up @@ -1239,6 +1265,8 @@ PODS:
- permission_handler_apple (9.3.0):
- Flutter
- PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
- RecaptchaInterop (100.0.0)
- share_plus (0.0.1):
- Flutter
Expand All @@ -1261,6 +1289,7 @@ DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- firebase_storage (from `.symlinks/plugins/firebase_storage/ios`)
- Flutter (from `Flutter`)
Expand Down Expand Up @@ -1294,12 +1323,15 @@ SPEC REPOS:
- FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal
- FirebaseCrashlytics
- FirebaseFirestore
- FirebaseFirestoreInternal
- FirebaseFunctions
- FirebaseInstallations
- FirebaseMessaging
- FirebaseMessagingInterop
- FirebaseRemoteConfigInterop
- FirebaseSessions
- FirebaseSharedSwift
- FirebaseStorage
- GoogleDataTransport
Expand All @@ -1313,6 +1345,7 @@ SPEC REPOS:
- leveldb-library
- nanopb
- PromisesObjC
- PromisesSwift
- RecaptchaInterop
- Toast
- TOCropViewController
Expand All @@ -1332,6 +1365,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_auth/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_crashlytics:
:path: ".symlinks/plugins/firebase_crashlytics/ios"
firebase_messaging:
:path: ".symlinks/plugins/firebase_messaging/ios"
firebase_storage:
Expand Down Expand Up @@ -1385,6 +1420,7 @@ SPEC CHECKSUMS:
Firebase: 0312a2352584f782ea56f66d91606891d4607f06
firebase_auth: 5719ddc9f654b813405899480e84971bd8e61235
firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197
firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece
firebase_messaging: 06391e8f35dc65a00c56580266285263d2861f10
firebase_storage: 5c0f552d6b27d621429d7fd16ebab4be94a3c954
FirebaseAppCheckInterop: 0dd062c9926a76332ca5711dbed6f1a9ac540b54
Expand All @@ -1393,12 +1429,15 @@ SPEC CHECKSUMS:
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
FirebaseCoreExtension: 4ec89dd0c6de93d6becde32122d68b7c35f6bf5d
FirebaseCoreInternal: 4b297a2d56063dbea2c1d0d04222d44a8d058862
FirebaseCrashlytics: 4b96efb0ce73b38b2a85e8b8bd1bd8f63f09d015
FirebaseFirestore: 977ccc27a3caa5d68279f209c3b0450f85b9dc5f
FirebaseFirestoreInternal: 04b8afa77b4e5b84e86ab5ad985193e9573239fa
FirebaseFunctions: 93b1c7f352aec3922925a0e856cb1d6a09197083
FirebaseInstallations: 766dabca09fd94aef922538aaf144cc4a6fb6869
FirebaseMessaging: 88950ba9485052891ebe26f6c43a52bb62248952
FirebaseMessagingInterop: 8e911a5387664e849d316c5cd257c33fa1d37529
FirebaseRemoteConfigInterop: c55a739f5ab121792776e191d9fd437dc624a541
FirebaseSessions: 2fdf949f9e58295a57703ae8f2efc44f9fa3aa16
FirebaseSharedSwift: a03fe7a59ee646fef71099a887f774fe25d745b8
FirebaseStorage: 44f4e25073f6fa0d4d8c09f5bec299ee9e4eb985
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
Expand Down Expand Up @@ -1426,6 +1465,7 @@ SPEC CHECKSUMS:
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
Expand Down
23 changes: 23 additions & 0 deletions app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
0CD401F3BCA4EED2528C954B /* [CP] Embed Pods Frameworks */,
9425FCD72573146E4CEC649C /* [CP] Copy Pods Resources */,
636ADB5F2CC225B400AEBD76 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -314,6 +315,28 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
636ADB5F2CC225B400AEBD76 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist",
"$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist",
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols --build-phase --validate -ai 1:406838982484:ios:1f872619a1a0648f3afac1 -- $DWARF_DSYM_FOLDER_PATH/App.framework.dSYM\n";
};
9425FCD72573146E4CEC649C /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
8 changes: 8 additions & 0 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import 'package:data/service/location_service.dart';
import 'package:data/service/network_service.dart';
import 'package:data/storage/preferences_provider.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
Expand Down Expand Up @@ -44,6 +46,7 @@ void main() async {

final container = await _initContainer();
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;

startService();

Expand Down Expand Up @@ -89,6 +92,11 @@ void updateCurrentUserState(RemoteMessage message, NetworkService networkService

Future<ProviderContainer> _initContainer() async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
if (!kDebugMode) {
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
await FirebaseCrashlytics.instance.setCustomKey("app_type", "flutter");
}

locationService = LocationService(FirebaseFirestore.instance);
journeyService = ApiJourneyService(FirebaseFirestore.instance);
journeyRepository = JourneyRepository(journeyService);
Expand Down
16 changes: 16 additions & 0 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.17.5"
firebase_crashlytics:
dependency: "direct main"
description:
name: firebase_crashlytics
sha256: "9897c01efaa950d2f6da8317d12452749a74dc45f33b46390a14cfe28067f271"
url: "https://pub.dev"
source: hosted
version: "3.5.7"
firebase_crashlytics_platform_interface:
dependency: transitive
description:
name: firebase_crashlytics_platform_interface
sha256: "16a71e08fbf6e00382816e1b13397898c29a54fa0ad969c2c2a3b82a704877f0"
url: "https://pub.dev"
source: hosted
version: "3.6.35"
firebase_messaging:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ dependencies:
google_sign_in: ^6.1.6
logger: ^2.3.0
flutter_svg: ^2.0.9
firebase_crashlytics: ^3.5.7
# picker
connectivity_plus: ^6.0.5

Expand Down
2 changes: 1 addition & 1 deletion data/.flutter-plugins-dependencies

Large diffs are not rendered by default.

0 comments on commit 0e88ea6

Please sign in to comment.