Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae03891d2f | ||
|
|
01efd56d6f |
+143
-142
@@ -1,55 +1,55 @@
|
||||
legacy.status-im.utils.build/warning-handler
|
||||
legacy.status-im.utils.build/get-current-sha
|
||||
status-im.constants/spacing-char
|
||||
status-im.constants/arg-wrapping-char
|
||||
legacy.status-im.ios.core/init
|
||||
legacy.status-im.ui.components.camera/aspects
|
||||
legacy.status-im.ui.components.camera/capture-targets
|
||||
legacy.status-im.ui.components.camera/set-torch
|
||||
legacy.status-im.ui.components.camera/request-access-ios
|
||||
legacy.status-im.chat.models.message-content/stylings
|
||||
legacy.status-im.chat.models.message-content/actions
|
||||
legacy.status-im.chat.models.message-content/blank-string
|
||||
legacy.status-im.chat.models.message-content/sorted-ranges
|
||||
legacy.status-im.ethereum.mnemonic/words->passphrase
|
||||
status-im.utils.build/warning-handler
|
||||
status-im.utils.build/get-current-sha
|
||||
status-im2.constants/spacing-char
|
||||
status-im2.constants/arg-wrapping-char
|
||||
status-im.ios.core/init
|
||||
status-im.ui.components.camera/aspects
|
||||
status-im.ui.components.camera/capture-targets
|
||||
status-im.ui.components.camera/set-torch
|
||||
status-im.ui.components.camera/request-access-ios
|
||||
status-im.chat.models.message-content/stylings
|
||||
status-im.chat.models.message-content/actions
|
||||
status-im.chat.models.message-content/blank-string
|
||||
status-im.chat.models.message-content/sorted-ranges
|
||||
status-im.ethereum.mnemonic/words->passphrase
|
||||
native-module.core/listener
|
||||
native-module.core/multiaccount-reset
|
||||
native-module.core/extract-group-membership-signatures
|
||||
native-module.core/sign-group-membership
|
||||
native-module.core/update-mailservers
|
||||
legacy.status-im.ethereum.abi-spec/bytes-to-hex
|
||||
legacy.status-im.android.core/init
|
||||
legacy.status-im.chat.models.message/transport-keys
|
||||
legacy.status-im.utils.datetime/week
|
||||
legacy.status-im.utils.datetime/time-ago
|
||||
legacy.status-im.utils.datetime/format-date
|
||||
legacy.status-im.utils.datetime/get-ordinal-date
|
||||
status-im.ethereum.abi-spec/bytes-to-hex
|
||||
status-im.android.core/init
|
||||
status-im.chat.models.message/transport-keys
|
||||
status-im.utils.datetime/week
|
||||
status-im.utils.datetime/time-ago
|
||||
status-im.utils.datetime/format-date
|
||||
status-im.utils.datetime/get-ordinal-date
|
||||
reagent.dom/render
|
||||
reagent.dom/unmount-component-at-node
|
||||
reagent.dom/dom-node
|
||||
reagent.dom/force-update-all
|
||||
legacy.status-im.multiaccounts.create.core/get-new-key-code
|
||||
legacy.status-im.ethereum.decode/string
|
||||
legacy.status-im.ui.screens.network.views/mainnet?
|
||||
legacy.status-im.data-store.chats/event->string
|
||||
legacy.status-im.mailserver.constants/seven-days
|
||||
legacy.status-im.mailserver.constants/connection-timeout
|
||||
legacy.status-im.hardwallet.card/install-applet
|
||||
legacy.status-im.hardwallet.card/install-cash-applet
|
||||
legacy.status-im.multiaccount.login.data-test/all-contacts
|
||||
legacy.status-im.multiaccount.login.data-test/multiaccounts
|
||||
legacy.status-im.multiaccount.login.data-test/get-chats
|
||||
legacy.status-im.multiaccount.login.data-test/transport
|
||||
legacy.status-im.multiaccount.login.data-test/topics
|
||||
legacy.status-im.utils.utils/clear-timeout
|
||||
legacy.status-im.utils.handlers/logged-in
|
||||
legacy.status-im.multiaccounts.model/credentials
|
||||
legacy.status-im.multiaccounts.login.core/contract-fleet?
|
||||
legacy.status-im.multiaccounts.login.core/fetch-nodes
|
||||
status-im.config/rpc-networks-only?
|
||||
status-im.config/waku-enabled?
|
||||
legacy.status-im.utils.pairing/has-paired-installations?
|
||||
legacy.status-im.tribute-to-talk.core-test/user-cofx
|
||||
status-im.multiaccounts.create.core/get-new-key-code
|
||||
status-im.ethereum.decode/string
|
||||
status-im.ui.screens.network.views/mainnet?
|
||||
status-im.data-store.chats/event->string
|
||||
status-im.mailserver.constants/seven-days
|
||||
status-im.mailserver.constants/connection-timeout
|
||||
status-im.hardwallet.card/install-applet
|
||||
status-im.hardwallet.card/install-cash-applet
|
||||
status-im.multiaccount.login.data-test/all-contacts
|
||||
status-im.multiaccount.login.data-test/multiaccounts
|
||||
status-im.multiaccount.login.data-test/get-chats
|
||||
status-im.multiaccount.login.data-test/transport
|
||||
status-im.multiaccount.login.data-test/topics
|
||||
status-im.utils.utils/clear-timeout
|
||||
status-im.utils.handlers/logged-in
|
||||
status-im.multiaccounts.model/credentials
|
||||
status-im.multiaccounts.login.core/contract-fleet?
|
||||
status-im.multiaccounts.login.core/fetch-nodes
|
||||
status-im2.config/rpc-networks-only?
|
||||
status-im2.config/waku-enabled?
|
||||
status-im.utils.pairing/has-paired-installations?
|
||||
status-im.tribute-to-talk.core-test/user-cofx
|
||||
mocks.js-dependencies/action-button
|
||||
mocks.js-dependencies/camera
|
||||
mocks.js-dependencies/dismiss-keyboard
|
||||
@@ -78,108 +78,109 @@ mocks.js-dependencies/react-navigation-bottom-tabs
|
||||
mocks.js-dependencies/react-native-haptic-feedback
|
||||
mocks.js-dependencies/mock
|
||||
quo.previews.main/init
|
||||
legacy.status-im.chat.models.message-list-test/descending-range
|
||||
legacy.status-im.chat.models.message-list-test/random-range
|
||||
legacy.status-im.ethereum.eip165/supports?
|
||||
legacy.status-im.utils.hex/valid-hex?
|
||||
legacy.status-im.multiaccounts.core/chat-send?
|
||||
legacy.status-im.hardwallet.simulated-keycard/install-cash-applet
|
||||
legacy.status-im.hardwallet.simulated-keycard/sign-typed-data
|
||||
legacy.status-im.utils.core/safe-read-message-content
|
||||
legacy.status-im.ui.components.react/native-modules
|
||||
legacy.status-im.ui.components.react/progress-bar
|
||||
status-im.chat.models.message-list-test/descending-range
|
||||
status-im.chat.models.message-list-test/random-range
|
||||
status-im.ethereum.eip165/supports?
|
||||
status-im.utils.hex/valid-hex?
|
||||
status-im.multiaccounts.core/chat-send?
|
||||
status-im.hardwallet.simulated-keycard/install-cash-applet
|
||||
status-im.hardwallet.simulated-keycard/sign-typed-data
|
||||
status-im.utils.core/safe-read-message-content
|
||||
status-im.ui.components.react/native-modules
|
||||
status-im.ui.components.react/progress-bar
|
||||
react-native.fs/move-file
|
||||
react-native.fs/read-dir
|
||||
react-native.fs/mkdir
|
||||
react-native.fs/unlink
|
||||
react-native.fs/file-exists?
|
||||
legacy.status-im.ui.components.colors/white
|
||||
legacy.status-im.ui.components.colors/black
|
||||
legacy.status-im.ui.components.core/animated-header
|
||||
legacy.status-im.ui.components.core/safe-area-provider
|
||||
legacy.status-im.ui.components.core/safe-area-consumer
|
||||
legacy.status-im.ui.components.core/safe-area-view
|
||||
legacy.status-im.utils.universal-links.core/open!
|
||||
legacy.status-im.transport.filters.core-test/member-2
|
||||
legacy.status-im.ui.screens.chat.ttt/one-to-one-chat-description-container
|
||||
legacy.status-im.ethereum.ens/ttl
|
||||
legacy.status-im.ethereum.ens/addr-hash
|
||||
legacy.status-im.ethereum.ens/name-hash
|
||||
legacy.status-im.ethereum.ens/ABI-hash
|
||||
legacy.status-im.ethereum.ens/pubkey-hash
|
||||
legacy.status-im.network.core/get-network
|
||||
status-im.constants/desktop-content-types
|
||||
status-im.constants/blocks-per-hour
|
||||
status-im.constants/one-earth-day
|
||||
status-im.constants/left-pane-min-width
|
||||
status-im.constants/system
|
||||
status-im.constants/contact-discovery
|
||||
status-im.constants/send-transaction-failed-parse-response
|
||||
status-im.constants/send-transaction-failed-parse-params
|
||||
status-im.constants/send-transaction-no-account-selected
|
||||
status-im.constants/send-transaction-invalid-tx-sender
|
||||
status-im.constants/web3-get-logs
|
||||
status-im.constants/web3-transaction-receipt
|
||||
status-im.constants/web3-new-filter
|
||||
status-im.constants/web3-new-pending-transaction-filter
|
||||
status-im.constants/web3-new-block-filter
|
||||
status-im.constants/web3-uninstall-filter
|
||||
status-im.constants/web3-get-filter-changes
|
||||
status-im.constants/web3-shh-post
|
||||
status-im.constants/web3-shh-new-identity
|
||||
status-im.constants/web3-shh-has-identity
|
||||
status-im.constants/web3-shh-new-group
|
||||
status-im.constants/web3-shh-add-to-group
|
||||
status-im.constants/web3-shh-new-filter
|
||||
status-im.constants/web3-shh-uninstall-filter
|
||||
status-im.constants/web3-shh-get-filter-changes
|
||||
status-im.constants/web3-shh-get-messages
|
||||
status-im.constants/status-create-address
|
||||
status-im.constants/event-transfer-hash
|
||||
status-im.constants/regx-rtl-characters
|
||||
status-im.constants/desktop-msg-chars-hard-limit
|
||||
status-im.constants/debug-metrics
|
||||
status-im.constants/scan-qr-code
|
||||
status-im.constants/ipfs-proto-code
|
||||
status-im.constants/swarm-proto-code
|
||||
legacy.status-im.multiaccounts.update.publisher/publish-update!
|
||||
legacy.status-im.utils.async/task-queue
|
||||
legacy.status-im.utils.async/async-periodic-run!
|
||||
legacy.status-im.desktop.core/app-root
|
||||
legacy.status-im.desktop.core/init
|
||||
legacy.status-im.chat.models-test/test-db
|
||||
legacy.status-im.ui.components.spacing/padding-vertical
|
||||
legacy.status-im.utils.money/percent-change
|
||||
status-im.ui.components.colors/white
|
||||
status-im.ui.components.colors/black
|
||||
status-im.transport.core-test/messages
|
||||
status-im.ui.components.core/animated-header
|
||||
status-im.ui.components.core/safe-area-provider
|
||||
status-im.ui.components.core/safe-area-consumer
|
||||
status-im.ui.components.core/safe-area-view
|
||||
status-im.utils.universal-links.core/open!
|
||||
status-im.transport.filters.core-test/member-2
|
||||
status-im.ui.screens.chat.ttt/one-to-one-chat-description-container
|
||||
status-im.ethereum.ens/ttl
|
||||
status-im.ethereum.ens/addr-hash
|
||||
status-im.ethereum.ens/name-hash
|
||||
status-im.ethereum.ens/ABI-hash
|
||||
status-im.ethereum.ens/pubkey-hash
|
||||
status-im.network.core/get-network
|
||||
status-im2.constants/desktop-content-types
|
||||
status-im2.constants/blocks-per-hour
|
||||
status-im2.constants/one-earth-day
|
||||
status-im2.constants/left-pane-min-width
|
||||
status-im2.constants/system
|
||||
status-im2.constants/contact-discovery
|
||||
status-im2.constants/send-transaction-failed-parse-response
|
||||
status-im2.constants/send-transaction-failed-parse-params
|
||||
status-im2.constants/send-transaction-no-account-selected
|
||||
status-im2.constants/send-transaction-invalid-tx-sender
|
||||
status-im2.constants/web3-get-logs
|
||||
status-im2.constants/web3-transaction-receipt
|
||||
status-im2.constants/web3-new-filter
|
||||
status-im2.constants/web3-new-pending-transaction-filter
|
||||
status-im2.constants/web3-new-block-filter
|
||||
status-im2.constants/web3-uninstall-filter
|
||||
status-im2.constants/web3-get-filter-changes
|
||||
status-im2.constants/web3-shh-post
|
||||
status-im2.constants/web3-shh-new-identity
|
||||
status-im2.constants/web3-shh-has-identity
|
||||
status-im2.constants/web3-shh-new-group
|
||||
status-im2.constants/web3-shh-add-to-group
|
||||
status-im2.constants/web3-shh-new-filter
|
||||
status-im2.constants/web3-shh-uninstall-filter
|
||||
status-im2.constants/web3-shh-get-filter-changes
|
||||
status-im2.constants/web3-shh-get-messages
|
||||
status-im2.constants/status-create-address
|
||||
status-im2.constants/event-transfer-hash
|
||||
status-im2.constants/regx-rtl-characters
|
||||
status-im2.constants/desktop-msg-chars-hard-limit
|
||||
status-im2.constants/debug-metrics
|
||||
status-im2.constants/scan-qr-code
|
||||
status-im2.constants/ipfs-proto-code
|
||||
status-im2.constants/swarm-proto-code
|
||||
status-im.multiaccounts.update.publisher/publish-update!
|
||||
status-im.utils.async/task-queue
|
||||
status-im.utils.async/async-periodic-run!
|
||||
status-im.desktop.core/app-root
|
||||
status-im.desktop.core/init
|
||||
status-im.chat.models-test/test-db
|
||||
status-im.ui.components.spacing/padding-vertical
|
||||
status-im.utils.money/percent-change
|
||||
utils.debounce/clear-all
|
||||
legacy.status-im.transport.db/create-chat
|
||||
legacy.status-im.utils.priority-map/priority-map
|
||||
legacy.status-im.utils.priority-map/priority-map-by
|
||||
legacy.status-im.utils.priority-map/priority-map-keyfn
|
||||
legacy.status-im.utils.priority-map/empty-message-map
|
||||
legacy.status-im.wallet.choose-recipient.core/use-default-eth-gas
|
||||
legacy.status-im.ui.components.animation/decay
|
||||
legacy.status-im.ui.components.animation/remove-all-listeners
|
||||
legacy.status-im.ui.components.animation/stop-animation
|
||||
legacy.status-im.ui.components.animation/animated
|
||||
legacy.status-im.ui.components.animation/add
|
||||
legacy.status-im.ui.components.animation/subtract
|
||||
legacy.status-im.ui.components.animation/get-layout
|
||||
legacy.status-im.wallet.transactions-test/uri-query-data
|
||||
legacy.status-im.utils.name/shortened-name
|
||||
legacy.status-im.ui.components.button.haptic/trigger
|
||||
legacy.status-im.contact.db/filter-dapps
|
||||
legacy.status-im.contact.db/filter-group-contacts
|
||||
legacy.status-im.contact.db/legacy-pending?
|
||||
legacy.status-im.utils.transducers-test/preview-call-1
|
||||
legacy.status-im.utils.transducers-test/preview-call-2
|
||||
legacy.status-im.utils.types/to-string
|
||||
legacy.status-im.chat.db/datemark?
|
||||
legacy.status-im.chat.db/gap?
|
||||
legacy.status-im.chat.db/map->sorted-seq
|
||||
legacy.status-im.utils.snoopy/status-module-filter
|
||||
legacy.status-im.utils.snoopy/websocket-filter
|
||||
legacy.status-im.utils.snoopy/touches-filter
|
||||
legacy.status-im.utils.snoopy/native-animation-filter
|
||||
legacy.status-im.utils.snoopy/keyboard-observer-filter
|
||||
legacy.status-im.utils.multihash/hex
|
||||
legacy.status-im.utils.multihash/decode-array
|
||||
status-im.transport.db/create-chat
|
||||
status-im.utils.priority-map/priority-map
|
||||
status-im.utils.priority-map/priority-map-by
|
||||
status-im.utils.priority-map/priority-map-keyfn
|
||||
status-im.utils.priority-map/empty-message-map
|
||||
status-im.wallet.choose-recipient.core/use-default-eth-gas
|
||||
status-im.ui.components.animation/decay
|
||||
status-im.ui.components.animation/remove-all-listeners
|
||||
status-im.ui.components.animation/stop-animation
|
||||
status-im.ui.components.animation/animated
|
||||
status-im.ui.components.animation/add
|
||||
status-im.ui.components.animation/subtract
|
||||
status-im.ui.components.animation/get-layout
|
||||
status-im.wallet.transactions-test/uri-query-data
|
||||
status-im.utils.name/shortened-name
|
||||
status-im.ui.components.button.haptic/trigger
|
||||
status-im.contact.db/filter-dapps
|
||||
status-im.contact.db/filter-group-contacts
|
||||
status-im.contact.db/legacy-pending?
|
||||
status-im.utils.transducers-test/preview-call-1
|
||||
status-im.utils.transducers-test/preview-call-2
|
||||
status-im.utils.types/to-string
|
||||
status-im.chat.db/datemark?
|
||||
status-im.chat.db/gap?
|
||||
status-im.chat.db/map->sorted-seq
|
||||
status-im.utils.snoopy/status-module-filter
|
||||
status-im.utils.snoopy/websocket-filter
|
||||
status-im.utils.snoopy/touches-filter
|
||||
status-im.utils.snoopy/native-animation-filter
|
||||
status-im.utils.snoopy/keyboard-observer-filter
|
||||
status-im.utils.multihash/hex
|
||||
status-im.utils.multihash/decode-array
|
||||
|
||||
+17
-28
@@ -1,41 +1,30 @@
|
||||
{:config-paths ["status-im"]
|
||||
:lint-as {legacy.status-im.utils.views/defview clojure.core/defn
|
||||
legacy.status-im.utils.views/letsubs clojure.core/let
|
||||
reagent.core/with-let clojure.core/let
|
||||
legacy.status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
|
||||
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
|
||||
quo.react/with-deps-check clojure.core/fn
|
||||
quo.previews.preview/list-comp clojure.core/for
|
||||
legacy.status-im.utils.styles/def clojure.core/def
|
||||
legacy.status-im.utils.styles/defn clojure.core/defn
|
||||
test-helpers.unit/deftest-sub clojure.core/defn
|
||||
taoensso.tufte/defnp clojure.core/defn}
|
||||
:lint-as {status-im.utils.views/defview clojure.core/defn
|
||||
status-im.utils.views/letsubs clojure.core/let
|
||||
reagent.core/with-let clojure.core/let
|
||||
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
|
||||
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
|
||||
quo.react/with-deps-check clojure.core/fn
|
||||
quo.previews.preview/list-comp clojure.core/for
|
||||
status-im.utils.styles/def clojure.core/def
|
||||
status-im.utils.styles/defn clojure.core/defn
|
||||
test-helpers.unit/deftest-sub clojure.core/defn
|
||||
taoensso.tufte/defnp clojure.core/defn}
|
||||
:linters {:case-duplicate-test {:level :error}
|
||||
:case-quoted-test {:level :error}
|
||||
:case-symbol-test {:level :error}
|
||||
:clj-kondo-config {:level :error}
|
||||
:cond-else {:level :error}
|
||||
:consistent-alias {:level :error
|
||||
:aliases {clojure.set set
|
||||
clojure.string string
|
||||
clojure.walk walk
|
||||
malli.core malli
|
||||
malli.dev.pretty malli.pretty
|
||||
malli.dev.virhe malli.virhe
|
||||
malli.error malli.error
|
||||
malli.generator malli.generator
|
||||
malli.transform malli.transform
|
||||
malli.util malli.util
|
||||
promesa.core p
|
||||
schema.core schema
|
||||
status-im.feature-flags ff
|
||||
taoensso.timbre log}}
|
||||
:aliases {clojure.string string
|
||||
clojure.set set
|
||||
clojure.walk walk
|
||||
taoensso.timbre log}}
|
||||
:deprecated-namespace {:level :warning}
|
||||
:docstring-blank {:level :error}
|
||||
:equals-true {:level :error}
|
||||
:inline-def {:level :error}
|
||||
:invalid-arity {:skip-args [legacy.status-im.utils.fx/defn
|
||||
utils.re-frame/defn]}
|
||||
:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
|
||||
:loop-without-recur {:level :error}
|
||||
:minus-one {:level :error}
|
||||
:misplaced-docstring {:level :error}
|
||||
@@ -65,7 +54,7 @@
|
||||
;; https://github.com/borkdude/clj-kondo/issues/867
|
||||
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY
|
||||
number
|
||||
legacy.status-im.test-helpers/restore-app-db]}
|
||||
status-im.test-helpers/restore-app-db]}
|
||||
:unresolved-var {:level :error}
|
||||
:unsorted-required-namespaces {:level :error}
|
||||
:unused-alias {:level :warning}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{:lint-as {promesa.core/-> clojure.core/->
|
||||
promesa.core/->> clojure.core/->>
|
||||
promesa.core/as-> clojure.core/as->
|
||||
promesa.core/let clojure.core/let
|
||||
promesa.core/plet clojure.core/let
|
||||
promesa.core/loop clojure.core/loop
|
||||
promesa.core/recur clojure.core/recur
|
||||
promesa.core/with-redefs clojure.core/with-redefs
|
||||
promesa.core/doseq clojure.core/doseq}}
|
||||
@@ -1,2 +0,0 @@
|
||||
{:lint-as {malli.experimental/defn schema.core/defn}
|
||||
:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}}
|
||||
@@ -1,4 +0,0 @@
|
||||
{:linters
|
||||
{:unresolved-symbol
|
||||
{:exclude [(cljs.test/is [match? thrown-match?])
|
||||
(clojure.test/is [match? thrown-match?])]}}}
|
||||
@@ -1,5 +0,0 @@
|
||||
{:lint-as
|
||||
{rewrite-clj.zip/subedit-> clojure.core/->
|
||||
rewrite-clj.zip/subedit->> clojure.core/->>
|
||||
rewrite-clj.zip/edit-> clojure.core/->
|
||||
rewrite-clj.zip/edit->> clojure.core/->>}}
|
||||
@@ -1,8 +1,2 @@
|
||||
{:hooks
|
||||
{:analyze-call
|
||||
{utils.i18n/label utils.i18n/label
|
||||
test-helpers.component/get-all-by-translation-text utils.i18n/label
|
||||
test-helpers.component/get-by-translation-text utils.i18n/label
|
||||
test-helpers.component/query-all-by-translation-text utils.i18n/label
|
||||
test-helpers.component/query-by-translation-text utils.i18n/label}}
|
||||
{:hooks {:analyze-call {utils.i18n/label utils.i18n/label}}
|
||||
:linters {:status-im.linter/invalid-translation-keyword {:level :error}}}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{:hooks {:analyze-call {taoensso.encore/defalias taoensso.encore/defalias}}}
|
||||
@@ -1,16 +0,0 @@
|
||||
(ns taoensso.encore
|
||||
(:require
|
||||
[clj-kondo.hooks-api :as hooks]))
|
||||
|
||||
(defn defalias [{:keys [node]}]
|
||||
(let [[sym-raw src-raw] (rest (:children node))
|
||||
src (if src-raw src-raw sym-raw)
|
||||
sym (if src-raw
|
||||
sym-raw
|
||||
(symbol (name (hooks/sexpr src))))]
|
||||
{:node (with-meta
|
||||
(hooks/list-node
|
||||
[(hooks/token-node 'def)
|
||||
(hooks/token-node (hooks/sexpr sym))
|
||||
(hooks/token-node (hooks/sexpr src))])
|
||||
(meta src))}))
|
||||
@@ -34,4 +34,3 @@ STICKERS_TEST_ENABLED=1
|
||||
LOCAL_PAIRING_ENABLED=1
|
||||
TEST_STATEOFUS=1
|
||||
FAST_CREATE_COMMUNITY_ENABLED=1
|
||||
FLAG_NEW_CONTACT_UI_ENABLED=0
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: '@react-native',
|
||||
extends: '@react-native-community',
|
||||
};
|
||||
|
||||
+3
-6
@@ -36,10 +36,6 @@ project.xcworkspace
|
||||
**/android/.project
|
||||
**/android/.settings/org.eclipse.buildship.core.prefs
|
||||
local.properties
|
||||
*.hprof
|
||||
.cxx/
|
||||
*.keystore
|
||||
!debug.keystore
|
||||
|
||||
# Atom
|
||||
.tags*
|
||||
@@ -195,5 +191,6 @@ test/appium/tests/users.py
|
||||
## git hooks
|
||||
lefthook.yml
|
||||
|
||||
## build time logs
|
||||
/logs/*.log
|
||||
## clj-kondo
|
||||
/.clj-kondo/taoensso/*
|
||||
/.clj-kondo/babashka/*
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"include": [
|
||||
"target/test/legacy/status_im/**"
|
||||
"target/test/status_im/**"
|
||||
],
|
||||
"exclude": [
|
||||
"target/test/legacy/status_im/test/**",
|
||||
"target/test/legacy/status_im/ui/**"
|
||||
"target/test/status_im/test/**",
|
||||
"target/test/status_im/ui/**"
|
||||
],
|
||||
"report-dir": "./coverage-report",
|
||||
"all": true,
|
||||
@@ -14,4 +14,4 @@
|
||||
"exclude-after-remap": false,
|
||||
"extension": [".js"],
|
||||
"reporter": ["lcovonly"]
|
||||
}
|
||||
}
|
||||
@@ -1,61 +1,52 @@
|
||||
;; -*- mode: clojure -*-
|
||||
;; vi: ft=clojure
|
||||
{:width 105
|
||||
:remove {:fn-force-nl #{:noarg1-body}}
|
||||
{:width 105
|
||||
:style [;; community style
|
||||
;; https://github.com/kkinnear/zprint/blob/main/doc/reference.md#community
|
||||
:community
|
||||
|
||||
:style
|
||||
[;; community style https://github.com/kkinnear/zprint/blob/main/doc/reference.md#community
|
||||
:community
|
||||
;; no comma in map
|
||||
:no-comma
|
||||
|
||||
;; no comma in map
|
||||
:no-comma
|
||||
:custom-justify
|
||||
|
||||
:custom-justify
|
||||
;; respect all newlines
|
||||
;; https://github.com/kkinnear/zprint/blob/main/doc/reference.md#respect-nl
|
||||
:respect-nl
|
||||
|
||||
;; respect all newlines https://github.com/kkinnear/zprint/blob/main/doc/reference.md#respect-nl
|
||||
:respect-nl
|
||||
|
||||
;; respect blank line https://github.com/kkinnear/zprint/blob/main/doc/reference.md#respect-bl
|
||||
:respect-bl
|
||||
|
||||
;; hang multiline left-hand-thing https://github.com/kkinnear/zprint/issues/273
|
||||
:multi-lhs-hang]
|
||||
;; respect blank line
|
||||
;; https://github.com/kkinnear/zprint/blob/main/doc/reference.md#respect-bl
|
||||
:respect-bl
|
||||
|
||||
;; hang multiline left-hand-thing
|
||||
;; https://github.com/kkinnear/zprint/issues/273
|
||||
:multi-lhs-hang]
|
||||
:fn-map
|
||||
{"reg-sub" :arg1-pair
|
||||
"h/describe" :arg1-body
|
||||
"h/describe-skip" :arg1-body
|
||||
"h/describe-only" :arg1-body
|
||||
"h/test" :arg1-body
|
||||
"h/test-skip" :arg1-body
|
||||
"h/test-only" :arg1-body
|
||||
"test/async" :arg1-body
|
||||
"test/use-fixtures" :arg1-body
|
||||
"global.describe" :arg1-body
|
||||
"global.test" :arg1-body
|
||||
"list-comp" :binding
|
||||
"defview" :arg1-body
|
||||
"letsubs" :binding
|
||||
"with-let" "let"
|
||||
"reg-event-fx" :arg1-pair
|
||||
"reg-fx" :arg1-pair
|
||||
"testing" :arg1-body
|
||||
"deftest-sub" :arg1-body
|
||||
"h/integration-test" :arg1-body
|
||||
"wait-for" :arg1-body
|
||||
"with-deps-check" :arg1-body
|
||||
"schema/=>" :arg1-body
|
||||
"->" [:noarg1-body
|
||||
{:list {:constant-pair? false :force-nl? false}
|
||||
:next-inner-restore [[:list :constant-pair?]]}]
|
||||
"set!" "reset!"
|
||||
"assoc-when" "assoc"
|
||||
"assoc-some" "assoc"
|
||||
"conj-when" "conj"
|
||||
"conj-some" "conj"}
|
||||
|
||||
{"reg-sub" :arg1-pair
|
||||
"h/describe" :arg1-body
|
||||
"h/test" :arg1-body
|
||||
"global.describe" :arg1-body
|
||||
"global.test" :arg1-body
|
||||
"list-comp" :binding
|
||||
"defview" :arg1-body
|
||||
"letsubs" :binding
|
||||
"with-let" "let"
|
||||
"reg-event-fx" :arg1-pair
|
||||
"testing" :arg1-body
|
||||
"deftest-sub" :arg1-body
|
||||
"wait-for" :arg1-body
|
||||
"with-deps-check" :arg1-body
|
||||
"->" [:noarg1-body
|
||||
{:list {:constant-pair? false :force-nl? false}
|
||||
:next-inner-restore [[:list :constant-pair?]]}]
|
||||
"set!" "reset!"
|
||||
"assoc-when" "assoc"
|
||||
"assoc-some" "assoc"
|
||||
"conj-when" "conj"
|
||||
"conj-some" "conj"}
|
||||
:remove {:fn-force-nl #{:noarg1-body}}
|
||||
:style-map
|
||||
{:no-comma {:map {:comma? false}}
|
||||
{:no-comma {:map {:comma? false}}
|
||||
:custom-justify
|
||||
{:doc "Justify everything using pre-1.1.2 approach"
|
||||
:binding {:justify? true :justify {:max-variance 1000}}
|
||||
|
||||
@@ -36,8 +36,6 @@ endif
|
||||
export TMPDIR = /tmp/tmp-status-mobile-$(BUILD_TAG)
|
||||
# This has to be specified for both the Node.JS server process and the Qt process.
|
||||
export REACT_SERVER_PORT ?= 5001
|
||||
# Default metro port used by scripts/run-android.sh.
|
||||
export RCT_METRO_PORT ?= 8081
|
||||
# Fix for ERR_OSSL_EVP_UNSUPPORTED error.
|
||||
export NODE_OPTIONS += --openssl-legacy-provider
|
||||
# The path can be anything, but home is usually safest.
|
||||
@@ -46,7 +44,7 @@ export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore
|
||||
# Our custom config is located in nix/nix.conf
|
||||
export NIX_USER_CONF_FILES = $(PWD)/nix/nix.conf
|
||||
# Location of symlinks to derivations that should not be garbage collected
|
||||
export _NIX_GCROOTS = ./.nix-gcroots
|
||||
export _NIX_GCROOTS = /nix/var/nix/gcroots/per-user/$(USER)/status-mobile
|
||||
# Defines which variables will be kept for Nix pure shell, use semicolon as divider
|
||||
export _NIX_KEEP ?= TMPDIR,BUILD_ENV,\
|
||||
BUILD_TYPE,BUILD_NUMBER,COMMIT_HASH,\
|
||||
@@ -56,6 +54,12 @@ export _NIX_KEEP ?= TMPDIR,BUILD_ENV,\
|
||||
# Useful for Android release builds
|
||||
TMP_BUILD_NUMBER := $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)
|
||||
|
||||
# MacOS root is read-only, read nix/README.md for details
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
export NIX_IGNORE_SYMLINK_STORE=1
|
||||
endif
|
||||
|
||||
#----------------
|
||||
# Nix targets
|
||||
#----------------
|
||||
@@ -156,12 +160,10 @@ pod-install: export TARGET := ios
|
||||
pod-install: ##@prepare Run 'pod install' to install podfiles and update Podfile.lock
|
||||
cd ios && pod install; cd --
|
||||
|
||||
FLEETS_FILE := ./resources/config/fleets.json
|
||||
update-fleets: ##@prepare Download up-to-date JSON file with current fleets state
|
||||
curl -s https://fleets.status.im/ \
|
||||
| sed 's/"warning": "/"warning": "DO NOT EDIT! /' \
|
||||
> $(FLEETS_FILE)
|
||||
echo >> $(FLEETS_FILE)
|
||||
> resources/config/fleets.json
|
||||
|
||||
$(KEYSTORE_PATH): export TARGET := keytool
|
||||
$(KEYSTORE_PATH):
|
||||
@@ -210,7 +212,7 @@ build-fdroid: ##@build Build release for F-Droid
|
||||
|
||||
build-android: export BUILD_ENV ?= prod
|
||||
build-android: export BUILD_TYPE ?= nightly
|
||||
build-android: export ORG_GRADLE_PROJECT_versionCode ?= $(TMP_BUILD_NUMBER)
|
||||
build-android: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER)
|
||||
build-android: export ANDROID_ABI_SPLIT ?= false
|
||||
build-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
|
||||
build-android: ##@build Build unsigned Android APK
|
||||
@@ -263,7 +265,7 @@ run-clojure: ##@run Watch for and build Clojure changes for mobile
|
||||
|
||||
run-metro: export TARGET := clojure
|
||||
run-metro: ##@run Start Metro to build React Native changes
|
||||
@scripts/run-metro.sh
|
||||
@scripts/start-react-native.sh
|
||||
|
||||
run-re-frisk: export TARGET := clojure
|
||||
run-re-frisk: ##@run Start re-frisk server
|
||||
@@ -271,27 +273,31 @@ run-re-frisk: ##@run Start re-frisk server
|
||||
|
||||
# TODO: Migrate this to a Nix recipe, much the same way as nix/mobile/android/targets/release-android.nix
|
||||
run-android: export TARGET := android
|
||||
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
|
||||
# https://github.com/status-im/status-mobile/issues/18493
|
||||
run-android: export ORG_GRADLE_PROJECT_hermesEnabled := false
|
||||
# INFO: If it's empty (no devices attached, parsing issues, script error) - for Nix it's the same as not set.
|
||||
run-android: export ANDROID_ABI_INCLUDE ?= $(shell ./scripts/adb_devices_abis.sh)
|
||||
run-android: ##@run Build Android APK and start it on the device
|
||||
@scripts/run-android.sh
|
||||
npx react-native run-android --appIdSuffix debug
|
||||
|
||||
SIMULATOR=iPhone 13
|
||||
# TODO: fix IOS_STATUS_GO_TARGETS to be either amd64 or arm64 when RN is upgraded
|
||||
run-ios: export TARGET := ios
|
||||
run-ios: export IOS_STATUS_GO_TARGETS := ios/arm64;iossimulator/amd64
|
||||
run-ios: ##@run Build iOS app and start it in on the simulator
|
||||
@scripts/run-ios.sh "${SIMULATOR}"
|
||||
run-ios: export IOS_STATUS_GO_TARGETS := iossimulator/amd64
|
||||
run-ios: ##@run Build iOS app and start it in a simulator/device
|
||||
ifneq ("$(SIMULATOR)", "")
|
||||
npx react-native run-ios --simulator="$(SIMULATOR)"
|
||||
else
|
||||
npx react-native run-ios
|
||||
endif
|
||||
|
||||
show-ios-devices: ##@other shows connected ios device and its name
|
||||
xcrun xctrace list devices
|
||||
|
||||
# TODO: fix IOS_STATUS_GO_TARGETS to be either amd64 or arm64 when RN is upgraded
|
||||
run-ios-device: export TARGET := ios
|
||||
run-ios-device: export IOS_STATUS_GO_TARGETS := ios/arm64;iossimulator/amd64
|
||||
run-ios-device: ##@run iOS app and start it on the first connected iPhone
|
||||
@scripts/run-ios-device.sh
|
||||
run-ios-device: export IOS_STATUS_GO_TARGETS := ios/arm64
|
||||
run-ios-device: ##@run iOS app and start it on a connected device by its name
|
||||
ifndef DEVICE_NAME
|
||||
$(error Usage: make run-ios-device DEVICE_NAME=your-device-name)
|
||||
endif
|
||||
react-native run-ios --device "$(DEVICE_NAME)"
|
||||
|
||||
#--------------
|
||||
# Tests
|
||||
@@ -299,20 +305,19 @@ run-ios-device: ##@run iOS app and start it on the first connected iPhone
|
||||
|
||||
# Get all clojure files, including untracked, excluding removed
|
||||
define find_all_clojure_files
|
||||
$$(comm -23 <(sort <(git ls-files --cached --others --exclude-standard)) <(sort <(git ls-files --deleted)) | grep -E '((\.clj-kondo\/status-im)|(src).*\.clj[sc]?$$)|((\.clj-kondo\/(status-im|config))|(src).*\.edn$$)|shadow-cljs\.edn')
|
||||
$$(comm -23 <(sort <(git ls-files --cached --others --exclude-standard)) <(sort <(git ls-files --deleted)) | grep -e \.clj$$ -e \.cljs$$ -e \.cljc$$ -e \.edn)
|
||||
endef
|
||||
|
||||
lint: export TARGET := clojure
|
||||
lint: export CLJ_LINTER_PRINT_WARNINGS ?= false
|
||||
lint: ##@test Run code style checks
|
||||
@sh scripts/lint/re-frame-in-quo-components.sh && \
|
||||
sh scripts/lint/direct-require-component-outside-quo.sh && \
|
||||
sh scripts/lint/require-i18n-resource-first.sh && \
|
||||
@sh scripts/lint-re-frame-in-quo-components.sh && \
|
||||
sh scripts/lint-direct-require-component-outside-quo.sh && \
|
||||
clj-kondo --config .clj-kondo/config.edn --cache false --fail-level error --lint src $(if $(filter $(CLJ_LINTER_PRINT_WARNINGS),true),,| grep -v ': warning: ') && \
|
||||
ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \
|
||||
scripts/lint/translations.clj && \
|
||||
scripts/lint_translations.clj && \
|
||||
zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILES && \
|
||||
sh scripts/lint/trailing-newline.sh && \
|
||||
sh scripts/lint-trailing-newline.sh && \
|
||||
node_modules/.bin/prettier --write .
|
||||
|
||||
# NOTE: We run the linter twice because of https://github.com/kkinnear/zprint/issues/271
|
||||
@@ -321,57 +326,34 @@ lint-fix: ##@test Run code style checks and fix issues
|
||||
ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \
|
||||
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \
|
||||
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \
|
||||
clojure-lsp --ns-exclude-regex ".*/\.clj-kondo/.*|.*/src/status_im/core\.cljs|.*/src/test_helpers/component_tests_preload\.cljs$$" clean-ns && \
|
||||
sh scripts/lint/trailing-newline.sh --fix && \
|
||||
clojure-lsp --ns-exclude-regex ".*/src/status_im2/core\.cljs$$" clean-ns && \
|
||||
sh scripts/lint-trailing-newline.sh --fix && \
|
||||
node_modules/.bin/prettier --write .
|
||||
|
||||
shadow-server: export TARGET := clojure
|
||||
shadow-server:##@ Start shadow-cljs in server mode for watching
|
||||
yarn shadow-cljs server
|
||||
|
||||
_test-clojure: export TARGET := clojure
|
||||
_test-clojure: export WATCH ?= false
|
||||
_test-clojure:
|
||||
ifeq ($(WATCH), true)
|
||||
yarn install && \
|
||||
yarn shadow-cljs compile mocks && \
|
||||
nodemon --exec "yarn shadow-cljs compile test && node --require ./test-resources/override.js $$SHADOW_OUTPUT_TO" -e cljs
|
||||
else
|
||||
yarn install && \
|
||||
yarn shadow-cljs compile mocks && \
|
||||
yarn shadow-cljs compile test && \
|
||||
node --require ./test-resources/override.js "$$SHADOW_OUTPUT_TO"
|
||||
endif
|
||||
test-watch: export TARGET := clojure
|
||||
test-watch: ##@ Watch tests and re-run no changes to cljs files
|
||||
yarn install
|
||||
nodemon --exec 'yarn shadow-cljs compile mocks && yarn shadow-cljs compile test && node --require ./test-resources/override.js target/test/test.js' -e cljs
|
||||
|
||||
test: export SHADOW_OUTPUT_TO := target/test/test.js
|
||||
test: export SHADOW_NS_REGEXP := .*-test$$
|
||||
test: ##@test Run all Clojure tests
|
||||
test: _test-clojure
|
||||
|
||||
test-watch-for-repl: export SHADOW_OUTPUT_TO := target/test/test.js
|
||||
test-watch-for-repl: export SHADOW_NS_REGEXP := .*-test$$
|
||||
test-watch-for-repl: ##@test Watch all Clojure tests and support REPL connections
|
||||
test-watch-for-repl: export TARGET := clojure
|
||||
test-watch-for-repl: ##@ Watch tests and support REPL connections
|
||||
yarn install
|
||||
rm -f target/test/test.js
|
||||
yarn shadow-cljs compile mocks && \
|
||||
concurrently --kill-others --prefix-colors 'auto' --names 'build,repl' \
|
||||
'yarn shadow-cljs watch test --verbose' \
|
||||
"until [ -f $$SHADOW_OUTPUT_TO ] ; do sleep 1 ; done ; node --require ./test-resources/override.js $$SHADOW_OUTPUT_TO --repl"
|
||||
'yarn shadow-cljs compile mocks && yarn shadow-cljs watch test --verbose' \
|
||||
'until [ -f ./target/test/test.js ] ; do sleep 1 ; done ; node --require ./test-resources/override.js ./target/test/test.js --repl'
|
||||
|
||||
test-unit: export SHADOW_OUTPUT_TO := target/unit_test/test.js
|
||||
test-unit: export SHADOW_NS_REGEXP := ^(?!tests\.integration-test)(?!tests\.contract-test).*-test$$
|
||||
test-unit: ##@test Run unit tests
|
||||
test-unit: _test-clojure
|
||||
|
||||
test-integration: export SHADOW_OUTPUT_TO := target/integration_test/test.js
|
||||
test-integration: export SHADOW_NS_REGEXP := ^tests\.integration-test.*$$
|
||||
test-integration: ##@test Run integration tests
|
||||
test-integration: _test-clojure
|
||||
|
||||
test-contract: export SHADOW_OUTPUT_TO := target/contract_test/test.js
|
||||
test-contract: export SHADOW_NS_REGEXP := ^tests\.contract-test.*$$
|
||||
test-contract: ##@test Run contract tests
|
||||
test-contract: _test-clojure
|
||||
test: export TARGET := clojure
|
||||
test: ##@test Run tests once in NodeJS
|
||||
# Here we create the gyp bindings for nodejs
|
||||
yarn install
|
||||
yarn shadow-cljs compile mocks && \
|
||||
yarn shadow-cljs compile test && \
|
||||
node --require ./test-resources/override.js target/test/test.js
|
||||
|
||||
android-test: jsbundle
|
||||
android-test: export TARGET := android
|
||||
@@ -381,21 +363,21 @@ android-test:
|
||||
component-test-watch: export TARGET := clojure
|
||||
component-test-watch: export COMPONENT_TEST := true
|
||||
component-test-watch: export BABEL_ENV := test
|
||||
component-test-watch: export JEST_USE_SILENT_REPORTER := false
|
||||
component-test-watch: ##@ Watch tests and re-run no changes to cljs files
|
||||
@scripts/check-metro-shadow-process.sh
|
||||
@@scripts/check-metro-shadow-process.sh
|
||||
rm -rf ./component-spec
|
||||
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js --testEnvironment node ' -e cljs
|
||||
yarn install
|
||||
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js' -e cljs
|
||||
|
||||
component-test: export TARGET := clojure
|
||||
component-test: export COMPONENT_TEST := true
|
||||
component-test: export BABEL_ENV := test
|
||||
component-test: export JEST_USE_SILENT_REPORTER := false
|
||||
component-test: ##@test Run component tests once in NodeJS
|
||||
@scripts/check-metro-shadow-process.sh
|
||||
rm -rf ./component-spec
|
||||
yarn install
|
||||
yarn shadow-cljs compile component-test && \
|
||||
jest --clearCache && jest --config=test/jest/jest.config.js --testEnvironment node
|
||||
jest --config=test/jest/jest.config.js
|
||||
|
||||
#--------------
|
||||
# Other
|
||||
@@ -448,18 +430,3 @@ repl-clojure: ##@repl Start Clojure repl for mobile App
|
||||
yarn shadow-cljs cljs-repl mobile
|
||||
|
||||
repl-nix: nix-repl ##@repl Start an interactive Nix REPL
|
||||
|
||||
#--------------
|
||||
# Dev Automation Flows
|
||||
#--------------
|
||||
|
||||
auto-login: export TARGET := default
|
||||
auto-login: ##@auto runs flow for login or onboarding app on simulator/emulator
|
||||
maestro test "maestro/create-account-or-login.yaml"
|
||||
|
||||
auto-custom: export TARGET := default
|
||||
auto-custom: ##@auto runs any custom maestro automation flow on simulator/emulator
|
||||
ifndef FLOW
|
||||
$(error Usage: make automate FLOW=your-maestro-flow-file.yaml)
|
||||
endif
|
||||
maestro test "$(FLOW)"
|
||||
|
||||
@@ -37,7 +37,7 @@ project dependencies, coding guidelines and testing procedures.
|
||||
Check out our [coding guidelines](doc/new-guidelines.md).
|
||||
|
||||
- **Community Management**
|
||||
Metcalfe's law states that the value of a network is proportional to the square of the number of connected users of the system - without community Status is meaningless. We're looking to create a positive, fun environment to explore new ideas, experiment and grow the Status community. Building a community takes a lot of work but the people you'll meet and the long-lasting relationships you form will be well worth it, check out our [Mission and Community Principles](https://status.app/manifesto)
|
||||
Metcalfe's law states that the value of a network is proportional to the square of the number of connected users of the system - without community Status is meaningless. We're looking to create a positive, fun environment to explore new ideas, experiment and grow the Status community. Building a community takes a lot of work but the people you'll meet and the long-lasting relationships you form will be well worth it, check out our [Mission and Community Principles](https://status.im/about)
|
||||
|
||||
- **Specification / Documentation**
|
||||
John Dewey once said, "Education is not preparation for life; education is life *itself* ". Developers and Designers need guidance and it all starts from documentation and specifications. Our software is only as good as its documentation, check out our [docs](doc/) and see how you can improve what we have.
|
||||
@@ -53,10 +53,10 @@ Status is a visual interface to make permanent changes on the Blockchain, it han
|
||||
|
||||
- **Evangelism**
|
||||
Help us spread the word! Tell a friend *right now*, in fact, tell **everyone** - yell from a mountain if you have to, every person counts! If you've got a great story to tell or have some interesting way you've spread the word about Status let us know about it in our [chat](https://join.status.im/chat/public/status)
|
||||
|
||||
|
||||
## Give me Binaries!
|
||||
|
||||
You can get our Beta builds for both Android and iOS on our [website](https://status.app), through our [nightly builds](https://status.im/nightly/), or by [building it yourself](doc/starting-guide.md).
|
||||
You can get our Beta builds for both Android and iOS on our [website](https://status.im), through our [nightly builds](https://status.im/nightly/), or by [building it yourself](https://status.im/technical/build_status/).
|
||||
|
||||
## Core Contributors
|
||||
|
||||
|
||||
+223
-71
@@ -1,75 +1,128 @@
|
||||
apply plugin: "com.android.application"
|
||||
apply plugin: "org.jetbrains.kotlin.android"
|
||||
apply plugin: "com.facebook.react"
|
||||
|
||||
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
|
||||
|
||||
import com.android.build.OutputFile
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
|
||||
|
||||
/*
|
||||
* This is the configuration block to customize your React Native Android app.
|
||||
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
||||
/**
|
||||
* The react.gradle file registers a task for each build variant:
|
||||
* - bundlePrJsAndAssets
|
||||
* - bundleDebugJsAndAssets
|
||||
* - bundleReleaseJsAndAssets
|
||||
* These basically call `react-native bundle` with the correct arguments during the Android build
|
||||
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
|
||||
* bundle directly from the development server. Below you can see all the possible configurations
|
||||
* and their defaults. If you decide to add a configuration block, make sure to add it before the
|
||||
* `apply from: "../../node_modules/react-native/react.gradle"` line.
|
||||
*
|
||||
* project.ext.react = [
|
||||
* // the name of the generated asset file containing your JS bundle
|
||||
* bundleAssetName: "index.android.bundle",
|
||||
*
|
||||
* // the entry file for bundle generation
|
||||
* entryFile: "index.js",
|
||||
*
|
||||
* // whether to bundle JS and assets in debug mode
|
||||
* bundleInDebug: false,
|
||||
*
|
||||
* // whether to bundle JS and assets in release mode
|
||||
* bundleInRelease: true,
|
||||
*
|
||||
* // whether to bundle JS and assets in another build variant (if configured).
|
||||
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
|
||||
* // The configuration property can be in the following formats
|
||||
* // 'bundleIn${productFlavor}${buildType}'
|
||||
* // 'bundleIn${buildType}'
|
||||
* // bundleInFreeDebug: true,
|
||||
* // bundleInPaidRelease: true,
|
||||
* // bundleInBeta: true,
|
||||
*
|
||||
* // whether to disable dev mode in custom build variants (by default only disabled in release)
|
||||
* // for example: to disable dev mode in the staging build type (if configured)
|
||||
* devDisabledInStaging: true,
|
||||
* // The configuration property can be in the following formats
|
||||
* // 'devDisabledIn${productFlavor}${buildType}'
|
||||
* // 'devDisabledIn${buildType}'
|
||||
*
|
||||
* // the root of your project, i.e. where "package.json" lives
|
||||
* root: "../../",
|
||||
*
|
||||
* // where to put the JS bundle asset in debug mode
|
||||
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
|
||||
*
|
||||
* // where to put the JS bundle asset in release mode
|
||||
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
|
||||
*
|
||||
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||
* // require('./image.png')), in debug mode
|
||||
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
|
||||
*
|
||||
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||
* // require('./image.png')), in release mode
|
||||
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
|
||||
*
|
||||
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
|
||||
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
|
||||
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
|
||||
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
|
||||
* // for example, you might want to remove it from here.
|
||||
* inputExcludes: ["android/**", "ios/**"],
|
||||
*
|
||||
* // override which node gets called and with what additional arguments
|
||||
* nodeExecutableAndArgs: ["node", "--max-old-space-size=8192"],
|
||||
*
|
||||
* // supply additional arguments to the packager
|
||||
* extraPackagerArgs: []
|
||||
* ]
|
||||
*/
|
||||
react {
|
||||
/* Folders */
|
||||
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
||||
// root = file("../")
|
||||
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
||||
// reactNativeDir = file("../node_modules/react-native")
|
||||
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
||||
// codegenDir = file("../node_modules/@react-native/codegen")
|
||||
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
||||
// cliFile = file("../node_modules/react-native/cli.js")
|
||||
|
||||
/* Variants */
|
||||
// The list of variants to that are debuggable. For those we're going to
|
||||
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
||||
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
||||
// debuggableVariants = ["liteDebug", "prodDebug"]
|
||||
/*
|
||||
Enabling Hermes on x86 devices is crashing the app after a few reloads,
|
||||
this flag can be used to disable Hermes while building app.
|
||||
https://github.com/status-im/status-mobile/issues/14031
|
||||
*/
|
||||
|
||||
/* Bundling */
|
||||
// A list containing the node command and its flags. Default is just 'node'.
|
||||
nodeExecutableAndArgs = ["node", "--max-old-space-size=16384" ]
|
||||
//
|
||||
// The command to run when bundling. By default is 'bundle'
|
||||
// bundleCommand = "ram-bundle"
|
||||
//
|
||||
// The path to the CLI configuration file. Default is empty.
|
||||
// bundleConfig = file(../rn-cli.config.js)
|
||||
//
|
||||
// The name of the generated asset file containing your JS bundle
|
||||
// bundleAssetName = "MyApplication.android.bundle"
|
||||
//
|
||||
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
||||
// entryFile = file("../js/MyApplication.android.js")
|
||||
//
|
||||
// A list of extra flags to pass to the 'bundle' commands.
|
||||
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
||||
// extraPackagerArgs = []
|
||||
def disableHermes = System.getenv('DISABLE_HERMES') == 'true'
|
||||
|
||||
/* Hermes Commands */
|
||||
// The hermes compiler command to run. By default it is 'hermesc'
|
||||
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
||||
//
|
||||
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
||||
// hermesFlags = ["-O", "-output-source-map"]
|
||||
}
|
||||
project.ext.react = [
|
||||
nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"],
|
||||
entryFile: "index.js",
|
||||
/* NOTE: Hermes engine is required for Android 64-bit builds running on 64 devices,
|
||||
* to guard against a hang in the UI thread after invoking status-go.
|
||||
* Also a clean and rebuild is required when changing this. */
|
||||
enableHermes: !disableHermes,
|
||||
/* Disable 'The first definition was here.' warnings */
|
||||
hermesFlagsRelease: ["-w"],
|
||||
/* FIXME: Workaround for crash caused by missing libhermes-executor-release.so.
|
||||
* https://github.com/facebook/react-native/issues/32928 */
|
||||
deleteDebugFilesForVariant: { false },
|
||||
enableVmCleanup: false,
|
||||
bundleInPr: true,
|
||||
inputExcludes: ["android/**", "ios/**", "react-native/**", "src/**", "test/**"]
|
||||
]
|
||||
|
||||
// NOTE: Uncomment if building RN from a fork
|
||||
// configurations.all {
|
||||
// exclude group: 'com.facebook.react', module: 'react-native'
|
||||
// }
|
||||
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
|
||||
/**
|
||||
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
||||
* Run Proguard to shrink the Java bytecode in release builds.
|
||||
*/
|
||||
def enableProguardInReleaseBuilds = false
|
||||
|
||||
/**
|
||||
* The preferred build flavor of JavaScriptCore (JSC)
|
||||
* The preferred build flavor of JavaScriptCore.
|
||||
*
|
||||
* For example, to use the international variant, you can use:
|
||||
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||
*
|
||||
* The international variant includes ICU i18n library and necessary data
|
||||
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||
* give correct results when using with locales other than en-US. Note that
|
||||
* give correct results when using with locales other than en-US. Note that
|
||||
* this variant is about 6MiB larger per architecture than default.
|
||||
*/
|
||||
def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
@@ -81,8 +134,15 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
|
||||
* and the benefits of using Hermes will therefore be sharply reduced.
|
||||
*/
|
||||
def enableHermes = hermesEnabled.toBoolean();
|
||||
def enableHermes = project.ext.react.get("enableHermes", false);
|
||||
|
||||
/**
|
||||
* Architectures to build native code for.
|
||||
*/
|
||||
def reactNativeArchitectures() {
|
||||
def value = project.getProperties().get("reactNativeArchitectures")
|
||||
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||
}
|
||||
|
||||
def getCommitHash = { ->
|
||||
if (project.hasProperty("commitHash")) {
|
||||
@@ -145,7 +205,6 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
namespace "im.status.ethereum"
|
||||
defaultConfig {
|
||||
applicationId "im.status.ethereum"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
@@ -161,8 +220,70 @@ android {
|
||||
abiFilters getEnvOrConfig('ANDROID_ABI_INCLUDE').split(";")
|
||||
}
|
||||
}
|
||||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
// We configure the NDK build only if you decide to opt-in for the New Architecture.
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "APP_PLATFORM=android-21",
|
||||
"APP_STL=c++_shared",
|
||||
"NDK_TOOLCHAIN_VERSION=clang",
|
||||
"GENERATED_SRC_DIR=$buildDir/generated/source",
|
||||
"PROJECT_BUILD_DIR=$buildDir",
|
||||
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
|
||||
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
|
||||
"NODE_MODULES_DIR=$rootDir/../node_modules"
|
||||
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
|
||||
cppFlags "-std=c++17"
|
||||
// Make sure this target name is the same you specify inside the
|
||||
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
|
||||
targets "rndiffapp_appmodules"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
// We configure the NDK build only if you decide to opt-in for the New Architecture.
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path "$projectDir/src/main/jni/Android.mk"
|
||||
}
|
||||
}
|
||||
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
|
||||
def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
|
||||
dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
|
||||
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
|
||||
into("$buildDir/react-ndk/exported")
|
||||
}
|
||||
def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
|
||||
dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
|
||||
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
|
||||
into("$buildDir/react-ndk/exported")
|
||||
}
|
||||
afterEvaluate {
|
||||
// If you wish to add a custom TurboModule or component locally,
|
||||
// you should uncomment this line.
|
||||
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
|
||||
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
|
||||
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
|
||||
|
||||
// Due to a bug inside AGP, we have to explicitly set a dependency
|
||||
// between configureNdkBuild* tasks and the preBuild tasks.
|
||||
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
|
||||
configureNdkBuildRelease.dependsOn(preReleaseBuild)
|
||||
configureNdkBuildDebug.dependsOn(preDebugBuild)
|
||||
reactNativeArchitectures().each { architecture ->
|
||||
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
|
||||
dependsOn("preDebugBuild")
|
||||
}
|
||||
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
|
||||
dependsOn("preReleaseBuild")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Arbitrary project metadata
|
||||
* https://docs.gradle.org/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
|
||||
@@ -233,11 +354,10 @@ android {
|
||||
versionNameSuffix ".pr"
|
||||
debuggable false
|
||||
matchingFallbacks = ["release"]
|
||||
// necessary to make react-native-config's code generation work
|
||||
resValue "string", "build_config_package", "im.status.ethereum"
|
||||
// necessary to make react-native-config's code generation work
|
||||
resValue "string", "build_config_package", "im.status.ethereum"
|
||||
}
|
||||
}
|
||||
|
||||
// applicationVariants are e.g. debug, release
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
@@ -253,7 +373,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
aaptOptions {
|
||||
// disable PNG optimization as for some reason it cannot be trusted to provide deterministic output (see https://f-droid.org/en/docs/Reproducible_Builds/)
|
||||
cruncherEnabled = false
|
||||
@@ -265,29 +384,54 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// The version of react-native is set by the React Native Gradle Plugin
|
||||
implementation("com.facebook.react:react-android")
|
||||
implementation("androidx.core:core-splashscreen:1.0.0")
|
||||
// we don't use hermes for debug but we need its pom file for release builds
|
||||
// https://github.com/status-im/status-mobile/pull/18675
|
||||
implementation("com.facebook.react:hermes-android")
|
||||
// FIXME: implementing both hermes & JSC increases bundle size by ~ 2MB
|
||||
implementation(jscFlavor)
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
implementation 'com.facebook.soloader:soloader:0.10.3+'
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
||||
implementation "androidx.core:core-splashscreen:1.0.0"
|
||||
|
||||
if (enableHermes) {
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
|
||||
exclude group: 'com.facebook.fbjni' }
|
||||
} else {
|
||||
implementation jscFlavor
|
||||
}
|
||||
|
||||
// react-native-screens
|
||||
implementation("androidx.appcompat:appcompat:1.1.0-rc01")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02")
|
||||
implementation("androidx.multidex:multidex:2.0.1") // required by status-mobile/android/app/src/main/java/im/status/ethereum/MainApplication.java
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
|
||||
|
||||
implementation 'androidx.multidex:multidex:2.0.1' // only needed if minSdkVersion is less than 21 (https://developer.android.com/studio/build/multidex)
|
||||
implementation project(':react-native-dialogs')
|
||||
implementation project(':react-native-blur')
|
||||
// Force using exact RN version instead of relying on gradle dependency resolution
|
||||
// https://docs.gradle.org/current/userguide/introduction_dependency_management.html#sec:dependency_resolution
|
||||
// NOTE: Uncomment if building RN from a fork
|
||||
//compile ("com.facebook.react:react-native:0.55.4") { force = true } // From node_modules
|
||||
implementation project(':react-native-status')
|
||||
implementation project(':react-native-status-keycard')
|
||||
implementation("com.github.status-im:function:0.0.1")
|
||||
implementation("com.facebook.fresco:fresco:2.5.0")
|
||||
implementation("com.facebook.fresco:animated-gif:2.5.0")
|
||||
implementation("com.squareup.okhttp3:okhttp-tls:4.9.2")
|
||||
implementation("com.google.prefab:cli:2.0.0")
|
||||
implementation 'com.github.status-im:function:0.0.1'
|
||||
implementation 'com.facebook.fresco:fresco:2.5.0'
|
||||
implementation 'com.facebook.fresco:animated-gif:2.5.0'
|
||||
implementation "com.squareup.okhttp3:okhttp-tls:4.9.2"
|
||||
}
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
// If new architecture is enabled, we let you build RN from source
|
||||
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
|
||||
// This will be applied to all the imported transtitive dependency.
|
||||
configurations.all {
|
||||
resolutionStrategy.dependencySubstitution {
|
||||
substitute(module("com.facebook.react:react-native"))
|
||||
.using(project(":ReactAndroid"))
|
||||
.because("On New Architecture we're building React Native from source")
|
||||
substitute(module("com.facebook.react:hermes-engine"))
|
||||
.using(project(":ReactAndroid:hermes-engine"))
|
||||
.because("On New Architecture we're building Hermes from source")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getLocalNDKDir = { ->
|
||||
def rootDir = project.rootDir
|
||||
@@ -322,3 +466,11 @@ task hemroidBuild(type: Exec) {
|
||||
preBuild.dependsOn hemroidBuild
|
||||
|
||||
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
||||
|
||||
def isNewArchitectureEnabled() {
|
||||
// To opt-in for the New Architecture, you can either:
|
||||
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
||||
// - Invoke gradle with `-newArchEnabled=true`
|
||||
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
||||
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:installLocation="auto">
|
||||
android:installLocation="auto"
|
||||
package="im.status.ethereum">
|
||||
|
||||
<!-- non-dangerous permissions -->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
@@ -16,11 +17,11 @@
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="28" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
|
||||
<application
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
package im.status.ethereum;
|
||||
|
||||
import android.content.Context;
|
||||
import android.annotation.TargetApi;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.provider.Settings;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import com.facebook.react.ReactActivityDelegate;
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
|
||||
|
||||
import com.reactnativenavigation.NavigationActivity;
|
||||
import com.facebook.react.modules.core.PermissionListener;
|
||||
import androidx.core.splashscreen.SplashScreen;
|
||||
import com.facebook.react.ReactActivity;
|
||||
|
||||
import java.util.Properties;
|
||||
import im.status.ethereum.module.StatusThreadPoolExecutor;
|
||||
import im.status.ethereum.MainApplication;
|
||||
|
||||
public class MainActivity extends NavigationActivity
|
||||
implements ActivityCompat.OnRequestPermissionsResultCallback{
|
||||
|
||||
|
||||
@Nullable private PermissionListener mPermissionListener;
|
||||
private boolean keepSplash = true;
|
||||
private final int SPLASH_DELAY = 3200;
|
||||
|
||||
private static void registerUncaughtExceptionHandler(final Context context) {
|
||||
final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(final Thread thread, final Throwable t) {
|
||||
// High priority, so don't use StatusThreadPoolExecutor
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
Looper.prepare();
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle("Error")
|
||||
.setMessage(t.toString())
|
||||
.setNegativeButton("Exit", new DialogInterface.OnClickListener() {
|
||||
public void onClick(final DialogInterface dialog, final int id) {
|
||||
dialog.dismiss();
|
||||
defaultUncaughtExceptionHandler.uncaughtException(thread, t);
|
||||
}
|
||||
}).show();
|
||||
|
||||
Looper.loop();
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ActivityManager getActivityManager() {
|
||||
return (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
|
||||
}
|
||||
|
||||
private ActivityManager.MemoryInfo getAvailableMemory(final ActivityManager activityManager) {
|
||||
final ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||
activityManager.getMemoryInfo(memoryInfo);
|
||||
return memoryInfo;
|
||||
}
|
||||
|
||||
protected void configureStatus() {
|
||||
// Required because of crazy APN settings redirecting localhost (found in GB)
|
||||
Properties properties = System.getProperties();
|
||||
properties.setProperty("http.nonProxyHosts", "localhost|127.0.0.1");
|
||||
properties.setProperty("https.nonProxyHosts", "localhost|127.0.0.1");
|
||||
}
|
||||
|
||||
private Intent createNotificationSettingsIntent() {
|
||||
final Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName());
|
||||
} else {
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
}
|
||||
return intent;
|
||||
}
|
||||
|
||||
private void tryToEmit(String eventName, WritableMap event) {
|
||||
try {
|
||||
((MainApplication) getApplication()).getReactNativeHost()
|
||||
.getReactInstanceManager()
|
||||
.getCurrentReactContext()
|
||||
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("url", event);
|
||||
} catch(Exception e) {/* we expect NPE on first start, which is OK because we have a fallback */}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(final Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
if (intent.getDataString() != null && intent.getData().getScheme().startsWith("app-settings")) {
|
||||
startActivity(createNotificationSettingsIntent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
|
||||
setTheme(R.style.DarkTheme);
|
||||
// Make sure we get an Alert for every uncaught exceptions
|
||||
registerUncaughtExceptionHandler(MainActivity.this);
|
||||
|
||||
// Report memory details for this application
|
||||
final ActivityManager activityManager = getActivityManager();
|
||||
Log.v("RNBootstrap", "Available system memory "+getAvailableMemory(activityManager).availMem + ", maximum usable application memory " + activityManager.getLargeMemoryClass()+"M");
|
||||
|
||||
setSecureFlag();
|
||||
|
||||
// NOTE: Try to not restore the state https://github.com/software-mansion/react-native-screens/issues/17
|
||||
super.onCreate(null);
|
||||
|
||||
if (!shouldShowRootedNotification()) {
|
||||
configureStatus();
|
||||
} else {
|
||||
AlertDialog dialog = new AlertDialog.Builder(MainActivity.this)
|
||||
.setMessage(getResources().getString(R.string.root_warning))
|
||||
.setPositiveButton(getResources().getString(R.string.root_okay), new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
rejectRootedNotification();
|
||||
dialog.dismiss();
|
||||
configureStatus();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.root_cancel), new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
MainActivity.this.finishAffinity();
|
||||
}
|
||||
})
|
||||
.setOnCancelListener(new OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
MainActivity.this.finishAffinity();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.loadLibrary("status-logs");
|
||||
|
||||
// when app is started but the Activity has been destroyed, the deep linking url event is
|
||||
// not emitted when coming back to foreground. This is a workaround. If the problem is
|
||||
// resolved in react-native this code should be removed
|
||||
if (getIntent().getData() != null) {
|
||||
WritableMap event = Arguments.createMap();
|
||||
event.putString("url", getIntent().getDataString());
|
||||
// on first start emit will (silently) fail, but the regular deep linking handler will work
|
||||
tryToEmit("url", event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
splashScreen.setKeepOnScreenCondition(() -> keepSplash);
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(() -> keepSplash = false, SPLASH_DELAY);
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
Intent intent = new Intent("onConfigurationChanged");
|
||||
intent.putExtra("newConfig", newConfig);
|
||||
this.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private static final String REJECTED_ROOTED_NOTIFICATION = "rejectedRootedNotification";
|
||||
private static final Integer FREQUENCY_OF_REMINDER_IN_PERCENT = 5;
|
||||
|
||||
private boolean shouldShowRootedNotification() {
|
||||
if (RootUtil.isDeviceRooted() && BuildConfig.ENABLE_ROOT_ALERT == "1") {
|
||||
if (userRejectedRootedNotification()) {
|
||||
return ((Math.random() * 100) < FREQUENCY_OF_REMINDER_IN_PERCENT);
|
||||
} else return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean userRejectedRootedNotification() {
|
||||
SharedPreferences preferences = getPreferences(0);
|
||||
return preferences.getBoolean(REJECTED_ROOTED_NOTIFICATION, false);
|
||||
}
|
||||
|
||||
private void rejectRootedNotification() {
|
||||
SharedPreferences preferences = getPreferences(0);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean(REJECTED_ROOTED_NOTIFICATION, true);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
private void setSecureFlag() {
|
||||
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final boolean setSecure = sharedPrefs.getBoolean("BLANK_PREVIEW", false);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && setSecure) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||
} else {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
public void requestPermissions(String[] permissions, int requestCode, PermissionListener listener) {
|
||||
mPermissionListener = listener;
|
||||
requestPermissions(permissions, requestCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
|
||||
mPermissionListener = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
package im.status.ethereum
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.app.ActivityManager
|
||||
import android.app.AlertDialog
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.preference.PreferenceManager
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.Nullable
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import com.facebook.react.ReactActivityDelegate
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
|
||||
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule
|
||||
import com.facebook.react.modules.core.PermissionListener
|
||||
import com.reactnativenavigation.NavigationActivity
|
||||
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView
|
||||
import im.status.ethereum.MainApplication
|
||||
import im.status.ethereum.module.StatusThreadPoolExecutor
|
||||
import java.util.Properties
|
||||
|
||||
class MainActivity : NavigationActivity(), ActivityCompat.OnRequestPermissionsResultCallback {
|
||||
|
||||
@Nullable
|
||||
private var mPermissionListener: PermissionListener? = null
|
||||
private var keepSplash = true
|
||||
private val SPLASH_DELAY = 3200
|
||||
|
||||
/**
|
||||
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
||||
* rendering of the component.
|
||||
*/
|
||||
protected fun getMainComponentName(): String {
|
||||
return "StatusIm"
|
||||
}
|
||||
|
||||
private fun registerUncaughtExceptionHandler(context: Context) {
|
||||
val defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler()
|
||||
// High priority, so don't use StatusThreadPoolExecutor
|
||||
Thread.setDefaultUncaughtExceptionHandler { thread, t ->
|
||||
Thread {
|
||||
Looper.prepare()
|
||||
AlertDialog.Builder(context)
|
||||
.setTitle("Error")
|
||||
.setMessage(t.toString())
|
||||
.setNegativeButton("Exit") { dialog, id ->
|
||||
dialog.dismiss()
|
||||
defaultUncaughtExceptionHandler.uncaughtException(thread, t)
|
||||
}.show()
|
||||
Looper.loop()
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getActivityManager(): ActivityManager {
|
||||
return getSystemService(ACTIVITY_SERVICE) as ActivityManager
|
||||
}
|
||||
|
||||
private fun getAvailableMemory(activityManager: ActivityManager): ActivityManager.MemoryInfo {
|
||||
val memoryInfo = ActivityManager.MemoryInfo()
|
||||
activityManager.getMemoryInfo(memoryInfo)
|
||||
return memoryInfo
|
||||
}
|
||||
|
||||
protected fun configureStatus() {
|
||||
// Required because of crazy APN settings redirecting localhost (found in GB)
|
||||
val properties = System.getProperties()
|
||||
properties.setProperty("http.nonProxyHosts", "localhost|127.0.0.1")
|
||||
properties.setProperty("https.nonProxyHosts", "localhost|127.0.0.1")
|
||||
}
|
||||
|
||||
private fun createNotificationSettingsIntent(): Intent {
|
||||
val intent = Intent()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, packageName)
|
||||
} else {
|
||||
intent.action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
intent.data = Uri.parse("package:$packageName")
|
||||
}
|
||||
return intent
|
||||
}
|
||||
|
||||
private fun tryToEmit(eventName: String, event: WritableMap) {
|
||||
try {
|
||||
(getApplication() as MainApplication).getReactNativeHost()
|
||||
.getReactInstanceManager()
|
||||
.getCurrentReactContext()
|
||||
?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
||||
?.emit("url", event)
|
||||
} catch (e: Exception) { // we expect NPE on first start, which is OK because we have a fallback
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
if (intent.dataString != null && intent.data!!.scheme!!.startsWith("app-settings")) {
|
||||
startActivity(createNotificationSettingsIntent())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val splashScreen = installSplashScreen();
|
||||
setTheme(R.style.DarkTheme)
|
||||
// Make sure we get an Alert for every uncaught exceptions
|
||||
registerUncaughtExceptionHandler(this)
|
||||
|
||||
// Report memory details for this application
|
||||
val activityManager = getActivityManager()
|
||||
Log.v("RNBootstrap", "Available system memory " + getAvailableMemory(activityManager).availMem + ", maximum usable application memory " + activityManager.largeMemoryClass + "M")
|
||||
|
||||
setSecureFlag()
|
||||
|
||||
// NOTE: Try to not restore the state https://github.com/software-mansion/react-native-screens/issues/17
|
||||
super.onCreate(null)
|
||||
|
||||
if (!shouldShowRootedNotification()) {
|
||||
configureStatus()
|
||||
} else {
|
||||
val dialog = AlertDialog.Builder(this)
|
||||
.setMessage(resources.getString(R.string.root_warning))
|
||||
.setPositiveButton(resources.getString(R.string.root_okay)) { dialog, which ->
|
||||
rejectRootedNotification()
|
||||
dialog.dismiss()
|
||||
configureStatus()
|
||||
}
|
||||
.setNegativeButton(resources.getString(R.string.root_cancel)) { dialog, which ->
|
||||
dialog.dismiss()
|
||||
finishAffinity()
|
||||
}
|
||||
.setOnCancelListener {
|
||||
it.dismiss()
|
||||
finishAffinity()
|
||||
}
|
||||
.create()
|
||||
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
val r = Runnable {
|
||||
System.loadLibrary("status-logs")
|
||||
|
||||
// when app is started but the Activity has been destroyed, the deep linking url event is
|
||||
// not emitted when coming back to foreground. This is a workaround. If the problem is
|
||||
// resolved in react-native this code should be removed
|
||||
if (intent.data != null) {
|
||||
val event = Arguments.createMap()
|
||||
event.putString("url", intent.dataString)
|
||||
// on first start emit will (silently) fail, but the regular deep linking handler will work
|
||||
tryToEmit("url", event)
|
||||
}
|
||||
}
|
||||
|
||||
splashScreen.setKeepOnScreenCondition { keepSplash }
|
||||
|
||||
val handler = Handler()
|
||||
handler.postDelayed({ keepSplash = false }, SPLASH_DELAY.toLong())
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
val intent = Intent("onConfigurationChanged")
|
||||
intent.putExtra("newConfig", newConfig)
|
||||
sendBroadcast(intent)
|
||||
}
|
||||
|
||||
private val REJECTED_ROOTED_NOTIFICATION = "rejectedRootedNotification"
|
||||
private val FREQUENCY_OF_REMINDER_IN_PERCENT = 5
|
||||
|
||||
private fun shouldShowRootedNotification(): Boolean {
|
||||
if (RootUtil.isDeviceRooted() && BuildConfig.ENABLE_ROOT_ALERT == "1") {
|
||||
return if (userRejectedRootedNotification()) {
|
||||
(Math.random() * 100) < FREQUENCY_OF_REMINDER_IN_PERCENT
|
||||
} else true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private fun userRejectedRootedNotification(): Boolean {
|
||||
val preferences = getPreferences(0)
|
||||
return preferences.getBoolean(REJECTED_ROOTED_NOTIFICATION, false)
|
||||
}
|
||||
|
||||
private fun rejectRootedNotification() {
|
||||
val preferences = getPreferences(0)
|
||||
val editor = preferences.edit()
|
||||
editor.putBoolean(REJECTED_ROOTED_NOTIFICATION, true)
|
||||
editor.commit()
|
||||
}
|
||||
|
||||
private fun setSecureFlag() {
|
||||
val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val setSecure = sharedPrefs.getBoolean("BLANK_PREVIEW", false)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && setSecure) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
} else {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
override fun requestPermissions(permissions: Array<String>, requestCode: Int, listener: PermissionListener) {
|
||||
mPermissionListener = listener
|
||||
super.requestPermissions(permissions, requestCode)
|
||||
}
|
||||
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
||||
if (mPermissionListener != null && mPermissionListener!!.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
|
||||
mPermissionListener = null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package im.status.ethereum;
|
||||
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
import android.content.Context;
|
||||
import android.webkit.WebView;
|
||||
import im.status.ethereum.newarchitecture.MainApplicationReactNativeHost;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import com.facebook.react.PackageList;
|
||||
|
||||
import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage;
|
||||
import com.facebook.react.ReactApplication;
|
||||
import cl.json.RNSharePackage;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.reactnativenavigation.NavigationApplication;
|
||||
import com.reactnativenavigation.react.NavigationReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.ReactInstanceManager;
|
||||
import com.facebook.react.modules.network.OkHttpClientProvider;
|
||||
import com.reactnativecommunity.blurview.BlurViewPackage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import im.status.ethereum.keycard.RNStatusKeycardPackage;
|
||||
import im.status.ethereum.module.StatusPackage;
|
||||
import im.status.ethereum.pushnotifications.PushNotificationPackage;
|
||||
import im.status.ethereum.StatusOkHttpClientFactory;
|
||||
|
||||
import com.facebook.react.bridge.JSIModulePackage;
|
||||
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
|
||||
|
||||
public class MainApplication extends NavigationApplication {
|
||||
|
||||
private final ReactNativeHost mReactNativeHost = new NavigationReactNativeHost(this) {
|
||||
@Override
|
||||
public boolean getUseDeveloperSupport() {
|
||||
return BuildConfig.DEBUG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
|
||||
StatusPackage statusPackage = new StatusPackage(RootUtil.isDeviceRooted());
|
||||
|
||||
List<ReactPackage> packages = new PackageList(this).getPackages();
|
||||
packages.add(statusPackage);
|
||||
packages.add(new ReactNativeDialogsPackage());
|
||||
packages.add(new RNStatusKeycardPackage());
|
||||
packages.add(new PushNotificationPackage());
|
||||
packages.add(new BlurViewPackage());
|
||||
return packages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getJSMainModuleName() {
|
||||
return "index";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSIModulePackage getJSIModulePackage() {
|
||||
return new ReanimatedJSIModulePackage();
|
||||
}
|
||||
};
|
||||
|
||||
private final ReactNativeHost mNewArchitectureNativeHost = new MainApplicationReactNativeHost(this);
|
||||
|
||||
@Override
|
||||
public ReactNativeHost getReactNativeHost() {
|
||||
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||
return mNewArchitectureNativeHost;
|
||||
} else {
|
||||
return mReactNativeHost;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// If you opted-in for the New Architecture, we enable the TurboModule system
|
||||
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
||||
|
||||
OkHttpClientProvider.setOkHttpClientFactory(new StatusOkHttpClientFactory());
|
||||
|
||||
WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG_WEBVIEW == "1");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package im.status.ethereum
|
||||
|
||||
import android.webkit.WebView
|
||||
import androidx.multidex.MultiDexApplication
|
||||
import com.facebook.react.PackageList
|
||||
import com.facebook.react.ReactApplication
|
||||
import com.facebook.react.ReactNativeHost
|
||||
import com.facebook.react.ReactPackage
|
||||
import com.facebook.react.bridge.JSIModulePackage
|
||||
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
|
||||
import com.facebook.react.modules.network.OkHttpClientProvider
|
||||
import com.reactnativenavigation.NavigationApplication
|
||||
import com.reactnativenavigation.react.NavigationReactNativeHost
|
||||
import cl.json.RNSharePackage
|
||||
import com.reactnativecommunity.blurview.BlurViewPackage
|
||||
import im.status.ethereum.keycard.RNStatusKeycardPackage
|
||||
import im.status.ethereum.module.StatusPackage
|
||||
import im.status.ethereum.pushnotifications.PushNotificationPackage
|
||||
import im.status.ethereum.StatusOkHttpClientFactory
|
||||
|
||||
class MainApplication : NavigationApplication() {
|
||||
|
||||
private val mReactNativeHost = object : NavigationReactNativeHost(this) {
|
||||
override fun getUseDeveloperSupport(): Boolean {
|
||||
return BuildConfig.DEBUG
|
||||
}
|
||||
|
||||
override fun getPackages(): List<ReactPackage> {
|
||||
val statusPackage = StatusPackage(RootUtil.isDeviceRooted())
|
||||
val packages = PackageList(this).getPackages()
|
||||
packages.add(statusPackage)
|
||||
packages.add(RNStatusKeycardPackage())
|
||||
packages.add(PushNotificationPackage())
|
||||
packages.add(BlurViewPackage())
|
||||
return packages
|
||||
}
|
||||
|
||||
override fun getJSMainModuleName(): String = "index"
|
||||
|
||||
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
||||
|
||||
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
||||
}
|
||||
|
||||
override fun getReactNativeHost(): ReactNativeHost {
|
||||
return mReactNativeHost
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
OkHttpClientProvider.setOkHttpClientFactory(StatusOkHttpClientFactory())
|
||||
|
||||
WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG_WEBVIEW == "1")
|
||||
|
||||
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
||||
DefaultNewArchitectureEntryPoint.load()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package im.status.ethereum
|
||||
|
||||
import android.util.Log
|
||||
import com.facebook.react.modules.network.OkHttpClientFactory
|
||||
import com.facebook.react.modules.network.OkHttpClientProvider
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.tls.HandshakeCertificates
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.lang.RuntimeException
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Method
|
||||
import java.security.cert.CertificateFactory
|
||||
import java.security.cert.X509Certificate
|
||||
import im.status.ethereum.module.StatusPackage
|
||||
|
||||
class StatusOkHttpClientFactory : OkHttpClientFactory {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "StatusOkHttpClientFactory"
|
||||
private const val SLEEP_DURATION = 500L // milliseconds
|
||||
}
|
||||
|
||||
override fun createNewNetworkModuleClient(): OkHttpClient? {
|
||||
val certPem = getCertificatePem().takeIf { it.isNotEmpty() }
|
||||
?: return logAndReturnNull("Certificate is empty, cannot create OkHttpClient without a valid certificate")
|
||||
|
||||
val cert = try {
|
||||
induceSleep()
|
||||
// Convert PEM certificate string to X509Certificate object
|
||||
CertificateFactory.getInstance("X.509")
|
||||
.generateCertificate(ByteArrayInputStream(certPem.toByteArray())) as? X509Certificate
|
||||
?: return logAndReturnNull("Certificate could not be parsed as non-null")
|
||||
} catch (e: Exception) {
|
||||
return logAndReturnNull("Could not parse certificate", e)
|
||||
}
|
||||
|
||||
val clientCertificates = try {
|
||||
induceSleep()
|
||||
// Create HandshakeCertificates object with our certificate
|
||||
HandshakeCertificates.Builder()
|
||||
.addPlatformTrustedCertificates()
|
||||
.addTrustedCertificate(cert)
|
||||
.build()
|
||||
} catch (e: Exception) {
|
||||
return logAndReturnNull("Could not build HandshakeCertificates", e)
|
||||
}
|
||||
|
||||
return try {
|
||||
OkHttpClientProvider.createClientBuilder()
|
||||
.sslSocketFactory(clientCertificates.sslSocketFactory(), clientCertificates.trustManager)
|
||||
.build()
|
||||
} catch (e: Exception) {
|
||||
logAndReturnNull("Could not create OkHttpClient", e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCertificatePem(): String {
|
||||
return try {
|
||||
// Create OkHttpClient with custom SSL socket factory and trust manager
|
||||
StatusPackage.getImageTLSCert().takeIf { !it.isNullOrBlank() }
|
||||
?: logAndReturnEmpty("Certificate PEM string is null or empty")
|
||||
} catch (e: Exception) {
|
||||
logAndReturnEmpty("Could not getImageTLSCert", e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun induceSleep() {
|
||||
try {
|
||||
// induce half second sleep because sometimes a cert is not immediately available
|
||||
// TODO : remove sleep if App no longer crashes on Android 10 devices with
|
||||
// java.lang.RuntimeException: Could not invoke WebSocketModule.connect
|
||||
Thread.sleep(SLEEP_DURATION)
|
||||
} catch (e: InterruptedException) {
|
||||
Log.e(TAG, "Sleep interrupted", e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun logAndReturnNull(message: String, e: Exception? = null): Nothing? {
|
||||
Log.e(TAG, message, e)
|
||||
return null
|
||||
}
|
||||
|
||||
private fun logAndReturnEmpty(message: String, e: Exception? = null): String {
|
||||
Log.e(TAG, message, e)
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package im.status.ethereum;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.react.modules.network.OkHttpClientFactory;
|
||||
import com.facebook.react.modules.network.OkHttpClientProvider;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.tls.HandshakeCertificates;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.RuntimeException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import im.status.ethereum.module.StatusPackage;
|
||||
|
||||
class StatusOkHttpClientFactory implements OkHttpClientFactory {
|
||||
|
||||
private static final String TAG = "StatusOkHttpClientFactory";
|
||||
|
||||
public OkHttpClient createNewNetworkModuleClient() {
|
||||
X509Certificate cert = null;
|
||||
HandshakeCertificates clientCertificates;
|
||||
String certPem = "";
|
||||
|
||||
// Get TLS PEM certificate from status-go
|
||||
try {
|
||||
// induce half second sleep because sometimes a cert is not immediately available
|
||||
// TODO : remove sleep if App no longer crashes on Android 10 devices with
|
||||
// java.lang.RuntimeException: Could not invoke WebSocketModule.connect
|
||||
Thread.sleep(500);
|
||||
certPem = StatusPackage.getImageTLSCert();
|
||||
} catch(Exception e) {
|
||||
Log.e(TAG, "Could not getImageTLSCert",e);
|
||||
}
|
||||
// Convert PEM certificate string to X509Certificate object
|
||||
try {
|
||||
// induce half second sleep because sometimes a cert is not immediately available
|
||||
// TODO : remove sleep if App no longer crashes on Android 10 devices
|
||||
// java.lang.RuntimeException: Could not invoke WebSocketModule.connect
|
||||
Thread.sleep(500);
|
||||
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||
cert = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(certPem.getBytes()));
|
||||
} catch(Exception e) {
|
||||
Log.e(TAG, "Could not parse certificate",e);
|
||||
}
|
||||
// Create HandshakeCertificates object with our certificate
|
||||
try {
|
||||
// induce half second sleep because sometimes a cert is not immediately available
|
||||
// TODO : remove sleep if App no longer crashes on Android 10 devices
|
||||
// java.lang.RuntimeException: Could not invoke WebSocketModule.connect
|
||||
Thread.sleep(500);
|
||||
clientCertificates = new HandshakeCertificates.Builder()
|
||||
.addPlatformTrustedCertificates()
|
||||
.addTrustedCertificate(cert)
|
||||
.build();
|
||||
} catch(Exception e) {
|
||||
Log.e(TAG, "Could not build HandshakeCertificates", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create OkHttpClient with custom SSL socket factory and trust manager
|
||||
try {
|
||||
return OkHttpClientProvider.createClientBuilder()
|
||||
.sslSocketFactory(clientCertificates.sslSocketFactory(), clientCertificates.trustManager())
|
||||
.build();
|
||||
} catch(Exception e) {
|
||||
Log.e(TAG, "Could not create OkHttpClient", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package im.status.ethereum.newarchitecture;
|
||||
import android.app.Application;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.facebook.react.PackageList;
|
||||
import com.facebook.react.ReactInstanceManager;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
||||
import com.facebook.react.bridge.JSIModulePackage;
|
||||
import com.facebook.react.bridge.JSIModuleProvider;
|
||||
import com.facebook.react.bridge.JSIModuleSpec;
|
||||
import com.facebook.react.bridge.JSIModuleType;
|
||||
import com.facebook.react.bridge.JavaScriptContextHolder;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.fabric.ComponentFactory;
|
||||
import com.facebook.react.fabric.CoreComponentsRegistry;
|
||||
import com.facebook.react.fabric.FabricJSIModuleProvider;
|
||||
import com.facebook.react.fabric.ReactNativeConfig;
|
||||
import com.facebook.react.uimanager.ViewManagerRegistry;
|
||||
import im.status.ethereum.BuildConfig;
|
||||
import im.status.ethereum.newarchitecture.components.MainComponentsRegistry;
|
||||
import im.status.ethereum.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
* A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both
|
||||
* TurboModule delegates and the Fabric Renderer.
|
||||
*
|
||||
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
||||
* `newArchEnabled` property). Is ignored otherwise.
|
||||
*/
|
||||
public class MainApplicationReactNativeHost extends ReactNativeHost {
|
||||
public MainApplicationReactNativeHost(Application application) {
|
||||
super(application);
|
||||
}
|
||||
@Override
|
||||
public boolean getUseDeveloperSupport() {
|
||||
return BuildConfig.DEBUG;
|
||||
}
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
List<ReactPackage> packages = new PackageList(this).getPackages();
|
||||
// Packages that cannot be autolinked yet can be added manually here, for example:
|
||||
// packages.add(new MyReactNativePackage());
|
||||
// TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
|
||||
// packages.add(new TurboReactPackage() { ... });
|
||||
// If you have custom Fabric Components, their ViewManagers should also be loaded here
|
||||
// inside a ReactPackage.
|
||||
return packages;
|
||||
}
|
||||
@Override
|
||||
protected String getJSMainModuleName() {
|
||||
return "index";
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
protected ReactPackageTurboModuleManagerDelegate.Builder
|
||||
getReactPackageTurboModuleManagerDelegateBuilder() {
|
||||
// Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary
|
||||
// for the new architecture and to use TurboModules correctly.
|
||||
return new MainApplicationTurboModuleManagerDelegate.Builder();
|
||||
}
|
||||
@Override
|
||||
protected JSIModulePackage getJSIModulePackage() {
|
||||
return new JSIModulePackage() {
|
||||
@Override
|
||||
public List<JSIModuleSpec> getJSIModules(
|
||||
final ReactApplicationContext reactApplicationContext,
|
||||
final JavaScriptContextHolder jsContext) {
|
||||
final List<JSIModuleSpec> specs = new ArrayList<>();
|
||||
// Here we provide a new JSIModuleSpec that will be responsible of providing the
|
||||
// custom Fabric Components.
|
||||
specs.add(
|
||||
new JSIModuleSpec() {
|
||||
@Override
|
||||
public JSIModuleType getJSIModuleType() {
|
||||
return JSIModuleType.UIManager;
|
||||
}
|
||||
@Override
|
||||
public JSIModuleProvider<UIManager> getJSIModuleProvider() {
|
||||
final ComponentFactory componentFactory = new ComponentFactory();
|
||||
CoreComponentsRegistry.register(componentFactory);
|
||||
// Here we register a Components Registry.
|
||||
// The one that is generated with the template contains no components
|
||||
// and just provides you the one from React Native core.
|
||||
MainComponentsRegistry.register(componentFactory);
|
||||
final ReactInstanceManager reactInstanceManager = getReactInstanceManager();
|
||||
ViewManagerRegistry viewManagerRegistry =
|
||||
new ViewManagerRegistry(
|
||||
reactInstanceManager.getOrCreateViewManagers(reactApplicationContext));
|
||||
return new FabricJSIModuleProvider(
|
||||
reactApplicationContext,
|
||||
componentFactory,
|
||||
ReactNativeConfig.DEFAULT_CONFIG,
|
||||
viewManagerRegistry);
|
||||
}
|
||||
});
|
||||
return specs;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package im.status.ethereum.newarchitecture.components;
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.fabric.ComponentFactory;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
/**
|
||||
* Class responsible to load the custom Fabric Components. This class has native methods and needs a
|
||||
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
||||
* folder for you).
|
||||
*
|
||||
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
||||
* `newArchEnabled` property). Is ignored otherwise.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public class MainComponentsRegistry {
|
||||
static {
|
||||
SoLoader.loadLibrary("fabricjni");
|
||||
}
|
||||
@DoNotStrip private final HybridData mHybridData;
|
||||
@DoNotStrip
|
||||
private native HybridData initHybrid(ComponentFactory componentFactory);
|
||||
@DoNotStrip
|
||||
private MainComponentsRegistry(ComponentFactory componentFactory) {
|
||||
mHybridData = initHybrid(componentFactory);
|
||||
}
|
||||
@DoNotStrip
|
||||
public static MainComponentsRegistry register(ComponentFactory componentFactory) {
|
||||
return new MainComponentsRegistry(componentFactory);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package im.status.ethereum.newarchitecture.modules;
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import java.util.List;
|
||||
/**
|
||||
* Class responsible to load the TurboModules. This class has native methods and needs a
|
||||
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
||||
* folder for you).
|
||||
*
|
||||
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
||||
* `newArchEnabled` property). Is ignored otherwise.
|
||||
*/
|
||||
public class MainApplicationTurboModuleManagerDelegate
|
||||
extends ReactPackageTurboModuleManagerDelegate {
|
||||
private static volatile boolean sIsSoLibraryLoaded;
|
||||
protected MainApplicationTurboModuleManagerDelegate(
|
||||
ReactApplicationContext reactApplicationContext, List<ReactPackage> packages) {
|
||||
super(reactApplicationContext, packages);
|
||||
}
|
||||
protected native HybridData initHybrid();
|
||||
native boolean canCreateTurboModule(String moduleName);
|
||||
public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder {
|
||||
protected MainApplicationTurboModuleManagerDelegate build(
|
||||
ReactApplicationContext context, List<ReactPackage> packages) {
|
||||
return new MainApplicationTurboModuleManagerDelegate(context, packages);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected synchronized void maybeLoadOtherSoLibraries() {
|
||||
if (!sIsSoLibraryLoaded) {
|
||||
// If you change the name of your application .so file in the Android.mk file,
|
||||
// make sure you update the name here as well.
|
||||
SoLoader.loadLibrary("status-im_appmodules");
|
||||
sIsSoLibraryLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
THIS_DIR := $(call my-dir)
|
||||
include $(REACT_ANDROID_DIR)/Android-prebuilt.mk
|
||||
# If you wish to add a custom TurboModule or Fabric component in your app you
|
||||
# will have to include the following autogenerated makefile.
|
||||
# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_PATH := $(THIS_DIR)
|
||||
# You can customize the name of your application .so file here.
|
||||
LOCAL_MODULE := rndiffapp_appmodules
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
# If you wish to add a custom TurboModule or Fabric component in your app you
|
||||
# will have to uncomment those lines to include the generated source
|
||||
# files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni)
|
||||
#
|
||||
# LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
|
||||
# LOCAL_SRC_FILES += $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp)
|
||||
# LOCAL_EXPORT_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
|
||||
# Here you should add any native library you wish to depend on.
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libfabricjni \
|
||||
libfbjni \
|
||||
libfolly_runtime \
|
||||
libglog \
|
||||
libjsi \
|
||||
libreact_codegen_rncore \
|
||||
libreact_debug \
|
||||
libreact_nativemodule_core \
|
||||
libreact_render_componentregistry \
|
||||
libreact_render_core \
|
||||
libreact_render_debug \
|
||||
libreact_render_graphics \
|
||||
librrc_view \
|
||||
libruntimeexecutor \
|
||||
libturbomodulejsijni \
|
||||
libyoga
|
||||
LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "MainApplicationModuleProvider.h"
|
||||
#include <rncore.h>
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
|
||||
const std::string moduleName,
|
||||
const JavaTurboModule::InitParams ¶ms) {
|
||||
// Here you can provide your own module provider for TurboModules coming from
|
||||
// either your application or from external libraries. The approach to follow
|
||||
// is similar to the following (for a library called `samplelibrary`:
|
||||
//
|
||||
// auto module = samplelibrary_ModuleProvider(moduleName, params);
|
||||
// if (module != nullptr) {
|
||||
// return module;
|
||||
// }
|
||||
// return rncore_ModuleProvider(moduleName, params);
|
||||
return rncore_ModuleProvider(moduleName, params);
|
||||
}
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <ReactCommon/JavaTurboModule.h>
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
|
||||
const std::string moduleName,
|
||||
const JavaTurboModule::InitParams ¶ms);
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "MainApplicationTurboModuleManagerDelegate.h"
|
||||
#include "MainApplicationModuleProvider.h"
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
jni::local_ref<MainApplicationTurboModuleManagerDelegate::jhybriddata>
|
||||
MainApplicationTurboModuleManagerDelegate::initHybrid(
|
||||
jni::alias_ref<jhybridobject>) {
|
||||
return makeCxxInstance();
|
||||
}
|
||||
void MainApplicationTurboModuleManagerDelegate::registerNatives() {
|
||||
registerHybrid({
|
||||
makeNativeMethod(
|
||||
"initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid),
|
||||
makeNativeMethod(
|
||||
"canCreateTurboModule",
|
||||
MainApplicationTurboModuleManagerDelegate::canCreateTurboModule),
|
||||
});
|
||||
}
|
||||
std::shared_ptr<TurboModule>
|
||||
MainApplicationTurboModuleManagerDelegate::getTurboModule(
|
||||
const std::string name,
|
||||
const std::shared_ptr<CallInvoker> jsInvoker) {
|
||||
// Not implemented yet: provide pure-C++ NativeModules here.
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<TurboModule>
|
||||
MainApplicationTurboModuleManagerDelegate::getTurboModule(
|
||||
const std::string name,
|
||||
const JavaTurboModule::InitParams ¶ms) {
|
||||
return MainApplicationModuleProvider(name, params);
|
||||
}
|
||||
bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
|
||||
std::string name) {
|
||||
return getTurboModule(name, nullptr) != nullptr ||
|
||||
getTurboModule(name, {.moduleName = name}) != nullptr;
|
||||
}
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -0,0 +1,30 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <ReactCommon/TurboModuleManagerDelegate.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
class MainApplicationTurboModuleManagerDelegate
|
||||
: public jni::HybridClass<
|
||||
MainApplicationTurboModuleManagerDelegate,
|
||||
TurboModuleManagerDelegate> {
|
||||
public:
|
||||
// Adapt it to the package you used for your Java class.
|
||||
static constexpr auto kJavaDescriptor =
|
||||
"Lcom/rndiffapp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;";
|
||||
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject>);
|
||||
static void registerNatives();
|
||||
std::shared_ptr<TurboModule> getTurboModule(
|
||||
const std::string name,
|
||||
const std::shared_ptr<CallInvoker> jsInvoker) override;
|
||||
std::shared_ptr<TurboModule> getTurboModule(
|
||||
const std::string name,
|
||||
const JavaTurboModule::InitParams ¶ms) override;
|
||||
/**
|
||||
* Test-only method. Allows user to verify whether a TurboModule can be
|
||||
* created by instances of this class.
|
||||
*/
|
||||
bool canCreateTurboModule(std::string name);
|
||||
};
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -0,0 +1,48 @@
|
||||
#include "MainComponentsRegistry.h"
|
||||
#include <CoreComponentsRegistry.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
#include <react/renderer/components/rncore/ComponentDescriptors.h>
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {}
|
||||
std::shared_ptr<ComponentDescriptorProviderRegistry const>
|
||||
MainComponentsRegistry::sharedProviderRegistry() {
|
||||
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
|
||||
// Custom Fabric Components go here. You can register custom
|
||||
// components coming from your App or from 3rd party libraries here.
|
||||
//
|
||||
// providerRegistry->add(concreteComponentDescriptorProvider<
|
||||
// AocViewerComponentDescriptor>());
|
||||
return providerRegistry;
|
||||
}
|
||||
jni::local_ref<MainComponentsRegistry::jhybriddata>
|
||||
MainComponentsRegistry::initHybrid(
|
||||
jni::alias_ref<jclass>,
|
||||
ComponentFactory *delegate) {
|
||||
auto instance = makeCxxInstance(delegate);
|
||||
auto buildRegistryFunction =
|
||||
[](EventDispatcher::Weak const &eventDispatcher,
|
||||
ContextContainer::Shared const &contextContainer)
|
||||
-> ComponentDescriptorRegistry::Shared {
|
||||
auto registry = MainComponentsRegistry::sharedProviderRegistry()
|
||||
->createComponentDescriptorRegistry(
|
||||
{eventDispatcher, contextContainer});
|
||||
auto mutableRegistry =
|
||||
std::const_pointer_cast<ComponentDescriptorRegistry>(registry);
|
||||
mutableRegistry->setFallbackComponentDescriptor(
|
||||
std::make_shared<UnimplementedNativeViewComponentDescriptor>(
|
||||
ComponentDescriptorParameters{
|
||||
eventDispatcher, contextContainer, nullptr}));
|
||||
return registry;
|
||||
};
|
||||
delegate->buildRegistryFunction = buildRegistryFunction;
|
||||
return instance;
|
||||
}
|
||||
void MainComponentsRegistry::registerNatives() {
|
||||
registerHybrid({
|
||||
makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid),
|
||||
});
|
||||
}
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <ComponentFactory.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
class MainComponentsRegistry
|
||||
: public facebook::jni::HybridClass<MainComponentsRegistry> {
|
||||
public:
|
||||
// Adapt it to the package you used for your Java class.
|
||||
constexpr static auto kJavaDescriptor =
|
||||
"Lcom/rndiffapp/newarchitecture/components/MainComponentsRegistry;";
|
||||
static void registerNatives();
|
||||
MainComponentsRegistry(ComponentFactory *delegate);
|
||||
private:
|
||||
static std::shared_ptr<ComponentDescriptorProviderRegistry const>
|
||||
sharedProviderRegistry();
|
||||
static jni::local_ref<jhybriddata> initHybrid(
|
||||
jni::alias_ref<jclass>,
|
||||
ComponentFactory *delegate);
|
||||
};
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -0,0 +1,10 @@
|
||||
#include <fbjni/fbjni.h>
|
||||
#include "MainApplicationTurboModuleManagerDelegate.h"
|
||||
#include "MainComponentsRegistry.h"
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
|
||||
return facebook::jni::initialize(vm, [] {
|
||||
facebook::react::MainApplicationTurboModuleManagerDelegate::
|
||||
registerNatives();
|
||||
facebook::react::MainComponentsRegistry::registerNatives();
|
||||
});
|
||||
}
|
||||
+38
-6
@@ -1,3 +1,4 @@
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
/**
|
||||
@@ -5,17 +6,25 @@
|
||||
*/
|
||||
ext {
|
||||
// kotlin_version is needed for react-native-camera-kit library
|
||||
kotlin_version = project.kotlinPluginVersion
|
||||
RNNKotlinVersion = project.kotlinPluginVersion
|
||||
RNGH_kotlinVersion = project.kotlinPluginVersion
|
||||
kotlin_version = project.kotlinVersion
|
||||
RNNKotlinVersion = "1.6.20"
|
||||
RNGH_kotlinVersion = "1.6.20"
|
||||
buildToolsVersion = project.buildToolsVersion
|
||||
minSdkVersion = Integer.valueOf(project.minSdkVersion)
|
||||
compileSdkVersion = Integer.valueOf(project.compileSdkVersion)
|
||||
targetSdkVersion = Integer.valueOf(project.targetSdkVersion)
|
||||
supportLibVersion = project.supportLibVersion
|
||||
gradlePluginVersion = project.gradlePluginVersion
|
||||
kotlinVersion = project.kotlinPluginVersion
|
||||
ndkVersion = "25.2.9519653"
|
||||
kotlinPluginVersion = project.kotlinPluginVersion
|
||||
|
||||
if (System.properties['os.arch'] == "aarch64") {
|
||||
// For M1 Users we need to use the NDK 24 which added support for aarch64
|
||||
ndkVersion = "24.0.8215888"
|
||||
} else {
|
||||
// Otherwise we default to the side-by-side NDK version from AGP.
|
||||
ndkVersion = "21.4.7075529"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildscript {
|
||||
@@ -26,8 +35,11 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.kotlinPluginVersion}"
|
||||
classpath("com.android.tools.build:gradle")
|
||||
classpath "com.android.tools.build:gradle:${project.ext.gradlePluginVersion}"
|
||||
classpath("com.facebook.react:react-native-gradle-plugin")
|
||||
classpath("de.undercouch:gradle-download-task:5.0.1")
|
||||
// WARNING: Do not place your application dependencies here!
|
||||
// They belong in the individual module build.gradle files.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,14 +64,34 @@ allprojects {
|
||||
throw new GradleException('STATUS_GO_ANDROID_LIBDIR environment variable is not valid!')
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
exclusiveContent {
|
||||
// We get React Native's Android binaries exclusively through npm,
|
||||
// from a local Maven repo inside node_modules/react-native/.
|
||||
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
|
||||
// and potentially getting a wrong version.)
|
||||
filter {
|
||||
includeGroup "com.facebook.react"
|
||||
}
|
||||
forRepository {
|
||||
maven {
|
||||
url "$rootDir/../node_modules/react-native/android"
|
||||
}
|
||||
}
|
||||
}
|
||||
mavenLocal()
|
||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
||||
maven { url("$rootDir/../node_modules/react-native/android") }
|
||||
// Android JSC is installed from npm
|
||||
maven { url("$rootDir/../node_modules/jsc-android/dist") }
|
||||
// For geth, function, and status-go
|
||||
flatDir { dirs "libs", System.env.STATUS_GO_ANDROID_LIBDIR }
|
||||
// Everything Else
|
||||
google()
|
||||
jcenter() // Required for @react-native-community/blur:3.6.1, can be removed after updating to 3.6.1+
|
||||
mavenCentral()
|
||||
// maven { url "https://www.jitpack.io" }
|
||||
maven { url 'https://mvnrepository.com/artifact/com.github.gundy/semver4j'}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,15 @@
|
||||
# $keytool -genkey -v -keystore ./status-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias status
|
||||
|
||||
# Version requirements used throughout the Gradle scripts
|
||||
kotlinVersion=1.6.20
|
||||
minSdkVersion=24
|
||||
compileSdkVersion=33
|
||||
targetSdkVersion=33
|
||||
buildToolsVersion=33.0.0
|
||||
compileSdkVersion=31
|
||||
targetSdkVersion=31
|
||||
buildToolsVersion=31.0.0
|
||||
supportLibVersion=28.0.0
|
||||
# This should match version from nix/pkgs/aapt2/default.nix
|
||||
gradlePluginVersion=7.4.2
|
||||
kotlinPluginVersion=1.9.0
|
||||
# This should match version from nix/mobile/android/maven-and-npm-deps/maven/default.nix
|
||||
gradlePluginVersion=7.2.2
|
||||
kotlinPluginVersion=1.6.20
|
||||
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
@@ -41,7 +42,7 @@ KEYSTORE_KEY_PASSWORD=password
|
||||
# By default we build a mostly universal APK
|
||||
ANDROID_ABI_SPLIT=false
|
||||
# Some platforms are excluded though
|
||||
ANDROID_ABI_INCLUDE=armeabi-v7a;arm64-v8a;x86;x86_64
|
||||
ANDROID_ABI_INCLUDE=armeabi-v7a;arm64-v8a;x86
|
||||
|
||||
org.gradle.jvmargs=-Xmx8704M
|
||||
|
||||
@@ -54,9 +55,3 @@ commitHash=unknown
|
||||
# to write custom TurboModules/Fabric components OR use libraries that
|
||||
# are providing them.
|
||||
newArchEnabled=false
|
||||
|
||||
# Use this property to enable or disable the Hermes JS engine.
|
||||
# If set to false, you will be using JSC instead.
|
||||
# Disabled for debug builds to avoid 'maximum call stack exceeded' errors.
|
||||
# https://github.com/status-im/status-mobile/issues/18493
|
||||
hermesEnabled=false
|
||||
|
||||
@@ -12,10 +12,18 @@ apply from: file("../node_modules/@react-native-community/cli-platform-android/n
|
||||
include ':react-native-nfc-manager'
|
||||
project(':react-native-nfc-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-nfc-manager/android')
|
||||
include ':app'
|
||||
include ':react-native-dialogs'
|
||||
project(':react-native-dialogs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialogs/android')
|
||||
include ':react-native-status'
|
||||
project(':react-native-status').projectDir = new File(rootProject.projectDir, '../modules/react-native-status/android')
|
||||
include ':react-native-status-keycard'
|
||||
project(':react-native-status-keycard').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-status-keycard/android')
|
||||
include ':react-native-blur'
|
||||
project(':react-native-blur').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/blur/android')
|
||||
includeBuild('../node_modules/@react-native/gradle-plugin')
|
||||
includeBuild('../node_modules/react-native-gradle-plugin')
|
||||
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
|
||||
include(":ReactAndroid")
|
||||
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
|
||||
include(":ReactAndroid:hermes-engine")
|
||||
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ module.exports = {
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
node: 'current',
|
||||
node: '14',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux && x86_64 && nix-2.19' }
|
||||
agent { label 'linux && x86_64 && nix-2.14' }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
@@ -15,7 +15,7 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '20',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
/* Allows combined build to copy */
|
||||
copyArtifactPermission('/status-mobile/*')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
@@ -13,7 +13,7 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ pipeline {
|
||||
stage('Prep') {
|
||||
steps { script {
|
||||
println("Current JOB: ${env.JOB_NAME}")
|
||||
/* just for a shorter access */
|
||||
btype = utils.getBuildType()
|
||||
} }
|
||||
}
|
||||
stage('Build') {
|
||||
@@ -82,8 +84,10 @@ pipeline {
|
||||
when { expression { params.PUBLISH } }
|
||||
steps { script {
|
||||
switch (btype) {
|
||||
case 'nightly': /* Create JSON file with newest build URLs */
|
||||
case 'nightly':
|
||||
/* Create JSON file with newest build URLs */
|
||||
s3.updateBucketJSON(urls, 'latest.json');
|
||||
build(job: 'website/status.im', wait: false);
|
||||
break;
|
||||
case 'release':
|
||||
github.publishReleaseFiles(repo: 'status-mobile');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
@@ -23,7 +23,6 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
|
||||
pipeline {
|
||||
agent { label 'macos && arm64 && nix-2.19 && xcode-15.1' }
|
||||
agent { label 'macos && arm64 && nix-2.14 && xcode-14.3' }
|
||||
|
||||
parameters {
|
||||
string(
|
||||
@@ -23,7 +23,7 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '20',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
/* Allows combined build to copy */
|
||||
copyArtifactPermission('/status-mobile/*')
|
||||
@@ -39,6 +39,8 @@ pipeline {
|
||||
LANGUAGE = "en_US.UTF-8"
|
||||
TARGET = 'ios'
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||
/* See nix/README.md */
|
||||
NIX_IGNORE_SYMLINK_STORE = 1
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
BUNDLE_PATH = "${HOME}/.bundle"
|
||||
}
|
||||
@@ -63,7 +65,7 @@ pipeline {
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
archiveArtifacts 'logs/*'
|
||||
archiveArtifacts 'ios/logs/*'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,6 +77,7 @@ pipeline {
|
||||
}
|
||||
}
|
||||
stage('Upload') {
|
||||
when { expression { !utils.isReleaseBuild() } }
|
||||
steps { script {
|
||||
env.DIAWI_URL = ios.uploadToDiawi()
|
||||
env.PKG_URL = env.DIAWI_URL
|
||||
|
||||
+6
-22
@@ -1,21 +1,21 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
/* Options section can't access functions in objects. */
|
||||
def isPRBuild = utils.isPRBuild()
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux && x86_64 && nix-2.19' }
|
||||
agent { label 'linux && x86_64 && nix-2.14' }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
/* Prevent Jenkins jobs from running forever */
|
||||
timeout(time: 20, unit: 'MINUTES')
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
/* Limit builds retained */
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '20',
|
||||
artifactNumToKeepStr: '1',
|
||||
artifactNumToKeepStr: '10',
|
||||
))
|
||||
/* Abort old PR builds. */
|
||||
disableConcurrentBuilds(
|
||||
@@ -52,32 +52,16 @@ pipeline {
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Unit Tests') {
|
||||
stage('Tests') {
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make test-unit 2>&1 | tee -a ${LOG_FILE}
|
||||
make test 2>&1 | tee -a ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Contract Tests') {
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make test-contract 2>&1 | tee -a ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Integration Tests') {
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
set -eo pipefail
|
||||
make test-integration 2>&1 | tee -a ${LOG_FILE}
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Component Tests') {
|
||||
steps {
|
||||
sh """#!/bin/bash
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
|
||||
@@ -29,11 +29,6 @@ pipeline {
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
stages {
|
||||
@@ -41,10 +36,10 @@ pipeline {
|
||||
steps { script {
|
||||
copyArtifacts(
|
||||
projectName: "status-mobile/platforms/android-e2e",
|
||||
filter: 'result/*-x86_64.apk',
|
||||
filter: 'result/*-x86.apk',
|
||||
selector: specific(env.APK_BUILD_NUMBER),
|
||||
)
|
||||
apk_path = "${env.WORKSPACE}/${utils.findFile('result/*-x86_64.apk')}"
|
||||
apk_path = "${env.WORKSPACE}/${utils.findFile('result/*-x86.apk')}"
|
||||
|
||||
} }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
|
||||
@@ -47,11 +47,6 @@ pipeline {
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
timeout(time: 90, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
|
||||
@@ -28,11 +28,6 @@ pipeline {
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '10',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
agent { label 'macos' }
|
||||
@@ -10,6 +10,8 @@ pipeline {
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
TARGET = 'ios'
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
/* See nix/README.md */
|
||||
NIX_IGNORE_SYMLINK_STORE = 1
|
||||
/* avoid writing to r/o /nix */
|
||||
GEM_HOME = '~/.rubygems'
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
agent { label params.AGENT_LABEL }
|
||||
@@ -18,11 +18,11 @@ pipeline {
|
||||
}
|
||||
|
||||
environment {
|
||||
/* See nix/README.md */
|
||||
NIX_IGNORE_SYMLINK_STORE = 1
|
||||
/* we source .bash_profile to be able to use nix-store */
|
||||
NIX_SSHOPTS = "-oStrictHostKeyChecking=no"
|
||||
NIX_SSHOPTS = "-o StrictHostKeyChecking=no source .profile;"
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||
NIX_STORE_CMD = '/nix/var/nix/profiles/default/bin/nix-store'
|
||||
NIX_SSH_REMOTE = "ssh://${params.NIX_CACHE_USER}@${params.NIX_CACHE_HOST}?remote-program=${env.NIX_STORE_CMD}"
|
||||
}
|
||||
|
||||
options {
|
||||
@@ -34,7 +34,6 @@ pipeline {
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '20',
|
||||
daysToKeepStr: '30',
|
||||
artifactNumToKeepStr: '1',
|
||||
))
|
||||
}
|
||||
|
||||
@@ -43,21 +42,19 @@ pipeline {
|
||||
steps { script {
|
||||
nix.shell('nix-env -i openssh', sandbox: false, pure: false)
|
||||
/* some build targets don't build on MacOS */
|
||||
os = sh(script: 'uname', returnStdout: true).trim()
|
||||
arch = sh(script: 'arch', returnStdout: true).trim()
|
||||
os = sh(script: 'uname', returnStdout: true)
|
||||
arch = sh(script: 'arch', returnStdout: true)
|
||||
} }
|
||||
}
|
||||
stage('Build status-go') {
|
||||
steps { script {
|
||||
def platforms = ['mobile.android', 'mobile.ios', 'library']
|
||||
if (os != 'Darwin') { platforms.removeAll { it == 'mobile.ios' } }
|
||||
/* FIXME: "'x86_64-darwin' with features {} is required to build" */
|
||||
/* FIXME: Remove this when #16237 is merged. */
|
||||
if (arch == 'arm64') { platforms.removeAll { it == 'mobile.android' } }
|
||||
platforms.each { platform ->
|
||||
/* Allow for Android builds on Apple ARM. */
|
||||
env.NIXPKGS_SYSTEM_OVERRIDE = nixSysOverride(os, arch, platform)
|
||||
platforms.each { os ->
|
||||
nix.build(
|
||||
attr: "targets.status-go.${platform}",
|
||||
attr: "targets.status-go.${os}",
|
||||
sandbox: false,
|
||||
link: false
|
||||
)
|
||||
@@ -77,11 +74,9 @@ pipeline {
|
||||
}
|
||||
stage('Build android deps') {
|
||||
steps { script {
|
||||
/* Allow for Android builds on Apple ARM. */
|
||||
env.NIXPKGS_SYSTEM_OVERRIDE = nixSysOverride(os, arch, 'android')
|
||||
/* Build/fetch deps required to build android release. */
|
||||
nix.build(
|
||||
attr: 'targets.mobile.android.build.buildInputs',
|
||||
attr: 'targets.mobile.android.release.buildInputs',
|
||||
sandbox: false,
|
||||
pure: false,
|
||||
link: false
|
||||
@@ -91,13 +86,9 @@ pipeline {
|
||||
stage('Build nix shell deps') {
|
||||
steps { script {
|
||||
def shells = ['android', 'ios', 'fastlane', 'keytool', 'clojure', 'gradle']
|
||||
if (os != 'Darwin') { shells.removeAll { it == 'ios' } }
|
||||
/* FIXME: "'x86_64-darwin' with features {} is required to build" */
|
||||
if (arch == 'arm64') { shells.removeAll { it == 'android' } }
|
||||
if (os != "Darwin") { shells.removeAll { it == 'ios' } }
|
||||
/* Build/fetch deps required to start default Nix shell. */
|
||||
shells.each { shell ->
|
||||
/* Allow for Android builds on Apple ARM. */
|
||||
env.NIXPKGS_SYSTEM_OVERRIDE = nixSysOverride(os, arch, shell)
|
||||
nix.build(
|
||||
attr: "shells.${shell}.buildInputs",
|
||||
sandbox: false,
|
||||
@@ -112,7 +103,8 @@ pipeline {
|
||||
nix.shell("""
|
||||
find /nix/store/ -mindepth 1 -maxdepth 1 -type d \
|
||||
-not -name '*.links' -and -not -name '*-status-mobile-*' \
|
||||
| xargs nix copy --to ${NIX_SSH_REMOTE}
|
||||
| xargs nix copy \
|
||||
--to ssh-ng://${params.NIX_CACHE_USER}@${params.NIX_CACHE_HOST}
|
||||
""",
|
||||
pure: false
|
||||
)
|
||||
@@ -127,11 +119,3 @@ pipeline {
|
||||
} }
|
||||
}
|
||||
}
|
||||
|
||||
def nixSysOverride(os, arch, target='android') {
|
||||
return (
|
||||
os == 'Darwin' &&
|
||||
arch == 'arm64' &&
|
||||
target =~ /.*android$/
|
||||
) ? 'x86_64-darwin' : ''
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux' }
|
||||
@@ -10,6 +10,8 @@ pipeline {
|
||||
LC_ALL = 'en_US.UTF-8'
|
||||
TARGET = 'ios'
|
||||
FASTLANE_DISABLE_COLORS = 1
|
||||
/* See nix/README.md */
|
||||
NIX_IGNORE_SYMLINK_STORE = 1
|
||||
/* avoid writing to r/o /nix */
|
||||
GEM_HOME = '~/.rubygems'
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env groovy
|
||||
library 'status-jenkins-lib@v1.8.7'
|
||||
library 'status-jenkins-lib@v1.7.15'
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
[Coding guidelines](new-guidelines.md)
|
||||
|
||||
[UI components coding guidelines](ui-guidelines.md)
|
||||
|
||||
[Release Checklist](release-checklist.md)
|
||||
|
||||
[Release Guide](release-guide.md)
|
||||
@@ -30,8 +28,6 @@
|
||||
|
||||
[Contributing to status-go](status-go-changes.md)
|
||||
|
||||
[Malli schemas (recorded demo)](https://www.youtube.com/watch?v=SlRio70aYVI) ([slides](files/forging-code-with-schemas-sep-2023-slides.pdf))
|
||||
|
||||
## Testing
|
||||
|
||||
[How to run local tests](testing.md)
|
||||
|
||||
+2
-2
@@ -144,9 +144,9 @@ used for keycard
|
||||
used for svg icons, mostly collectibles are using svg
|
||||
TODO: updating requires a pod update on iOS
|
||||
|
||||
## "react-native-biometrics": "^3.0.1"
|
||||
## "react-native-touch-id": "^4.4.1"
|
||||
|
||||
used for biometric authentication on Android and iOS
|
||||
used for touch-id identification
|
||||
|
||||
## "react-native-webview": "git+https://github.com/status-im/react-native-webview.git#v8.0.7_3"
|
||||
|
||||
|
||||
Binary file not shown.
+2
-1
@@ -122,9 +122,10 @@ See below:
|
||||
|
||||
Do the following:
|
||||
|
||||
Ensure you have 2 terminals running the following
|
||||
Ensure you have 3 terminals running the following
|
||||
|
||||
- `make run-clojure`
|
||||
- `make run-metro`
|
||||
- `make run-ios` / `make run-android`
|
||||
|
||||
[See the STARTING GUIDE for details](STARTING_GUIDE.md#development)
|
||||
|
||||
+5
-56
@@ -212,15 +212,16 @@ Properties must be set on view level
|
||||
:bottom 0}
|
||||
```
|
||||
|
||||
### Animated styles in the style file
|
||||
### Apply animated styles in the style file
|
||||
|
||||
```clojure
|
||||
;; bad
|
||||
(defn circle
|
||||
[]
|
||||
(let [opacity (reanimated/use-shared-value 1)]
|
||||
[reanimated/view {:style [{:opacity opacity}
|
||||
style/circle-container]}]))
|
||||
[reanimated/view {:style (reanimated/apply-animations-to-style
|
||||
{:opacity opacity}
|
||||
style/circle-container)}]))
|
||||
|
||||
;; good
|
||||
(defn circle
|
||||
@@ -229,38 +230,6 @@ Properties must be set on view level
|
||||
[reanimated/view {:style (style/circle-container opacity)}]))
|
||||
```
|
||||
|
||||
### Pass a vector of styles to Reanimated view
|
||||
|
||||
Prefer to pass a vector of styles to `react-native.reanimated/view` `:style`
|
||||
prop instead of using `apply-animations-to-style` directly. For more details, check out Reanimated docs about [inline
|
||||
styles](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/your-first-animation/#defining-a-shared-value)
|
||||
and [useAnimatedStyle](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/animating-styles-and-props/#animating-styles).
|
||||
|
||||
```clojure
|
||||
(defn f-view []
|
||||
(let [scroll-x (reanimated/use-shared-value 0)
|
||||
opacity (reanimated/interpolate scroll-x [0 45 50] [1 1 0])]
|
||||
[reanimated/view
|
||||
;; bad
|
||||
{:style (reanimated/apply-animations-to-style
|
||||
{:opacity opacity
|
||||
:transform [{:translate-x scroll-x}]}
|
||||
{:flex-direction :row})}
|
||||
|
||||
;; good
|
||||
{:style [{:opacity opacity
|
||||
:transform [{:translate-x scroll-x}]}
|
||||
{:flex-direction :row}]}
|
||||
|
||||
;; other valid and good variants
|
||||
{:style [{:opacity opacity}
|
||||
{:transform [{:translate-x scroll-x}]}
|
||||
{:flex-direction :row}]}
|
||||
|
||||
{:style {:opacity opacity
|
||||
:transform [{:translate-x scroll-x}]
|
||||
:flex-direction :row}}]))
|
||||
```
|
||||
### Don't use percents to define width/height
|
||||
|
||||
In ReactNative, all layouts use the [flexbox
|
||||
@@ -672,26 +641,6 @@ keywords and concatenating them into a single string.
|
||||
```
|
||||
|
||||
### Tests
|
||||
#### Prefer `match?` over `=` when comparing data structures
|
||||
|
||||
Prefer the `match?` directive over `=` when comparing data structures, otherwise
|
||||
when the check fails the output can be too difficult to read. `match?` is
|
||||
defined by library https://github.com/nubank/matcher-combinators.
|
||||
|
||||
```clojure
|
||||
;; bad
|
||||
(deftest some-test
|
||||
(let [expected {...}
|
||||
actual {...}]
|
||||
(is (= expected actual))))
|
||||
|
||||
;; good
|
||||
(deftest some-test
|
||||
(let [expected {...}
|
||||
actual {...}]
|
||||
(is (match? expected actual))))
|
||||
```
|
||||
|
||||
#### Subscription tests
|
||||
|
||||
Test [layer-3 subscriptions](https://day8.github.io/re-frame/subscriptions/) by
|
||||
@@ -767,7 +716,7 @@ src
|
||||
|
||||
- `src/js`: Raw Javascript files, e.g. React Native Reanimated worklets.
|
||||
- `src/mocks`: Plumbing configuration to be able to run tests.
|
||||
- `src/quo/`: The component library for Status Mobile. [Read more...](../src/quo/README.md)
|
||||
- `src/quo/`: The component library for Status Mobile.
|
||||
- `src/react_native/`: Contains only low-level constructs to help React Native
|
||||
work in tandem with Clojure(Script).
|
||||
- `src/status_im2/`: Directory where we try to be as strict as possible about
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB |
+23
-37
@@ -4,41 +4,22 @@ This document provides information on how to start developing Status App.
|
||||
|
||||
# Getting Started
|
||||
|
||||
To start developing clone the status-mobile repo in the directory of your choice.
|
||||
To start developing start a shell for the platform you are interested in.
|
||||
```
|
||||
git clone https://github.com/status-im/status-mobile.git
|
||||
make shell TARGET=android
|
||||
```
|
||||
This step will take a while the first time as it will download all dependencies.
|
||||
|
||||
Then open a terminal and cd into this directory.
|
||||
# Development
|
||||
|
||||
```
|
||||
cd status-mobile
|
||||
```
|
||||
There are three steps necessary to start development, in this case for Android:
|
||||
|
||||
Then build the clojure terminal
|
||||
1. `make run-clojure` - Compiles Clojure into JavaScript, watches for changes on cljs files, and hot-reloads code in the app.
|
||||
2. `make run-metro` - Starts metro bundler and watches JavaScript code.
|
||||
3. `make run-android` or `make run-ios` - Builds the Android/iOS app and starts it on the device.
|
||||
|
||||
```
|
||||
make run-clojure
|
||||
```
|
||||
|
||||
note: ⚠️ This might take a while if this is your first time.
|
||||
|
||||
This command installs `nix` and pulls in all the dependencies.
|
||||
Do answer with "Y" to all the prompts and press "Enter" when `nix` setup asks you to Acknowledge.
|
||||
This command builds the `jsbundle` and then compiles `Clojure` into `JavaScript`, watches for changes on `cljs` files, and hot-reloads code in the app.
|
||||
|
||||
wait till you see the following message :
|
||||
|
||||
```
|
||||
[:mobile] Build completed. (1801 files, 52 compiled, 0 warnings, 9.52s)
|
||||
```
|
||||
|
||||
Once the clojure terminal is running you need to run the appropriate command next for your platform in a separate terminal :
|
||||
|
||||
`make run-android` or `make run-ios`
|
||||
|
||||
These commands will build the app, start a metro bundler and deploy the app on your simulator OR connected device (android only). For building and deploying to connected iPhones use `make run-ios-device` instead of `make run-ios`
|
||||
Also check [developing on a physical iOS Device](#Additional-requirements-for-developing-on-physical-ios-device).
|
||||
The first two will continue watching for changes and keep re-building the app. They need to be ready first.
|
||||
The last one will exit once the app is up and ready.
|
||||
|
||||
## Simulators and Devices
|
||||
### Android
|
||||
@@ -65,9 +46,13 @@ Running `make run-ios` will target `iPhone 13` by default.
|
||||
|
||||
If you need to run on any other simulator, you can specify the simulator type by adding the `SIMULATOR` flag:
|
||||
```sh
|
||||
make run-ios SIMULATOR="iPhone 15"
|
||||
make run-ios SIMULATOR="iPhone 13"
|
||||
```
|
||||
|
||||
#### Running on a physical device
|
||||
|
||||
Some manual steps are necessary for [developing on a physical iOS Device](#physical-ios-device).
|
||||
|
||||
# Build release
|
||||
|
||||
To build the app, you can simply run on of the following:
|
||||
@@ -117,15 +102,16 @@ Steps:
|
||||
3. [Setup Git to sign commits](https://help.github.com/en/github/authenticating-to-github/signing-commits)
|
||||
4. [Setup GitHub to validate commits](https://help.github.com/en/github/authenticating-to-github/adding-a-new-gpg-key-to-your-github-account)
|
||||
|
||||
## Additional requirements for developing on Physical iOS Device
|
||||
## Physical iOS Device
|
||||
|
||||
To use a physical iPhone your device UDID must be added to provisioning profiles and your Apple account invited as Developer to Status team.
|
||||
|
||||
1. [Get your UDID of your iPhone.](https://www.extentia.com/post/finding-the-udid-of-an-ios-device)
|
||||
2. Request from someone with access like @cammellos or @jakubgs to
|
||||
- Add the UDID to development devices on Apple Developer Portal.
|
||||
- Invite your Apple account to be Developer in Status team.
|
||||
3. Open XCode using the project from `status-mobile/ios` directory.
|
||||
- You might see error: `Select a development team in the Signing & Capabilities editor`
|
||||
- Select `Status Research & Development GmbH` as the development team.
|
||||
4. In a new terminal execute `make clean` and then `make xcode-clean`
|
||||
- Add the UDID to development devices on Apple Developer Portal.
|
||||
- Invite your Apple account to be Developer in Status team.
|
||||
3. Run a build in XCode using the project from `status-mobile/ios` directory.
|
||||
- You might see error: `Select a development team in the Signing & Capabilities editor`
|
||||
- Select `Status Research & Development GmbH` as the development team and rebuild again.
|
||||
|
||||
Once build finishes Status should start on your iPhone with its logs in terminal running `make run-metro`.
|
||||
|
||||
+9
-35
@@ -2,19 +2,21 @@
|
||||
|
||||
## Unit & integration tests
|
||||
|
||||
To run all tests:
|
||||
To run tests:
|
||||
|
||||
```
|
||||
make test
|
||||
make test
|
||||
```
|
||||
|
||||
|
||||
|
||||
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
|
||||
|
||||
```
|
||||
make test WATCH=true
|
||||
make test-watch
|
||||
```
|
||||
|
||||
Developers can also manually change the shadow-cljs option `:ns-regex` to control which namespaces the test runner should pick.
|
||||
Developers can also manually change the shadow-cljs option `:ns-regex` to control which namespaces the test runner should pick.
|
||||
|
||||
## Testing with REPL
|
||||
|
||||
@@ -49,46 +51,18 @@ Here I'm showing a terminal-only experience using Tmux (left pane Emacs, right p
|
||||
|
||||
[2022-12-19 13-17.webm](https://user-images.githubusercontent.com/46027/208471199-1909c446-c82d-42a0-9350-0c15ca562713.webm)
|
||||
|
||||
## Component tests only
|
||||
## Component tests
|
||||
|
||||
To run tests:
|
||||
|
||||
```
|
||||
make component-test
|
||||
make component-test
|
||||
```
|
||||
|
||||
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
|
||||
|
||||
```
|
||||
make component-test-watch
|
||||
make component-test-watch
|
||||
```
|
||||
|
||||
Check [component tests doc](./component-tests-overview.md) for more.
|
||||
|
||||
## Unit tests only
|
||||
|
||||
To run unit tests:
|
||||
|
||||
```
|
||||
make test-unit
|
||||
```
|
||||
|
||||
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
|
||||
|
||||
```
|
||||
make test-unit WATCH=true
|
||||
```
|
||||
|
||||
## Integration tests only
|
||||
|
||||
To run integration tests:
|
||||
|
||||
```
|
||||
make test-integration
|
||||
```
|
||||
|
||||
Also test watcher can be launched. It will re-run the entire test suite when any file is modified
|
||||
|
||||
```
|
||||
make test-integration WATCH=true
|
||||
```
|
||||
|
||||
+20
-1
@@ -88,7 +88,6 @@ info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this
|
||||
Update yarn.lock file. In order to do this, perform the following steps on a clean `status-mobile` repo:
|
||||
```
|
||||
cd status-mobile
|
||||
make shell
|
||||
yarn install
|
||||
```
|
||||
and don't forget to commit updated `yarn.lock` together with `package.json`.
|
||||
@@ -128,3 +127,23 @@ Status-mobile uses `shadow-cljs` for hot reloading changes and uses its own [rel
|
||||
|
||||
### Solution
|
||||
Open react native's [In-App Developer Menu](https://reactnative.dev/docs/debugging#accessing-the-in-app-developer-menu) and press "Disable Fast Refresh" or "Disable Hot Reloading"
|
||||
|
||||
## App Crashes after few reloads
|
||||
|
||||
### Cause
|
||||
For x86 CPU architecture Android Devices, Hermes is creating the issue and the app crashes after a few reloads.
|
||||
([Original Issue](https://github.com/status-im/status-mobile/issues/14031))
|
||||
|
||||
<details>
|
||||
<summary>How to Find CPU architecture</summary>
|
||||
|
||||
CPU architecture of android device can be found using
|
||||
- `adb shell uname -m` or
|
||||
- `adb shell getprop ro.product.cpu.abilist`
|
||||
|
||||
</details>
|
||||
|
||||
### Solution
|
||||
Disable Hermes while building the app
|
||||
|
||||
`make run-android DISABLE_HERMES=true`
|
||||
|
||||
@@ -1,254 +0,0 @@
|
||||
# UI components coding guidelines
|
||||
|
||||
> [!IMPORTANT]
|
||||
> React apps are made out of components. A component is a piece of the UI (user interface) that has its own logic and appearance. A component can be as small as a button, or as large as an entire screen.
|
||||
> React components are JavaScript functions that return markup
|
||||
> This document will provide best practices on how to write efficient React components in ClojureScript
|
||||
|
||||
|
||||
At the time of creating the Status app, the Reagent library was a solid choice. Back then, hooks didn't exist, and there weren't any libraries providing effective global state management. After Reagent's emergence, another library called Re-frame built upon Reagent. Together, they offered powerful tools for developing React applications with ClojureScript. However, as React evolved, significant changes occurred. Class components, utilized in Reagent, became deprecated. Instead, functional components and hooks emerged for state management. In Status 2.0, we began incorporating more functional components and hooks, resulting in a blend of both approaches. To simplify matters and reduce confusion, we opted to transition to functional components and hooks for local state management.
|
||||
|
||||
BEFORE:
|
||||
```clojure
|
||||
(defn- view-internal
|
||||
[_ _]
|
||||
(let [pressed? (reagent/atom false)]
|
||||
(fn
|
||||
[{:keys [theme on-press on-long-press icon]}]
|
||||
[rn/pressable
|
||||
{:style (style/main @pressed? theme)
|
||||
:on-press on-press
|
||||
:on-press-in #(reset! pressed? true)
|
||||
:on-press-out #(reset! pressed? nil)
|
||||
:on-long-press on-long-press}
|
||||
[quo.icons/icon icon]])))
|
||||
|
||||
(def view (theme/with-theme view-internal))
|
||||
```
|
||||
|
||||
NOW:
|
||||
```clojure
|
||||
(defn view
|
||||
[{:keys [on-press on-long-press icon]}]
|
||||
(let [[pressed? set-pressed] (rn/use-state false)
|
||||
theme (theme/use-theme-value)
|
||||
on-press-in (rn/use-callback #(set-pressed true))
|
||||
on-press-out (rn/use-callback #(set-pressed nil))]
|
||||
[rn/pressable
|
||||
{:style (style/main pressed? theme)
|
||||
:on-press on-press
|
||||
:on-press-in on-press-in
|
||||
:on-press-out on-press-out
|
||||
:on-long-press on-long-press}
|
||||
[quo.icons/icon icon]]))
|
||||
```
|
||||
|
||||
|
||||
- We no longer need to create an anonymous function for rendering. This removes unnecessary confusion and the need for specific knowledge on how it works and why it was needed.
|
||||
- `rn/use-state` is used instead of `reagent/atom`
|
||||
- State values no longer need to be dereferenced; they are accessible as regular symbols. This eliminates a common bug where the "@" symbol was inadvertently omitted.
|
||||
- `theme/with-theme` wrapper is not needed anymore, `(theme/use-theme-value)` hook can be used directly in the components
|
||||
- `:f>` not needed anymore, all components are functional by default
|
||||
- `rn/use-callback` hook should be used for anon callback functions
|
||||
|
||||
> [!IMPORTANT]
|
||||
> DO NOT USE anon functions directly in the props
|
||||
|
||||
BAD
|
||||
```clojure
|
||||
(defn view
|
||||
[]
|
||||
(let [[pressed? set-pressed] (rn/use-state false)]
|
||||
[rn/pressable
|
||||
{:style (style/main pressed?)
|
||||
:on-press-in #(set-pressed true)
|
||||
:on-press-out #(set-pressed nil)}]))
|
||||
```
|
||||
|
||||
GOOD:
|
||||
```clojure
|
||||
(defn view
|
||||
[]
|
||||
(let [[pressed? set-pressed] (rn/use-state false)
|
||||
on-press-in (rn/use-callback #(set-pressed true))
|
||||
on-press-out (rn/use-callback #(set-pressed nil))]
|
||||
[rn/pressable
|
||||
{:style (style/main pressed?)
|
||||
:on-press-in on-press-in
|
||||
:on-press-out on-press-out}]))
|
||||
```
|
||||
|
||||
## Global state and subscriptions
|
||||
|
||||
For global state management, we utilize Re-frame subscriptions. They can be likened to React state. To obtain the state, `(rf/sub [])` is employed, and to modify it, `(rf/dispatch [])` is utilized. However, they update components in a similar manner to React states.
|
||||
|
||||
```clojure
|
||||
(defn view
|
||||
[{:keys [selected-tab]}]
|
||||
(let [collectible-list (rf/sub [:wallet/all-collectibles])
|
||||
on-collectible-press (rn/use-callback
|
||||
(fn [{:keys [id]}]
|
||||
(rf/dispatch [:wallet/get-collectible-details id])))]
|
||||
[rn/view {:style style/container}
|
||||
(case selected-tab
|
||||
:assets [assets/view]
|
||||
:collectibles [collectibles/view {:collectibles collectible-list
|
||||
:on-collectible-press on-collectible-press}])
|
||||
[activity/view]]))
|
||||
```
|
||||
|
||||
## Regular atoms
|
||||
|
||||
In certain instances, components utilized regular atoms; however, they should now be used with `rn/use-ref-atom`
|
||||
|
||||
BEFORE:
|
||||
```clojure
|
||||
(defn view
|
||||
[]
|
||||
(let [focused? (atom false)]
|
||||
(fn []
|
||||
(let [on-clear #(reset! status (if @focused? :active :default))
|
||||
on-focus #(reset! focused? true)
|
||||
on-blur #(reset! focused? false)]))))
|
||||
```
|
||||
|
||||
NOW:
|
||||
```clojure
|
||||
(defn view
|
||||
[]
|
||||
(let [focused? (rn/use-ref-atom false)
|
||||
on-clear (rn/use-callback #(set-status (if @focused? :active :default)))
|
||||
on-focus (rn/use-callback #(reset! focused? true))
|
||||
on-blur (rn/use-callback #(reset! focused? false))]))
|
||||
```
|
||||
|
||||
## Effects
|
||||
|
||||
LIFECYCLE:
|
||||
|
||||
```clojure
|
||||
(defn view
|
||||
[{:keys []}]
|
||||
(let [opacity (reanimated/use-shared-value 0)]
|
||||
(rn/use-mount #(reanimated/animate opacity 1))
|
||||
[rn/view
|
||||
{:style (style/opacity opacity)}]))
|
||||
```
|
||||
|
||||
```clojure
|
||||
(defn view
|
||||
[{:keys []}]
|
||||
(let []
|
||||
(rn/use-unmount #(rn/dispatch [:unmounted]))
|
||||
[rn/view]))
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Effects should NOT be utilized as a response to state changes for modifying logic. If you're unsure how to achieve this without using effects, please consult the team in the general chat. There may be instances where using effects is appropriate, so we can explore a solution together and enhance our guidelines.
|
||||
|
||||
BAD:
|
||||
```clojure
|
||||
(defn f-zoom-button
|
||||
[{:keys [selected? current-zoom]}]
|
||||
(let [size (reanimated/use-shared-value (if selected? 37 25))]
|
||||
(rn/use-effect #(reanimated/animate size (if selected? 37 25)) [current-zoom])
|
||||
[rn/touchable-opacity
|
||||
{:style (style/zoom-button-container size)}]))
|
||||
```
|
||||
|
||||
BAD:
|
||||
|
||||
```clojure
|
||||
(defn view
|
||||
[collectible-list (rf/sub [:wallet/all-collectibles])]
|
||||
(let []
|
||||
(rn/use-effect #(rn/dispatch [:all-collectibles-changed]) [collectible-list])
|
||||
[rn/view]))
|
||||
```
|
||||
|
||||
Instead `:all-collectibles-changed` should be used in the handler which changes `collectible-list` state
|
||||
|
||||
|
||||
|
||||
## Performance tips
|
||||
|
||||
To begin with, we need to understand that there are two distinct stages for a component: creation and update. React creates a render tree, a UI tree, composed of the rendered components.
|
||||
|
||||

|
||||
|
||||
### Component creation
|
||||
|
||||
For component creation, the most critical factor is the number of elements involved, so we should strive to minimize them. For instance, it's advisable to avoid using unnecessary wrappers or containers.
|
||||
|
||||
BAD:
|
||||
|
||||
```clojure
|
||||
(defn view
|
||||
[]
|
||||
(let []
|
||||
[rn/view {:style {:padding-top 20}}
|
||||
[quo/button]]))
|
||||
```
|
||||
|
||||
GOOD:
|
||||
```clojure
|
||||
(defn view
|
||||
[]
|
||||
(let []
|
||||
[quo/button {:container-style {:padding-top 20}}]))
|
||||
```
|
||||
|
||||
### Component updates
|
||||
|
||||
For component updates, it's crucial to recognize that React will invoke the function where state is utilized. Therefore, if you utilize state in the root component, React will execute the root function and re-render the entire root component along with all its children (unless optimizations like memoization are implemented).
|
||||
|
||||
BAD:
|
||||
|
||||
```clojure
|
||||
(defn component
|
||||
[{:keys [label]}]
|
||||
(let []
|
||||
[rn/text label]))
|
||||
|
||||
(defn component2
|
||||
[{:keys [label2]}]
|
||||
(let []
|
||||
[rn/text label2]))
|
||||
|
||||
(defn screen
|
||||
[]
|
||||
(let [screen-params (rf/sub [:screen-params])]
|
||||
[component screen-params]
|
||||
[component1]
|
||||
[component2 screen-params]
|
||||
[component3]
|
||||
[rn/view {:padding-top 20}
|
||||
[quo/button]]))
|
||||
```
|
||||
|
||||
Here, we have lost control over the `screen-params` map. It can contain any data, and if any field within this map changes, the entire screen function will be executed, resulting in the re-rendering of both `component` and `component2`.
|
||||
|
||||
GOOD:
|
||||
```clojure
|
||||
(defn component
|
||||
[]
|
||||
(let [label (rf/sub [:screen-params-label])]
|
||||
[rn/text label]))
|
||||
|
||||
(defn component2
|
||||
[]
|
||||
(let [label2 (rf/sub [:screen-params-label2])]
|
||||
[rn/text label2]))
|
||||
|
||||
(defn screen
|
||||
[]
|
||||
(let []
|
||||
[component]
|
||||
[component1]
|
||||
[component2]
|
||||
[component3]
|
||||
[rn/view {:padding-top 20}
|
||||
[quo/button]]))
|
||||
```
|
||||
|
||||
So, now the screen component function will never be invoked, and `component` and `component2` will be re-rendered only when `label` or `label2` have changed.
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
# This file contains the fastlane.tools configuration
|
||||
|
||||
# You can find the documentation at https://docs.fastlane.tools
|
||||
#
|
||||
# For a list of all available actions, check out
|
||||
@@ -97,7 +96,7 @@ end
|
||||
# if false - read list of devices from AppStoreConnect, and upgrade the provisioning profiles from it
|
||||
# `pr_build`:
|
||||
# if true - uses StatusImPR scheme and postfixed app id with `.pr` to build an app, which can be used in parallel with release
|
||||
# if false - uses StatusIm scheme to build the release app
|
||||
# if false - uses StatusIm scheme to build the release app
|
||||
|
||||
def build_ios_adhoc(readonly: false, pr_build: false)
|
||||
# PR builds should appear as a separate App on iOS
|
||||
@@ -124,7 +123,7 @@ def build_ios_adhoc(readonly: false, pr_build: false)
|
||||
export_method: 'ad-hoc',
|
||||
output_name: 'StatusIm',
|
||||
output_directory: 'status-ios',
|
||||
buildlog_path: 'logs',
|
||||
buildlog_path: 'ios/logs',
|
||||
export_options: {
|
||||
signingStyle: 'manual',
|
||||
provisioningProfiles: {
|
||||
|
||||
+18
-16
@@ -1,18 +1,16 @@
|
||||
# Resolve react_native_pods.rb with node to allow for hoisting
|
||||
require Pod::Executable.execute_command('node', ['-p',
|
||||
'require.resolve(
|
||||
"react-native/scripts/react_native_pods.rb",
|
||||
{paths: [process.argv[1]]},
|
||||
)', __dir__]).strip
|
||||
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
||||
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
||||
|
||||
platform :ios, min_ios_version_supported
|
||||
prepare_react_native_project!
|
||||
platform :ios, '12.4'
|
||||
|
||||
linkage = ENV['USE_FRAMEWORKS']
|
||||
if linkage != nil
|
||||
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
|
||||
use_frameworks! :linkage => linkage.to_sym
|
||||
end
|
||||
production = ENV["PRODUCTION"] == "1"
|
||||
|
||||
# We need to enable codegen discovery to fix the issue of these files not being generated properly:
|
||||
# ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm
|
||||
# ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h
|
||||
# more details here : https://github.com/status-im/status-mobile/issues/15911
|
||||
# TODO: remove this flag once you upgrade react-native above version 0.70
|
||||
ENV['USE_CODEGEN_DISCOVERY'] = "1"
|
||||
|
||||
# If inside a Nix shell, allow pod install
|
||||
inside_nix_shell = ENV['IN_NIX_SHELL']
|
||||
@@ -32,8 +30,11 @@ abstract_target 'Status' do
|
||||
|
||||
use_react_native!(
|
||||
:path => config[:reactNativePath],
|
||||
:hermes_enabled => false,
|
||||
# to enable hermes on iOS, change `false` to `true` and then install pods
|
||||
:production => production,
|
||||
:hermes_enabled => flags[:hermes_enabled],
|
||||
:fabric_enabled => flags[:fabric_enabled],
|
||||
:use_codegen_discovery => true,
|
||||
# An absolute path to your application root.
|
||||
:app_path => "#{Pod::Config.instance.installation_root}/.."
|
||||
)
|
||||
@@ -44,8 +45,9 @@ abstract_target 'Status' do
|
||||
pod 'SSZipArchive', '2.4.3'
|
||||
|
||||
permissions_path = '../node_modules/react-native-permissions/ios'
|
||||
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone/Permission-Microphone.podspec"
|
||||
pod 'Permission-Camera', :path => "#{permissions_path}/Camera/Permission-Camera.podspec"
|
||||
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
|
||||
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
|
||||
|
||||
pod "react-native-status-keycard", path: "../node_modules/react-native-status-keycard"
|
||||
pod "react-native-status", path: "../modules/react-native-status"
|
||||
pod "Keycard", git: "https://github.com/status-im/Keycard.swift.git"
|
||||
|
||||
+325
-432
File diff suppressed because it is too large
Load Diff
@@ -3,11 +3,12 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objectVersion = 52;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
00E356F31AD99517003FC87E /* StatusImTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* StatusImTests.m */; };
|
||||
04515E9DF839CBF55C690E79 /* libPods-Status-StatusImPR.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5006FF03675A7E50320B4002 /* libPods-Status-StatusImPR.a */; };
|
||||
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
|
||||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||
25DC9C9DC25846BD8D084888 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9A886A2CB448B1ABA0EB62 /* libc++.tbd */; };
|
||||
@@ -43,9 +44,8 @@
|
||||
715D8132290BE850006F5C88 /* UbuntuMono-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 715D8131290BE850006F5C88 /* UbuntuMono-Regular.ttf */; };
|
||||
715D8133290BE850006F5C88 /* UbuntuMono-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 715D8131290BE850006F5C88 /* UbuntuMono-Regular.ttf */; };
|
||||
74B758FC20D7C00B003343C3 /* launch-image-universal.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74B758FB20D7C00B003343C3 /* launch-image-universal.storyboard */; };
|
||||
81F3191BB1D4BDF3442402BD /* libPods-Status-StatusIm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F8E9088BDE117AB71366407 /* libPods-Status-StatusIm.a */; };
|
||||
8391E8E0E93C41A98AAA6631 /* Inter-SemiBoldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = A4F2BBE8D4DD4140A6CCAC39 /* Inter-SemiBoldItalic.otf */; };
|
||||
8BE7C1BD90A0AB68254988BD /* libPods-Status-StatusIm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 28A248DF828DD5505CABC707 /* libPods-Status-StatusIm.a */; };
|
||||
9930D2C5DF7BE851C6CE54A1 /* libPods-Status-StatusImPR.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B792BBAE71EAA1C3F2C9C47 /* libPods-Status-StatusImPR.a */; };
|
||||
B24FC7FD1DE7195700D694FF /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24FC7FC1DE7195700D694FF /* Social.framework */; };
|
||||
B24FC7FF1DE7195F00D694FF /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24FC7FE1DE7195F00D694FF /* MessageUI.framework */; };
|
||||
B2F2D1BC1D9D531B00B7B453 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2F2D1BB1D9D531B00B7B453 /* Images.xcassets */; };
|
||||
@@ -57,10 +57,10 @@
|
||||
C1715FFB29C0BCE50088FA8B /* launch-icon@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C14C5F8C29C0A149005C58A7 /* launch-icon@3x.png */; };
|
||||
C1715FFC29C0BCE80088FA8B /* launch-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = C14C5F9229C0ADB5005C58A7 /* launch-icon.png */; };
|
||||
CE4E31B31D8695250033ED64 /* Statusgo.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE4E31B21D8695250033ED64 /* Statusgo.xcframework */; };
|
||||
D156FF2CCF43C136F7BF8AE5 /* libPods-Status-StatusIm-StatusImTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3EFEEB5FC1235562D5D3BF1 /* libPods-Status-StatusIm-StatusImTests.a */; };
|
||||
D1786306E0184916B11F4C37 /* Inter-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = B2A38FC3D3954DE7B2B171F8 /* Inter-Medium.otf */; };
|
||||
D84616FB563A48EBB1678699 /* Inter-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = CD4A2C27D6D5473184DC1F7E /* Inter-Bold.otf */; };
|
||||
D99C50E5E18942A39C8DDF61 /* Inter-BoldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = B321D25F4493470980039457 /* Inter-BoldItalic.otf */; };
|
||||
E6794203DEE6BE3C85F205F8 /* libPods-Status-StatusIm-StatusImTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9305FC57D289E57F96162DD2 /* libPods-Status-StatusIm-StatusImTests.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -108,14 +108,15 @@
|
||||
00E356EE1AD99517003FC87E /* StatusImTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = StatusImTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
00E356F21AD99517003FC87E /* StatusImTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StatusImTests.m; sourceTree = "<group>"; };
|
||||
1130DCD9CBDCA3CA461F55B4 /* Pods-Status-StatusIm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm.debug.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
06AF19FA626AFFC91E66916B /* Pods-Status-StatusImPR.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusImPR.release.xcconfig"; path = "Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR.release.xcconfig"; sourceTree = "<group>"; };
|
||||
0F8E9088BDE117AB71366407 /* libPods-Status-StatusIm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Status-StatusIm.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
13B07F961A680F5B00A75B9A /* StatusIm.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StatusIm.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = StatusIm/AppDelegate.h; sourceTree = "<group>"; };
|
||||
13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = StatusIm/AppDelegate.mm; sourceTree = "<group>"; };
|
||||
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = StatusIm/Info.plist; sourceTree = "<group>"; };
|
||||
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = StatusIm/main.m; sourceTree = "<group>"; };
|
||||
1426DF592BA248FC81D955CB /* Inter-Regular.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-Regular.otf"; path = "../resources/fonts/Inter-Regular.otf"; sourceTree = "<group>"; };
|
||||
28A248DF828DD5505CABC707 /* libPods-Status-StatusIm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Status-StatusIm.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1CDF317A2E103217DF386083 /* Pods-Status-StatusIm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm.release.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3A2626CE245C3F2200D5F94B /* Dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dummy.swift; sourceTree = "<group>"; };
|
||||
3A6406FB24A3ADF90046ED37 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
3A8F8EA924A4D31600BF206D /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
|
||||
@@ -123,24 +124,21 @@
|
||||
3AB1C3AD245C043900098F67 /* StatusIm-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "StatusIm-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
|
||||
4E586E1B0E544F64AA9F5BD1 /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
|
||||
59C9C002A09CA7F40E69C6CB /* Pods-Status-StatusIm-StatusImTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm-StatusImTests.debug.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm-StatusImTests/Pods-Status-StatusIm-StatusImTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
5B792BBAE71EAA1C3F2C9C47 /* libPods-Status-StatusImPR.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Status-StatusImPR.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5006FF03675A7E50320B4002 /* libPods-Status-StatusImPR.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Status-StatusImPR.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
65F693BD2578002500A45E76 /* CoreNFC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreNFC.framework; path = System/Library/Frameworks/CoreNFC.framework; sourceTree = SDKROOT; };
|
||||
65F693BF2578003600A45E76 /* CoreNFC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreNFC.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/System/iOSSupport/System/Library/Frameworks/CoreNFC.framework; sourceTree = DEVELOPER_DIR; };
|
||||
65F6941725780A4E00A45E76 /* StatusImTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "StatusImTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
65F6941825780A4F00A45E76 /* Bridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bridge.swift; sourceTree = "<group>"; };
|
||||
668C1A2ADF1899973DAA1AB7 /* Pods-Status-StatusIm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm.release.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm.release.xcconfig"; sourceTree = "<group>"; };
|
||||
693A62DB37BC4CD5A30E5C96 /* Inter-SemiBold.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-SemiBold.otf"; path = "../resources/fonts/Inter-SemiBold.otf"; sourceTree = "<group>"; };
|
||||
715D8131290BE850006F5C88 /* UbuntuMono-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "UbuntuMono-Regular.ttf"; path = "../resources/fonts/UbuntuMono-Regular.ttf"; sourceTree = "<group>"; };
|
||||
74B758FB20D7C00B003343C3 /* launch-image-universal.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "launch-image-universal.storyboard"; sourceTree = "<group>"; };
|
||||
8B9A886A2CB448B1ABA0EB62 /* libc++.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
|
||||
922C4CA61F4D5F8B0033C753 /* StatusIm.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = StatusIm.entitlements; path = StatusIm/StatusIm.entitlements; sourceTree = "<group>"; };
|
||||
9305FC57D289E57F96162DD2 /* libPods-Status-StatusIm-StatusImTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Status-StatusIm-StatusImTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
93347A9564A62A24509EFA9C /* Pods-Status-StatusIm-StatusImTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm-StatusImTests.release.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm-StatusImTests/Pods-Status-StatusIm-StatusImTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
9C76AF5A418D4D65A4CAD1D9 /* InterStatus-Regular.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "InterStatus-Regular.otf"; path = "../resources/fonts/InterStatus-Regular.otf"; sourceTree = "<group>"; };
|
||||
9EC0135C1E06FB1900155B5C /* RCTWKWebView.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWKWebView.xcodeproj; path = "../node_modules/react-native-wkwebview-reborn/ios/RCTWKWebView.xcodeproj"; sourceTree = "<group>"; };
|
||||
A18E846035BD6544591E45B9 /* Pods-Status-StatusImPR.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusImPR.release.xcconfig"; path = "Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR.release.xcconfig"; sourceTree = "<group>"; };
|
||||
A4F2BBE8D4DD4140A6CCAC39 /* Inter-SemiBoldItalic.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-SemiBoldItalic.otf"; path = "../resources/fonts/Inter-SemiBoldItalic.otf"; sourceTree = "<group>"; };
|
||||
ACFD5EEA905CF67FD6F8C2CC /* Pods-Status-StatusIm-StatusImTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm-StatusImTests.release.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm-StatusImTests/Pods-Status-StatusIm-StatusImTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
AA6DC18226EB1EFB2A8FE64D /* Pods-Status-StatusIm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm.debug.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
B07176ACDAA1422E8F0A3D6B /* Inter-Italic.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-Italic.otf"; path = "../resources/fonts/Inter-Italic.otf"; sourceTree = "<group>"; };
|
||||
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; };
|
||||
@@ -150,10 +148,12 @@
|
||||
C14C5F8C29C0A149005C58A7 /* launch-icon@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "launch-icon@3x.png"; path = "StatusIm/launch-icon@3x.png"; sourceTree = "<group>"; };
|
||||
C14C5F9029C0AD9C005C58A7 /* launch-icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "launch-icon@2x.png"; path = "StatusIm/launch-icon@2x.png"; sourceTree = "<group>"; };
|
||||
C14C5F9229C0ADB5005C58A7 /* launch-icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "launch-icon.png"; path = "StatusIm/launch-icon.png"; sourceTree = "<group>"; };
|
||||
C618F2C2EF820C722B1E7624 /* Pods-Status-StatusImPR.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusImPR.debug.xcconfig"; path = "Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
C6B1215047604CD59A4C74D6 /* Inter-MediumItalic.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-MediumItalic.otf"; path = "../resources/fonts/Inter-MediumItalic.otf"; sourceTree = "<group>"; };
|
||||
CD4A2C27D6D5473184DC1F7E /* Inter-Bold.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Inter-Bold.otf"; path = "../resources/fonts/Inter-Bold.otf"; sourceTree = "<group>"; };
|
||||
CE4E31B21D8695250033ED64 /* Statusgo.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Statusgo.xcframework; path = "../modules/react-native-status/ios/RCTStatus/Statusgo.xcframework"; sourceTree = "<group>"; };
|
||||
D0D6FCD821497D4A6D28C82E /* Pods-Status-StatusImPR.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusImPR.debug.xcconfig"; path = "Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
D3EFEEB5FC1235562D5D3BF1 /* libPods-Status-StatusIm-StatusImTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Status-StatusIm-StatusImTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DAE7378308FEB005CE0A6E42 /* Pods-Status-StatusIm-StatusImTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Status-StatusIm-StatusImTests.debug.xcconfig"; path = "Target Support Files/Pods-Status-StatusIm-StatusImTests/Pods-Status-StatusIm-StatusImTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -161,7 +161,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E6794203DEE6BE3C85F205F8 /* libPods-Status-StatusIm-StatusImTests.a in Frameworks */,
|
||||
D156FF2CCF43C136F7BF8AE5 /* libPods-Status-StatusIm-StatusImTests.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -174,7 +174,7 @@
|
||||
CE4E31B31D8695250033ED64 /* Statusgo.xcframework in Frameworks */,
|
||||
25DC9C9DC25846BD8D084888 /* libc++.tbd in Frameworks */,
|
||||
BA68A2377A20496EA737000D /* libz.tbd in Frameworks */,
|
||||
8BE7C1BD90A0AB68254988BD /* libPods-Status-StatusIm.a in Frameworks */,
|
||||
81F3191BB1D4BDF3442402BD /* libPods-Status-StatusIm.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -188,7 +188,7 @@
|
||||
3AAD2AC224A3A60E0075D594 /* Statusgo.xcframework in Frameworks */,
|
||||
3AAD2AC524A3A60E0075D594 /* libc++.tbd in Frameworks */,
|
||||
3AAD2AC624A3A60E0075D594 /* libz.tbd in Frameworks */,
|
||||
9930D2C5DF7BE851C6CE54A1 /* libPods-Status-StatusImPR.a in Frameworks */,
|
||||
04515E9DF839CBF55C690E79 /* libPods-Status-StatusImPR.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -314,9 +314,9 @@
|
||||
CE4E31B21D8695250033ED64 /* Statusgo.xcframework */,
|
||||
8B9A886A2CB448B1ABA0EB62 /* libc++.tbd */,
|
||||
4E586E1B0E544F64AA9F5BD1 /* libz.tbd */,
|
||||
28A248DF828DD5505CABC707 /* libPods-Status-StatusIm.a */,
|
||||
9305FC57D289E57F96162DD2 /* libPods-Status-StatusIm-StatusImTests.a */,
|
||||
5B792BBAE71EAA1C3F2C9C47 /* libPods-Status-StatusImPR.a */,
|
||||
0F8E9088BDE117AB71366407 /* libPods-Status-StatusIm.a */,
|
||||
D3EFEEB5FC1235562D5D3BF1 /* libPods-Status-StatusIm-StatusImTests.a */,
|
||||
5006FF03675A7E50320B4002 /* libPods-Status-StatusImPR.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@@ -324,12 +324,12 @@
|
||||
D0D5C8D06825D33BA2D2121E /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1130DCD9CBDCA3CA461F55B4 /* Pods-Status-StatusIm.debug.xcconfig */,
|
||||
668C1A2ADF1899973DAA1AB7 /* Pods-Status-StatusIm.release.xcconfig */,
|
||||
59C9C002A09CA7F40E69C6CB /* Pods-Status-StatusIm-StatusImTests.debug.xcconfig */,
|
||||
ACFD5EEA905CF67FD6F8C2CC /* Pods-Status-StatusIm-StatusImTests.release.xcconfig */,
|
||||
D0D6FCD821497D4A6D28C82E /* Pods-Status-StatusImPR.debug.xcconfig */,
|
||||
A18E846035BD6544591E45B9 /* Pods-Status-StatusImPR.release.xcconfig */,
|
||||
AA6DC18226EB1EFB2A8FE64D /* Pods-Status-StatusIm.debug.xcconfig */,
|
||||
1CDF317A2E103217DF386083 /* Pods-Status-StatusIm.release.xcconfig */,
|
||||
DAE7378308FEB005CE0A6E42 /* Pods-Status-StatusIm-StatusImTests.debug.xcconfig */,
|
||||
93347A9564A62A24509EFA9C /* Pods-Status-StatusIm-StatusImTests.release.xcconfig */,
|
||||
C618F2C2EF820C722B1E7624 /* Pods-Status-StatusImPR.debug.xcconfig */,
|
||||
06AF19FA626AFFC91E66916B /* Pods-Status-StatusImPR.release.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
@@ -341,11 +341,11 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "StatusImTests" */;
|
||||
buildPhases = (
|
||||
CA339D1D94763C013F2794AD /* [CP] Check Pods Manifest.lock */,
|
||||
A461E3110C485D2A21EB942C /* [CP] Check Pods Manifest.lock */,
|
||||
00E356EA1AD99517003FC87E /* Sources */,
|
||||
00E356EB1AD99517003FC87E /* Frameworks */,
|
||||
00E356EC1AD99517003FC87E /* Resources */,
|
||||
D737FA0B0E9D346092C626FB /* [CP] Copy Pods Resources */,
|
||||
2B2389E62F0A9702C522FD40 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -361,14 +361,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "StatusIm" */;
|
||||
buildPhases = (
|
||||
523CD6BCB20FD78FBF3564AD /* [CP] Check Pods Manifest.lock */,
|
||||
C5DA0344FCE555AD1908FBCD /* [CP] Check Pods Manifest.lock */,
|
||||
13B07F871A680F5B00A75B9A /* Sources */,
|
||||
13B07F8C1A680F5B00A75B9A /* Frameworks */,
|
||||
13B07F8E1A680F5B00A75B9A /* Resources */,
|
||||
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
|
||||
20B6B6891D92C42700CC5C6A /* Embed Frameworks */,
|
||||
E3914A731DF919ED00EBB515 /* Run Script */,
|
||||
28606042DA81A750949525E4 /* [CP] Copy Pods Resources */,
|
||||
EC618D80223E4CE064CFF898 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -383,14 +383,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3AAD2AD924A3A60E0075D594 /* Build configuration list for PBXNativeTarget "StatusImPR" */;
|
||||
buildPhases = (
|
||||
BDAFF7E8D7D1C97E92C1F9B0 /* [CP] Check Pods Manifest.lock */,
|
||||
0196982A5A6EB89DC2106F9B /* [CP] Check Pods Manifest.lock */,
|
||||
3AAD2ABB24A3A60E0075D594 /* Sources */,
|
||||
3AAD2ABF24A3A60E0075D594 /* Frameworks */,
|
||||
3AAD2AC924A3A60E0075D594 /* Resources */,
|
||||
3AAD2AD524A3A60E0075D594 /* Bundle React Native code and images */,
|
||||
3AAD2AD624A3A60E0075D594 /* Embed Frameworks */,
|
||||
3AAD2AD724A3A60E0075D594 /* Run Script */,
|
||||
BB1D92AA7446228787D6925C /* [CP] Copy Pods Resources */,
|
||||
4DBAAF9A3117797361E216BA /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -542,103 +542,9 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = "/usr/bin/env sh";
|
||||
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ../logs/react-native-xcode.log 2>&1";
|
||||
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ./logs/react-native-xcode.log 2>&1";
|
||||
};
|
||||
28606042DA81A750949525E4 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm-resources.sh",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3AAD2AD524A3A60E0075D594 /* Bundle React Native code and images */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Bundle React Native code and images";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = "/usr/bin/env sh";
|
||||
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ../logs/react-native-xcode.log 2>&1";
|
||||
};
|
||||
3AAD2AD724A3A60E0075D594 /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 8;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
shellPath = "/usr/bin/env sh";
|
||||
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ../logs/set_xcode_version.log 2>&1";
|
||||
};
|
||||
523CD6BCB20FD78FBF3564AD /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Status-StatusIm-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
BB1D92AA7446228787D6925C /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR-resources.sh",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
BDAFF7E8D7D1C97E92C1F9B0 /* [CP] Check Pods Manifest.lock */ = {
|
||||
0196982A5A6EB89DC2106F9B /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -660,29 +566,7 @@
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
CA339D1D94763C013F2794AD /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Status-StatusIm-StatusImTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
D737FA0B0E9D346092C626FB /* [CP] Copy Pods Resources */ = {
|
||||
2B2389E62F0A9702C522FD40 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -704,6 +588,100 @@
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Status-StatusIm-StatusImTests/Pods-Status-StatusIm-StatusImTests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3AAD2AD524A3A60E0075D594 /* Bundle React Native code and images */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Bundle React Native code and images";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = "/usr/bin/env sh";
|
||||
shellScript = "set -o errexit\nexport NODE_BINARY=\"${NODE_BINARY:-node}\"\nexport NODE_ARGS=\"${NODE_ARGS:- --max-old-space-size=16384 }\"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh > ./logs/react-native-xcode.log 2>&1";
|
||||
};
|
||||
3AAD2AD724A3A60E0075D594 /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 8;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
shellPath = "/usr/bin/env sh";
|
||||
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ./logs/set_xcode_version.log 2>&1";
|
||||
};
|
||||
4DBAAF9A3117797361E216BA /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR-resources.sh",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Status-StatusImPR/Pods-Status-StatusImPR-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
A461E3110C485D2A21EB942C /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Status-StatusIm-StatusImTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
C5DA0344FCE555AD1908FBCD /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Status-StatusIm-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
E3914A731DF919ED00EBB515 /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 8;
|
||||
@@ -716,7 +694,29 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
shellPath = "/usr/bin/env sh";
|
||||
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ../logs/set_xcode_version.log 2>&1";
|
||||
shellScript = "\"${PROJECT_DIR}/scripts/set_xcode_version.sh\" > ./logs/set_xcode_version.log 2>&1";
|
||||
};
|
||||
EC618D80223E4CE064CFF898 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm-resources.sh",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker/QBImagePicker.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
|
||||
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QBImagePicker.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
|
||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TOCropViewControllerBundle.bundle",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Status-StatusIm/Pods-Status-StatusIm-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
@@ -765,7 +765,7 @@
|
||||
/* Begin XCBuildConfiguration section */
|
||||
00E356F61AD99517003FC87E /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 59C9C002A09CA7F40E69C6CB /* Pods-Status-StatusIm-StatusImTests.debug.xcconfig */;
|
||||
baseConfigurationReference = DAE7378308FEB005CE0A6E42 /* Pods-Status-StatusIm-StatusImTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
BUNDLE_ID_SUFFIX = .debug;
|
||||
@@ -802,7 +802,7 @@
|
||||
};
|
||||
00E356F71AD99517003FC87E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = ACFD5EEA905CF67FD6F8C2CC /* Pods-Status-StatusIm-StatusImTests.release.xcconfig */;
|
||||
baseConfigurationReference = 93347A9564A62A24509EFA9C /* Pods-Status-StatusIm-StatusImTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
BUNDLE_ID_SUFFIX = "";
|
||||
@@ -835,7 +835,7 @@
|
||||
};
|
||||
13B07F941A680F5B00A75B9A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 1130DCD9CBDCA3CA461F55B4 /* Pods-Status-StatusIm.debug.xcconfig */;
|
||||
baseConfigurationReference = AA6DC18226EB1EFB2A8FE64D /* Pods-Status-StatusIm.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon$(BUNDLE_ID_SUFFIX)";
|
||||
BUNDLE_ID_SUFFIX = .debug;
|
||||
@@ -915,7 +915,7 @@
|
||||
};
|
||||
13B07F951A680F5B00A75B9A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 668C1A2ADF1899973DAA1AB7 /* Pods-Status-StatusIm.release.xcconfig */;
|
||||
baseConfigurationReference = 1CDF317A2E103217DF386083 /* Pods-Status-StatusIm.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon$(BUNDLE_ID_SUFFIX)";
|
||||
BUNDLE_ID_SUFFIX = "";
|
||||
@@ -988,7 +988,7 @@
|
||||
};
|
||||
3AAD2ADA24A3A60E0075D594 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D0D6FCD821497D4A6D28C82E /* Pods-Status-StatusImPR.debug.xcconfig */;
|
||||
baseConfigurationReference = C618F2C2EF820C722B1E7624 /* Pods-Status-StatusImPR.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon$(BUNDLE_ID_SUFFIX)";
|
||||
BUNDLE_ID_SUFFIX = .debug;
|
||||
@@ -1065,7 +1065,7 @@
|
||||
};
|
||||
3AAD2ADB24A3A60E0075D594 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = A18E846035BD6544591E45B9 /* Pods-Status-StatusImPR.release.xcconfig */;
|
||||
baseConfigurationReference = 06AF19FA626AFFC91E66916B /* Pods-Status-StatusImPR.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIconPR$(BUNDLE_ID_SUFFIX)";
|
||||
BUNDLE_ID_SUFFIX = "";
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <RCTAppDelegate.h>
|
||||
#import <React/RCTBridgeDelegate.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <UserNotifications/UNUserNotificationCenter.h>
|
||||
|
||||
@interface AppDelegate : RCTAppDelegate <UIApplicationDelegate, UNUserNotificationCenterDelegate>
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIWindow *window;
|
||||
|
||||
@end
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#import "RNSplashScreen.h"
|
||||
#import "RCTLinkingManager.h"
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTHTTPRequestHandler.h>
|
||||
|
||||
@@ -27,8 +28,30 @@
|
||||
#import <SDWebImage/SDWebImageDownloaderOperation.h>
|
||||
|
||||
#import <Security/Security.h>
|
||||
// adding this for v0.68.x
|
||||
#import <React/RCTAppSetupUtils.h>
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#import <React/CoreModulesPlugins.h>
|
||||
#import <React/RCTCxxBridgeDelegate.h>
|
||||
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
||||
#import <React/RCTSurfacePresenter.h>
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
#import <ReactCommon/RCTTurboModuleManager.h>
|
||||
#import <react/config/ReactNativeConfig.h>
|
||||
|
||||
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
|
||||
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
|
||||
RCTTurboModuleManager *_turboModuleManager;
|
||||
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
|
||||
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
||||
facebook::react::ContextContainer::Shared _contextContainer;
|
||||
}
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//TODO: properly import the framework
|
||||
extern "C" NSString* StatusgoImageServerTLSCert();
|
||||
|
||||
@@ -43,12 +66,18 @@ extern "C" NSString* StatusgoImageServerTLSCert();
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
RCTAppSetupPrepareApp(application);
|
||||
|
||||
if (!self.bridge) {
|
||||
self.bridge = [self createBridgeWithDelegate:self launchOptions:launchOptions];
|
||||
}
|
||||
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
||||
[ReactNativeNavigation bootstrapWithBridge:bridge];
|
||||
|
||||
[ReactNativeNavigation bootstrapWithBridge:self.bridge];
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
|
||||
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
|
||||
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
|
||||
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
|
||||
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
|
||||
#endif
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
NSURL *jsCodeLocation;
|
||||
@@ -103,6 +132,25 @@ extern "C" NSString* StatusgoImageServerTLSCert();
|
||||
}
|
||||
|
||||
|
||||
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
|
||||
///
|
||||
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
|
||||
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
|
||||
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
|
||||
- (BOOL)concurrentRootEnabled
|
||||
{
|
||||
// Switch this bool to turn on and off the concurrent root
|
||||
return true;
|
||||
}
|
||||
- (NSDictionary *)prepareInitialProps
|
||||
{
|
||||
NSMutableDictionary *initProps = [NSMutableDictionary new];
|
||||
#ifdef RCT_NEW_ARCH_ENABLED
|
||||
initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
|
||||
#endif
|
||||
return initProps;
|
||||
}
|
||||
|
||||
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
||||
{
|
||||
#if DEBUG
|
||||
@@ -112,6 +160,37 @@ extern "C" NSString* StatusgoImageServerTLSCert();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if RCT_NEW_ARCH_ENABLED
|
||||
#pragma mark - RCTCxxBridgeDelegate
|
||||
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
||||
{
|
||||
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
||||
delegate:self
|
||||
jsInvoker:bridge.jsCallInvoker];
|
||||
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
||||
}
|
||||
#pragma mark RCTTurboModuleManagerDelegate
|
||||
- (Class)getModuleClassFromName:(const char *)name
|
||||
{
|
||||
return RCTCoreModulesClassProvider(name);
|
||||
}
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
initParams:
|
||||
(const facebook::react::ObjCTurboModule::InitParams &)params
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
||||
{
|
||||
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"BLANK_PREVIEW"]) {
|
||||
[self.window addSubview:_blankView];
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<true/>
|
||||
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
|
||||
<array>
|
||||
<string>A00000080400010101</string>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Description
|
||||
|
||||
This directory is the destination of logs created by Fastlane and React Native Xcode script.
|
||||
|
||||
# Logs
|
||||
|
||||
* `react-native-xcode.log` - Output from `node_modules/react-native/scripts/react-native-xcode.sh`.
|
||||
- Created by redirecting output of `shellScript` in `ios/StatusIm.xcodeproj/project.pbxproj`.
|
||||
* `Status PR-StatusImPR.log - Created by [Fastlane Gym](https://docs.fastlane.tools/actions/gym/).
|
||||
- Configred via [`Fastfile`](../Fastfile) using `buildlog_path` argument for `build_ios_app`.
|
||||
|
||||
# CI
|
||||
|
||||
These log files are uploaded to Jenkins as CI job artifacts on failure using `archiveArtifacts`.
|
||||
@@ -1,27 +0,0 @@
|
||||
# Description
|
||||
|
||||
This directory is the destination of logs created during build time of debug builds and logs created by Fastlane on CI.
|
||||
|
||||
# Logs
|
||||
|
||||
* `xcrun_device_install.log` - Output from `status-mobile/scripts/run-ios-device.sh`.
|
||||
- Created by redirecting output of `xcrun simctl install "$UDID" "$APP_PATH"`.
|
||||
* `xcrun_device_process_launch.log` - Output from `status-mobile/scripts/run-ios-device.sh`.
|
||||
- Created by specifying `--json-output` flag for `xcrun devicectl device process launch --no-activate --verbose --device "${DEVICE_UUID}" "${INSTALLATION_URL}"`.
|
||||
* `xcrun_device_process_resume.log` - Output from `status-mobile/scripts/run-ios-device.sh`.
|
||||
- Created by redirecting output of `xcrun devicectl device process resume --device "${DEVICE_UUID}" --pid "${STATUS_PID}"`.
|
||||
* `adb_install.log` - Output from `scripts/run-android.sh`.
|
||||
- Created by redirecting output of `adb install -r ./result/app-debug.apk`.
|
||||
* `adb_shell_monkey.log` - Output from `status-mobile/scripts/run-android.sh`.
|
||||
- Created by redirecting output of `adb shell monkey -p im.status.ethereum.debug 1 >`.
|
||||
* `ios_simulators_list.log` - Output from `status-mobile/scripts/run-ios.sh`.
|
||||
- Created by redirecting output of `xcrun simctl list devices -j`.
|
||||
|
||||
# CI
|
||||
|
||||
These log files are uploaded to Jenkins as CI job artifacts on failure using `archiveArtifacts`.
|
||||
|
||||
* `react-native-xcode.log` - Output from `node_modules/react-native/scripts/react-native-xcode.sh`.
|
||||
- Created by redirecting output of `shellScript` in `ios/StatusIm.xcodeproj/project.pbxproj`.
|
||||
* `Status PR-StatusImPR.log - Created by [Fastlane Gym](https://docs.fastlane.tools/actions/gym/).
|
||||
- Configred via [`Fastfile`](../Fastfile) using `buildlog_path` argument for `build_ios_app`.
|
||||
@@ -1,11 +0,0 @@
|
||||
appId: im.status.ethereum.debug
|
||||
---
|
||||
- runFlow: # to run onboarding flow only when device is in onboarding state
|
||||
when:
|
||||
visible: "I’m new to Status"
|
||||
file: onboarding.yaml
|
||||
|
||||
- runFlow: # to run login flow only when device is on login screen
|
||||
when:
|
||||
visible: "Profile password"
|
||||
file: login.yaml
|
||||
@@ -1,5 +0,0 @@
|
||||
appId: im.status.ethereum.debug
|
||||
---
|
||||
- tapOn: "password-input"
|
||||
- inputText: "password123" # update your account password here
|
||||
- tapOn: login-button
|
||||
@@ -1,15 +0,0 @@
|
||||
appId: im.status.ethereum.debug
|
||||
---
|
||||
- tapOn: "I’m new to Status"
|
||||
- tapOn: "small-option-card"
|
||||
- tapOn: "Your name"
|
||||
- inputText: "DeviceA"
|
||||
- tapOn: "submit-create-profile-button"
|
||||
- inputText: "password123"
|
||||
- tapOn: "Repeat password"
|
||||
- inputText: "password123"
|
||||
- tapOn: "disclaimer-touchable-opacity"
|
||||
- tapOn: "Confirm password"
|
||||
- tapOn: "skip-identifiers"
|
||||
- tapOn: "enable-notifications-later-button"
|
||||
- tapOn: "welcome-button"
|
||||
+4
-9
@@ -1,11 +1,10 @@
|
||||
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
|
||||
/**
|
||||
* Metro configuration
|
||||
* https://facebook.github.io/metro/docs/configuration
|
||||
* Metro configuration for React Native
|
||||
* https://github.com/facebook/react-native
|
||||
*
|
||||
* @type {import('metro-config').MetroConfig}
|
||||
* @format
|
||||
*/
|
||||
const config = {
|
||||
module.exports = {
|
||||
transformer: {
|
||||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
@@ -15,10 +14,6 @@ const config = {
|
||||
}),
|
||||
},
|
||||
resolver: {
|
||||
resolverMainFields: ['react-native', 'browser', 'main'],
|
||||
nodeModulesPaths: ['./node_modules'],
|
||||
extraNodeModules: require('node-libs-react-native'),
|
||||
unstable_enableSymlinks: true,
|
||||
},
|
||||
};
|
||||
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: "org.jetbrains.kotlin.android"
|
||||
|
||||
def getStatusGoSHA1 = { ->
|
||||
def statusgoOverridePath = System.getenv("STATUS_GO_SRC_OVERRIDE")
|
||||
|
||||
-355
@@ -1,355 +0,0 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import statusgo.Statusgo;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
import android.util.Log;
|
||||
import android.content.Context;
|
||||
import android.app.Activity;
|
||||
|
||||
public class AccountManager extends ReactContextBaseJavaModule {
|
||||
private static final String TAG = "AccountManager";
|
||||
private static final String gethLogFileName = "geth.log";
|
||||
private ReactApplicationContext reactContext;
|
||||
|
||||
private Utils utils;
|
||||
private LogManager logManager;
|
||||
|
||||
public AccountManager(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.reactContext = reactContext;
|
||||
this.utils = new Utils(reactContext);
|
||||
this.logManager = new LogManager(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AccountManager";
|
||||
}
|
||||
|
||||
private String getTestnetDataDir(final String absRootDirPath) {
|
||||
return this.utils.pathCombine(absRootDirPath, "ethereum/testnet");
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void createAccountAndLogin(final String createAccountRequest) {
|
||||
Log.d(TAG, "createAccountAndLogin");
|
||||
String result = Statusgo.createAccountAndLogin(createAccountRequest);
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "createAccountAndLogin success: " + result);
|
||||
Log.d(TAG, "Geth node started");
|
||||
} else {
|
||||
Log.e(TAG, "createAccountAndLogin failed: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void restoreAccountAndLogin(final String restoreAccountRequest) {
|
||||
Log.d(TAG, "restoreAccountAndLogin");
|
||||
String result = Statusgo.restoreAccountAndLogin(restoreAccountRequest);
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "restoreAccountAndLogin success: " + result);
|
||||
Log.d(TAG, "Geth node started");
|
||||
} else {
|
||||
Log.e(TAG, "restoreAccountAndLogin failed: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
private String updateConfig(final String jsonConfigString, final String absRootDirPath, final String keystoreDirPath) throws JSONException {
|
||||
final JSONObject jsonConfig = new JSONObject(jsonConfigString);
|
||||
// retrieve parameters from app config, that will be applied onto the Go-side config later on
|
||||
final String dataDirPath = jsonConfig.getString("DataDir");
|
||||
final Boolean logEnabled = jsonConfig.getBoolean("LogEnabled");
|
||||
final Context context = this.getReactApplicationContext();
|
||||
final File gethLogFile = logEnabled ? this.logManager.prepareLogsFile(context) : null;
|
||||
String gethLogDirPath = null;
|
||||
if (gethLogFile != null) {
|
||||
gethLogDirPath = gethLogFile.getParent();
|
||||
}
|
||||
|
||||
Log.d(TAG, "log dir: " + gethLogDirPath + " log name: " + gethLogFileName);
|
||||
|
||||
jsonConfig.put("DataDir", dataDirPath);
|
||||
jsonConfig.put("KeyStoreDir", keystoreDirPath);
|
||||
jsonConfig.put("LogDir", gethLogDirPath);
|
||||
jsonConfig.put("LogFile", gethLogFileName);
|
||||
|
||||
return jsonConfig.toString();
|
||||
}
|
||||
|
||||
private static void prettyPrintConfig(final String config) {
|
||||
Log.d(TAG, "startNode() with config (see below)");
|
||||
String configOutput = config;
|
||||
final int maxOutputLen = 4000;
|
||||
Log.d(TAG, "********************** NODE CONFIG ****************************");
|
||||
while (!configOutput.isEmpty()) {
|
||||
Log.d(TAG, "Node config:" + configOutput.substring(0, Math.min(maxOutputLen, configOutput.length())));
|
||||
if (configOutput.length() > maxOutputLen) {
|
||||
configOutput = configOutput.substring(maxOutputLen);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "******************* ENDOF NODE CONFIG *************************");
|
||||
}
|
||||
|
||||
private void copyDirectory(File sourceLocation, File targetLocation) throws IOException {
|
||||
if (sourceLocation.isDirectory()) {
|
||||
if (!targetLocation.exists() && !targetLocation.mkdirs()) {
|
||||
throw new IOException("Cannot create dir " + targetLocation.getAbsolutePath());
|
||||
}
|
||||
|
||||
String[] children = sourceLocation.list();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
copyDirectory(new File(sourceLocation, children[i]), new File(targetLocation, children[i]));
|
||||
}
|
||||
} else {
|
||||
File directory = targetLocation.getParentFile();
|
||||
if (directory != null && !directory.exists() && !directory.mkdirs()) {
|
||||
throw new IOException("Cannot create dir " + directory.getAbsolutePath());
|
||||
}
|
||||
|
||||
InputStream in = new FileInputStream(sourceLocation);
|
||||
OutputStream out = new FileOutputStream(targetLocation);
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
private String prepareDirAndUpdateConfig(final String jsonConfigString, final String keyUID) {
|
||||
|
||||
final String absRootDirPath = this.utils.getNoBackupDirectory();
|
||||
final String dataFolder = this.getTestnetDataDir(absRootDirPath);
|
||||
Log.d(TAG, "Starting Geth node in folder: " + dataFolder);
|
||||
|
||||
try {
|
||||
final File newFile = new File(dataFolder);
|
||||
// todo handle error?
|
||||
newFile.mkdir();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "error making folder: " + dataFolder, e);
|
||||
}
|
||||
|
||||
final String ropstenFlagPath = this.utils.pathCombine(absRootDirPath, "ropsten_flag");
|
||||
final File ropstenFlag = new File(ropstenFlagPath);
|
||||
if (!ropstenFlag.exists()) {
|
||||
try {
|
||||
final String chaindDataFolderPath = this.utils.pathCombine(dataFolder, "StatusIM/lightchaindata");
|
||||
final File lightChainFolder = new File(chaindDataFolderPath);
|
||||
if (lightChainFolder.isDirectory()) {
|
||||
String[] children = lightChainFolder.list();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
new File(lightChainFolder, children[i]).delete();
|
||||
}
|
||||
}
|
||||
lightChainFolder.delete();
|
||||
ropstenFlag.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
String testnetDataDir = dataFolder;
|
||||
String oldKeystoreDir = this.utils.pathCombine(testnetDataDir, "keystore");
|
||||
String newKeystoreDir = this.utils.pathCombine(absRootDirPath, "keystore");
|
||||
final File oldKeystore = new File(oldKeystoreDir);
|
||||
if (oldKeystore.exists()) {
|
||||
try {
|
||||
final File newKeystore = new File(newKeystoreDir);
|
||||
copyDirectory(oldKeystore, newKeystore);
|
||||
|
||||
if (oldKeystore.isDirectory()) {
|
||||
String[] children = oldKeystore.list();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
new File(oldKeystoreDir, children[i]).delete();
|
||||
}
|
||||
}
|
||||
oldKeystore.delete();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
final String multiaccountKeystoreDir = this.utils.pathCombine("/keystore", keyUID);
|
||||
final String updatedJsonConfigString = this.updateConfig(jsonConfigString, absRootDirPath, multiaccountKeystoreDir);
|
||||
|
||||
prettyPrintConfig(updatedJsonConfigString);
|
||||
|
||||
return updatedJsonConfigString;
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "updateConfig failed: " + e.getMessage());
|
||||
System.exit(1);
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void prepareDirAndUpdateConfig(final String keyUID, final String config, final Callback callback) {
|
||||
Log.d(TAG, "prepareDirAndUpdateConfig");
|
||||
String finalConfig = prepareDirAndUpdateConfig(config, keyUID);
|
||||
callback.invoke(finalConfig);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void saveAccountAndLoginWithKeycard(final String multiaccountData, final String password, final String settings, final String config, final String accountsData, final String chatKey) {
|
||||
try {
|
||||
Log.d(TAG, "saveAccountAndLoginWithKeycard");
|
||||
String finalConfig = prepareDirAndUpdateConfig(config, this.utils.getKeyUID(multiaccountData));
|
||||
String result = Statusgo.saveAccountAndLoginWithKeycard(multiaccountData, password, settings, finalConfig, accountsData, chatKey);
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "saveAccountAndLoginWithKeycard result: " + result);
|
||||
Log.d(TAG, "Geth node started");
|
||||
} else {
|
||||
Log.e(TAG, "saveAccountAndLoginWithKeycard failed: " + result);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "JSON conversion failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void loginWithKeycard(final String accountData, final String password, final String chatKey, final String nodeConfigJSON) {
|
||||
Log.d(TAG, "loginWithKeycard");
|
||||
this.utils.migrateKeyStoreDir(accountData, password);
|
||||
String result = Statusgo.loginWithKeycard(accountData, password, chatKey, nodeConfigJSON);
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "LoginWithKeycard result: " + result);
|
||||
} else {
|
||||
Log.e(TAG, "LoginWithKeycard failed: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void loginWithConfig(final String accountData, final String password, final String configJSON) {
|
||||
Log.d(TAG, "loginWithConfig");
|
||||
this.utils.migrateKeyStoreDir(accountData, password);
|
||||
String result = Statusgo.loginWithConfig(accountData, password, configJSON);
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "LoginWithConfig result: " + result);
|
||||
} else {
|
||||
Log.e(TAG, "LoginWithConfig failed: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void loginAccount(final String request) {
|
||||
Log.d(TAG, "loginAccount");
|
||||
String result = Statusgo.loginAccount(request);
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "loginAccount result: " + result);
|
||||
} else {
|
||||
Log.e(TAG, "loginAccount failed: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void verify(final String address, final String password, final Callback callback) throws JSONException {
|
||||
Activity currentActivity = getCurrentActivity();
|
||||
|
||||
final String absRootDirPath = this.utils.getNoBackupDirectory();
|
||||
final String newKeystoreDir = this.utils.pathCombine(absRootDirPath, "keystore");
|
||||
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.verifyAccountPassword(newKeystoreDir, address, password), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void verifyDatabasePassword(final String keyUID, final String password, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.verifyDatabasePassword(keyUID, password), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
private void openAccounts(final Callback callback) throws JSONException {
|
||||
Log.d(TAG, "openAccounts");
|
||||
final String rootDir = this.utils.getNoBackupDirectory();
|
||||
Log.d(TAG, "[Opening accounts" + rootDir);
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.openAccounts(rootDir), callback);
|
||||
}
|
||||
|
||||
//TODO : refactor logout usage to accept callback so that we can do this.utils.executeRunnableStatusGoMethod
|
||||
@ReactMethod
|
||||
public void logout() {
|
||||
Log.d(TAG, "logout");
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String result = Statusgo.logout();
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "Logout result: " + result);
|
||||
} else {
|
||||
Log.e(TAG, "Logout failed: " + result);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(r);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountStoreAccount(final String json, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiAccountStoreAccount(json), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountLoadAccount(final String json, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiAccountLoadAccount(json), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountDeriveAddresses(final String json, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiAccountDeriveAddresses(json), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountGenerateAndDeriveAddresses(final String json, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiAccountGenerateAndDeriveAddresses(json), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountStoreDerived(final String json, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiAccountStoreDerivedAccounts(json), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountImportMnemonic(final String json, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiAccountImportMnemonic(json), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiAccountImportPrivateKey(final String json, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiAccountImportPrivateKey(json), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void deleteMultiaccount(final String keyUID, final Callback callback) throws JSONException {
|
||||
final String keyStoreDir = this.utils.getKeyStorePath(keyUID);
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.deleteMultiaccount(keyUID, keyStoreDir), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getRandomMnemonic(final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.getRandomMnemonic(), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void createAccountFromMnemonicAndDeriveAccountsForPaths(final String mnemonic, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.createAccountFromMnemonicAndDeriveAccountsForPaths(mnemonic), callback);
|
||||
}
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import statusgo.Statusgo;
|
||||
import android.util.Log;
|
||||
import java.io.File;
|
||||
import android.os.Environment;
|
||||
import android.content.Context;
|
||||
public class DatabaseManager extends ReactContextBaseJavaModule {
|
||||
private static final String TAG = "DatabaseManager";
|
||||
private ReactApplicationContext reactContext;
|
||||
private static final String exportDBFileName = "export.db";
|
||||
private Utils utils;
|
||||
public DatabaseManager(ReactApplicationContext reactContext) {
|
||||
this.reactContext = reactContext;
|
||||
this.utils = new Utils(reactContext);
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return "DatabaseManager";
|
||||
}
|
||||
|
||||
private File getExportDBFile() {
|
||||
final Context context = this.getReactApplicationContext();
|
||||
// Environment.getExternalStoragePublicDirectory doesn't work as expected on Android Q
|
||||
// https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String)
|
||||
final File pubDirectory = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
|
||||
final File filename = new File(pubDirectory, exportDBFileName);
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void exportUnencryptedDatabase(final String accountData, final String password, final Callback callback) {
|
||||
Log.d(TAG, "login");
|
||||
|
||||
final File newFile = getExportDBFile();
|
||||
|
||||
this.utils.migrateKeyStoreDir(accountData, password);
|
||||
String result = Statusgo.exportUnencryptedDatabase(accountData, password, newFile.getAbsolutePath());
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "Login result: " + result);
|
||||
} else {
|
||||
Log.e(TAG, "Login failed: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void importUnencryptedDatabase(final String accountData, final String password) {
|
||||
Log.d(TAG, "importUnencryptedDatabase");
|
||||
|
||||
final File newFile = getExportDBFile();
|
||||
|
||||
this.utils.migrateKeyStoreDir(accountData, password);
|
||||
String result = Statusgo.importUnencryptedDatabase(accountData, password, newFile.getAbsolutePath());
|
||||
if (result.startsWith("{\"error\":\"\"")) {
|
||||
Log.d(TAG, "import result: " + result);
|
||||
} else {
|
||||
Log.e(TAG, "import failed: " + result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-173
@@ -1,173 +0,0 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import android.util.Log;
|
||||
import statusgo.Statusgo;
|
||||
import org.json.JSONException;
|
||||
import java.util.function.Function;
|
||||
import android.app.Activity;
|
||||
import android.view.WindowManager;
|
||||
import android.os.Build;
|
||||
import android.view.Window;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class EncryptionUtils extends ReactContextBaseJavaModule {
|
||||
private static final String TAG = "EncryptionUtils";
|
||||
|
||||
private ReactApplicationContext reactContext;
|
||||
private Utils utils;
|
||||
|
||||
public EncryptionUtils(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.reactContext = reactContext;
|
||||
this.utils = new Utils(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "EncryptionUtils";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
private void initKeystore(final String keyUID, final Callback callback) throws JSONException {
|
||||
Log.d(TAG, "initKeystore");
|
||||
|
||||
final String commonKeydir = this.utils.pathCombine(this.utils.getNoBackupDirectory(), "/keystore");
|
||||
final String keydir = this.utils.pathCombine(commonKeydir, keyUID);
|
||||
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.initKeystore(keydir), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void reEncryptDbAndKeystore(final String keyUID, final String password, final String newPassword, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.changeDatabasePassword(keyUID, password, newPassword), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void convertToKeycardAccount(final String keyUID, final String accountData, final String options, final String keycardUID, final String password,
|
||||
final String newPassword, final Callback callback) throws JSONException {
|
||||
final String keyStoreDir = this.utils.getKeyStorePath(keyUID);
|
||||
this.utils.executeRunnableStatusGoMethod(() -> {
|
||||
Statusgo.initKeystore(keyStoreDir);
|
||||
return Statusgo.convertToKeycardAccount(accountData, options, keycardUID, password, newPassword);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String encodeTransfer(final String to, final String value) {
|
||||
return Statusgo.encodeTransfer(to, value);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String decodeParameters(final String decodeParamJSON) {
|
||||
return Statusgo.decodeParameters(decodeParamJSON);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String hexToNumber(final String hex) {
|
||||
return Statusgo.hexToNumber(hex);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String numberToHex(final String numString) {
|
||||
return Statusgo.numberToHex(numString);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String sha3(final String str) {
|
||||
return Statusgo.sha3(str);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String utf8ToHex(final String str) {
|
||||
return Statusgo.utf8ToHex(str);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String hexToUtf8(final String str) {
|
||||
return Statusgo.hexToUtf8(str);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setBlankPreviewFlag(final Boolean blankPreview) {
|
||||
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.reactContext);
|
||||
sharedPrefs.edit().putBoolean("BLANK_PREVIEW", blankPreview).commit();
|
||||
setSecureFlag();
|
||||
}
|
||||
|
||||
private void setSecureFlag() {
|
||||
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.reactContext);
|
||||
final boolean setSecure = sharedPrefs.getBoolean("BLANK_PREVIEW", true);
|
||||
final Activity activity = this.reactContext.getCurrentActivity();
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final Window window = activity.getWindow();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && setSecure) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||
} else {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashTransaction(final String txArgsJSON, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.hashTransaction(txArgsJSON), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashMessage(final String message, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.hashMessage(message), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void multiformatDeserializePublicKey(final String multiCodecKey, final String base58btc, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.multiformatDeserializePublicKey(multiCodecKey,base58btc), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void deserializeAndCompressKey(final String desktopKey, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.deserializeAndCompressKey(desktopKey), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashTypedData(final String data, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.hashTypedData(data), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hashTypedDataV4(final String data, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.hashTypedDataV4(data), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signMessage(final String rpcParams, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.signMessage(rpcParams), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signTypedData(final String data, final String account, final String password, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.signTypedData(data, account, password), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signTypedDataV4(final String data, final String account, final String password, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.signTypedDataV4(data, account, password), callback);
|
||||
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void signGroupMembership(final String content, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.signGroupMembership(content), callback);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-227
@@ -1,227 +0,0 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import java.io.File;
|
||||
import java.util.Stack;
|
||||
import android.util.Log;
|
||||
import android.net.Uri;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.IOException;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import androidx.core.content.FileProvider;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import org.json.JSONObject;
|
||||
import statusgo.Statusgo;
|
||||
import android.content.Context;
|
||||
import org.json.JSONException;
|
||||
public class LogManager extends ReactContextBaseJavaModule {
|
||||
private static final String TAG = "LogManager";
|
||||
private static final String gethLogFileName = "geth.log";
|
||||
private static final String statusLogFileName = "Status.log";
|
||||
private static final String logsZipFileName = "Status-debug-logs.zip";
|
||||
private ReactApplicationContext reactContext;
|
||||
private Utils utils;
|
||||
|
||||
public LogManager(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.reactContext = reactContext;
|
||||
this.utils = new Utils(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "LogManager";
|
||||
}
|
||||
|
||||
private File getLogsFile() {
|
||||
final File pubDirectory = this.utils.getPublicStorageDirectory();
|
||||
final File logFile = new File(pubDirectory, gethLogFileName);
|
||||
|
||||
return logFile;
|
||||
}
|
||||
|
||||
public File prepareLogsFile(final Context context) {
|
||||
final File logFile = this.utils.getLogsFile();
|
||||
|
||||
try {
|
||||
logFile.setReadable(true);
|
||||
File parent = logFile.getParentFile();
|
||||
if (!parent.canWrite()) {
|
||||
return null;
|
||||
}
|
||||
if (!parent.exists()) {
|
||||
parent.mkdirs();
|
||||
}
|
||||
logFile.createNewFile();
|
||||
logFile.setWritable(true);
|
||||
Log.d(TAG, "Can write " + logFile.canWrite());
|
||||
Uri gethLogUri = Uri.fromFile(logFile);
|
||||
|
||||
String gethLogFilePath = logFile.getAbsolutePath();
|
||||
Log.d(TAG, gethLogFilePath);
|
||||
|
||||
return logFile;
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Can't create geth.log file! " + e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void showErrorMessage(final String message) {
|
||||
final Activity activity = getCurrentActivity();
|
||||
|
||||
new AlertDialog.Builder(activity)
|
||||
.setTitle("Error")
|
||||
.setMessage(message)
|
||||
.setNegativeButton("Exit", new DialogInterface.OnClickListener() {
|
||||
public void onClick(final DialogInterface dialog, final int id) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
private void dumpAdbLogsTo(final FileOutputStream statusLogStream) throws IOException {
|
||||
final String filter = "logcat -d -b main ReactNativeJS:D StatusModule:D StatusService:D StatusNativeLogs:D *:S";
|
||||
final java.lang.Process p = Runtime.getRuntime().exec(filter);
|
||||
final java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
|
||||
final java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.OutputStreamWriter(statusLogStream));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
out.write(line);
|
||||
out.newLine();
|
||||
}
|
||||
out.close();
|
||||
in.close();
|
||||
}
|
||||
|
||||
private Boolean zip(File[] _files, File zipFile, Stack<String> errorList) {
|
||||
final int BUFFER = 0x8000;
|
||||
|
||||
try {
|
||||
BufferedInputStream origin = null;
|
||||
FileOutputStream dest = new FileOutputStream(zipFile);
|
||||
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest));
|
||||
byte data[] = new byte[BUFFER];
|
||||
|
||||
for (int i = 0; i < _files.length; i++) {
|
||||
final File file = _files[i];
|
||||
if (file == null || !file.exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Log.v("Compress", "Adding: " + file.getAbsolutePath());
|
||||
try {
|
||||
FileInputStream fi = new FileInputStream(file);
|
||||
origin = new BufferedInputStream(fi, BUFFER);
|
||||
|
||||
ZipEntry entry = new ZipEntry(file.getName());
|
||||
out.putNextEntry(entry);
|
||||
int count;
|
||||
|
||||
while ((count = origin.read(data, 0, BUFFER)) != -1) {
|
||||
out.write(data, 0, count);
|
||||
}
|
||||
origin.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
errorList.push(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
out.close();
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void sendLogs(final String dbJson, final String jsLogs, final Callback callback) {
|
||||
Log.d(TAG, "sendLogs");
|
||||
if (!this.utils.checkAvailability()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Context context = this.getReactApplicationContext();
|
||||
final File logsTempDir = new File(context.getCacheDir(), "logs"); // This path needs to be in sync with android/app/src/main/res/xml/file_provider_paths.xml
|
||||
logsTempDir.mkdir();
|
||||
|
||||
final File dbFile = new File(logsTempDir, "db.json");
|
||||
try {
|
||||
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(dbFile));
|
||||
outputStreamWriter.write(dbJson);
|
||||
outputStreamWriter.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "File write failed: " + e.toString());
|
||||
showErrorMessage(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
final File zipFile = new File(logsTempDir, logsZipFileName);
|
||||
final File statusLogFile = new File(logsTempDir, statusLogFileName);
|
||||
final File gethLogFile = getLogsFile();
|
||||
|
||||
try {
|
||||
if (zipFile.exists() || zipFile.createNewFile()) {
|
||||
final long usableSpace = zipFile.getUsableSpace();
|
||||
if (usableSpace < 20 * 1024 * 1024) {
|
||||
final String message = String.format("Insufficient space available on device (%s) to write logs.\nPlease free up some space.", android.text.format.Formatter.formatShortFileSize(context, usableSpace));
|
||||
Log.e(TAG, message);
|
||||
showErrorMessage(message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dumpAdbLogsTo(new FileOutputStream(statusLogFile));
|
||||
|
||||
final Stack<String> errorList = new Stack<String>();
|
||||
final Boolean zipped = zip(new File[]{dbFile, gethLogFile, statusLogFile}, zipFile, errorList);
|
||||
if (zipped && zipFile.exists()) {
|
||||
zipFile.setReadable(true, false);
|
||||
Uri extUri = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", zipFile);
|
||||
callback.invoke(extUri.toString());
|
||||
} else {
|
||||
Log.d(TAG, "File " + zipFile.getAbsolutePath() + " does not exist");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
showErrorMessage(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} finally {
|
||||
dbFile.delete();
|
||||
statusLogFile.delete();
|
||||
zipFile.deleteOnExit();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void initLogging(final boolean enabled, final boolean mobileSystem, final String logLevel, final Callback callback) throws JSONException {
|
||||
final JSONObject jsonConfig = new JSONObject();
|
||||
jsonConfig.put("Enabled", enabled);
|
||||
jsonConfig.put("MobileSystem", mobileSystem);
|
||||
jsonConfig.put("Level", logLevel);
|
||||
jsonConfig.put("File", getLogsFile().getAbsolutePath());
|
||||
final String config = jsonConfig.toString();
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.initLogging(config), callback);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String logFileDirectory() {
|
||||
return this.utils.getPublicStorageDirectory().getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import org.json.JSONException;
|
||||
import statusgo.Statusgo;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class NetworkManager extends ReactContextBaseJavaModule {
|
||||
private ReactApplicationContext reactContext;
|
||||
private Utils utils;
|
||||
|
||||
public NetworkManager(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.reactContext = reactContext;
|
||||
this.utils = new Utils(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "NetworkManager";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void startSearchForLocalPairingPeers(final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.startSearchForLocalPairingPeers(), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getConnectionStringForBootstrappingAnotherDevice(final String configJSON, final Callback callback) throws JSONException {
|
||||
final JSONObject jsonConfig = new JSONObject(configJSON);
|
||||
final JSONObject senderConfig = jsonConfig.getJSONObject("senderConfig");
|
||||
final String keyUID = senderConfig.getString("keyUID");
|
||||
final String keyStorePath = this.utils.getKeyStorePath(keyUID);
|
||||
senderConfig.put("keystorePath", keyStorePath);
|
||||
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.getConnectionStringForBootstrappingAnotherDevice(jsonConfig.toString()), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void inputConnectionStringForBootstrapping(final String connectionString, final String configJSON, final Callback callback) throws JSONException {
|
||||
final JSONObject jsonConfig = new JSONObject(configJSON);
|
||||
final JSONObject receiverConfig = jsonConfig.getJSONObject("receiverConfig");
|
||||
final String keyStorePath = this.utils.pathCombine(this.utils.getNoBackupDirectory(), "/keystore");
|
||||
receiverConfig.put("keystorePath", keyStorePath);
|
||||
receiverConfig.getJSONObject("nodeConfig").put("rootDataDir", this.utils.getNoBackupDirectory());
|
||||
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.inputConnectionStringForBootstrapping(connectionString, jsonConfig.toString()), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void sendTransactionWithSignature(final String txArgsJSON, final String signature, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.sendTransactionWithSignature(txArgsJSON, signature), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void sendTransaction(final String txArgsJSON, final String password, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.sendTransaction(txArgsJSON, password), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void callRPC(final String payload, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.callRPC(payload), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void callPrivateRPC(final String payload, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.callPrivateRPC(payload), callback);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void recover(final String rpcParams, final Callback callback) throws JSONException {
|
||||
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.recover(rpcParams), callback);
|
||||
}
|
||||
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import android.view.ActionMode;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.uimanager.NativeViewHierarchyManager;
|
||||
import com.facebook.react.uimanager.UIBlock;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.views.textinput.ReactEditText;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
class RNSelectableTextInputModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private ActionMode lastActionMode;
|
||||
|
||||
public RNSelectableTextInputModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RNSelectableTextInputManager";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setupMenuItems(final Integer selectableTextViewReactTag, final Integer textInputReactTag) {
|
||||
ReactApplicationContext reactContext = this.getReactApplicationContext();
|
||||
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
|
||||
uiManager.addUIBlock(new UIBlock() {
|
||||
public void execute (NativeViewHierarchyManager nvhm) {
|
||||
RNSelectableTextInputViewManager rnSelectableTextManager = (RNSelectableTextInputViewManager) nvhm.resolveViewManager(selectableTextViewReactTag);
|
||||
ReactEditText reactTextView = (ReactEditText) nvhm.resolveView(textInputReactTag);
|
||||
rnSelectableTextManager.registerSelectionListener(reactTextView);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void startActionMode(final Integer textInputReactTag) {
|
||||
ReactApplicationContext reactContext = this.getReactApplicationContext();
|
||||
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
|
||||
uiManager.addUIBlock(new UIBlock() {
|
||||
public void execute (NativeViewHierarchyManager nvhm) {
|
||||
ReactEditText reactTextView = (ReactEditText) nvhm.resolveView(textInputReactTag);
|
||||
lastActionMode = reactTextView.startActionMode(reactTextView.getCustomSelectionActionModeCallback(), ActionMode.TYPE_FLOATING);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hideLastActionMode(){
|
||||
ReactApplicationContext reactContext = this.getReactApplicationContext();
|
||||
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
|
||||
uiManager.addUIBlock(new UIBlock() {
|
||||
public void execute (NativeViewHierarchyManager nvhm) {
|
||||
if(lastActionMode!=null){
|
||||
lastActionMode.finish();
|
||||
lastActionMode = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setSelection(final Integer textInputReactTag, final Integer start, final Integer end){
|
||||
ReactApplicationContext reactContext = this.getReactApplicationContext();
|
||||
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
|
||||
uiManager.addUIBlock(new UIBlock() {
|
||||
public void execute (NativeViewHierarchyManager nvhm) {
|
||||
ReactEditText reactTextView = (ReactEditText) nvhm.resolveView(textInputReactTag);
|
||||
reactTextView.setSelection(start, end);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
package im.status.ethereum.module
|
||||
|
||||
import android.view.ActionMode
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
||||
import com.facebook.react.bridge.ReactMethod
|
||||
import com.facebook.react.uimanager.NativeViewHierarchyManager
|
||||
import com.facebook.react.uimanager.UIBlock
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
import com.facebook.react.views.textinput.ReactEditText
|
||||
|
||||
class RNSelectableTextInputModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
||||
|
||||
private var lastActionMode: ActionMode? = null
|
||||
|
||||
override fun getName(): String {
|
||||
return "RNSelectableTextInputManager"
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun setupMenuItems(selectableTextViewReactTag: Int?, textInputReactTag: Int?) {
|
||||
val reactContext = reactApplicationContext
|
||||
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
|
||||
selectableTextViewReactTag?.let { selectableTag ->
|
||||
textInputReactTag?.let { inputTag ->
|
||||
uiManager?.addUIBlock(UIBlock { nvhm: NativeViewHierarchyManager ->
|
||||
val rnSelectableTextManager = nvhm.resolveViewManager(selectableTag) as RNSelectableTextInputViewManager
|
||||
val reactTextView = nvhm.resolveView(inputTag) as ReactEditText
|
||||
rnSelectableTextManager.registerSelectionListener(reactTextView)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun startActionMode(textInputReactTag: Int?) {
|
||||
val reactContext = reactApplicationContext
|
||||
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
|
||||
textInputReactTag?.let { inputTag ->
|
||||
uiManager?.addUIBlock(UIBlock { nvhm: NativeViewHierarchyManager ->
|
||||
val reactTextView = nvhm.resolveView(inputTag) as ReactEditText
|
||||
lastActionMode = reactTextView.startActionMode(reactTextView.customSelectionActionModeCallback, ActionMode.TYPE_FLOATING)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun hideLastActionMode() {
|
||||
val reactContext = reactApplicationContext
|
||||
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
|
||||
uiManager?.addUIBlock(UIBlock { _ ->
|
||||
lastActionMode?.finish()
|
||||
lastActionMode = null
|
||||
})
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun setSelection(textInputReactTag: Int?, start: Int?, end: Int?) {
|
||||
val reactContext = reactApplicationContext
|
||||
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
|
||||
textInputReactTag?.let { inputTag ->
|
||||
start?.let { s ->
|
||||
end?.let { e ->
|
||||
uiManager?.addUIBlock(UIBlock { nvhm: NativeViewHierarchyManager ->
|
||||
val reactTextView = nvhm.resolveView(inputTag) as ReactEditText
|
||||
reactTextView.setSelection(s, e)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import android.view.ActionMode;
|
||||
import android.view.ActionMode.Callback;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
import com.facebook.react.views.textinput.ReactEditText;
|
||||
import com.facebook.react.views.view.ReactViewGroup;
|
||||
import com.facebook.react.views.view.ReactViewManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RNSelectableTextInputViewManager extends ReactViewManager {
|
||||
public static final String REACT_CLASS = "RNSelectableTextInput";
|
||||
private String[] _menuItems = new String[0];
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return REACT_CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReactViewGroup createViewInstance(ThemedReactContext context) {
|
||||
return new ReactViewGroup(context);
|
||||
}
|
||||
|
||||
@ReactProp(name = "menuItems")
|
||||
public void setMenuItems(ReactViewGroup reactViewGroup, ReadableArray items) {
|
||||
if(items != null) {
|
||||
List<String> result = new ArrayList<String>(items.size());
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
result.add(items.getString(i));
|
||||
}
|
||||
this._menuItems = result.toArray(new String[items.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerSelectionListener(final ReactEditText view) {
|
||||
view.setCustomSelectionActionModeCallback(new Callback() {
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
menu.clear();
|
||||
for (int i = 0; i < _menuItems.length; i++) {
|
||||
menu.add(0, i, 0, _menuItems[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
int selectionStart = view.getSelectionStart();
|
||||
int selectionEnd = view.getSelectionEnd();
|
||||
String selectedText = view.getText().toString().substring(selectionStart, selectionEnd);
|
||||
|
||||
// Dispatch event
|
||||
onSelectNativeEvent(view, item.getItemId(), selectedText, selectionStart, selectionEnd);
|
||||
|
||||
mode.finish();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void onSelectNativeEvent(ReactEditText view, int eventType, String content, int selectionStart, int selectionEnd) {
|
||||
WritableMap event = Arguments.createMap();
|
||||
event.putInt("eventType", eventType);
|
||||
event.putString("content", content);
|
||||
event.putInt("selectionStart", selectionStart);
|
||||
event.putInt("selectionEnd", selectionEnd);
|
||||
|
||||
// Dispatch
|
||||
ReactContext reactContext = (ReactContext) view.getContext();
|
||||
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "topSelection", event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getExportedCustomDirectEventTypeConstants() {
|
||||
return MapBuilder.builder()
|
||||
.put("topSelection", MapBuilder.of("registrationName","onSelection"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
package im.status.ethereum.module
|
||||
|
||||
import android.view.ActionMode
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.ReadableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.common.MapBuilder
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.annotations.ReactProp
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter
|
||||
import com.facebook.react.views.textinput.ReactEditText
|
||||
import com.facebook.react.views.view.ReactViewGroup
|
||||
import com.facebook.react.views.view.ReactViewManager
|
||||
|
||||
class RNSelectableTextInputViewManager : ReactViewManager() {
|
||||
companion object {
|
||||
const val REACT_CLASS = "RNSelectableTextInput"
|
||||
}
|
||||
|
||||
private var _menuItems = arrayOf<String>()
|
||||
|
||||
override fun getName(): String {
|
||||
return REACT_CLASS
|
||||
}
|
||||
|
||||
override fun createViewInstance(context: ThemedReactContext): ReactViewGroup {
|
||||
return ReactViewGroup(context)
|
||||
}
|
||||
|
||||
@ReactProp(name = "menuItems")
|
||||
fun setMenuItems(reactViewGroup: ReactViewGroup, items: ReadableArray?) {
|
||||
_menuItems = items?.let {
|
||||
Array(items.size()) { i -> items.getString(i) }
|
||||
} ?: arrayOf()
|
||||
}
|
||||
|
||||
fun registerSelectionListener(view: ReactEditText) {
|
||||
view.customSelectionActionModeCallback = object : ActionMode.Callback {
|
||||
override fun onPrepareActionMode(mode: ActionMode, menu: Menu): Boolean {
|
||||
menu.clear()
|
||||
_menuItems.forEachIndexed { i, item ->
|
||||
menu.add(0, i, 0, item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onDestroyActionMode(mode: ActionMode) {}
|
||||
|
||||
override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean {
|
||||
val selectionStart = view.selectionStart
|
||||
val selectionEnd = view.selectionEnd
|
||||
val selectedText = view.text.toString().substring(selectionStart, selectionEnd)
|
||||
|
||||
onSelectNativeEvent(view, item.itemId, selectedText, selectionStart, selectionEnd)
|
||||
mode.finish()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun onSelectNativeEvent(view: ReactEditText, eventType: Int, content: String, selectionStart: Int, selectionEnd: Int) {
|
||||
val event: WritableMap = Arguments.createMap().apply {
|
||||
putInt("eventType", eventType)
|
||||
putString("content", content)
|
||||
putInt("selectionStart", selectionStart)
|
||||
putInt("selectionEnd", selectionEnd)
|
||||
}
|
||||
|
||||
val reactContext = view.context as ReactContext
|
||||
reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(view.id, "topSelection", event)
|
||||
}
|
||||
|
||||
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
|
||||
return MapBuilder.builder<String, Any>()
|
||||
.put("topSelection", MapBuilder.of("registrationName", "onSelection"))
|
||||
.build()
|
||||
}
|
||||
}
|
||||
+1219
-12
File diff suppressed because it is too large
Load Diff
-7
@@ -30,13 +30,6 @@ public class StatusPackage implements ReactPackage {
|
||||
List<NativeModule> modules = new ArrayList<>();
|
||||
|
||||
modules.add(new StatusModule(reactContext, this.rootedDevice));
|
||||
modules.add(new AccountManager(reactContext));
|
||||
modules.add(new EncryptionUtils(reactContext));
|
||||
modules.add(new DatabaseManager(reactContext));
|
||||
modules.add(new UIHelper(reactContext));
|
||||
modules.add(new LogManager(reactContext));
|
||||
modules.add(new Utils(reactContext));
|
||||
modules.add(new NetworkManager(reactContext));
|
||||
modules.add(new RNSelectableTextInputModule(reactContext));
|
||||
|
||||
return modules;
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/** Uses an unbounded queue, but allows timeout of core threads
|
||||
* (modified case 2 in
|
||||
* https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html ) */
|
||||
public class StatusThreadPoolExecutor {
|
||||
private static final int NUMBER_OF_CORES =
|
||||
Runtime.getRuntime().availableProcessors();
|
||||
private static final int THREADS_TO_CORES_RATIO = 100;
|
||||
private static final int KEEP_ALIVE_TIME = 1;
|
||||
private static final TimeUnit KEEP_ALIVE_TIME_UNIT = TimeUnit.SECONDS;
|
||||
|
||||
private final BlockingQueue<Runnable> mQueue;
|
||||
private final ThreadPoolExecutor mThreadPool;
|
||||
|
||||
private StatusThreadPoolExecutor() {
|
||||
mQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
mThreadPool = new ThreadPoolExecutor(
|
||||
THREADS_TO_CORES_RATIO * NUMBER_OF_CORES,
|
||||
THREADS_TO_CORES_RATIO * NUMBER_OF_CORES,
|
||||
KEEP_ALIVE_TIME,
|
||||
KEEP_ALIVE_TIME_UNIT,
|
||||
mQueue);
|
||||
|
||||
// Allow pool to drain
|
||||
mThreadPool.allowCoreThreadTimeOut(true);
|
||||
}
|
||||
|
||||
/** Pugh singleton */
|
||||
private static class Holder {
|
||||
private static StatusThreadPoolExecutor instance = new StatusThreadPoolExecutor();
|
||||
}
|
||||
|
||||
public static StatusThreadPoolExecutor getInstance() {
|
||||
return Holder.instance;
|
||||
}
|
||||
|
||||
public void execute(final Runnable r) {
|
||||
mThreadPool.execute(r);
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package im.status.ethereum.module
|
||||
|
||||
import java.util.concurrent.*
|
||||
|
||||
/**
|
||||
* Uses an unbounded queue but allows timeout of core threads
|
||||
* (modified case 2 in
|
||||
* https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html )
|
||||
*/
|
||||
class StatusThreadPoolExecutor private constructor() {
|
||||
private val NUMBER_OF_CORES: Int = Runtime.getRuntime().availableProcessors()
|
||||
private val THREADS_TO_CORES_RATIO: Int = 100
|
||||
private val KEEP_ALIVE_TIME: Int = 1
|
||||
private val KEEP_ALIVE_TIME_UNIT: TimeUnit = TimeUnit.SECONDS
|
||||
|
||||
private val mQueue: BlockingQueue<Runnable> = LinkedBlockingQueue()
|
||||
private val mThreadPool: ThreadPoolExecutor
|
||||
|
||||
init {
|
||||
mThreadPool = ThreadPoolExecutor(
|
||||
THREADS_TO_CORES_RATIO * NUMBER_OF_CORES,
|
||||
THREADS_TO_CORES_RATIO * NUMBER_OF_CORES,
|
||||
KEEP_ALIVE_TIME.toLong(),
|
||||
KEEP_ALIVE_TIME_UNIT,
|
||||
mQueue
|
||||
)
|
||||
|
||||
// Allow pool to drain
|
||||
mThreadPool.allowCoreThreadTimeOut(true)
|
||||
}
|
||||
|
||||
/** Singleton holder */
|
||||
private object Holder {
|
||||
val instance = StatusThreadPoolExecutor()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(): StatusThreadPoolExecutor {
|
||||
return Holder.instance
|
||||
}
|
||||
}
|
||||
|
||||
fun execute(r: Runnable) {
|
||||
mThreadPool.execute(r)
|
||||
}
|
||||
}
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
import android.os.Build;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.WebStorage;
|
||||
import android.view.WindowManager;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.UIBlock;
|
||||
import com.facebook.react.uimanager.NativeViewHierarchyManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.content.Context;
|
||||
|
||||
public class UIHelper extends ReactContextBaseJavaModule {
|
||||
private static final String TAG = "UIHelper";
|
||||
private ReactApplicationContext reactContext;
|
||||
|
||||
public UIHelper(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.reactContext = reactContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "UIHelper";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setSoftInputMode(final int mode) {
|
||||
Log.d(TAG, "setSoftInputMode");
|
||||
final Activity activity = getCurrentActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
activity.getWindow().setSoftInputMode(mode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ReactMethod
|
||||
public void clearCookies() {
|
||||
Log.d(TAG, "clearCookies");
|
||||
final Activity activity = getCurrentActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
CookieManager.getInstance().removeAllCookies(null);
|
||||
CookieManager.getInstance().flush();
|
||||
} else {
|
||||
CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(activity);
|
||||
cookieSyncManager.startSync();
|
||||
CookieManager cookieManager = CookieManager.getInstance();
|
||||
cookieManager.removeAllCookie();
|
||||
cookieManager.removeSessionCookie();
|
||||
cookieSyncManager.stopSync();
|
||||
cookieSyncManager.sync();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void toggleWebviewDebug(final boolean val) {
|
||||
Log.d(TAG, "toggleWebviewDebug");
|
||||
final Activity activity = getCurrentActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WebView.setWebContentsDebuggingEnabled(val);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void clearStorageAPIs() {
|
||||
Log.d(TAG, "clearStorageAPIs");
|
||||
final Activity activity = getCurrentActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
WebStorage storage = WebStorage.getInstance();
|
||||
if (storage != null) {
|
||||
storage.deleteAllData();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void resetKeyboardInputCursor(final int reactTagToReset, final int selection) {
|
||||
UIManagerModule uiManager = getReactApplicationContext().getNativeModule(UIManagerModule.class);
|
||||
uiManager.addUIBlock(new UIBlock() {
|
||||
@Override
|
||||
public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
|
||||
InputMethodManager imm = (InputMethodManager) getReactApplicationContext().getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
View viewToReset = nativeViewHierarchyManager.resolveView(reactTagToReset);
|
||||
imm.restartInput(viewToReset);
|
||||
try {
|
||||
EditText textView = (EditText) viewToReset;
|
||||
textView.setSelection(selection);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-155
@@ -1,155 +0,0 @@
|
||||
package im.status.ethereum.module;
|
||||
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import android.util.Log;
|
||||
import java.util.function.Supplier;
|
||||
import java.io.File;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
import statusgo.Statusgo;
|
||||
|
||||
public class Utils extends ReactContextBaseJavaModule {
|
||||
private static final String gethLogFileName = "geth.log";
|
||||
|
||||
private static final String TAG = "Utils";
|
||||
private ReactApplicationContext reactContext;
|
||||
|
||||
public Utils(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.reactContext = reactContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Utils";
|
||||
}
|
||||
public String getNoBackupDirectory() {
|
||||
return this.getReactApplicationContext().getNoBackupFilesDir().getAbsolutePath();
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String backupDisabledDataDir() {
|
||||
return getNoBackupDirectory();
|
||||
}
|
||||
|
||||
public File getPublicStorageDirectory() {
|
||||
final Context context = this.getReactApplicationContext();
|
||||
// Environment.getExternalStoragePublicDirectory doesn't work as expected on Android Q
|
||||
// https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String)
|
||||
return context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
|
||||
}
|
||||
|
||||
public File getLogsFile() {
|
||||
final File pubDirectory = getPublicStorageDirectory();
|
||||
final File logFile = new File(pubDirectory, gethLogFileName);
|
||||
|
||||
return logFile;
|
||||
}
|
||||
|
||||
public String getKeyUID(final String json) throws JSONException {
|
||||
final JSONObject jsonObj = new JSONObject(json);
|
||||
return jsonObj.getString("key-uid");
|
||||
}
|
||||
|
||||
public String pathCombine(final String path1, final String path2) {
|
||||
// Replace this logic with Paths.get(path1, path2) once API level 26+ becomes the minimum supported API level
|
||||
final File file = new File(path1, path2);
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
public String getKeyStorePath(String keyUID) {
|
||||
final String commonKeydir = pathCombine(getNoBackupDirectory(), "/keystore");
|
||||
final String keydir = pathCombine(commonKeydir, keyUID);
|
||||
|
||||
return keydir;
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String keystoreDir() {
|
||||
final String absRootDirPath = getNoBackupDirectory();
|
||||
return pathCombine(absRootDirPath, "keystore");
|
||||
}
|
||||
|
||||
public void migrateKeyStoreDir(final String accountData, final String password) {
|
||||
try {
|
||||
final String commonKeydir = pathCombine(getNoBackupDirectory(), "/keystore");
|
||||
final String keydir = getKeyStorePath(getKeyUID(accountData));
|
||||
Log.d(TAG, "before migrateKeyStoreDir " + keydir);
|
||||
|
||||
File keydirFile = new File(keydir);
|
||||
if(!keydirFile.exists() || keydirFile.list().length == 0) {
|
||||
Log.d(TAG, "migrateKeyStoreDir");
|
||||
Statusgo.migrateKeyStoreDir(accountData, password, commonKeydir, keydir);
|
||||
Statusgo.initKeystore(keydir);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "JSON conversion failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkAvailability() {
|
||||
// We wait at least 10s for getCurrentActivity to return a value,
|
||||
// otherwise we give up
|
||||
for (int attempts = 0; attempts < 100; attempts++) {
|
||||
if (getCurrentActivity() != null) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ex) {
|
||||
if (getCurrentActivity() != null) {
|
||||
return true;
|
||||
}
|
||||
Log.d(TAG, "Activity doesn't exist");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "Activity doesn't exist");
|
||||
return false;
|
||||
}
|
||||
|
||||
public void executeRunnableStatusGoMethod(Supplier<String> method, Callback callback) throws JSONException {
|
||||
if (!checkAvailability()) {
|
||||
callback.invoke(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable runnableTask = () -> {
|
||||
String res = method.get();
|
||||
callback.invoke(res);
|
||||
};
|
||||
|
||||
StatusThreadPoolExecutor.getInstance().execute(runnableTask);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void validateMnemonic(final String seed, final Callback callback) throws JSONException {
|
||||
executeRunnableStatusGoMethod(() -> Statusgo.validateMnemonic(seed), callback);
|
||||
}
|
||||
|
||||
public Boolean is24Hour() {
|
||||
return android.text.format.DateFormat.is24HourFormat(this.reactContext.getApplicationContext());
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String checkAddressChecksum(final String address) {
|
||||
return Statusgo.checkAddressChecksum(address);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String isAddress(final String address) {
|
||||
return Statusgo.isAddress(address);
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String toChecksumAddress(final String address) {
|
||||
return Statusgo.toChecksumAddress(address);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package android.util;
|
||||
|
||||
public class Log {
|
||||
public static int d(String tag, String msg) {
|
||||
System.out.println("DEBUG: " + tag + ": " + msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int i(String tag, String msg) {
|
||||
System.out.println("INFO: " + tag + ": " + msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int w(String tag, String msg) {
|
||||
System.out.println("WARN: " + tag + ": " + msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int e(String tag, String msg) {
|
||||
System.out.println("ERROR: " + tag + ": " + msg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package android.util
|
||||
|
||||
object Log {
|
||||
@JvmStatic
|
||||
fun d(tag: String, msg: String): Int {
|
||||
println("DEBUG: $tag: $msg")
|
||||
return 0
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun i(tag: String, msg: String): Int {
|
||||
println("INFO: $tag: $msg")
|
||||
return 0
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun w(tag: String, msg: String): Int {
|
||||
println("WARN: $tag: $msg")
|
||||
return 0
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun e(tag: String, msg: String): Int {
|
||||
println("ERROR: $tag: $msg")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#import <sys/utsname.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import "Statusgo.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@interface AccountManager : NSObject <RCTBridgeModule>
|
||||
|
||||
@end
|
||||
@@ -1,233 +0,0 @@
|
||||
#import "AccountManager.h"
|
||||
#import "React/RCTBridge.h"
|
||||
#import "React/RCTEventDispatcher.h"
|
||||
#import "Statusgo.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation AccountManager
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
RCT_EXPORT_METHOD(createAccountAndLogin:(NSString *)request) {
|
||||
#if DEBUG
|
||||
NSLog(@"createAccountAndLogin() method called");
|
||||
#endif
|
||||
StatusgoCreateAccountAndLogin(request);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(restoreAccountAndLogin:(NSString *)request) {
|
||||
#if DEBUG
|
||||
NSLog(@"restoreAccountAndLogin() method called");
|
||||
#endif
|
||||
StatusgoRestoreAccountAndLogin(request);
|
||||
}
|
||||
|
||||
-(NSString *) prepareDirAndUpdateConfig:(NSString *)config
|
||||
withKeyUID:(NSString *)keyUID {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSError *error = nil;
|
||||
NSURL *rootUrl =[[fileManager
|
||||
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
|
||||
lastObject];
|
||||
NSURL *absTestnetFolderName = [rootUrl URLByAppendingPathComponent:@"ethereum/testnet"];
|
||||
|
||||
if (![fileManager fileExistsAtPath:absTestnetFolderName.path])
|
||||
[fileManager createDirectoryAtPath:absTestnetFolderName.path withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
|
||||
NSURL *flagFolderUrl = [rootUrl URLByAppendingPathComponent:@"ropsten_flag"];
|
||||
|
||||
if(![fileManager fileExistsAtPath:flagFolderUrl.path]){
|
||||
NSLog(@"remove lightchaindata");
|
||||
NSURL *absLightChainDataUrl = [absTestnetFolderName URLByAppendingPathComponent:@"StatusIM/lightchaindata"];
|
||||
if([fileManager fileExistsAtPath:absLightChainDataUrl.path]) {
|
||||
[fileManager removeItemAtPath:absLightChainDataUrl.path
|
||||
error:nil];
|
||||
}
|
||||
[fileManager createDirectoryAtPath:flagFolderUrl.path
|
||||
withIntermediateDirectories:NO
|
||||
attributes:nil
|
||||
error:&error];
|
||||
}
|
||||
|
||||
NSLog(@"after remove lightchaindata");
|
||||
|
||||
NSString *keystore = @"keystore";
|
||||
NSURL *absTestnetKeystoreUrl = [absTestnetFolderName URLByAppendingPathComponent:keystore];
|
||||
NSURL *absKeystoreUrl = [rootUrl URLByAppendingPathComponent:keystore];
|
||||
if([fileManager fileExistsAtPath:absTestnetKeystoreUrl.path]){
|
||||
NSLog(@"copy keystore");
|
||||
[fileManager copyItemAtPath:absTestnetKeystoreUrl.path toPath:absKeystoreUrl.path error:nil];
|
||||
[fileManager removeItemAtPath:absTestnetKeystoreUrl.path error:nil];
|
||||
}
|
||||
|
||||
NSLog(@"after lightChainData");
|
||||
|
||||
NSLog(@"preconfig: %@", config);
|
||||
NSData *configData = [config dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSDictionary *configJSON = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
|
||||
NSString *relativeDataDir = [configJSON objectForKey:@"DataDir"];
|
||||
NSString *absDataDir = [rootUrl.path stringByAppendingString:relativeDataDir];
|
||||
NSURL *absDataDirUrl = [NSURL fileURLWithPath:absDataDir];
|
||||
NSString *keystoreDir = [@"/keystore/" stringByAppendingString:keyUID];
|
||||
[configJSON setValue:keystoreDir forKey:@"KeyStoreDir"];
|
||||
[configJSON setValue:@"" forKey:@"LogDir"];
|
||||
[configJSON setValue:@"geth.log" forKey:@"LogFile"];
|
||||
NSString *resultingConfig = [Utils jsonStringWithPrettyPrint:NO fromDictionary:configJSON];
|
||||
|
||||
NSLog(@"node config %@", resultingConfig);
|
||||
|
||||
if(![fileManager fileExistsAtPath:absDataDir]) {
|
||||
[fileManager createDirectoryAtPath:absDataDir
|
||||
withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
}
|
||||
|
||||
NSLog(@"logUrlPath %@ rootDir %@", @"geth.log", rootUrl.path);
|
||||
NSURL *absLogUrl = [absDataDirUrl URLByAppendingPathComponent:@"geth.log"];
|
||||
if(![fileManager fileExistsAtPath:absLogUrl.path]) {
|
||||
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
|
||||
[dict setObject:[NSNumber numberWithInt:511] forKey:NSFilePosixPermissions];
|
||||
[fileManager createFileAtPath:absLogUrl.path contents:nil attributes:dict];
|
||||
}
|
||||
|
||||
return resultingConfig;
|
||||
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(deleteMultiaccount:(NSString *)keyUID
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"DeleteMultiaccount() method called");
|
||||
#endif
|
||||
NSURL *multiaccountKeystoreDir = [Utils getKeyStoreDirForKeyUID:keyUID];
|
||||
NSString *result = StatusgoDeleteMultiaccount(keyUID, multiaccountKeystoreDir.path);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(prepareDirAndUpdateConfig:(NSString *)keyUID
|
||||
config:(NSString *)config
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"PrepareDirAndUpdateConfig() method called");
|
||||
#endif
|
||||
NSString *updatedConfig = [self prepareDirAndUpdateConfig:config
|
||||
withKeyUID:keyUID];
|
||||
callback(@[updatedConfig]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(saveAccountAndLoginWithKeycard:(NSString *)multiaccountData
|
||||
password:(NSString *)password
|
||||
settings:(NSString *)settings
|
||||
config:(NSString *)config
|
||||
accountsData:(NSString *)accountsData
|
||||
chatKey:(NSString *)chatKey) {
|
||||
#if DEBUG
|
||||
NSLog(@"SaveAccountAndLoginWithKeycard() method called");
|
||||
#endif
|
||||
[Utils getExportDbFilePath];
|
||||
NSString *keyUID = [Utils getKeyUID:multiaccountData];
|
||||
NSString *finalConfig = [self prepareDirAndUpdateConfig:config
|
||||
withKeyUID:keyUID];
|
||||
NSString *result = StatusgoSaveAccountAndLoginWithKeycard(multiaccountData, password, settings, finalConfig, accountsData, chatKey);
|
||||
NSLog(@"%@", result);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(loginWithKeycard:(NSString *)accountData
|
||||
password:(NSString *)password
|
||||
chatKey:(NSString *)chatKey
|
||||
nodeConfigJSON:(NSString *)nodeConfigJSON) {
|
||||
#if DEBUG
|
||||
NSLog(@"LoginWithKeycard() method called");
|
||||
#endif
|
||||
[Utils getExportDbFilePath];
|
||||
[Utils migrateKeystore:accountData password:password];
|
||||
|
||||
NSString *result = StatusgoLoginWithKeycard(accountData, password, chatKey, nodeConfigJSON);
|
||||
|
||||
NSLog(@"%@", result);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(loginWithConfig:(NSString *)accountData
|
||||
password:(NSString *)password
|
||||
configJSON:(NSString *)configJSON) {
|
||||
#if DEBUG
|
||||
NSLog(@"LoginWithConfig() method called");
|
||||
#endif
|
||||
[Utils getExportDbFilePath];
|
||||
[Utils migrateKeystore:accountData password:password];
|
||||
NSString *result = StatusgoLoginWithConfig(accountData, password, configJSON);
|
||||
NSLog(@"%@", result);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(loginAccount:(NSString *)request) {
|
||||
#if DEBUG
|
||||
NSLog(@"LoginAccount() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoLoginAccount(request);
|
||||
NSLog(@"%@", result);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(verify:(NSString *)address
|
||||
password:(NSString *)password
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"VerifyAccountPassword() method called");
|
||||
#endif
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *rootUrl =[[fileManager
|
||||
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
|
||||
lastObject];
|
||||
NSURL *absKeystoreUrl = [rootUrl URLByAppendingPathComponent:@"keystore"];
|
||||
|
||||
NSString *result = StatusgoVerifyAccountPassword(absKeystoreUrl.path, address, password);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(verifyDatabasePassword:(NSString *)keyUID
|
||||
password:(NSString *)password
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"VerifyDatabasePassword() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoVerifyDatabasePassword(keyUID, password);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(openAccounts:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"OpenAccounts() method called");
|
||||
#endif
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *rootUrl =[[fileManager
|
||||
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
|
||||
lastObject];
|
||||
|
||||
NSString *result = StatusgoOpenAccounts(rootUrl.path);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(logout) {
|
||||
#if DEBUG
|
||||
NSLog(@"Logout() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoLogout();
|
||||
|
||||
NSLog(@"%@", result);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getRandomMnemonic:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"GetRandomMnemonic() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoGetRandomMnemonic();
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(createAccountFromMnemonicAndDeriveAccountsForPaths:(NSString *)mnemonic callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"createAccountFromMnemonicAndDeriveAccountsForPaths() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoCreateAccountFromMnemonicAndDeriveAccountsForPaths(mnemonic);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,9 +0,0 @@
|
||||
#import <sys/utsname.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import "Statusgo.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@interface DatabaseManager : NSObject <RCTBridgeModule>
|
||||
|
||||
@end
|
||||
@@ -1,33 +0,0 @@
|
||||
#import "DatabaseManager.h"
|
||||
#import "React/RCTBridge.h"
|
||||
#import "React/RCTEventDispatcher.h"
|
||||
#import "Statusgo.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation DatabaseManager
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
RCT_EXPORT_METHOD(exportUnencryptedDatabase:(NSString *)accountData
|
||||
password:(NSString *)password
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"exportUnencryptedDatabase() method called");
|
||||
#endif
|
||||
|
||||
NSString *filePath = [Utils getExportDbFilePath];
|
||||
StatusgoExportUnencryptedDatabase(accountData, password, filePath);
|
||||
|
||||
callback(@[filePath]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(importUnencryptedDatabase:(NSString *)accountData
|
||||
password:(NSString *)password) {
|
||||
#if DEBUG
|
||||
NSLog(@"importUnencryptedDatabase() method called");
|
||||
#endif
|
||||
"";
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,9 +0,0 @@
|
||||
#import <sys/utsname.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import "Statusgo.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@interface EncryptionUtils : NSObject <RCTBridgeModule>
|
||||
|
||||
@end
|
||||
@@ -1,200 +0,0 @@
|
||||
#import "EncryptionUtils.h"
|
||||
#import "React/RCTBridge.h"
|
||||
#import "React/RCTEventDispatcher.h"
|
||||
#import "Statusgo.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation EncryptionUtils
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
#pragma mark - InitKeystore method
|
||||
|
||||
RCT_EXPORT_METHOD(initKeystore:(NSString *)keyUID
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"initKeystore() method called");
|
||||
#endif
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *rootUrl =[[fileManager
|
||||
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
|
||||
lastObject];
|
||||
|
||||
NSURL *commonKeystoreDir = [rootUrl URLByAppendingPathComponent:@"keystore"];
|
||||
NSURL *keystoreDir = [commonKeystoreDir URLByAppendingPathComponent:keyUID];
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
|
||||
^(void)
|
||||
{
|
||||
NSString *res = StatusgoInitKeystore(keystoreDir.path);
|
||||
NSLog(@"InitKeyStore result %@", res);
|
||||
callback(@[]);
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(reEncryptDbAndKeystore:(NSString *)keyUID
|
||||
currentPassword:(NSString *)currentPassword
|
||||
newPassword:(NSString *)newPassword
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"reEncryptDbAndKeystore() method called");
|
||||
#endif
|
||||
// changes password and re-encrypts keystore
|
||||
NSString *result = StatusgoChangeDatabasePassword(keyUID, currentPassword, newPassword);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(convertToKeycardAccount:(NSString *)keyUID
|
||||
accountData:(NSString *)accountData
|
||||
settings:(NSString *)settings
|
||||
keycardUID:(NSString *)keycardUID
|
||||
currentPassword:(NSString *)currentPassword
|
||||
newPassword:(NSString *)newPassword
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"convertToKeycardAccount() method called");
|
||||
#endif
|
||||
NSURL *multiaccountKeystoreDir = [Utils getKeyStoreDirForKeyUID:keyUID];
|
||||
StatusgoInitKeystore(multiaccountKeystoreDir.path);
|
||||
NSString *result = StatusgoConvertToKeycardAccount(accountData, settings, keycardUID, currentPassword, newPassword);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(encodeTransfer:(NSString *)to
|
||||
value:(NSString *)value) {
|
||||
return StatusgoEncodeTransfer(to,value);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(encodeFunctionCall:(NSString *)method
|
||||
paramsJSON:(NSString *)paramsJSON) {
|
||||
return StatusgoEncodeFunctionCall(method,paramsJSON);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(decodeParameters:(NSString *)decodeParamJSON) {
|
||||
return StatusgoDecodeParameters(decodeParamJSON);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(hexToNumber:(NSString *)hex) {
|
||||
return StatusgoHexToNumber(hex);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(numberToHex:(NSString *)numString) {
|
||||
return StatusgoNumberToHex(numString);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(sha3:(NSString *)str) {
|
||||
return StatusgoSha3(str);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(utf8ToHex:(NSString *)str) {
|
||||
return StatusgoUtf8ToHex(str);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(hexToUtf8:(NSString *)str) {
|
||||
return StatusgoHexToUtf8(str);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setBlankPreviewFlag:(BOOL *)newValue)
|
||||
{
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
[userDefaults setBool:newValue forKey:@"BLANK_PREVIEW"];
|
||||
|
||||
[userDefaults synchronize];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(hashTransaction:(NSString *)txArgsJSON
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"HashTransaction() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoHashTransaction(txArgsJSON);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(hashMessage:(NSString *)message
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"hashMessage() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoHashMessage(message);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(localPairingPreflightOutboundCheck:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"LocalPairingPreflightOutboundCheck() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoLocalPairingPreflightOutboundCheck();
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(multiformatDeserializePublicKey:(NSString *)multiCodecKey
|
||||
base58btc:(NSString *)base58btc
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
NSString *result = StatusgoMultiformatDeserializePublicKey(multiCodecKey,base58btc);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(deserializeAndCompressKey:(NSString *)desktopKey
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
NSString *result = StatusgoDeserializeAndCompressKey(desktopKey);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(hashTypedData:(NSString *)data
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"hashTypedData() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoHashTypedData(data);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(hashTypedDataV4:(NSString *)data
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"hashTypedDataV4() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoHashTypedDataV4(data);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
#pragma mark - SignMessage
|
||||
|
||||
RCT_EXPORT_METHOD(signMessage:(NSString *)message
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"SignMessage() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoSignMessage(message);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
#pragma mark - SignTypedData
|
||||
|
||||
RCT_EXPORT_METHOD(signTypedData:(NSString *)data
|
||||
account:(NSString *)account
|
||||
password:(NSString *)password
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"SignTypedData() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoSignTypedData(data, account, password);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
#pragma mark - SignTypedDataV4
|
||||
|
||||
RCT_EXPORT_METHOD(signTypedDataV4:(NSString *)data
|
||||
account:(NSString *)account
|
||||
password:(NSString *)password
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
#if DEBUG
|
||||
NSLog(@"SignTypedDataV4() method called");
|
||||
#endif
|
||||
NSString *result = StatusgoSignTypedDataV4(data, account, password);
|
||||
callback(@[result]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,9 +0,0 @@
|
||||
#import <sys/utsname.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import "Statusgo.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@interface LogManager : NSObject <RCTBridgeModule>
|
||||
|
||||
@end
|
||||
@@ -1,115 +0,0 @@
|
||||
#import "LogManager.h"
|
||||
#import "React/RCTBridge.h"
|
||||
#import "React/RCTEventDispatcher.h"
|
||||
#import "Statusgo.h"
|
||||
#import "Utils.h"
|
||||
#import "SSZipArchive.h"
|
||||
|
||||
@implementation LogManager
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
#pragma mark - SendLogs method
|
||||
|
||||
RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson
|
||||
jsLogs:(NSString *)jsLogs
|
||||
callback:(RCTResponseSenderBlock)callback) {
|
||||
// TODO: Implement SendLogs for iOS
|
||||
#if DEBUG
|
||||
NSLog(@"SendLogs() method called, not implemented");
|
||||
#endif
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSError *error = nil;
|
||||
NSURL *rootUrl =[[fileManager
|
||||
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
|
||||
lastObject];
|
||||
|
||||
NSURL *zipFile = [rootUrl URLByAppendingPathComponent:@"logs.zip"];
|
||||
[fileManager removeItemAtPath:zipFile.path error:nil];
|
||||
|
||||
NSURL *logsFolderName = [rootUrl URLByAppendingPathComponent:@"logs"];
|
||||
|
||||
if (![fileManager fileExistsAtPath:logsFolderName.path])
|
||||
[fileManager createDirectoryAtPath:logsFolderName.path withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
|
||||
NSURL *dbFile = [logsFolderName URLByAppendingPathComponent:@"db.json"];
|
||||
NSURL *jsLogsFile = [logsFolderName URLByAppendingPathComponent:@"Status.log"];
|
||||
#if DEBUG
|
||||
NSString *networkDirPath = @"ethereum/mainnet_rpc_dev";
|
||||
#else
|
||||
NSString *networkDirPath = @"ethereum/mainnet_rpc";
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
NSString *goerliNetworkDirPath = @"ethereum/goerli_rpc_dev";
|
||||
#else
|
||||
NSString *goerliNetworkDirPath = @"ethereum/goerli_rpc";
|
||||
#endif
|
||||
|
||||
NSURL *networkDir = [rootUrl URLByAppendingPathComponent:networkDirPath];
|
||||
NSURL *originalGethLogsFile = [networkDir URLByAppendingPathComponent:@"geth.log"];
|
||||
NSURL *gethLogsFile = [logsFolderName URLByAppendingPathComponent:@"mainnet_geth.log"];
|
||||
|
||||
NSURL *goerliNetworkDir = [rootUrl URLByAppendingPathComponent:goerliNetworkDirPath];
|
||||
NSURL *goerliGethLogsFile = [goerliNetworkDir URLByAppendingPathComponent:@"geth.log"];
|
||||
NSURL *goerliLogsFile = [logsFolderName URLByAppendingPathComponent:@"goerli_geth.log"];
|
||||
|
||||
NSURL *mainGethLogsFile = [rootUrl URLByAppendingPathComponent:@"geth.log"];
|
||||
NSURL *mainLogsFile = [logsFolderName URLByAppendingPathComponent:@"geth.log"];
|
||||
|
||||
[dbJson writeToFile:dbFile.path atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
||||
[jsLogs writeToFile:jsLogsFile.path atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
||||
|
||||
//NSString* gethLogs = StatusgoExportNodeLogs();
|
||||
//[gethLogs writeToFile:gethLogsFile.path atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
||||
[fileManager copyItemAtPath:originalGethLogsFile.path toPath:gethLogsFile.path error:nil];
|
||||
[fileManager copyItemAtPath:goerliGethLogsFile.path toPath:goerliLogsFile.path error:nil];
|
||||
[fileManager copyItemAtPath:mainGethLogsFile.path toPath:mainLogsFile.path error:nil];
|
||||
|
||||
[SSZipArchive createZipFileAtPath:zipFile.path withContentsOfDirectory:logsFolderName.path];
|
||||
[fileManager removeItemAtPath:logsFolderName.path error:nil];
|
||||
|
||||
callback(@[zipFile.absoluteString]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(initLogging:(BOOL)enabled
|
||||
mobileSystem:(BOOL)mobileSystem
|
||||
logLevel:(NSString *)logLevel
|
||||
callback:(RCTResponseSenderBlock)callback)
|
||||
{
|
||||
NSString *logDirectory = [self logFileDirectory];
|
||||
NSString *logFilePath = [logDirectory stringByAppendingPathComponent:@"geth.log"];
|
||||
|
||||
NSMutableDictionary *jsonConfig = [NSMutableDictionary dictionary];
|
||||
jsonConfig[@"Enabled"] = @(enabled);
|
||||
jsonConfig[@"MobileSystem"] = @(mobileSystem);
|
||||
jsonConfig[@"Level"] = logLevel;
|
||||
jsonConfig[@"File"] = logFilePath;
|
||||
|
||||
NSError *error = nil;
|
||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonConfig options:0 error:&error];
|
||||
|
||||
if (error) {
|
||||
// Handle JSON serialization error
|
||||
callback(@[error.localizedDescription]);
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *config = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||
|
||||
// Call your native logging initialization method here
|
||||
NSString *initResult = StatusgoInitLogging(config);
|
||||
|
||||
callback(@[initResult]);
|
||||
}
|
||||
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(logFileDirectory) {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *rootUrl =[[fileManager
|
||||
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
|
||||
lastObject];
|
||||
return rootUrl.path;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user