From 1485e07259c984d3ec2e100f1a17da2c033a384d Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Tue, 11 Jul 2017 14:54:01 +0300 Subject: [PATCH] make all specs nilable --- src/status_im/accounts/specs.cljs | 6 +-- src/status_im/chat/specs.cljs | 56 +++++++++++++-------------- src/status_im/contacts/specs.cljs | 16 ++++---- src/status_im/discover/specs.cljs | 12 +++--- src/status_im/navigation/specs.cljs | 8 ++-- src/status_im/new_group/specs.cljs | 12 +++--- src/status_im/profile/specs.cljs | 2 +- src/status_im/qr_scanner/specs.cljs | 6 +-- src/status_im/specs.cljs | 28 +++++++------- src/status_im/transactions/specs.cljs | 18 ++++----- 10 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/status_im/accounts/specs.cljs b/src/status_im/accounts/specs.cljs index 3f6ad49cda..518e7fad3f 100644 --- a/src/status_im/accounts/specs.cljs +++ b/src/status_im/accounts/specs.cljs @@ -1,9 +1,9 @@ (ns status-im.accounts.specs (:require [cljs.spec.alpha :as s])) -(s/def :accounts/accounts map?) ;;{id (string) account (map)} all created accounts +(s/def :accounts/accounts (s/nilable map?)) ;;{id (string) account (map)} all created accounts (s/def :accounts/account-creation? (s/nilable boolean?)) ;;true during creating new account -(s/def :accounts/creating-account? boolean?) ;;what is the difference ? ^ +(s/def :accounts/creating-account? (s/nilable boolean?)) ;;what is the difference ? ^ (s/def :accounts/current-account-id (s/nilable string?)) ;;id of logged in account (s/def :accounts/recover (s/nilable map?)) ;;used during recovering account -(s/def :accounts/login map?) ;;used during logging \ No newline at end of file +(s/def :accounts/login (s/nilable map?)) ;;used during logging \ No newline at end of file diff --git a/src/status_im/chat/specs.cljs b/src/status_im/chat/specs.cljs index 316081dd46..aef83451c3 100644 --- a/src/status_im/chat/specs.cljs +++ b/src/status_im/chat/specs.cljs @@ -1,32 +1,32 @@ (ns status-im.chat.specs (:require [cljs.spec.alpha :as s])) -(s/def :chat/chats map?) ;; {id (string) chat (map)} active chats on chat's tab -(s/def :chat/current-chat-id string?) ;;current or last opened chat-id -(s/def :chat/chat-id string?) ;;what is the difference ? ^ -(s/def :chat/new-chat map?) ;;used during adding new chat -(s/def :chat/new-chat-name string?) ;;we have name in the new-chat why do we need this field -(s/def :chat/chat-animations map?) ;;{id (string) props (map)} -(s/def :chat/chat-ui-props map?) ;;{id (string) props (map)} -(s/def :chat/chat-list-ui-props map?) -(s/def :chat/layout-height number?) ;;height of chat's view layout -(s/def :chat/expandable-view-height-to-value number?) -(s/def :chat/global-commands map?) ; {key (keyword) command (map)} atm used for browse command -(s/def :chat/loading-allowed boolean?) ;;allow to load more messages -(s/def :chat/message-data map?) -(s/def :chat/message-id->transaction-id map?) -(s/def :chat/message-status map?) +(s/def :chat/chats (s/nilable map?)) ;; {id (string) chat (map)} active chats on chat's tab +(s/def :chat/current-chat-id (s/nilable string?)) ;;current or last opened chat-id +(s/def :chat/chat-id (s/nilable string?)) ;;what is the difference ? ^ +(s/def :chat/new-chat (s/nilable map?)) ;;used during adding new chat +(s/def :chat/new-chat-name (s/nilable string?)) ;;we have name in the new-chat why do we need this field +(s/def :chat/chat-animations (s/nilable map?)) ;;{id (string) props (map)} +(s/def :chat/chat-ui-props (s/nilable map?)) ;;{id (string) props (map)} +(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/global-commands (s/nilable map?)) ; {key (keyword) command (map)} atm used for browse command +(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?)) (s/def :chat/unviewed-messages (s/nilable map?)) -(s/def :chat/selected-participants set?) -(s/def :chat/chat-loaded-callbacks map?) -(s/def :chat/commands-callbacks map?) -(s/def :chat/command-hash-valid? boolean?) -(s/def :chat/public-group-topic string?) -(s/def :chat/confirmation-code-sms-listener any?) ; .addListener result object -(s/def :chat/messages seq?) -(s/def :chat/loaded-chats seq?) -(s/def :chat/bot-subscriptions map?) -(s/def :chat/new-request map?) -(s/def :chat/raw-unviewed-messages vector?) -(s/def :chat/bot-db map?) -(s/def :chat/geolocation map?) \ No newline at end of file +(s/def :chat/selected-participants (s/nilable set?)) +(s/def :chat/chat-loaded-callbacks (s/nilable map?)) +(s/def :chat/commands-callbacks (s/nilable map?)) +(s/def :chat/command-hash-valid? (s/nilable boolean?)) +(s/def :chat/public-group-topic (s/nilable string?)) +(s/def :chat/confirmation-code-sms-listener (s/nilable any?)) ; .addListener result object +(s/def :chat/messages (s/nilable seq?)) +(s/def :chat/loaded-chats (s/nilable seq?)) +(s/def :chat/bot-subscriptions (s/nilable map?)) +(s/def :chat/new-request (s/nilable map?)) +(s/def :chat/raw-unviewed-messages (s/nilable vector?)) +(s/def :chat/bot-db (s/nilable map?)) +(s/def :chat/geolocation (s/nilable map?)) \ No newline at end of file diff --git a/src/status_im/contacts/specs.cljs b/src/status_im/contacts/specs.cljs index 413961279e..685a554d0e 100644 --- a/src/status_im/contacts/specs.cljs +++ b/src/status_im/contacts/specs.cljs @@ -1,15 +1,15 @@ (ns status-im.contacts.specs (:require [cljs.spec.alpha :as s])) -(s/def :contacts/contacts map?) ;; {id (string) contact (map)} -(s/def :contacts/new-contacts seq?) -(s/def :contacts/new-contact-identity string?) ;;public key of new contact during adding this new contact -(s/def :contacts/new-contact-public-key-error string?) -(s/def :contacts/contact-identity string?) ;;on showing this contact profile -(s/def :contacts/contacts-ui-props map?) -(s/def :contacts/contact-list-ui-props map?) +(s/def :contacts/contacts (s/nilable map?)) ;; {id (string) contact (map)} +(s/def :contacts/new-contacts (s/nilable seq?)) +(s/def :contacts/new-contact-identity (s/nilable string?)) ;;public key of new contact during adding this new contact +(s/def :contacts/new-contact-public-key-error (s/nilable string?)) +(s/def :contacts/contact-identity (s/nilable string?)) ;;on showing this contact profile +(s/def :contacts/contacts-ui-props (s/nilable map?)) +(s/def :contacts/contact-list-ui-props (s/nilable map?)) (s/def :contacts/contacts-click-handler (s/nilable fn?)) ;;used in modal list (for example for wallet) (s/def :contacts/contacts-click-action (s/nilable keyword?)) ;;used in modal list (for example for wallet) -(s/def :contacts/contacts-click-params map?) ;;used in modal list (for example for wallet) +(s/def :contacts/contacts-click-params (s/nilable map?)) ;;used in modal list (for example for wallet) diff --git a/src/status_im/discover/specs.cljs b/src/status_im/discover/specs.cljs index 7a05698e25..14ef95bc69 100644 --- a/src/status_im/discover/specs.cljs +++ b/src/status_im/discover/specs.cljs @@ -1,9 +1,9 @@ (ns status-im.discover.specs (:require [cljs.spec.alpha :as s])) -(s/def :discoveries/discoveries map?) ;; {id (string) descovery (map)} -(s/def :discoveries/discover-search-tags seq?) -(s/def :discoveries/tags vector?) -(s/def :discoveries/current-tag map?) -(s/def :discoveries/request-discoveries-timer int?) -(s/def :discoveries/new-discover map?) \ No newline at end of file +(s/def :discoveries/discoveries (s/nilable map?)) ;; {id (string) descovery (map)} +(s/def :discoveries/discover-search-tags (s/nilable seq?)) +(s/def :discoveries/tags (s/nilable vector?)) +(s/def :discoveries/current-tag (s/nilable map?)) +(s/def :discoveries/request-discoveries-timer (s/nilable int?)) +(s/def :discoveries/new-discover (s/nilable map?)) \ No newline at end of file diff --git a/src/status_im/navigation/specs.cljs b/src/status_im/navigation/specs.cljs index 9e15e28eeb..e3c15b56e1 100644 --- a/src/status_im/navigation/specs.cljs +++ b/src/status_im/navigation/specs.cljs @@ -1,8 +1,8 @@ (ns status-im.navigation.specs (:require [cljs.spec.alpha :as s])) -(s/def :navigation/view-id keyword?) ;;current view +(s/def :navigation/view-id (s/nilable keyword?)) ;;current view (s/def :navigation/modal (s/nilable keyword?)) ;;modal view id -(s/def :navigation/navigation-stack seq?) ;;stack of view's ids (keywords) -(s/def :navigation/prev-tab-view-id keyword?) -(s/def :navigation/prev-view-id keyword?) \ No newline at end of file +(s/def :navigation/navigation-stack (s/nilable seq?)) ;;stack of view's ids (keywords) +(s/def :navigation/prev-tab-view-id (s/nilable keyword?)) +(s/def :navigation/prev-view-id (s/nilable keyword?)) \ No newline at end of file diff --git a/src/status_im/new_group/specs.cljs b/src/status_im/new_group/specs.cljs index 93dd7c8cb9..a958ae81e4 100644 --- a/src/status_im/new_group/specs.cljs +++ b/src/status_im/new_group/specs.cljs @@ -1,11 +1,11 @@ (ns status-im.new-group.specs (:require [cljs.spec.alpha :as s])) -(s/def :group/contact-groups map?) ;; {id (string) group (map)} -(s/def :group/contact-group-id string?) ;;used during editing contact group -(s/def :group/group-type keyword?) ;;contact group or chat group -(s/def :group/new-group map?) ;;used during creating or edeting contact group +(s/def :group/contact-groups (s/nilable map?)) ;; {id (string) group (map)} +(s/def :group/contact-group-id (s/nilable string?)) ;;used during editing contact group +(s/def :group/group-type (s/nilable keyword?)) ;;contact group or chat group +(s/def :group/new-group (s/nilable map?)) ;;used during creating or edeting contact group (s/def :group/new-groups (s/nilable vector?)) ;;used during creating or edeting contact groups (s/def :group/contacts-group (s/nilable map?)) -(s/def :group/selected-contacts set?) -(s/def :group/groups-order seq?) ;;list of group ids \ No newline at end of file +(s/def :group/selected-contacts (s/nilable set?)) +(s/def :group/groups-order (s/nilable seq?)) ;;list of group ids \ No newline at end of file diff --git a/src/status_im/profile/specs.cljs b/src/status_im/profile/specs.cljs index 22892d213b..6f8503913f 100644 --- a/src/status_im/profile/specs.cljs +++ b/src/status_im/profile/specs.cljs @@ -2,4 +2,4 @@ (:require [cljs.spec.alpha :as s])) ;EDIT PROFILE -(s/def :profile/profile-edit map?) \ No newline at end of file +(s/def :profile/profile-edit (s/nilable map?)) \ No newline at end of file diff --git a/src/status_im/qr_scanner/specs.cljs b/src/status_im/qr_scanner/specs.cljs index 1b579cab7e..c32734a21a 100644 --- a/src/status_im/qr_scanner/specs.cljs +++ b/src/status_im/qr_scanner/specs.cljs @@ -1,6 +1,6 @@ (ns status-im.qr-scanner.specs (:require [cljs.spec.alpha :as s])) -(s/def :qr/qr-codes map?) ;;on scan qr -(s/def :qr/qr-modal map?) ;;used in qr modal screen -(s/def :qr/current-qr-context map?) \ No newline at end of file +(s/def :qr/qr-codes (s/nilable map?)) ;;on scan qr +(s/def :qr/qr-modal (s/nilable map?)) ;;used in qr modal screen +(s/def :qr/current-qr-context (s/nilable map?)) \ No newline at end of file diff --git a/src/status_im/specs.cljs b/src/status_im/specs.cljs index 8035642325..3e8d6f813e 100644 --- a/src/status_im/specs.cljs +++ b/src/status_im/specs.cljs @@ -12,24 +12,24 @@ [status-im.discover.specs])) ;GLOBAL -(s/def ::current-public-key string?) ;;public key of current logged in account -(s/def ::first-run boolean?) ;;true when application running at first time -(s/def ::was-modal? boolean?) -(s/def ::rpc-url string?) ;;"http://localhost:8545" -(s/def ::web3 any?) ;;object? doesn't work -(s/def ::webview-bridge any?) ;;object? -(s/def ::status-module-initialized? boolean?) +(s/def ::current-public-key (s/nilable string?)) ;;public key of current logged in account +(s/def ::first-run (s/nilable boolean?)) ;;true when application running at first time +(s/def ::was-modal? (s/nilable boolean?)) +(s/def ::rpc-url (s/nilable string?)) ;;"http://localhost:8545" +(s/def ::web3 (s/nilable any?)) ;;object? doesn't work +(s/def ::webview-bridge (s/nilable any?)) ;;object? +(s/def ::status-module-initialized? (s/nilable boolean?)) (s/def ::status-node-started? (s/nilable boolean?)) -(s/def ::toolbar-search map?) -(s/def ::keyboard-height number?) ;;height of native keyboard if shown -(s/def ::keyboard-max-height number?) -(s/def ::orientation keyword?) ;;:unknown - not used +(s/def ::toolbar-search (s/nilable map?)) +(s/def ::keyboard-height (s/nilable number?)) ;;height of native keyboard if shown +(s/def ::keyboard-max-height (s/nilable number?)) +(s/def ::orientation (s/nilable keyword?)) ;;:unknown - not used (s/def ::network-status (s/nilable keyword?)) ;;:online - presence of internet connection in the phone ;NODE -(s/def ::sync-listening-started boolean?) -(s/def ::sync-state keyword?) +(s/def ::sync-listening-started (s/nilable boolean?)) +(s/def ::sync-state (s/nilable keyword?)) ;NETWORK -(s/def ::network keyword?) ;;network name :testnet +(s/def ::network (s/nilable keyword?)) ;;network name :testnet (s/def ::db (allowed-keys :opt-un [::current-public-key diff --git a/src/status_im/transactions/specs.cljs b/src/status_im/transactions/specs.cljs index 826744a7c6..aeced89874 100644 --- a/src/status_im/transactions/specs.cljs +++ b/src/status_im/transactions/specs.cljs @@ -1,12 +1,12 @@ (ns status-im.transactions.specs (:require [cljs.spec.alpha :as s])) -(s/def :transactions/transactions map?) ;; {id (string) transaction (map)} -(s/def :transactions/transactions-queue map?) ;; {id (string) transaction (map)} -(s/def :transactions/selected-transaction map?) -(s/def :transactions/confirm-transactions map?) -(s/def :transactions/confirmed-transactions-count int?) -(s/def :transactions/transactions-list-ui-props map?) -(s/def :transactions/transaction-details-ui-props map?) -(s/def :transactions/wrong-password-counter int?) -(s/def :transactions/wrong-password? boolean?) \ No newline at end of file +(s/def :transactions/transactions (s/nilable map?)) ;; {id (string) transaction (map)} +(s/def :transactions/transactions-queue (s/nilable map?)) ;; {id (string) transaction (map)} +(s/def :transactions/selected-transaction (s/nilable map?)) +(s/def :transactions/confirm-transactions (s/nilable map?)) +(s/def :transactions/confirmed-transactions-count (s/nilable int?)) +(s/def :transactions/transactions-list-ui-props (s/nilable map?)) +(s/def :transactions/transaction-details-ui-props (s/nilable map?)) +(s/def :transactions/wrong-password-counter (s/nilable int?)) +(s/def :transactions/wrong-password? (s/nilable boolean?)) \ No newline at end of file