-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat refactoring: updated send-message namespace #2795
Conversation
5030b44
to
10a3d84
Compare
10a3d84
to
046d8cd
Compare
#2572 is merged, @yenda @janherich please review this PR |
:chat-id chat-id})))) | ||
|
||
(handlers/register-handler-fx | ||
:chat-send-message/send-message! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handler should be pure, it should return data with fx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
(send-notification fcm-token (:message options)))))))))) | ||
|
||
(handlers/register-handler-fx | ||
:chat-send-message/send-command! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, should be pure
[(re-frame/inject-cofx :random-id) | ||
(re-frame/inject-cofx :random-id-seq) | ||
(re-frame/inject-cofx :get-stored-chat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:get-stored-chat
can we get this from db
? not from realm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and :get-last-clock-value
?
|
||
(defn send-message [{{:keys [network-status] :as db} :db | ||
:keys [now get-stored-chat]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function should be pure too
src/status_im/chat/events/input.cljs
Outdated
:chat-id current-chat-id | ||
:identity current-public-key | ||
:address current-account-id})] | ||
(assoc cofx' :db (-> (:db cofx') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no reason to return cofx
it's confusing, better to return effects
or fx
app is hanging after sending password confirm |
@alwx What's the status of this PR? |
The original issue is fixed. The only thing that is left to be done is rebasing the branch. I've also found some other things that can be simplified, but these parts can probably be skipped now. |
c8dca07
to
ff34aa4
Compare
It's finished. Please, check. |
src/status_im/chat/events/input.cljs
Outdated
:chat-id current-chat-id | ||
:identity current-public-key | ||
:address current-account-id})] | ||
(assoc fx :db (-> (:db fx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like update
no?
src/status_im/chat/events/input.cljs
Outdated
|
||
(handlers/register-handler-fx | ||
::send-command | ||
message-model/send-interceptors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the ::send-command
handler duplicated ?
(filter :hidden) | ||
(map :name)) | ||
command' (prepare-command current-public-key chat-id (get-last-clock-value chat-id) request content) | ||
preview (get-in db [:message-data :preview (:message-id command')]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no :message-data
anymore, please check the current code
All code style issues have been fixed. |
e19a040
to
03a1ed5
Compare
dc43da1
to
7468955
Compare
@yenda there are no change requests from me, just comments |
@alwx , @yenda The latest build of this branch (Android: https://i.diawi.com/Ni4DY3, iOS: https://i.diawi.com/CeuTFs) has been tested on iOS (11.2.2) and Android (7.0) The only issue is present: it's exactly what described in #2807 (comment) (no indication on sender side that /location, /request, /send in group chat delivered to any of group chat members). This issue is not present in latest develop build (25th of January), not present in develop build from 22nd of January. |
@Serhy checking |
2827f5f
to
ef17f05
Compare
@Serhy Please, take a look at these builds ASAP, because it's already time to merge this branch. Thanks! Android: https://i.diawi.com/PftqWL |
ef17f05
to
d7f9330
Compare
Builds for Android: https://i.diawi.com/ez6PN8 and iOS: https://i.diawi.com/JcYz9K was tested on Android 7.0 (Samsung real device) and iOS 11.2.2. Upgrade from 0.9.13 tested on Android 6.0 emulator. |
d7f9330
to
4d733ce
Compare
…if quickly tap on send button Signed-off-by: Dmitry Novotochinov <trybeee@gmail.com>
4d733ce
to
74f9ea3
Compare
#2572 should be merged first!
This PR removes side effects from send-message namespace and makes it a little easier.
However, there are things that should be done next (and will be done in the next PRs):
status-im.commands.handlers.jail
:chat-send-message/send-command!
and:chat-send-message/send-message!
(the logic of these two methods is different, but can be generalized)