fix(service): Fix defaultMuteState not being honoured
This commit is contained in:
parent
a08a110ef6
commit
21878ae135
@ -191,6 +191,7 @@ Future<void> performAddConversation(AddConversationCommand command, { dynamic ex
|
|||||||
final updatedConversation = await cs.updateConversation(
|
final updatedConversation = await cs.updateConversation(
|
||||||
conversation.id,
|
conversation.id,
|
||||||
open: true,
|
open: true,
|
||||||
|
lastChangeTimestamp: DateTime.now().millisecondsSinceEpoch,
|
||||||
);
|
);
|
||||||
|
|
||||||
sendEvent(
|
sendEvent(
|
||||||
@ -208,17 +209,17 @@ Future<void> performAddConversation(AddConversationCommand command, { dynamic ex
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
final preferences = await GetIt.I.get<PreferencesService>().getPreferences();
|
||||||
final conversation = await cs.addConversationFromData(
|
final conversation = await cs.addConversationFromData(
|
||||||
command.title,
|
command.title,
|
||||||
null,
|
null,
|
||||||
command.avatarUrl,
|
command.avatarUrl,
|
||||||
command.jid,
|
command.jid,
|
||||||
0,
|
0,
|
||||||
-1,
|
DateTime.now().millisecondsSinceEpoch,
|
||||||
true,
|
true,
|
||||||
// TODO(PapaTutuWawa): Take as an argument
|
preferences.defaultMuteState,
|
||||||
false,
|
preferences.enableOmemoByDefault,
|
||||||
(await GetIt.I.get<PreferencesService>().getPreferences()).enableOmemoByDefault,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
sendEvent(
|
sendEvent(
|
||||||
@ -341,24 +342,25 @@ Future<void> performAddContact(AddContactCommand command, { dynamic extra }) asy
|
|||||||
final c = await cs.updateConversation(
|
final c = await cs.updateConversation(
|
||||||
conversation.id,
|
conversation.id,
|
||||||
open: true,
|
open: true,
|
||||||
|
lastChangeTimestamp: DateTime.now().millisecondsSinceEpoch,
|
||||||
);
|
);
|
||||||
|
|
||||||
sendEvent(
|
sendEvent(
|
||||||
AddContactResultEvent(conversation: c, added: false),
|
AddContactResultEvent(conversation: c, added: false),
|
||||||
id: id,
|
id: id,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
final prefs = await GetIt.I.get<PreferencesService>().getPreferences();
|
||||||
final c = await cs.addConversationFromData(
|
final c = await cs.addConversationFromData(
|
||||||
jid.split('@')[0],
|
jid.split('@')[0],
|
||||||
null,
|
null,
|
||||||
'',
|
'',
|
||||||
jid,
|
jid,
|
||||||
0,
|
0,
|
||||||
-1,
|
DateTime.now().millisecondsSinceEpoch,
|
||||||
true,
|
true,
|
||||||
// TODO(PapaTutuWawa): Take as an argument
|
prefs.defaultMuteState,
|
||||||
false,
|
prefs.enableOmemoByDefault,
|
||||||
(await GetIt.I.get<PreferencesService>().getPreferences()).enableOmemoByDefault,
|
|
||||||
);
|
);
|
||||||
sendEvent(
|
sendEvent(
|
||||||
AddContactResultEvent(conversation: c, added: true),
|
AddContactResultEvent(conversation: c, added: true),
|
||||||
|
@ -271,7 +271,16 @@ class ConversationBloc extends Bloc<ConversationEvent, ConversationState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onJidAdded(JidAddedEvent event, Emitter<ConversationState> emit) async {
|
Future<void> _onJidAdded(JidAddedEvent event, Emitter<ConversationState> emit) async {
|
||||||
// TODO(Unknown): Maybe have some state here
|
// Just update the state here. If it does not work, then the next conversation
|
||||||
|
// update will fix it.
|
||||||
|
emit(
|
||||||
|
state.copyWith(
|
||||||
|
conversation: state.conversation!.copyWith(
|
||||||
|
inRoster: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
await MoxplatformPlugin.handler.getDataSender().sendData(
|
await MoxplatformPlugin.handler.getDataSender().sendData(
|
||||||
AddContactCommand(jid: state.conversation!.jid),
|
AddContactCommand(jid: state.conversation!.jid),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user