From 7f2085fb145bc724f573e3174aacc86ababc6855 Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Wed, 29 Nov 2017 16:59:01 +0100 Subject: [PATCH] Fixed regression when sending transaction Remove obsolete realm --- src/status_im/chat/events.cljs | 6 ++---- src/status_im/chat/specs.cljs | 3 +-- src/status_im/data_store/commands.cljs | 10 ---------- src/status_im/data_store/handler_data.cljs | 16 --------------- src/status_im/data_store/realm/commands.cljs | 11 ---------- .../data_store/realm/handler_data.cljs | 16 --------------- .../realm/schemas/account/v19/core.cljs | 20 ++++++------------- .../realm/schemas/base/v4/core.cljs | 6 ++---- src/status_im/ui/screens/db.cljs | 3 +-- 9 files changed, 12 insertions(+), 79 deletions(-) delete mode 100644 src/status_im/data_store/commands.cljs delete mode 100644 src/status_im/data_store/handler_data.cljs delete mode 100644 src/status_im/data_store/realm/commands.cljs delete mode 100644 src/status_im/data_store/realm/handler_data.cljs diff --git a/src/status_im/chat/events.cljs b/src/status_im/chat/events.cljs index 685d14f496..18e382f4b4 100644 --- a/src/status_im/chat/events.cljs +++ b/src/status_im/chat/events.cljs @@ -6,8 +6,7 @@ [status-im.chat.models :as model] [status-im.chat.models.unviewed-messages :as unviewed-messages-model] [status-im.chat.sign-up :as sign-up] - [status-im.chat.constants :as chat-const] - [status-im.data-store.handler-data :as handler-data] + [status-im.chat.constants :as chat-const] [status-im.data-store.messages :as msg-store] [status-im.data-store.contacts :as contacts-store] [status-im.data-store.chats :as chats-store] @@ -202,8 +201,7 @@ :requests (get chat->message-id->request chat-id))])) (into {}))] (-> new-db - (assoc-in [:message-data :preview] message-previews) - (assoc :handler-data (handler-data/get-all)) + (assoc-in [:message-data :preview] message-previews) (assoc :chats chats) init-console-chat (update :dispatch-n conj event))))))) diff --git a/src/status_im/chat/specs.cljs b/src/status_im/chat/specs.cljs index 07efd604c3..cb3fda5714 100644 --- a/src/status_im/chat/specs.cljs +++ b/src/status_im/chat/specs.cljs @@ -10,8 +10,7 @@ (s/def :chat/chat-list-ui-props (s/nilable map?)) (s/def :chat/layout-height (s/nilable number?)) ;;height of chat's view layout (s/def :chat/expandable-view-height-to-value (s/nilable number?)) -(s/def :chat/loading-allowed (s/nilable boolean?)) ;;allow to load more messages -(s/def :chat/handler-data (s/nilable map?)) +(s/def :chat/loading-allowed (s/nilable boolean?)) ;;allow to load more messages (s/def :chat/message-data (s/nilable map?)) (s/def :chat/message-id->transaction-id (s/nilable map?)) (s/def :chat/message-status (s/nilable map?)) diff --git a/src/status_im/data_store/commands.cljs b/src/status_im/data_store/commands.cljs deleted file mode 100644 index 9a7a04cf7e..0000000000 --- a/src/status_im/data_store/commands.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.commands - (:require [status-im.data-store.realm.commands :as data-store])) - -(defn get-by-chat-id - [chat-id] - (data-store/get-by-chat-id chat-id)) - -(defn save - [command] - (data-store/save command)) diff --git a/src/status_im/data_store/handler_data.cljs b/src/status_im/data_store/handler_data.cljs deleted file mode 100644 index a5a97af203..0000000000 --- a/src/status_im/data_store/handler_data.cljs +++ /dev/null @@ -1,16 +0,0 @@ -(ns status-im.data-store.handler-data - (:require [cljs.reader :as reader] - [status-im.data-store.realm.handler-data :as data-store] - [taoensso.timbre :as log])) - -(defn get-all [] - (->> (data-store/get-all-as-list) - (map (fn [{:keys [message-id data]}] - [message-id (reader/read-string data)])) - (into {}))) - -(defn get-data [message-id] - (-> message-id data-store/get-by-message-id :data reader/read-string)) - -(defn save-data [handler-data] - (data-store/save (update handler-data :data pr-str))) diff --git a/src/status_im/data_store/realm/commands.cljs b/src/status_im/data_store/realm/commands.cljs deleted file mode 100644 index 2353cbca33..0000000000 --- a/src/status_im/data_store/realm/commands.cljs +++ /dev/null @@ -1,11 +0,0 @@ -(ns status-im.data-store.realm.commands - (:require [status-im.data-store.realm.core :as realm])) - -(defn get-by-chat-id - [chat-id] - (realm/get-one-by-field-clj @realm/account-realm :command - :chat-id chat-id)) - -(defn save - [command] - (realm/save @realm/account-realm :command command true)) diff --git a/src/status_im/data_store/realm/handler_data.cljs b/src/status_im/data_store/realm/handler_data.cljs deleted file mode 100644 index 218f085707..0000000000 --- a/src/status_im/data_store/realm/handler_data.cljs +++ /dev/null @@ -1,16 +0,0 @@ -(ns status-im.data-store.realm.handler-data - (:require [status-im.data-store.realm.core :as realm])) - -(defn get-all [] - (realm/get-all @realm/account-realm :handler-data)) - -(defn get-all-as-list [] - (realm/js-object->clj (get-all))) - -(defn get-by-message-id - [message-id] - (realm/get-one-by-field-clj @realm/account-realm :handler-data :message-id message-id)) - -(defn save - [handler-data] - (realm/save @realm/account-realm :handler-data handler-data true)) diff --git a/src/status_im/data_store/realm/schemas/account/v19/core.cljs b/src/status_im/data_store/realm/schemas/account/v19/core.cljs index 9e962c19f0..c02999689e 100644 --- a/src/status_im/data_store/realm/schemas/account/v19/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/v19/core.cljs @@ -1,11 +1,8 @@ (ns status-im.data-store.realm.schemas.account.v19.core (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] + [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] [status-im.data-store.realm.schemas.account.v19.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] + [status-im.data-store.realm.schemas.account.v1.discover :as discover] [status-im.data-store.realm.schemas.account.v10.message :as message] [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] @@ -14,18 +11,14 @@ [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v13.handler-data :as handler-data] + [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] [taoensso.timbre :as log] [cljs.reader :as reader])) (def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema + chat-contact/schema contact/schema - discover/schema - kv-store/schema + discover/schema message/schema pending-message/schema processed-message/schema @@ -34,8 +27,7 @@ user-status/schema contact-group/schema group-contact/schema - local-storage/schema - handler-data/schema]) + local-storage/schema]) (defn remove-contact! [new-realm whisper-identity] (when-let [contact (some-> new-realm diff --git a/src/status_im/data_store/realm/schemas/base/v4/core.cljs b/src/status_im/data_store/realm/schemas/base/v4/core.cljs index 850129dd06..c4d609813a 100644 --- a/src/status_im/data_store/realm/schemas/base/v4/core.cljs +++ b/src/status_im/data_store/realm/schemas/base/v4/core.cljs @@ -1,12 +1,10 @@ (ns status-im.data-store.realm.schemas.base.v4.core (:require [status-im.data-store.realm.schemas.base.v4.network :as network] - [status-im.data-store.realm.schemas.base.v4.account :as account] - [status-im.data-store.realm.schemas.base.v1.kv-store :as kv-store] + [status-im.data-store.realm.schemas.base.v4.account :as account] [taoensso.timbre :as log])) (def schema [network/schema - account/schema - kv-store/schema]) + account/schema]) (defn migration [old-realm new-realm] (log/debug "migrating v4 base database: " old-realm new-realm) diff --git a/src/status_im/ui/screens/db.cljs b/src/status_im/ui/screens/db.cljs index 583692220c..096563e1bd 100644 --- a/src/status_im/ui/screens/db.cljs +++ b/src/status_im/ui/screens/db.cljs @@ -163,8 +163,7 @@ :chat/command-hash-valid? :chat/public-group-topic :chat/confirmation-code-sms-listener - :chat/messages - :chat/handler-data + :chat/messages :chat/loaded-chats :chat/raw-unviewed-messages :chat/bot-db