Skip to content
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

Merged
merged 1 commit into from
Feb 1, 2018

Conversation

alwx
Copy link
Contributor

@alwx alwx commented Dec 22, 2017

#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):

  1. Refactoring of status-im.commands.handlers.jail
  2. Simplification of :chat-send-message/send-command! and :chat-send-message/send-message! (the logic of these two methods is different, but can be generalized)

@alwx alwx self-assigned this Dec 22, 2017
@alwx alwx force-pushed the feature/chat-send-message-refactoring branch 2 times, most recently from 5030b44 to 10a3d84 Compare December 22, 2017 11:44
@alwx alwx changed the title WIP: Chat refactoring: updated send-message namespace Chat refactoring: updated send-message namespace Dec 23, 2017
@alwx alwx requested review from yenda and janherich December 23, 2017 09:15
@flexsurfer flexsurfer force-pushed the feature/chat-send-message-refactoring branch from 10a3d84 to 046d8cd Compare December 25, 2017 20:48
@flexsurfer
Copy link
Member

#2572 is merged, @yenda @janherich please review this PR

:chat-id chat-id}))))

(handlers/register-handler-fx
:chat-send-message/send-message!
Copy link
Member

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

Copy link
Member

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!
Copy link
Member

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)
Copy link
Member

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

Copy link
Member

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]}
Copy link
Member

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

:chat-id current-chat-id
:identity current-public-key
:address current-account-id})]
(assoc cofx' :db (-> (:db cofx')
Copy link
Member

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

@flexsurfer
Copy link
Member

app is hanging after sending password confirm

@oskarth
Copy link
Contributor

oskarth commented Jan 2, 2018

@alwx What's the status of this PR?

@alwx
Copy link
Contributor Author

alwx commented Jan 4, 2018

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.

@alwx alwx force-pushed the feature/chat-send-message-refactoring branch 3 times, most recently from c8dca07 to ff34aa4 Compare January 5, 2018 09:12
@alwx alwx requested a review from flexsurfer January 5, 2018 09:12
@alwx
Copy link
Contributor Author

alwx commented Jan 5, 2018

It's finished. Please, check.

:chat-id current-chat-id
:identity current-public-key
:address current-account-id})]
(assoc fx :db (-> (:db fx)
Copy link
Member

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?


(handlers/register-handler-fx
::send-command
message-model/send-interceptors
Copy link
Contributor

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')])
Copy link
Contributor

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

@alwx
Copy link
Contributor Author

alwx commented Jan 8, 2018

All code style issues have been fixed.

@alwx alwx force-pushed the feature/chat-send-message-refactoring branch from e19a040 to 03a1ed5 Compare January 8, 2018 08:05
@yenda yenda force-pushed the feature/chat-send-message-refactoring branch from dc43da1 to 7468955 Compare January 25, 2018 01:05
@flexsurfer
Copy link
Member

flexsurfer commented Jan 25, 2018

@yenda there are no change requests from me, just comments

@Serhy
Copy link
Contributor

Serhy commented Jan 25, 2018

@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.

@alwx
Copy link
Contributor Author

alwx commented Jan 25, 2018

@Serhy checking

@alwx alwx force-pushed the feature/chat-send-message-refactoring branch 4 times, most recently from 2827f5f to ef17f05 Compare January 29, 2018 09:31
@alwx
Copy link
Contributor Author

alwx commented Jan 29, 2018

@Serhy
Sorry, there was a problem with Jenkins, that's why it took some time. The problem described by you, by the way, exists in master as well, but maybe due to restructuring it doesn't affect things there the way it affects them here :)

Please, take a look at these builds ASAP, because it's already time to merge this branch. Thanks!

Android: https://i.diawi.com/PftqWL
iOS: https://i.diawi.com/PjAdXb

@alwx alwx force-pushed the feature/chat-send-message-refactoring branch from ef17f05 to d7f9330 Compare January 30, 2018 21:28
@Serhy
Copy link
Contributor

Serhy commented Feb 1, 2018

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.
No any regression found! Looks good for merge!

@alwx alwx force-pushed the feature/chat-send-message-refactoring branch from d7f9330 to 4d733ce Compare February 1, 2018 15:56
…if quickly tap on send button

Signed-off-by: Dmitry Novotochinov <trybeee@gmail.com>
@dmitryn dmitryn force-pushed the feature/chat-send-message-refactoring branch from 4d733ce to 74f9ea3 Compare February 1, 2018 16:17
@dmitryn dmitryn merged commit 74f9ea3 into develop Feb 1, 2018
@rasom rasom deleted the feature/chat-send-message-refactoring branch April 19, 2018 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants