Skip to content

Commit e6905e7

Browse files
xsahil03xclaude
andcommitted
chore(sample): port Sentry → Firebase Crashlytics for v10
Pulls master's #2665 migration into v10's redesigned sample app so iOS builds again on Xcode 26.3 (sentry-cocoa fails to compile with the current Xcode). Build / platform config taken from master's #2665 commit verbatim: - sample_app/android/{app/build.gradle,build.gradle,settings.gradle} - sample_app/android/app/src/main/AndroidManifest.xml - sample_app/android/app/google-services.json - sample_app/ios/Runner.xcodeproj/project.pbxproj - sample_app/ios/Runner/Info.plist - sample_app/macos/Runner/{Info.plist,GoogleService-Info.plist} - sample_app/lib/firebase_options.dart Dart wiring ported to v10's redesigned layout: - sample_app/lib/main.dart — rewritten to match master's Crashlytics-only main(): post-Flutter-3.3 pattern with FlutterError.onError + PlatformDispatcher.instance.onError, runZonedGuarded dropped. - sample_app/lib/auth/auth_controller.dart — `_sampleAppLogHandler` now reports via FirebaseCrashlytics.recordError(reason: …) instead of Sentry.captureException. (v10 moved the handler out of app.dart, so master's diff lands here.) - sample_app/lib/utils/app_config.dart — `sentryDsn` removed. - sample_app/pubspec.yaml — drop `sentry_flutter`, add `firebase_crashlytics: ^5.2.0`. `firebase_crashlytics` floor is `^5.2.0` (not `^4.0.0` from #2665) — v10's `firebase_core: ^4.0.0` requires the 5.x line of the plugin. `melos.yaml` bumped to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c73de0f commit e6905e7

15 files changed

Lines changed: 107 additions & 96 deletions

File tree

melos.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ command:
4646
equatable: ^2.0.8
4747
ezanimation: ^0.6.0
4848
firebase_core: ^4.0.0
49-
firebase_crashlytics: ^4.0.0
49+
firebase_crashlytics: ^5.2.0
5050
firebase_messaging: ^16.0.0
5151
file_picker: ^11.0.0
5252
file_selector: ^1.1.0

sample_app/android/app/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id "com.android.application"
33
// START: FlutterFire Configuration
44
id "com.google.gms.google-services"
5+
id 'com.google.firebase.crashlytics'
56
// END: FlutterFire Configuration
67
id "kotlin-android"
78
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
@@ -10,7 +11,10 @@ plugins {
1011

1112
android {
1213
namespace "io.getstream.chat.android.flutter.sample"
13-
compileSdkVersion flutter.compileSdkVersion
14+
// Pin a floor of 36 so AAR metadata checks pass for transitive
15+
// dependencies that require it until Flutter's bundled
16+
// compileSdkVersion catches up.
17+
compileSdkVersion Math.max(flutter.compileSdkVersion, 36)
1418
ndkVersion "27.0.12077973"
1519

1620
compileOptions {

sample_app/android/app/google-services.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -94,42 +94,6 @@
9494
}
9595
}
9696
},
97-
{
98-
"client_info": {
99-
"mobilesdk_app_id": "1:674907137625:android:07c76802bbfd5654d7f348",
100-
"android_client_info": {
101-
"package_name": "com.sampleapp.rnpushtest"
102-
}
103-
},
104-
"oauth_client": [
105-
{
106-
"client_id": "674907137625-o5iqvv6dtmljtn069b5djv19ad9a7js0.apps.googleusercontent.com",
107-
"client_type": 3
108-
}
109-
],
110-
"api_key": [
111-
{
112-
"current_key": "AIzaSyBArS4RH7lUn3xbD-jhzWl5hVWZhliRgY0"
113-
}
114-
],
115-
"services": {
116-
"appinvite_service": {
117-
"other_platform_oauth_client": [
118-
{
119-
"client_id": "674907137625-o5iqvv6dtmljtn069b5djv19ad9a7js0.apps.googleusercontent.com",
120-
"client_type": 3
121-
},
122-
{
123-
"client_id": "674907137625-2a06km2oshvi7e9m52v95a30u0ek36up.apps.googleusercontent.com",
124-
"client_type": 2,
125-
"ios_info": {
126-
"bundle_id": "io.getstream.expotiktokapp"
127-
}
128-
}
129-
]
130-
}
131-
}
132-
},
13397
{
13498
"client_info": {
13599
"mobilesdk_app_id": "1:674907137625:android:c02fbdcc683148e1d7f348",
@@ -706,6 +670,42 @@
706670
}
707671
}
708672
},
673+
{
674+
"client_info": {
675+
"mobilesdk_app_id": "1:674907137625:android:cba499ae72f6ee4bd7f348",
676+
"android_client_info": {
677+
"package_name": "io.getstream.reactnative.sampleapp"
678+
}
679+
},
680+
"oauth_client": [
681+
{
682+
"client_id": "674907137625-o5iqvv6dtmljtn069b5djv19ad9a7js0.apps.googleusercontent.com",
683+
"client_type": 3
684+
}
685+
],
686+
"api_key": [
687+
{
688+
"current_key": "AIzaSyBArS4RH7lUn3xbD-jhzWl5hVWZhliRgY0"
689+
}
690+
],
691+
"services": {
692+
"appinvite_service": {
693+
"other_platform_oauth_client": [
694+
{
695+
"client_id": "674907137625-o5iqvv6dtmljtn069b5djv19ad9a7js0.apps.googleusercontent.com",
696+
"client_type": 3
697+
},
698+
{
699+
"client_id": "674907137625-2a06km2oshvi7e9m52v95a30u0ek36up.apps.googleusercontent.com",
700+
"client_type": 2,
701+
"ios_info": {
702+
"bundle_id": "io.getstream.expotiktokapp"
703+
}
704+
}
705+
]
706+
}
707+
}
708+
},
709709
{
710710
"client_info": {
711711
"mobilesdk_app_id": "1:674907137625:android:e20ff8f1ccbf76e4d7f348",

sample_app/android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,11 @@
6969
<meta-data
7070
android:name="com.google.firebase.messaging.default_notification_icon"
7171
android:resource="@drawable/ic_notification" />
72+
73+
<!-- Disable Crashlytics collection by default; re-enabled at runtime
74+
for non-debug builds. -->
75+
<meta-data
76+
android:name="firebase_crashlytics_collection_enabled"
77+
android:value="false" />
7278
</application>
7379
</manifest>

sample_app/android/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ subprojects {
1616
android.namespace = project.group
1717
}
1818

19-
// Align the compileSdkVersion with Flutter's compileSdkVersion
20-
android.compileSdkVersion = flutter.compileSdkVersion
19+
// Pin a floor of 36 so AAR metadata checks pass for transitive
20+
// dependencies that require it until Flutter's bundled
21+
// compileSdkVersion catches up.
22+
android.compileSdkVersion = Math.max(flutter.compileSdkVersion, 36)
2123
}
2224
}
2325

sample_app/android/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ plugins {
2121
id "com.android.application" version "8.12.2" apply false
2222
// START: FlutterFire Configuration
2323
id "com.google.gms.google-services" version "4.4.3" apply false
24+
id "com.google.firebase.crashlytics" version "2.8.1" apply false
2425
// END: FlutterFire Configuration
2526
id "org.jetbrains.kotlin.android" version "2.1.20" apply false
2627
}

sample_app/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,18 @@
268268
"${BUILT_PRODUCTS_DIR}/DKImagePickerController/DKImagePickerController.framework",
269269
"${BUILT_PRODUCTS_DIR}/DKPhotoGallery/DKPhotoGallery.framework",
270270
"${BUILT_PRODUCTS_DIR}/FirebaseCore/FirebaseCore.framework",
271+
"${BUILT_PRODUCTS_DIR}/FirebaseCoreExtension/FirebaseCoreExtension.framework",
271272
"${BUILT_PRODUCTS_DIR}/FirebaseCoreInternal/FirebaseCoreInternal.framework",
273+
"${BUILT_PRODUCTS_DIR}/FirebaseCrashlytics/FirebaseCrashlytics.framework",
272274
"${BUILT_PRODUCTS_DIR}/FirebaseInstallations/FirebaseInstallations.framework",
273275
"${BUILT_PRODUCTS_DIR}/FirebaseMessaging/FirebaseMessaging.framework",
276+
"${BUILT_PRODUCTS_DIR}/FirebaseRemoteConfigInterop/FirebaseRemoteConfigInterop.framework",
277+
"${BUILT_PRODUCTS_DIR}/FirebaseSessions/FirebaseSessions.framework",
274278
"${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework",
275279
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
276280
"${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework",
281+
"${BUILT_PRODUCTS_DIR}/PromisesSwift/Promises.framework",
277282
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
278-
"${BUILT_PRODUCTS_DIR}/Sentry/Sentry.framework",
279283
"${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework",
280284
"${BUILT_PRODUCTS_DIR}/audio_session/audio_session.framework",
281285
"${BUILT_PRODUCTS_DIR}/connectivity_plus/connectivity_plus.framework",
@@ -297,7 +301,6 @@
297301
"${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework",
298302
"${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework",
299303
"${BUILT_PRODUCTS_DIR}/record_ios/record_ios.framework",
300-
"${BUILT_PRODUCTS_DIR}/sentry_flutter/sentry_flutter.framework",
301304
"${BUILT_PRODUCTS_DIR}/share_plus/share_plus.framework",
302305
"${BUILT_PRODUCTS_DIR}/shared_preferences_foundation/shared_preferences_foundation.framework",
303306
"${BUILT_PRODUCTS_DIR}/sqflite_darwin/sqflite_darwin.framework",
@@ -312,14 +315,18 @@
312315
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKImagePickerController.framework",
313316
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKPhotoGallery.framework",
314317
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCore.framework",
318+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCoreExtension.framework",
315319
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCoreInternal.framework",
320+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCrashlytics.framework",
316321
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseInstallations.framework",
317322
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseMessaging.framework",
323+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseRemoteConfigInterop.framework",
324+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseSessions.framework",
318325
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework",
319326
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
320327
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework",
328+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Promises.framework",
321329
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
322-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sentry.framework",
323330
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework",
324331
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/audio_session.framework",
325332
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity_plus.framework",
@@ -341,7 +348,6 @@
341348
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework",
342349
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework",
343350
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/record_ios.framework",
344-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sentry_flutter.framework",
345351
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share_plus.framework",
346352
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences_foundation.framework",
347353
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite_darwin.framework",

sample_app/ios/Runner/Info.plist

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,18 @@
2727
<string>????</string>
2828
<key>CFBundleVersion</key>
2929
<string>$(FLUTTER_BUILD_NUMBER)</string>
30-
<key>ITSAppUsesNonExemptEncryption</key>
30+
<key>FirebaseCrashlyticsCollectionEnabled</key>
3131
<false/>
3232
<key>LSRequiresIPhoneOS</key>
3333
<true/>
34-
<key>NSAppTransportSecurity</key>
35-
<dict>
36-
<key>NSAllowsArbitraryLoads</key>
37-
<true/>
38-
</dict>
3934
<key>NSAppleMusicUsageDescription</key>
4035
<string>Used to send message attachments</string>
4136
<key>NSCameraUsageDescription</key>
4237
<string>Used to send message attachments</string>
4338
<key>NSLocationWhenInUseUsageDescription</key>
4439
<string>We need access to your location to share it in the chat.</string>
4540
<key>NSLocationAlwaysUsageDescription</key>
46-
<string>We need access to your location to share it in the chat.</string>
41+
<string>We need access to your location to share it in the chat.</string>
4742
<key>NSMicrophoneUsageDescription</key>
4843
<string>Used to send message attachments</string>
4944
<key>NSPhotoLibraryUsageDescription</key>
@@ -77,5 +72,12 @@
7772
</array>
7873
<key>UIViewControllerBasedStatusBarAppearance</key>
7974
<true/>
75+
<key>NSAppTransportSecurity</key>
76+
<dict>
77+
<key>NSAllowsArbitraryLoads</key>
78+
<true/>
79+
</dict>
80+
<key>ITSAppUsesNonExemptEncryption</key>
81+
<false/>
8082
</dict>
8183
</plist>

sample_app/lib/auth/auth_controller.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import 'dart:async';
22

3+
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
34
import 'package:flutter/foundation.dart';
45
import 'package:flutter/scheduler.dart';
56
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
67
import 'package:sample_app/push/push_provider.dart';
78
import 'package:sample_app/push/push_token_manager.dart';
89
import 'package:sample_app/utils/app_config.dart';
9-
import 'package:sentry_flutter/sentry_flutter.dart';
1010
import 'package:stream_chat_flutter/stream_chat_flutter.dart' hide PushProvider;
1111
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
1212

@@ -29,10 +29,12 @@ final _chatPersistenceClient = StreamChatPersistenceClient(
2929
Future<void> _sampleAppLogHandler(LogRecord record) async {
3030
if (kDebugMode) StreamChatClient.defaultLogHandler(record);
3131

32+
// report errors to Firebase Crashlytics
3233
if (record.error != null || record.stackTrace != null) {
33-
await Sentry.captureException(
34+
await FirebaseCrashlytics.instance.recordError(
3435
record.error,
35-
stackTrace: record.stackTrace,
36+
record.stackTrace,
37+
reason: record.message,
3638
);
3739
}
3840
}

sample_app/lib/firebase_options.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ class DefaultFirebaseOptions {
8282
databaseURL: 'https://stream-chat-internal.firebaseio.com',
8383
storageBucket: 'stream-chat-internal.appspot.com',
8484
androidClientId: '674907137625-0aa50j6b2i35ef9c52lsbk1v16otl492.apps.googleusercontent.com',
85-
iosClientId: '674907137625-p3msks3snq0h22l7ekpqcf0frr0vt8mg.apps.googleusercontent.com',
8685
iosBundleId: 'io.getstream.streamChatV1',
8786
);
8887
}

0 commit comments

Comments
 (0)