Fix OMEMO new device notifications appearing in wrong context
This commit is contained in:
parent
952ac95484
commit
a493269791
|
@ -17,6 +17,8 @@ public class DeviceNotificationPopulator : NotificationPopulator, Object {
|
||||||
public DeviceNotificationPopulator(Plugin plugin, StreamInteractor stream_interactor) {
|
public DeviceNotificationPopulator(Plugin plugin, StreamInteractor stream_interactor) {
|
||||||
this.stream_interactor = stream_interactor;
|
this.stream_interactor = stream_interactor;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
|
stream_interactor.account_added.connect(on_account_added);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool has_new_devices(Jid jid) {
|
public bool has_new_devices(Jid jid) {
|
||||||
|
@ -28,11 +30,6 @@ public class DeviceNotificationPopulator : NotificationPopulator, Object {
|
||||||
public void init(Conversation conversation, NotificationCollection notification_collection, Plugins.WidgetType type) {
|
public void init(Conversation conversation, NotificationCollection notification_collection, Plugins.WidgetType type) {
|
||||||
current_conversation = conversation;
|
current_conversation = conversation;
|
||||||
this.notification_collection = notification_collection;
|
this.notification_collection = notification_collection;
|
||||||
stream_interactor.module_manager.get_module(conversation.account, StreamModule.IDENTITY).bundle_fetched.connect_after((jid, device_id, bundle) => {
|
|
||||||
if (jid.equals(conversation.counterpart) && has_new_devices(conversation.counterpart) && conversation.type_ == Conversation.Type.CHAT) {
|
|
||||||
display_notification();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (has_new_devices(conversation.counterpart) && conversation.type_ == Conversation.Type.CHAT) {
|
if (has_new_devices(conversation.counterpart) && conversation.type_ == Conversation.Type.CHAT) {
|
||||||
display_notification();
|
display_notification();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +53,14 @@ public class DeviceNotificationPopulator : NotificationPopulator, Object {
|
||||||
notification = null;
|
notification = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void on_account_added(Account account) {
|
||||||
|
stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).bundle_fetched.connect_after((jid, device_id, bundle) => {
|
||||||
|
if (jid.equals(current_conversation.counterpart) && has_new_devices(current_conversation.counterpart)) {
|
||||||
|
display_notification();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ConversationNotification : MetaConversationNotification {
|
private class ConversationNotification : MetaConversationNotification {
|
||||||
|
|
Loading…
Reference in a new issue