From 613aede46c685b0e43d01f6ceafd90d927a1447a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Fri, 14 Oct 2022 10:52:37 -0400 Subject: [PATCH] ios: add type for cloneConversation If iOS is in deep sleep mode, it will only wake up the daemon if a new activity needs to be shown (call, message or contact). If the peer accepts a trust request, it will clone and join the conversation (so a new message will be shown). So, cloning a conversation should notify the iOS device that the daemon MUST be started. GitLab: #776 Change-Id: I639a5f928fec2970909a29b9f3c33c165ac201c8 --- src/jamidht/conversation_module.cpp | 6 +++--- src/jamidht/conversation_module.h | 4 ++-- src/jamidht/jamiaccount.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/jamidht/conversation_module.cpp b/src/jamidht/conversation_module.cpp index 369f28635..f9850f904 100644 --- a/src/jamidht/conversation_module.cpp +++ b/src/jamidht/conversation_module.cpp @@ -337,7 +337,7 @@ ConversationModule::Impl::cloneConversation(const std::string& deviceId, } } return false; - }); + }, "application/im-gitmessage-id"); JAMI_INFO("[Account %s] New conversation detected: %s. Ask device %s to clone it", accountId_.c_str(), @@ -456,7 +456,7 @@ ConversationModule::Impl::fetchNewCommits(const std::string& peer, }, commitId); return true; - }); + }, ""); } else { if (getRequest(conversationId) != std::nullopt) return; @@ -1261,7 +1261,7 @@ ConversationModule::cloneConversationFrom(const std::string& conversationId, } } return false; - }); + }, "application/im-gitmessage-id"); }); ConvInfo info; info.id = conversationId; diff --git a/src/jamidht/conversation_module.h b/src/jamidht/conversation_module.h index 068a03f1a..83f3fcd15 100644 --- a/src/jamidht/conversation_module.h +++ b/src/jamidht/conversation_module.h @@ -42,9 +42,9 @@ struct SyncMsg }; using ChannelCb = std::function&)>; -using NeedSocketCb = std::function; +using NeedSocketCb = std::function; using SengMsgCb - = std::function&&, uint64_t)>; + = std::function, uint64_t)>; using NeedsSyncingCb = std::function&&)>; using UpdateConvReq = std::function; diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 4c044e16e..c98ce1c30 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -2350,8 +2350,8 @@ JamiAccount::convModule() // main thread. return sendTextMessage(uri, msg, token); }, - [this](const auto& convId, const auto& deviceId, auto&& cb) { - runOnMainThread([w = weak(), convId, deviceId, cb = std::move(cb)] { + [this](const auto& convId, const auto& deviceId, auto cb, const auto& type) { + runOnMainThread([w = weak(), convId, deviceId, cb = std::move(cb), type] { auto shared = w.lock(); if (!shared) return; @@ -2384,7 +2384,7 @@ JamiAccount::convModule() socket->shutdown(); } else cb({}); - }); + }, false, false, type); }); }, [this](auto&& convId, auto&& contactUri, bool accept) {