Skip to content

Commit a998272

Browse files
authored
Merge branch 'develop' into mute-for-specific-amount-of-time
2 parents f6ec489 + e1bbf4b commit a998272

File tree

26 files changed

+388
-1295
lines changed

26 files changed

+388
-1295
lines changed

nix/deps/nodejs-patched/default.nix

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ stdenv.mkDerivation {
1212
"patchBuildIdPhase"
1313
"patchHermesPhase"
1414
"patchJavaPhase"
15+
"patchYogaNodePackagePhase"
1516
"installPhase"
1617
];
1718

@@ -66,6 +67,14 @@ stdenv.mkDerivation {
6667
patchJavaPhase = ''
6768
${nodejs}/bin/node ./node_modules/jetifier/bin/jetify
6869
'';
70+
# Patch React Native Yoga.cpp file
71+
# FIXME: Remove this once release newer than 1.19.0 is used which includes:
72+
# https://github.com/facebook/yoga/commit/f174de70
73+
patchYogaNodePackagePhase = ''
74+
substituteInPlace ./node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp --replace \
75+
'node->getLayout().hadOverflow() |' \
76+
'node->getLayout().hadOverflow() ||'
77+
'';
6978
installPhase = ''
7079
mkdir -p $out
7180
cp -R node_modules $out/

nix/pkgs.nix

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ let
1111
# We follow the master branch of official nixpkgs.
1212
nixpkgsSrc = fetchFromGitHub {
1313
name = "nixpkgs-source";
14-
owner = "status-im"; # FIXME: Fork used to get Cocoapods 1.12.0.
14+
# FIXME: Fork used to get Cocoapods 1.12.0 and apksigner macOS build.
15+
owner = "status-im";
1516
repo = "nixpkgs";
16-
rev = "b9b2ed705edc00003d47625950602136be3e1ed5";
17-
sha256 = "sha256-F0qOawdKx7kgiGqwVikYIawL2taJ1XfcgHy0Wn0mho8=";
17+
rev = "d0c06fa3d3982a91aa01bd63ed84020cbde3d3ab";
18+
sha256 = "sha256-8blvuUHnuf0hFr/PpBxVohJp5CaGXIXhgJlFN/cv7us=";
1819
# To get the compressed Nix sha256, use:
1920
# nix-prefetch-url --unpack https://github.com/${ORG}/nixpkgs/archive/${REV}.tar.gz
2021
};

src/status_im/chat/models/input.cljs

+37-41
Original file line numberDiff line numberDiff line change
@@ -41,36 +41,19 @@
4141

4242
(rf/defn select-mention
4343
{:events [:chat.ui/select-mention]}
44-
[{:keys [db] :as cofx} text-input-ref {:keys [primary-name searched-text match] :as user}]
45-
(let [chat-id (:current-chat-id db)
46-
new-text (mentions/new-input-text-with-mention cofx user)
47-
at-sign-idx (get-in db [:chats/mentions chat-id :mentions :at-sign-idx])
48-
cursor (+ at-sign-idx (count primary-name) 2)]
49-
(rf/merge
50-
cofx
51-
{:db (-> db
52-
(assoc-in [:chats/cursor chat-id] cursor)
53-
(assoc-in [:chats/mention-suggestions chat-id] nil))
54-
:set-text-input-value [chat-id new-text text-input-ref]}
55-
(set-chat-input-text new-text chat-id)
56-
;; NOTE(rasom): Some keyboards do not react on selection property passed to
57-
;; text input (specifically Samsung keyboard with predictive text set on).
58-
;; In this case, if the user continues typing after the programmatic change,
59-
;; the new text is added to the last known cursor position before
60-
;; programmatic change. By calling `reset-text-input-cursor` we force the
61-
;; keyboard's cursor position to be changed before the next input.
62-
(mentions/reset-text-input-cursor text-input-ref cursor)
63-
;; NOTE(roman): on-text-input event is not dispatched when we change input
64-
;; programmatically, so we have to call `on-text-input` manually
65-
(mentions/on-text-input
66-
(let [match-len (count match)
67-
start (inc at-sign-idx)
68-
end (+ start match-len)]
69-
{:new-text match
70-
:previous-text searched-text
71-
:start start
72-
:end end}))
73-
(mentions/recheck-at-idxs {primary-name user}))))
44+
[{:keys [db] :as cofx} text-input-ref {:keys [primary-name searched-text match public-key] :as user}]
45+
(let [chat-id (:current-chat-id db)
46+
text (get-in db [:chat/inputs chat-id :input-text])
47+
method "wakuext_chatMentionNewInputTextWithMention"
48+
params [chat-id text primary-name]]
49+
{:json-rpc/call [{:method method
50+
:params params
51+
:on-success #(rf/dispatch [:mention/on-new-input-text-with-mentions-success %
52+
primary-name text-input-ref match searched-text
53+
public-key])
54+
:on-error #(rf/dispatch [:mention/on-error
55+
{:method method
56+
:params params} %])}]}))
7457

7558
(rf/defn disable-chat-cooldown
7659
"Turns off chat cooldown (protection against message spamming)"
@@ -182,8 +165,7 @@
182165
(rf/merge cofx
183166
{:set-text-input-value [current-chat-id ""]}
184167
(clean-input current-chat-id)
185-
(mentions/clear-mentions)
186-
(mentions/clear-cursor))))
168+
(mentions/clear-mentions))))
187169

188170
(rf/defn send-messages
189171
[{:keys [db] :as cofx} input-text current-chat-id]
@@ -251,13 +233,29 @@
251233
[{{:keys [current-chat-id] :as db} :db :as cofx}]
252234
(let [{:keys [input-text metadata]} (get-in db [:chat/inputs current-chat-id])
253235
editing-message (:editing-message metadata)
254-
input-text-with-mentions (mentions/check-mentions cofx input-text)]
255-
(rf/merge cofx
256-
(if editing-message
257-
(send-edited-message input-text-with-mentions editing-message)
258-
(send-messages input-text-with-mentions current-chat-id))
259-
(mentions/clear-mentions)
260-
(mentions/clear-cursor))))
236+
method "wakuext_chatMentionCheckMentions"
237+
params [current-chat-id input-text]]
238+
{:json-rpc/call [{:method method
239+
:params params
240+
:on-error #(rf/dispatch [:mention/on-error {:method method :params params} %])
241+
:on-success #(rf/dispatch [:mention/on-check-mentions-success
242+
current-chat-id
243+
editing-message
244+
input-text
245+
%])}]}))
246+
247+
(rf/defn on-check-mentions-success
248+
{:events [:mention/on-check-mentions-success]}
249+
[{:keys [db] :as cofx} current-chat-id editing-message input-text new-text]
250+
(log/debug "[mentions] on-check-mentions-success"
251+
{:chat-id current-chat-id
252+
:editing-message editing-message
253+
:input-text input-text
254+
:new-text new-text})
255+
(rf/merge cofx
256+
(if editing-message
257+
(send-edited-message new-text editing-message)
258+
(send-messages new-text current-chat-id))))
261259

262260
(rf/defn send-contact-request
263261
{:events [:contacts/send-contact-request]}
@@ -271,7 +269,6 @@
271269
:on-error #(log/warn "failed to send a contact request" %)
272270
:on-success #(re-frame/dispatch [:transport/message-sent %])}]}
273271
(mentions/clear-mentions)
274-
(mentions/clear-cursor)
275272
(clean-input (:current-chat-id db))))
276273

277274
(rf/defn cancel-contact-request
@@ -282,7 +279,6 @@
282279
(rf/merge cofx
283280
{:db (assoc-in db [:chat/inputs current-chat-id :metadata :sending-contact-request] nil)}
284281
(mentions/clear-mentions)
285-
(mentions/clear-cursor)
286282
(clean-input (:current-chat-id db)))))
287283

288284
(rf/defn chat-send-sticker

0 commit comments

Comments
 (0)