[StreamChatPersistence] Fix ownReactions userId bug
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -12,9 +12,10 @@ import '../moor_chat_database.dart';
|
||||
|
||||
class SharedDB {
|
||||
static Future<VmDatabase> constructDatabase(
|
||||
String dbName, {
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
}) async {
|
||||
final dbName = 'db_$userId';
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final path = join(dir.path, '$dbName.sqlite');
|
||||
@@ -62,15 +63,16 @@ class SharedDB {
|
||||
}
|
||||
|
||||
static Future<MoorChatDatabase> constructOfflineStorage(
|
||||
String dbName, {
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
}) async {
|
||||
final dbName = 'db_$userId';
|
||||
final isolate = await _createMoorIsolate(
|
||||
dbName,
|
||||
logStatements: logStatements,
|
||||
);
|
||||
final connection = await isolate.connect();
|
||||
return MoorChatDatabase.connect(isolate, connection);
|
||||
return MoorChatDatabase.connect(userId, isolate, connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
class SharedDB {
|
||||
static constructDatabase(
|
||||
String dbName, {
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
}) {
|
||||
throw 'Unsupported Platform';
|
||||
}
|
||||
|
||||
static constructOfflineStorage(
|
||||
String dbName, {
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
}) {
|
||||
throw 'Unsupported Platform';
|
||||
|
||||
@@ -6,16 +6,18 @@ import '../moor_chat_database.dart';
|
||||
|
||||
class SharedDB {
|
||||
static constructDatabase(
|
||||
String dbName, {
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
}) async {
|
||||
final dbName = 'db_$userId';
|
||||
return WebDatabase(dbName, logStatements: logStatements);
|
||||
}
|
||||
|
||||
static Future<MoorChatDatabase> constructOfflineStorage(
|
||||
String dbName, {
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
}) async {
|
||||
final dbName = 'db_$userId';
|
||||
return MoorChatDatabase(dbName, logStatements: logStatements);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user