Make stream_chat_persistence a add on dependency instead of shipping it with the llc

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-27 12:52:37 +05:30
parent f48b7c8882
commit 1521558304
16 changed files with 126 additions and 187 deletions
@@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:stream_chat_persistence/stream_chat_persistence.dart';
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
import 'notifications_service.dart';
@@ -17,6 +18,11 @@ import 'routes/app_routes.dart';
import 'routes/routes.dart';
import 'search_text_field.dart';
final chatPersistentClient = StreamChatPersistenceClient(
logLevel: Level.INFO,
connectionMode: ConnectionMode.background,
);
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final secureStorage = FlutterSecureStorage();
@@ -29,8 +35,7 @@ void main() async {
logLevel: Level.INFO,
showLocalNotification:
(!kIsWeb && Platform.isAndroid) ? showLocalNotification : null,
persistenceEnabled: true,
);
)..chatPersistenceClient = chatPersistentClient;
if (userId != null) {
final token = await secureStorage.read(key: kStreamToken);