Development tools (#719)

This commit is contained in:
alwx 2017-02-02 09:07:44 +03:00 committed by Roman Volosovskyi
parent 8957e00592
commit bf27c55398
30 changed files with 411 additions and 44 deletions

3
.gitignore vendored
View File

@ -72,8 +72,9 @@ doo-index.html
# Re-natal
re-natal
# status-go
# Status
Statusgo.framework
status-dev-cli
#ios
ios/Pods

View File

@ -38,7 +38,8 @@
"react-native-emoji-picker",
"react-native-autolink",
"instabug-reactnative",
"nfc-react-native"
"nfc-react-native",
"react-native-http-bridge"
],
"imageDirs": [
"images"

View File

@ -158,6 +158,7 @@ android {
}
dependencies {
compile project(':react-native-http-bridge')
compile project(':nfc-react-native')
compile project(':instabug-reactnative')
compile project(':react-native-splash-screen')

View File

@ -3,6 +3,7 @@ package im.status.ethereum;
import android.app.Application;
import com.facebook.react.ReactApplication;
import me.alwx.HttpServer.HttpServerReactPackage;
import es.tiarg.nfcreactnative.NfcReactNativePackage;
import com.instabug.reactlibrary.RNInstabugReactnativePackage;
import com.cboy.rn.splashscreen.SplashScreenReactPackage;
@ -42,6 +43,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new HttpServerReactPackage(),
new NfcReactNativePackage(),
new RNInstabugReactnativePackage("b239f82a9cb00464e4c72cc703e6821e",MainApplication.this,"shake"),
new SplashScreenReactPackage(),

View File

@ -1,6 +1,8 @@
rootProject.name = 'StatusIm'
include ':app'
include ':react-native-http-bridge'
project(':react-native-http-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-http-bridge/android')
include ':nfc-react-native'
project(':nfc-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/nfc-react-native/android')
include ':instabug-reactnative'

View File

@ -14,7 +14,7 @@
(re-frame.core/dispatch [:load-commands!]))
(figwheel/watch-and-reload
:websocket-url "ws://localhost:3449/figwheel-ws"
:websocket-url "ws://10.0.3.2:3449/figwheel-ws"
:heads-up-display false
:jsload-callback callback)

View File

@ -59,6 +59,7 @@
B24FC7FD1DE7195700D694FF /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24FC7FC1DE7195700D694FF /* Social.framework */; };
B24FC7FF1DE7195F00D694FF /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24FC7FE1DE7195F00D694FF /* MessageUI.framework */; };
B2A5F45C1DEC36BB00174F4D /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2A5F4381DEC36B200174F4D /* libRCTAnimation.a */; };
B2DEA0D01E49E33300FA28D6 /* libRCTHttpServer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2DEA0B11E49E32000FA28D6 /* libRCTHttpServer.a */; };
B2F2D1BC1D9D531B00B7B453 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2F2D1BB1D9D531B00B7B453 /* Images.xcassets */; };
BA68A2377A20496EA737000D /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E586E1B0E544F64AA9F5BD1 /* libz.tbd */; };
C3EE9AEA6F77464588FBAA64 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7B5870D9ED504F32B6A09C35 /* FontAwesome.ttf */; };
@ -343,6 +344,13 @@
remoteGlobalIDString = 2D2A28201D9B03D100D4039D;
remoteInfo = "RCTAnimation-tvOS";
};
B2DEA0B01E49E32000FA28D6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B29EC9CC1E48BED600704A36;
remoteInfo = RCTHttpServer;
};
CE4E319D1D8693090033ED64 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */;
@ -439,6 +447,7 @@
B24FC7FC1DE7195700D694FF /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; };
B24FC7FE1DE7195F00D694FF /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
B2A5F42F1DEC36B200174F4D /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTHttpServer.xcodeproj; path = "../node_modules/react-native-http-bridge/ios/RCTHttpServer.xcodeproj"; sourceTree = "<group>"; };
B2F2D1BB1D9D531B00B7B453 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = StatusIm/Images.xcassets; sourceTree = "<group>"; };
B3B19223008342D096AA356E /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libTcpSockets.a; sourceTree = "<group>"; };
@ -465,6 +474,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B2DEA0D01E49E33300FA28D6 /* libRCTHttpServer.a in Frameworks */,
9EE89E271E03FCB7007D3C25 /* libSplashScreen.a in Frameworks */,
B2A5F45C1DEC36BB00174F4D /* libRCTAnimation.a in Frameworks */,
B24FC7FF1DE7195F00D694FF /* MessageUI.framework in Frameworks */,
@ -766,6 +776,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */,
9EC0135C1E06FB1900155B5C /* RCTWKWebView.xcodeproj */,
B2A5F42F1DEC36B200174F4D /* RCTAnimation.xcodeproj */,
B24FC7F51DE7190C00D694FF /* RNShare.xcodeproj */,
@ -900,6 +911,14 @@
name = Products;
sourceTree = "<group>";
};
B2DEA0A51E49E32000FA28D6 /* Products */ = {
isa = PBXGroup;
children = (
B2DEA0B11E49E32000FA28D6 /* libRCTHttpServer.a */,
);
name = Products;
sourceTree = "<group>";
};
CE4E31941D8693090033ED64 /* Products */ = {
isa = PBXGroup;
children = (
@ -1015,6 +1034,10 @@
ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
},
{
ProductGroup = B2DEA0A51E49E32000FA28D6 /* Products */;
ProjectRef = B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */;
},
{
ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
@ -1383,6 +1406,13 @@
remoteRef = B2A5F4391DEC36B200174F4D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B2DEA0B11E49E32000FA28D6 /* libRCTHttpServer.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTHttpServer.a;
remoteRef = B2DEA0B01E49E32000FA28D6 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
CE4E319E1D8693090033ED64 /* libRCTImageResizer.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;

View File

@ -56,6 +56,7 @@
"react-native-emoji-picker": "git+https://github.com/alwx/react-native-emoji-picker.git",
"react-native-fs": "^1.5.1",
"react-native-http": "github:tradle/react-native-http#834492d",
"react-native-http-bridge": "^0.2.2",
"react-native-i18n": "0.0.8",
"react-native-image-crop-picker": "^0.9.4",
"react-native-image-resizer": "github:danieldunderfelt/react-native-image-resizer",
@ -74,6 +75,7 @@
"react-native-webview-bridge": "github:status-im/react-native-webview-bridge#0.33.5",
"readable-stream": "^1.0.33",
"realm": "^0.14.3",
"status-dev-cli": "^1.1.3",
"stream-browserify": "^1.0.0",
"timers-browserify": "^1.4.2",
"tty-browserify": "0.0.0",

View File

@ -10,5 +10,12 @@ npm install --save react-native-tcp@2.0.4;
if ! [ -f re-natal ]; then
ln -s ./node_modules/re-natal/index.js re-natal;
else
echo "exists"
echo "re-natal exists"
fi
# symlink for status-dev-cli
if ! [ -f status-dev-cli ]; then
ln -s ./node_modules/status-dev-cli/index.js status-dev-cli;
else
echo "status-dev-cli exists"
fi

View File

@ -1767,6 +1767,51 @@ status.command({
}
});
function debugSuggestions(params) {
var suggestions = ["On", "Off"].map(function(entry) {
return status.components.touchable(
{onPress: [status.events.SET_VALUE, entry]},
status.components.view(
suggestionContainerStyle,
[status.components.view(
suggestionSubContainerStyle,
[
status.components.text(
{style: valueStyle},
entry
)
]
)]
)
);
});
var view = status.components.scrollView(
suggestionsContainerStyle(faucets.length),
suggestions
);
return {markup: view};
}
status.command({
name: "debug",
title: "Debug",
description: "Starts/stops a debug server",
color: "#7099e6",
registeredOnly: true,
params: [{
name: "mode",
suggestions: debugSuggestions,
type: status.types.TEXT
}],
preview: function (params) {
return status.components.text(
{},
"Debug mode: " + params.mode
);
}
});
function browseSuggestions(params) {
if (params.url && params.url !== "undefined" && params.url != "") {

View File

@ -21,6 +21,7 @@
(defn initialize-account
[address new-account?]
(dispatch [:set :login {}])
(dispatch [:debug-server-stop])
(dispatch [:set-current-account address])
(dispatch [:initialize-account address])
(if new-account?

View File

@ -9,7 +9,8 @@
back-android
view
modal
splash-screen]]
splash-screen
http-bridge]]
[status-im.components.main-tabs :refer [main-tabs]]
[status-im.contacts.search-results :refer [contacts-search-results]]
[status-im.contacts.views.contact-list :refer [contact-list]]
@ -83,6 +84,9 @@
#(when-not (= 0 @keyboard-height)
(dispatch [:set :keyboard-height 0])))
(.hide splash-screen))
:component-will-unmount
(fn []
(.stop http-bridge))
:render
(fn []
(when @view-id

View File

@ -497,7 +497,10 @@
(defn delete-chat!
[_ [_ chat-id]]
(chats/delete chat-id))
(let [{:keys [debug?]} (chats/get-by-id chat-id)]
(if debug?
(chats/delete chat-id)
(chats/set-inactive chat-id))))
(defn remove-pending-messages!
[_ [_ chat-id]]
@ -519,9 +522,9 @@
:private private-key}
:message {:from current-public-key
:message-id (random/id)}}))
(dispatch [::remove-chat current-chat-id]))))
(dispatch [:remove-chat current-chat-id]))))
(register-handler ::remove-chat
(register-handler :remove-chat
(-> remove-chat
;((after leaving-message!))
((after delete-messages!))

View File

@ -22,12 +22,20 @@
:faucet
(fn [params id]
(dispatch [:open-faucet (params "url") id]))})
(dispatch [:open-faucet (params "url") id]))
:debug
(fn [params id]
(let [debug-on? (= (params "mode") "On")]
(dispatch [:account-update {:debug? debug-on?}])
(if debug-on?
(dispatch [:debug-server-start])
(dispatch [:debug-server-stop]))))})
(def commands-names (set (keys console-commands)))
(def commands-with-delivery-status
(disj commands-names :password :faucet))
(disj commands-names :password :faucet :debug))
(register-handler :invoke-console-command-handler!
(u/side-effect!

View File

@ -144,4 +144,9 @@
(defn autolink [opts]
(r/as-element
[autolink-class (add-font-style :style opts)]))
[autolink-class (add-font-style :style opts)]))
;; HTTP Bridge
(def http-bridge
(js/require "react-native-http-bridge"))

View File

@ -280,13 +280,23 @@
(dispatch [:update-contact! {:whisper-identity from
:last-online timestamp}]))))))
(register-handler :remove-contact
(register-handler :hide-contact
(after stop-watching-contact)
(u/side-effect!
(fn [_ [_ {:keys [whisper-identity] :as contact}]]
(dispatch [:update-contact! (assoc contact :pending true)])
(dispatch [:account-update-keys]))))
(register-handler :remove-contact
(fn [db [_ whisper-identity pred]]
(if-let [contact (contacts/get-by-id whisper-identity)]
(if (pred contact)
(do
(contacts/delete contact)
(update db :contacts dissoc whisper-identity))
db)
db)))
(register-handler
:open-contact-menu
(u/side-effect!
@ -295,6 +305,6 @@
:options [(label :t/remove-contact)]
:callback (fn [index]
(case index
0 (dispatch [:remove-contact contact])
0 (dispatch [:hide-contact contact])
:default))
:cancel-text (label :t/cancel)}))))

View File

@ -28,6 +28,10 @@
[chat-id]
(data-store/delete chat-id))
(defn set-inactive
[chat-id]
(data-store/set-inactive chat-id))
(defn get-contacts
[chat-id]
(data-store/get-contacts chat-id))

View File

@ -1,6 +1,7 @@
(ns status-im.data-store.realm.chats
(:require [status-im.data-store.realm.core :as realm]
[status-im.utils.random :refer [timestamp]])
[status-im.utils.random :refer [timestamp]]
[taoensso.timbre :as log])
(:refer-clojure :exclude [exists?]))
(defn get-all
@ -49,6 +50,11 @@
(realm/exists? @realm/account-realm :chat {:chat-id chat-id}))
(defn delete
[chat-id]
(when-let [chat (realm/get-by-field @realm/account-realm :chat :chat-id chat-id)]
(realm/delete @realm/account-realm chat)))
(defn set-inactive
[chat-id]
(when-let [chat (get-by-id chat-id)]
(realm/write @realm/account-realm

View File

@ -1,6 +1,7 @@
(ns status-im.data-store.realm.schemas.account.core
(:require [status-im.data-store.realm.schemas.account.v1.core :as v1]
[status-im.data-store.realm.schemas.account.v2.core :as v2]))
[status-im.data-store.realm.schemas.account.v2.core :as v2]
[status-im.data-store.realm.schemas.account.v3.core :as v3]))
; put schemas ordered by version
(def schemas [{:schema v1/schema
@ -8,4 +9,7 @@
:migration v1/migration}
{:schema v2/schema
:schemaVersion 2
:migration v2/migration}])
:migration v2/migration}
{:schema v3/schema
:schemaVersion 3
:migration v3/migration}])

View File

@ -0,0 +1,40 @@
(ns status-im.data-store.realm.schemas.account.v3.chat
(:require [taoensso.timbre :as log]
[status-im.components.styles :refer [default-chat-color]]))
(def schema {:name :chat
:primaryKey :chat-id
:properties {:chat-id :string
:name :string
:color {:type :string
:default default-chat-color}
:group-chat {:type :bool
:indexed true}
:group-admin {:type :string
:optional true}
:is-active :bool
:timestamp :int
:contacts {:type :list
:objectType :chat-contact}
:removed-at {:type :int
:optional true}
:removed-from-at {:type :int
:optional true}
:added-to-at {:type :int
:optional true}
:updated-at {:type :int
:optional true}
:last-message-id :string
:message-overhead {:type :int
:default 0}
:public-key {:type :string
:optional true}
:private-key {:type :string
:optional true}
:contact-info {:type :string
:optional true}
:debug? {:type :bool
:default false}}})
(defn migration [old-realm new-realm]
(log/debug "migrating chat schema v3"))

View File

@ -0,0 +1,28 @@
(ns status-im.data-store.realm.schemas.account.v3.contact
(:require [taoensso.timbre :as log]))
(def schema {:name :contact
:primaryKey :whisper-identity
:properties {:address {:type "string" :optional true}
:whisper-identity "string"
:name {:type "string" :optional true}
:photo-path {:type "string" :optional true}
:last-updated {:type "int" :default 0}
:last-online {:type "int" :default 0}
:pending? {:type "bool" :default false}
:status {:type "string" :optional true}
:public-key {:type :string
:optional true}
:private-key {:type :string
:optional true}
:dapp? {:type :bool
:default false}
:dapp-url {:type :string
:optional true}
:dapp-hash {:type :int
:optional true}
:debug? {:type :bool
:default false}}})
(defn migration [old-realm new-realm]
(log/debug "migrating contact schema v3"))

View File

@ -0,0 +1,32 @@
(ns status-im.data-store.realm.schemas.account.v3.core
(:require [status-im.data-store.realm.schemas.account.v3.chat :as chat]
[status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact]
[status-im.data-store.realm.schemas.account.v1.command :as command]
[status-im.data-store.realm.schemas.account.v3.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.message :as message]
[status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message]
[status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message]
[status-im.data-store.realm.schemas.account.v1.request :as request]
[status-im.data-store.realm.schemas.account.v1.tag :as tag]
[status-im.data-store.realm.schemas.account.v1.user-status :as user-status]
[taoensso.timbre :as log]))
(def schema [chat/schema
chat-contact/schema
command/schema
contact/schema
discover/schema
kv-store/schema
message/schema
pending-message/schema
processed-message/schema
request/schema
tag/schema
user-status/schema])
(defn migration [old-realm new-realm]
(log/debug "migrating v3 account database: " old-realm new-realm)
(chat/migration old-realm new-realm)
(contact/migration old-realm new-realm))

View File

@ -1,7 +1,11 @@
(ns status-im.data-store.realm.schemas.base.core
(:require [status-im.data-store.realm.schemas.base.v1.core :as v1]))
(:require [status-im.data-store.realm.schemas.base.v1.core :as v1]
[status-im.data-store.realm.schemas.base.v2.core :as v2]))
; put schemas ordered by version
(def schemas [{:schema v1/schema
:schemaVersion 1
:migration v1/migration}])
:migration v1/migration}
{:schema v2/schema
:schemaVersion 2
:migration v2/migration}])

View File

@ -0,0 +1,25 @@
(ns status-im.data-store.realm.schemas.base.v2.account
(:require [taoensso.timbre :as log]))
(def schema {:name :account
:primaryKey :address
:properties {:address :string
:public-key :string
:updates-public-key {:type :string
:optional true}
:updates-private-key {:type :string
:optional true}
:name {:type :string :optional true}
:phone {:type :string :optional true}
:email {:type :string :optional true}
:status {:type :string :optional true}
:debug? {:type :bool :default false}
:photo-path :string
:last-updated {:type :int :default 0}
:signed-up? {:type :bool
:default false}
:network :string}})
(defn migration [_ _]
(log/debug "migrating account schema"))

View File

@ -0,0 +1,13 @@
(ns status-im.data-store.realm.schemas.base.v2.core
(:require [status-im.data-store.realm.schemas.base.v2.account :as account]
[status-im.data-store.realm.schemas.base.v1.kv-store :as kv-store]
[taoensso.timbre :as log]))
(def schema [account/schema
kv-store/schema])
(defn migration [old-realm new-realm]
(log/debug "migrating v2 base database: " old-realm new-realm)
(account/migration old-realm new-realm)
(kv-store/migration old-realm new-realm))

View File

@ -0,0 +1,82 @@
(ns status-im.debug.handlers
(:require [re-frame.core :refer [after dispatch]]
[status-im.utils.handlers :refer [register-handler] :as u]
[status-im.components.react :refer [http-bridge]]
[status-im.data-store.accounts :as accounts]
[taoensso.timbre :as log]))
(def debug-server-port 5561)
(register-handler :init-debug-mode
(u/side-effect!
(fn [_ [_ address]]
(let [{:keys [debug?]} (accounts/get-by-address address)]
(when debug?
(dispatch [:debug-server-start]))))))
(register-handler :debug-server-start
(u/side-effect!
(fn [_]
(.start http-bridge
debug-server-port
(fn [req]
(try
(let [{:keys [postData url]} (js->clj req :keywordize-keys true)
postData (if (string? postData)
(-> (.parse js/JSON postData)
(js->clj :keywordize-keys true))
postData)]
(dispatch [:debug-request {:url url :postData postData}]))
(catch js/Error e
(log/debug "Error: " e))))))))
(register-handler :debug-server-stop
(u/side-effect!
(fn [_]
(.stop http-bridge))))
(register-handler :debug-request
(u/side-effect!
(fn [{:keys [web3]} [_ {url :url
{:keys [encoded]} :postData :as d}]]
(try
(let [json (->> (.toAscii web3 encoded)
(.parse js/JSON))
obj (js->clj json :keywordize-keys true)]
(case url
"/add-dapp" (dispatch [:debug-add-dapp obj])
"/remove-dapp" (dispatch [:debug-remove-dapp obj])
"/dapp-changed" (dispatch [:debug-dapp-changed obj])
:default))
(catch js/Error e
(log/debug "Error: " e))))))
(register-handler :debug-add-dapp
(u/side-effect!
(fn [{:keys [contacts]} [_ {:keys [name whisper-identity dapp-url] :as dapp-data}]]
(when (and name
whisper-identity
dapp-url
(or (not (get contacts whisper-identity))
(get-in contacts [whisper-identity :debug?])))
(let [dapp (merge dapp-data {:dapp? true
:debug? true})]
(dispatch [:add-chat whisper-identity {:name name
:debug? true}])
(dispatch [:add-contacts [dapp]]))))))
(register-handler :debug-remove-dapp
(u/side-effect!
(fn [{:keys [chats]} [_ {:keys [whisper-identity]}]]
(when (get-in chats [whisper-identity :debug?])
(dispatch [:remove-chat whisper-identity]))
(dispatch [:remove-contact whisper-identity #(and (:dapp? %) (:debug? %))]))))
(register-handler :debug-dapp-changed
(u/side-effect!
(fn [{:keys [webview-bridge current-chat-id chats]} [_ {:keys [whisper-identity]}]]
(when (and (= current-chat-id whisper-identity)
(get-in chats [whisper-identity :debug?])
webview-bridge)
(.reload webview-bridge)))))

View File

@ -22,6 +22,7 @@
status-im.protocol.handlers
status-im.transactions.handlers
status-im.network.handlers
status-im.debug.handlers
[status-im.utils.types :as t]
[status-im.i18n :refer [label]]
[status-im.constants :refer [console-chat-id]]
@ -76,6 +77,7 @@
(dispatch [:load-contacts])
(dispatch [:init-chat])
(dispatch [:init-discoveries])
(dispatch [:init-debug-mode address])
(dispatch [:send-account-update-if-needed])
(dispatch [:start-requesting-discoveries])
(dispatch [:remove-old-discoveries!]))))

View File

@ -8,7 +8,8 @@
app-registry
keyboard
orientation
splash-screen]]
splash-screen
http-bridge]]
[status-im.components.main-tabs :refer [main-tabs]]
[status-im.contacts.search-results :refer [contacts-search-results]]
[status-im.contacts.views.contact-list :refer [contact-list]]
@ -71,6 +72,9 @@
#(when-not (= 0 @keyboard-height)
(dispatch [:set :keyboard-height 0])))
(.hide splash-screen))
:component-will-unmount
(fn []
(.stop http-bridge))
:render
(fn []
(when @view-id

View File

@ -105,32 +105,32 @@
(cache/add! processed-message)
(processed-messages/save processed-message))
(case type
:message (dispatch [:received-protocol-message! message])
:group-message (dispatch [:received-protocol-message! message])
:ack (if (#{:message :group-message} (:type payload))
(dispatch [:message-delivered message])
(dispatch [:pending-message-remove message]))
:seen (dispatch [:message-seen message])
:clock-value-request (dispatch [:message-clock-value-request message])
:clock-value (dispatch [:message-clock-value message])
:group-invitation (dispatch [:group-chat-invite-received message])
:update-group (dispatch [:update-group-message message])
:add-group-identity (dispatch [:participant-invited-to-group message])
:message (dispatch [:received-protocol-message! message])
:group-message (dispatch [:received-protocol-message! message])
:ack (if (#{:message :group-message} (:type payload))
(dispatch [:message-delivered message])
(dispatch [:pending-message-remove message]))
:seen (dispatch [:message-seen message])
:clock-value-request (dispatch [:message-clock-value-request message])
:clock-value (dispatch [:message-clock-value message])
:group-invitation (dispatch [:group-chat-invite-received message])
:update-group (dispatch [:update-group-message message])
:add-group-identity (dispatch [:participant-invited-to-group message])
:remove-group-identity (dispatch [:participant-removed-from-group message])
:leave-group (dispatch [:participant-left-group message])
:contact-request (dispatch [:contact-request-received message])
:discover (dispatch [:status-received message])
:discoveries-request (dispatch [:discoveries-request-received message])
:discoveries-response (dispatch [:discoveries-response-received message])
:profile (dispatch [:contact-update-received message])
:update-keys (dispatch [:update-keys-received message])
:online (dispatch [:contact-online-received message])
:pending (dispatch [:pending-message-upsert message])
:sent (let [{:keys [to id group-id]} message
message' {:from to
:payload {:message-id id
:group-id group-id}}]
(dispatch [:message-sent message']))
:leave-group (dispatch [:participant-left-group message])
:contact-request (dispatch [:contact-request-received message])
:discover (dispatch [:status-received message])
:discoveries-request (dispatch [:discoveries-request-received message])
:discoveries-response (dispatch [:discoveries-response-received message])
:profile (dispatch [:contact-update-received message])
:update-keys (dispatch [:update-keys-received message])
:online (dispatch [:contact-online-received message])
:pending (dispatch [:pending-message-upsert message])
:sent (let [{:keys [to id group-id]} message
message' {:from to
:payload {:message-id id
:group-id group-id}}]
(dispatch [:message-sent message']))
(debug "Unknown message type" type)))))))
(defn system-message

View File

@ -51,3 +51,4 @@
message' (assoc message :payload payload'')]
(callback (if ack? :ack type) message')
(ack/check-ack! web3 from payload'' identity)))))))))