This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Stream<List<Channel>> get channelsThatTheUserIsIncluded { | |
return streamChatClient | |
.queryChannels( | |
filter: Filter.in_( | |
'members', | |
[streamChatClient.state.currentUser!.id], | |
), | |
) | |
.map((listOfChannels) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Future<void> disconnectUser() async { | |
await streamChatClient.disconnectUser(); | |
} | |
@override | |
Future<void> connectTheCurrentUser() async { | |
final signedInUserOption = await _firebaseAuth.getSignedInUser(); | |
final signedInUser = signedInUserOption.fold( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Stream<ChatUserModel> get chatAuthStateChanges { | |
return streamChatClient.state.currentUserStream.map( | |
(OwnUser? user) { | |
if (user == null) { | |
return ChatUserModel.empty(); | |
} else { | |
return user.toDomain(); | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension GetstreamUserDomainX on OwnUser { | |
ChatUserModel toDomain() { | |
return ChatUserModel( | |
createdAt: formatDate(createdAt, [yyyy, '-', mm, '-', dd]), | |
userRole: role?.toUpperCase() ?? "?", | |
isUserBanned: banned, | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@module | |
abstract class InjectableModule { | |
@singleton | |
Connectivity get connectivity => Connectivity(); | |
@singleton | |
AppRouter get appRouter => AppRouter(); | |
@lazySingleton | |
FirebaseAuth get firebaseAuth => FirebaseAuth.instance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class IConnectivityService { | |
Stream<ConnectivityResult> get connectivityStateChanges; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class IMicrophoneService { | |
Stream<PermissionStatus> get microphoneStateChanges; | |
Future<PermissionStatus> requestPermission(); | |
Future<void> openAppSettingsForTheMicrophonePermission(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class ICameraService { | |
Stream<PermissionStatus> get cameraStateChanges; | |
Future<PermissionStatus> requestPermission(); | |
Future<void> openAppSettingsForTheCameraPermission(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class IChatService { | |
Stream<ChatUserModel> get chatAuthStateChanges; | |
Stream<List<Channel>> get channelsThatTheUserIsIncluded; | |
Future<void> disconnectUser(); | |
Future<void> connectTheCurrentUser(); | |
Future<void> createNewChannel({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part 'chat_user_model.freezed.dart'; | |
part 'chat_user_model.g.dart'; | |
@freezed | |
class ChatUserModel with _$ChatUserModel { | |
const factory ChatUserModel({ | |
required String createdAt, | |
required String userRole, | |
required bool isUserBanned, | |
}) = _ChatUserModel; |