Compare commits

...
Author SHA1 Message Date
Andrey Shovkoplyas ff6cb2292d fix crash on ios
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2020-05-02 11:43:45 +02:00
Andrey Shovkoplyas 25727bc281 1.3.1 2020-05-02 11:43:45 +02:00
Andrea Maria Piana 00d63edf93 Handle when message confirmations arrive out of order.
In some cases message confirmations might arrive out of order, before
status-go calls the callback for a sent message.

This commit changes the behavior so that confirmations out of order are
not ignored and they are checked when the callback for sending message
is called.

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-04-22 16:56:05 +02:00
Andrey Shovkoplyas 67ceb74c6e [#10396] Quoted text (using markdown) in dark mode is hardly visible
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2020-04-22 15:58:38 +02:00
Andrea Maria Piana 4aa90f2b9b Fix replies emoji messages
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2020-04-21 15:00:14 +02:00
Andrey Shovkoplyas 51ce235948 [#10369] App freezes on transaction signing after entering wrong password
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2020-04-20 20:05:36 +02:00
Andrey Shovkoplyas cf63839a86 [#10366] App Dark mode: signing phrase+message not visible when Signing message in Dapps
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2020-04-20 14:36:38 +02:00
Andrey Shovkoplyas 4904e923a5 enable group chats 2020-04-17 17:52:53 +02:00
Andrey Shovkoplyas 427d9f05a1 1.3.0 2020-04-17 16:54:16 +02:00
12 changed files with 69 additions and 56 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ ERC20_CONTRACT_WARNINGS=0
ETHEREUM_DEV_CLUSTER=0
EXTENSIONS=0
FLEET=eth.prod
GROUP_CHATS_ENABLED=0
GROUP_CHATS_ENABLED=1
LOG_LEVEL_STATUS_GO=
LOG_LEVEL=info
MAILSERVER_CONFIRMATIONS_ENABLED=1
+1 -1
View File
@@ -1 +1 @@
0.14.0
1.3.1
+1 -1
View File
@@ -54,7 +54,7 @@
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
_blankView = [[UIView alloc]initWithFrame:self.window.frame];
_blankView.backgroundColor = [UIColor systemBackgroundColor];
_blankView.backgroundColor = [UIColor whiteColor];
_blankView.alpha = 0;
UIViewController *rootViewController = [UIViewController new];
+6 -9
View File
@@ -812,15 +812,12 @@
(handlers/register-handler-fx
:transport/message-sent
(fn [cofx [_ response messages-count]]
(let [{:keys [localChatId id messageType]} (-> response :messages first)]
(fx/merge cofx
(handle-update response)
(transport.message/set-message-envelope-hash localChatId id messageType messages-count)))))
(handlers/register-handler-fx
:transport/contact-message-sent
(fn [cofx [_ chat-id envelope-hash]]
(transport.message/set-contact-message-envelope-hash cofx chat-id envelope-hash)))
(let [set-hash-fxs (map (fn [{:keys [localChatId id messageType]}]
(transport.message/set-message-envelope-hash localChatId id messageType messages-count))
(:messages response))]
(apply fx/merge cofx
(conj set-hash-fxs
(handle-update response))))))
(handlers/register-handler-fx
:transport.callback/node-info-fetched
+3 -1
View File
@@ -335,7 +335,9 @@
{:events [:signing/transaction-completed]
:interceptors [(re-frame/inject-cofx :random-id-generator)]}
[cofx response tx-obj hashed-password]
(let [cofx-in-progress-false (assoc-in cofx [:db :signing/in-progress?] false)
(let [cofx-in-progress-false (-> cofx
(assoc-in [:db :signing/in-progress?] false)
(assoc-in [:db :signing/sign :in-progress?] false))
{:keys [result error]} (types/json->clj response)]
(log/debug "transaction-completed" error tx-obj)
(if error
+25 -25
View File
@@ -95,37 +95,37 @@
confirmations)}))))
(fx/defn update-envelope-status
[{:keys [db] :as cofx} envelope-hash status]
(let [{:keys [chat-id message-type message-id]}
(get-in db [:transport/message-envelopes envelope-hash])]
(case message-type
:contact-message
(when (= :sent status)
(remove-hash cofx envelope-hash))
(when-let [{:keys [from]} (get-in db [:chats chat-id :messages message-id])]
(check-confirmations cofx status chat-id message-id)))))
[{:keys [db] :as cofx} message-id status]
(if-let [{:keys [chat-id]}
(get-in db [:transport/message-envelopes message-id])]
(when-let [{:keys [from]} (get-in db [:chats chat-id :messages message-id])]
(check-confirmations cofx status chat-id message-id))
;; We don't have a message-envelope for this, might be that the confirmation
;; came too early
{:db (update-in db [:transport/message-confirmations message-id] conj status)}))
(fx/defn update-envelopes-status
[{:keys [db] :as cofx} envelope-hashes status]
(apply fx/merge cofx (map #(update-envelope-status % status) envelope-hashes)))
(fx/defn set-contact-message-envelope-hash
[{:keys [db] :as cofx} chat-id envelope-hash]
{:db (assoc-in db [:transport/message-envelopes envelope-hash]
{:chat-id chat-id
:message-type :contact-message})})
[{:keys [db] :as cofx} message-id status]
(apply fx/merge cofx (map #(update-envelope-status % status) message-id)))
(fx/defn set-message-envelope-hash
"message-type is used for tracking"
[{:keys [db] :as cofx} chat-id message-id message-type messages-count]
{:db (-> db
(assoc-in [:transport/message-envelopes message-id]
{:chat-id chat-id
:message-id message-id
:message-type message-type})
(update-in [:transport/message-ids->confirmations message-id]
#(or % {:pending-confirmations messages-count})))})
;; Check first if the confirmation has already arrived
(let [statuses (get-in db [:transport/message-confirmations message-id])
check-confirmations-fx (map
#(check-confirmations % chat-id message-id)
statuses)
add-envelope-data (fn [{:keys [db]}]
{:db (-> db
(update :transport/message-confirmations dissoc message-id)
(assoc-in [:transport/message-envelopes message-id]
{:chat-id chat-id
:message-type message-type})
(update-in [:transport/message-ids->confirmations message-id]
#(or % {:pending-confirmations messages-count})))})]
(apply fx/merge cofx (conj check-confirmations-fx add-envelope-data))))
(defn- own-info [db]
(let [{:keys [name photo-path address]} (:multiaccount db)]
@@ -41,7 +41,7 @@
:border-radius 32}))
(defn default-chat-icon-text [size]
{:color (colors/alpha colors/white 0.7)
{:color colors/white-transparent-70-persist
:font-weight "700"
:font-size (/ size 2)
:line-height size})
@@ -170,8 +170,8 @@
(let [response-to (:response-to content)]
[message-bubble-wrapper message
[react/view {:style (style/style-message-text outgoing)}
(when response-to
[quoted-message response-to (:quoted-message message) alias outgoing current-public-key])
(when (and (seq response-to) (:quoted-message message))
[quoted-message response-to (:quoted-message message) outgoing current-public-key])
[react/text {:style (style/emoji-message message)}
(:text content)]]
[message-timestamp message]]))
@@ -299,34 +299,34 @@
:font-family monospace-fonts
:color colors/white))
(def default-blockquote-style
(defn default-blockquote-style []
{:style {:border-left-width 2
:padding-left 3
:border-left-color colors/gray-transparent-40}})
(def outgoing-blockquote-style
(update default-blockquote-style :style
(defn outgoing-blockquote-style []
(update (default-blockquote-style) :style
assoc
:border-left-color colors/white-transparent))
:border-left-color colors/white-transparent-70-persist))
(defn blockquote-style [outgoing]
(if outgoing
outgoing-blockquote-style
default-blockquote-style))
(outgoing-blockquote-style)
(default-blockquote-style)))
(def default-blockquote-text-style
(defn default-blockquote-text-style []
(update (default-text-style) :style
assoc
:line-height 19
:font-size 14
:color colors/black-transparent-50))
(def outgoing-blockquote-text-style
(update default-blockquote-text-style :style
(defn outgoing-blockquote-text-style []
(update (default-blockquote-text-style) :style
assoc
:color colors/white-transparent-70-persist))
(defn blockquote-text-style [outgoing]
(if outgoing
outgoing-blockquote-text-style
default-blockquote-text-style))
(outgoing-blockquote-text-style)
(default-blockquote-text-style)))
+1 -1
View File
@@ -18,7 +18,7 @@
:padding-right 24
:margin-bottom 19})
(def message
(defn message []
{:background-color colors/white
:border-top-right-radius 16
:border-top-left-radius 16
+1 -1
View File
@@ -263,7 +263,7 @@
small-screen? [:dimensions/small-screen?]]
(if (= type :pinless)
[signature-request sign small-screen?]
[react/view styles/message
[react/view (styles/message)
[react/view styles/message-header
[react/text {:style {:typography :title-bold}} (i18n/label :t/signing-a-message)]
[react/touchable-highlight {:on-press #(re-frame/dispatch [:signing.ui/cancel-is-pressed])}
+16 -2
View File
@@ -67,7 +67,6 @@
(let [cofx (message/set-message-envelope-hash initial-cofx chat-id message-id :message-type 1)]
(testing "it sets the message-infos"
(is (= {:chat-id chat-id
:message-id message-id
:message-type :message-type}
(get-in cofx [:db :transport/message-envelopes message-id]))))
(testing "the message is sent"
@@ -75,7 +74,6 @@
(get-in
(message/update-envelope-status cofx message-id :sent)
[:db :chats chat-id :messages message-id :outgoing-status]))))
(testing "the message is not sent"
(is (= :not-sent
(get-in
@@ -107,6 +105,22 @@
(get-in
cofx
[:db :chats chat-id :messages message-id :outgoing-status]))))))
(testing "order of events is reversed"
(let [cofx (fx/merge
initial-cofx
(message/update-envelope-status message-id :sent)
(message/update-envelope-status message-id :sent)
(message/update-envelope-status message-id :sent)
(message/set-message-envelope-hash chat-id message-id :message-type 3))]
(testing "it removes the confirmations"
(is (not (get-in cofx [:db :transport/message-confirmations message-id])))
(is (not (get-in cofx [:db :transport/message-ids->confirmations message-id]))))
(testing "the message is sent"
(is (= :sent
(get-in
cofx
[:db :chats chat-id :messages message-id :outgoing-status]))))))
(testing "message not sent"
(let [cofx (fx/merge
initial-cofx