Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
749 B

import 'package:Envelope/database/models/my_profile.dart';
import '/database/models/conversations.dart';
import '/utils/storage/database.dart';
class DeviceTokensRepository {
static Future<List<String>> getDeviceTokensForConversation(Conversation conversation) async {
final db = await getDatabaseConnection();
MyProfile profile = await MyProfile.getProfile();
final List<Map<String, dynamic>> maps = await db.rawQuery(
'''
SELECT device_tokens.token from device_tokens
WHERE user_id IN (
SELECT user_id FROM conversation_users
WHERE conversation_id = ?
)
''',
[ conversation.id ],
);
return List.generate(maps.length, (i) {
return maps[i]['token'];
});
}
}