diff --git a/js/background.js b/js/background.js index 8d5ebd1f1..2bbc96db6 100644 --- a/js/background.js +++ b/js/background.js @@ -238,6 +238,18 @@ specialConvInited = true; }; + const initLokiMessageAPIs = () => { + const ourKey = textsecure.storage.user.getNumber(); + if (!window.lokiMessageAPI) { + window.lokiMessageAPI = new window.LokiMessageAPI(ourKey); + } + + if (!window.lokiPublicChatAPI) { + // singleton to relay events to libtextsecure/message_receiver + window.lokiPublicChatAPI = new window.LokiPublicChatAPI(ourKey); + } + }; + const initAPIs = async () => { if (window.initialisedAPI) { return; @@ -1488,8 +1500,8 @@ return; } - await initAPIs(); - await initSpecialConversations(); + initLokiMessageAPIs(); + messageReceiver = new textsecure.MessageReceiver( USERNAME, PASSWORD, @@ -1525,6 +1537,9 @@ PASSWORD ); + await initAPIs(); + await initSpecialConversations(); + // On startup after upgrading to a new version, request a contact sync // (but only if we're not the primary device) if ( diff --git a/ts/components/session/LeftPaneChannelSection.tsx b/ts/components/session/LeftPaneChannelSection.tsx index f7a9cdd08..c5131f448 100644 --- a/ts/components/session/LeftPaneChannelSection.tsx +++ b/ts/components/session/LeftPaneChannelSection.tsx @@ -406,7 +406,8 @@ export class LeftPaneChannelSection extends React.Component { return; } - await window.doCreateGroup(groupName, groupMembers); + const groupMemberIds = groupMembers.map(m => m.id); + await window.doCreateGroup(groupName, groupMemberIds); this.handleToggleOverlay(undefined); window.pushToast({