Merge branch 'develop' into release/4.0
This commit is contained in:
@@ -40,7 +40,7 @@ android {
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.example"
|
||||
minSdkVersion 21
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 30
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
|
||||
@@ -293,10 +293,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
|
||||
),
|
||||
);
|
||||
|
||||
final client = StreamChatClient(
|
||||
apiKey,
|
||||
logLevel: Level.INFO,
|
||||
)..chatPersistenceClient = chatPersistentClient;
|
||||
final client = buildStreamChatClient(apiKey);
|
||||
|
||||
try {
|
||||
await client.connectUser(
|
||||
|
||||
@@ -143,7 +143,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
context,
|
||||
Routes.CHANNEL_PAGE,
|
||||
ModalRoute.withName(Routes.HOME),
|
||||
ModalRoute.withName(Routes.CHANNEL_LIST_PAGE),
|
||||
arguments: ChannelPageArgs(channel: channel),
|
||||
);
|
||||
} catch (err) {
|
||||
|
||||
@@ -8,12 +8,12 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:stream_chat_localizations/stream_chat_localizations.dart';
|
||||
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
|
||||
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
|
||||
|
||||
import 'app_config.dart';
|
||||
import 'routes/app_routes.dart';
|
||||
import 'routes/routes.dart';
|
||||
|
||||
@@ -22,8 +22,65 @@ final chatPersistentClient = StreamChatPersistenceClient(
|
||||
connectionMode: ConnectionMode.regular,
|
||||
);
|
||||
|
||||
void sampleAppLogHandler(LogRecord record) async {
|
||||
if (kDebugMode) StreamChatClient.defaultLogHandler(record);
|
||||
|
||||
// report errors to sentry
|
||||
if (record.error != null || record.stackTrace != null) {
|
||||
await Sentry.captureException(
|
||||
record.error,
|
||||
stackTrace: record.stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
StreamChatClient buildStreamChatClient(
|
||||
String apiKey, {
|
||||
Level logLevel = Level.SEVERE,
|
||||
}) {
|
||||
return StreamChatClient(
|
||||
apiKey,
|
||||
logLevel: logLevel,
|
||||
logHandlerFunction: sampleAppLogHandler,
|
||||
)..chatPersistenceClient = chatPersistentClient;
|
||||
}
|
||||
|
||||
void main() async {
|
||||
runApp(MyApp());
|
||||
const sentryDsn =
|
||||
'https://6381ef88de4140db8f5e25ab37e0f08c@o1213503.ingest.sentry.io/6352870';
|
||||
|
||||
/// Captures errors reported by the Flutter framework.
|
||||
FlutterError.onError = (FlutterErrorDetails details) {
|
||||
if (kDebugMode) {
|
||||
// In development mode, simply print to console.
|
||||
FlutterError.dumpErrorToConsole(details);
|
||||
} else {
|
||||
// In production mode, report to the application zone to report to sentry.
|
||||
Zone.current.handleUncaughtError(details.exception, details.stack!);
|
||||
}
|
||||
};
|
||||
|
||||
Future<void> _reportError(dynamic error, StackTrace stackTrace) async {
|
||||
// Print the exception to the console.
|
||||
if (kDebugMode) {
|
||||
// Print the full stacktrace in debug mode.
|
||||
print(stackTrace);
|
||||
return;
|
||||
} else {
|
||||
// Send the Exception and Stacktrace to sentry in Production mode.
|
||||
await Sentry.captureException(error, stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
runZonedGuarded(
|
||||
() async {
|
||||
await SentryFlutter.init(
|
||||
(options) => options.dsn = sentryDsn,
|
||||
);
|
||||
runApp(MyApp());
|
||||
},
|
||||
_reportError,
|
||||
);
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
@@ -45,10 +102,7 @@ class _MyAppState extends State<MyApp>
|
||||
token = await secureStorage.read(key: kStreamToken);
|
||||
}
|
||||
|
||||
final client = StreamChatClient(
|
||||
apiKey ?? kDefaultStreamApiKey,
|
||||
logLevel: Level.SEVERE,
|
||||
)..chatPersistenceClient = chatPersistentClient;
|
||||
final client = buildStreamChatClient(apiKey ?? kStreamApiKey);
|
||||
|
||||
if (userId != null && token != null) {
|
||||
await client.connectUser(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: example
|
||||
description: A new Flutter project.
|
||||
publish_to: 'none'
|
||||
version: 1.7.1
|
||||
version: 1.8.1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
@@ -26,13 +26,14 @@ dependencies:
|
||||
ref: v4
|
||||
path: packages/stream_chat_localizations
|
||||
flutter_local_notifications: ^9.0.0
|
||||
flutter_svg: ^1.0.1
|
||||
flutter_secure_storage: ^4.2.1
|
||||
flutter_svg: ^1.0.3
|
||||
flutter_secure_storage: ^5.0.2
|
||||
yaml: ^3.1.0
|
||||
uuid: ^3.0.5
|
||||
streaming_shared_preferences: ^2.0.0
|
||||
lottie: ^1.2.1
|
||||
collection: ^1.15.0
|
||||
sentry_flutter: ^6.5.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_launcher_icons: ^0.9.2
|
||||
|
||||
Reference in New Issue
Block a user