removed dapps list and introduced simple Dapp store dapp
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 1003 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.1 KiB |
|
@ -8,7 +8,6 @@
|
|||
[status-im.js-dependencies :as dependencies]
|
||||
[status-im.native-module.core :as status]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
[status-im.ui.screens.browser.default-dapps :as default-dapps]
|
||||
[status-im.ui.screens.navigation :as navigation]
|
||||
[status-im.utils.ethereum.core :as ethereum]
|
||||
[status-im.utils.ethereum.ens :as ens]
|
||||
|
@ -21,7 +20,8 @@
|
|||
[status-im.utils.types :as types]
|
||||
[status-im.utils.universal-links.core :as utils.universal-links]
|
||||
[taoensso.timbre :as log]
|
||||
[status-im.js-dependencies :as js-dependencies]))
|
||||
[status-im.js-dependencies :as js-dependencies]
|
||||
[status-im.utils.universal-links.core :as universal-links]))
|
||||
|
||||
(fx/defn initialize-browsers
|
||||
[{:keys [db all-stored-browsers]}]
|
||||
|
@ -59,16 +59,8 @@
|
|||
{:db (update-in db [:browser/browsers] dissoc browser-id)
|
||||
:data-store/tx [(browser-store/remove-browser-tx browser-id)]})
|
||||
|
||||
(defn check-if-dapp-in-list [{:keys [history history-index name] :as browser}]
|
||||
(let [history-host (http/url-host (try (nth history history-index) (catch js/Error _)))
|
||||
dapp (first (filter #(= history-host (http/url-host (http/normalize-url (:dapp-url %))))
|
||||
(apply concat (mapv :data default-dapps/all))))]
|
||||
(if dapp
|
||||
;;TODO(yenda): the consequence of this is that if user goes to a different
|
||||
;;url from a dapp browser, the name of the browser in the home screen will
|
||||
;;change
|
||||
(assoc browser :dapp? true :name (:name dapp))
|
||||
(assoc browser :dapp? false :name (or name (i18n/label :t/browser))))))
|
||||
(defn update-dapp-name [{:keys [name] :as browser}]
|
||||
(assoc browser :dapp? false :name (or name (i18n/label :t/browser))))
|
||||
|
||||
(defn check-if-phishing-url [{:keys [history history-index] :as browser}]
|
||||
(let [history-host (http/url-host (try (nth history history-index) (catch js/Error _)))]
|
||||
|
@ -118,7 +110,7 @@
|
|||
[{:keys [db now]}
|
||||
{:keys [browser-id] :as browser}]
|
||||
(let [updated-browser (-> (assoc browser :timestamp now)
|
||||
(check-if-dapp-in-list)
|
||||
(update-dapp-name)
|
||||
(check-if-phishing-url))]
|
||||
{:db (update-in db
|
||||
[:browser/browsers browser-id]
|
||||
|
@ -250,8 +242,7 @@
|
|||
If the browser is reused, the history is flushed"
|
||||
[{:keys [db] :as cofx} url]
|
||||
(let [normalized-url (http/normalize-and-decode-url url)
|
||||
host (http/url-host normalized-url)
|
||||
browser {:browser-id (or host (random/id))
|
||||
browser {:browser-id (random/id)
|
||||
:history-index 0
|
||||
:history [normalized-url]}]
|
||||
(if (utils.universal-links/universal-link? normalized-url)
|
||||
|
@ -394,3 +385,8 @@
|
|||
:browser/show-web-browser-selection
|
||||
(fn [link]
|
||||
(list-selection/browse-in-web-browser link)))
|
||||
|
||||
(defn share-link [url]
|
||||
(let [link (universal-links/generate-link :browse :external url)
|
||||
message (i18n/label :t/share-dapp-text {:link link})]
|
||||
(list-selection/open-share {:message message})))
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
(fx/defn initialize-chats
|
||||
"Initialize persisted chats on startup"
|
||||
[{:keys [db default-dapps get-all-stored-chats] :as cofx}
|
||||
[{:keys [db get-all-stored-chats] :as cofx}
|
||||
{:keys [from to] :or {from 0 to nil}}]
|
||||
(let [old-chats (:chats db)
|
||||
chats (reduce (fn [acc {:keys [chat-id] :as chat}]
|
||||
|
@ -76,9 +76,7 @@
|
|||
(get-all-stored-chats from to))
|
||||
chats (merge old-chats chats)]
|
||||
(fx/merge cofx
|
||||
{:db (assoc db
|
||||
:chats chats
|
||||
:contacts/dapps default-dapps)}
|
||||
{:db (assoc db :chats chats)}
|
||||
(commands/load-commands commands/register))))
|
||||
|
||||
(defn load-more-messages
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
[status-im.utils.identicon :as identicon]
|
||||
[status-im.contact.db :as contact.db]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::dapps
|
||||
(fn [db]
|
||||
(:contacts/dapps db)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::contacts
|
||||
(fn [db]
|
||||
|
@ -68,28 +63,6 @@
|
|||
contact.db/public-key->new-contact
|
||||
contact.db/enrich-contact))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/all-dapps
|
||||
:<- [::dapps]
|
||||
:<- [:account/account]
|
||||
(fn [[dapps {:keys [dev-mode?]}]]
|
||||
(map (fn [m] (update m :data
|
||||
#(contact.db/filter-dapps % dev-mode?)))
|
||||
dapps)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/dapps-by-name
|
||||
:<- [:contacts/all-dapps]
|
||||
(fn [dapps]
|
||||
(reduce (fn [dapps-by-name category]
|
||||
(merge dapps-by-name
|
||||
(reduce (fn [acc {:keys [name] :as dapp}]
|
||||
(assoc acc name dapp))
|
||||
{}
|
||||
(:data category))))
|
||||
{}
|
||||
dapps)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:contacts/contact-name-by-identity
|
||||
:<- [:contacts/contacts]
|
||||
|
|
|
@ -103,7 +103,6 @@
|
|||
(handlers/register-handler-fx
|
||||
:init-rest-of-chats
|
||||
[(re-frame/inject-cofx :web3/get-web3)
|
||||
(re-frame/inject-cofx :get-default-dapps)
|
||||
(re-frame/inject-cofx :data-store/all-chats)]
|
||||
(fn [{:keys [db] :as cofx} [_]]
|
||||
(log/debug "PERF" :init-rest-of-chats (.now js/Date))
|
||||
|
@ -131,7 +130,6 @@
|
|||
(re-frame/inject-cofx :data-store/get-all-installations)
|
||||
(re-frame/inject-cofx :data-store/all-browsers)
|
||||
(re-frame/inject-cofx :data-store/all-dapp-permissions)
|
||||
(re-frame/inject-cofx :get-default-dapps)
|
||||
(re-frame/inject-cofx :data-store/all-chats)]
|
||||
account-change-success)
|
||||
|
||||
|
@ -1455,7 +1453,7 @@
|
|||
(handlers/register-handler-fx
|
||||
:browser/loading-started
|
||||
(fn [cofx _]
|
||||
(browser/update-browser-option cofx :error? false)))
|
||||
(browser/update-browser-options cofx {:error? false :loading? true})))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:browser.callback/resolve-ens-multihash-success
|
||||
|
|
|
@ -1,61 +1,5 @@
|
|||
(ns status-im.react-native.resources)
|
||||
|
||||
(def contacts
|
||||
{:mkr-market (js/require "./resources/images/contacts/mkr-market.png")
|
||||
:oaken-water-meter (js/require "./resources/images/contacts/oaken-water-meter.png")
|
||||
:gnosis (js/require "./resources/images/contacts/gnosis.png")
|
||||
:melonport (js/require "./resources/images/contacts/melonport.png")
|
||||
:bchat (js/require "./resources/images/contacts/bchat.png")
|
||||
:dentacoin (js/require "./resources/images/contacts/Dentacoin.png")
|
||||
:augur (js/require "./resources/images/contacts/augur.png")
|
||||
:ethlance (js/require "./resources/images/contacts/ethlance.png")
|
||||
:commiteth (js/require "./resources/images/contacts/commiteth.png")
|
||||
:etherplay (js/require "./resources/images/contacts/etherplay.png")
|
||||
:ethcro (js/require "./resources/images/contacts/ethcro.png")
|
||||
:easytrade (js/require "./resources/images/contacts/easytrade.png")
|
||||
|
||||
:dragonereum (js/require "./resources/images/contacts/dragonereum.png")
|
||||
:name-bazaar (js/require "./resources/images/contacts/name-bazaar.png")
|
||||
:cryptographics (js/require "./resources/images/contacts/cryptographics.png")
|
||||
:cryptopunks (js/require "./resources/images/contacts/cryptopunks.png")
|
||||
:cryptotakeovers (js/require "./resources/images/contacts/cryptotakeovers.png")
|
||||
:cryptokitties (js/require "./resources/images/contacts/cryptokitties.png")
|
||||
:decentraland (js/require "./resources/images/contacts/decentraland.png")
|
||||
:etheremon (js/require "./resources/images/contacts/etheremon.png")
|
||||
:cryptostrikers (js/require "./resources/images/contacts/cryptostrikers.png")
|
||||
:cent (js/require "./resources/images/contacts/cent.png")
|
||||
:kickback (js/require "./resources/images/contacts/kickback.png")
|
||||
:hexel (js/require "./resources/images/contacts/hexel.png")
|
||||
:peepeth (js/require "./resources/images/contacts/peepeth.png")
|
||||
:etherbots (js/require "./resources/images/contacts/etherbots.png")
|
||||
:opensea (js/require "./resources/images/contacts/opensea.png")
|
||||
:kyber (js/require "./resources/images/contacts/kyber.png")
|
||||
:bancor (js/require "./resources/images/contacts/bancor.png")
|
||||
:blockimmo (js/require "./resources/images/contacts/blockimmo.png")
|
||||
:cryptocribs (js/require "./resources/images/contacts/cryptocribs.png")
|
||||
:cryptofighters (js/require "./resources/images/contacts/cryptofighters.png")
|
||||
:etherman (js/require "./resources/images/contacts/etherman.png")
|
||||
:airswap (js/require "./resources/images/contacts/airswap.png")
|
||||
:civitas (js/require "./resources/images/contacts/civitas.png")
|
||||
:dai (js/require "./resources/images/contacts/dai.png")
|
||||
:local-ethereum (js/require "./resources/images/contacts/local-ethereum.png")
|
||||
:eth2phone (js/require "./resources/images/contacts/eth2phone.png")
|
||||
:bounties-network (js/require "./resources/images/contacts/bounties-network.png")
|
||||
:cryptopurr (js/require "./resources/images/contacts/cryptopurr.png")
|
||||
:ethlend (js/require "./resources/images/contacts/ethlend.png")
|
||||
:smartz (js/require "./resources/images/contacts/smartz.png")
|
||||
:snt-voting (js/require "./resources/images/contacts/snt-voting.png")
|
||||
:superrare (js/require "./resources/images/contacts/superrare.png")
|
||||
:3box (js/require "./resources/images/contacts/3Box.png")
|
||||
:aragon (js/require "./resources/images/contacts/aragon.png")
|
||||
:slowtrade (js/require "./resources/images/contacts/slowtrade.png")
|
||||
|
||||
:ddex (js/require "./resources/images/contacts/ddex.png")
|
||||
:emoon (js/require "./resources/images/contacts/emoon.png")
|
||||
:livepeer (js/require "./resources/images/contacts/livepeer.png")
|
||||
|
||||
:console (js/require "./resources/images/contacts/console.png")})
|
||||
|
||||
(def ui
|
||||
{:empty-hashtags (js/require "./resources/images/ui/empty-hashtags.png")
|
||||
:empty-recent (js/require "./resources/images/ui/empty-recent.png")
|
||||
|
|
|
@ -1,184 +0,0 @@
|
|||
(ns status-im.ui.screens.browser.default-dapps
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.i18n :as i18n]))
|
||||
|
||||
(def all
|
||||
[{:title (i18n/label :t/default-dapps-exchanges)
|
||||
:data [{:name "Airswap"
|
||||
:dapp-url "https://instant.airswap.io/"
|
||||
:photo-path "contacts://airswap"
|
||||
:description "Meet the future of trading."}
|
||||
{:name "Bancor"
|
||||
:dapp-url "https://www.bancor.network/"
|
||||
:photo-path "contacts://bancor"
|
||||
:description "Bancor is a decentralized liquidity network"}
|
||||
{:name "Kyber"
|
||||
:dapp-url "https://web3.kyber.network"
|
||||
:photo-path "contacts://kyber"
|
||||
:description "On-chain, instant and liquid platform for exchange and payment service"}
|
||||
{:name "DAI by MakerDao"
|
||||
:dapp-url "https://dai.makerdao.com"
|
||||
:photo-path "contacts://dai"
|
||||
:description "Stability for the blockchain"}
|
||||
{:name "LocalEthereum"
|
||||
:dapp-url "https://localethereum.com/"
|
||||
:photo-path "contacts://local-ethereum"
|
||||
:description "The smartest way to buy and sell Ether"}
|
||||
{:name "Eth2phone"
|
||||
:dapp-url "https://eth2.io"
|
||||
:photo-path "contacts://eth2phone"
|
||||
:description "Send Ether by phone number"}
|
||||
{:name "DDEX"
|
||||
:dapp-url "https://ddex.io/"
|
||||
:photo-path "contacts://ddex"
|
||||
:description "Instant, real-time order matching with secure on-chain settlement"}
|
||||
{:name "EasyTrade"
|
||||
:dapp-url "https://easytrade.io"
|
||||
:photo-path "contacts://easytrade"
|
||||
:description "One exchange for every token"}
|
||||
{:name "slow.trade"
|
||||
:dapp-url "https://slow.trade/"
|
||||
:photo-path "contacts://slowtrade"
|
||||
:description "Trade fairly priced crypto assets on the first platform built with the DutchX protocol."}]}
|
||||
{:title (i18n/label :t/default-dapps-marketplaces)
|
||||
:data [{:name "blockimmo"
|
||||
:dapp-url "https://blockimmo.ch"
|
||||
:photo-path "contacts://blockimmo"
|
||||
:description "blockimmo is a blockchain powered, regulated platform enabling shared property investments and ownership."}
|
||||
{:name "CryptoCribs"
|
||||
:dapp-url "https://cryptocribs.com"
|
||||
:photo-path "contacts://cryptocribs"
|
||||
:description "Travel the globe. Pay in crypto."}
|
||||
{:name "Ethlance"
|
||||
:dapp-url "https://ethlance.com"
|
||||
:photo-path "contacts://ethlance"
|
||||
:description "The future of work is now. Hire people or work yourself in return for ETH."}
|
||||
{:name "OpenSea"
|
||||
:dapp-url "https://opensea.io"
|
||||
:photo-path "contacts://opensea"
|
||||
:description "The largest decentralized marketplace for cryptogoods"}
|
||||
{:name "Name Bazaar"
|
||||
:dapp-url "https://namebazaar.io"
|
||||
:photo-path "contacts://name-bazaar"
|
||||
:description "ENS name marketplace"}
|
||||
{:name "The Bounties Network"
|
||||
:dapp-url "https://bounties.network/"
|
||||
:photo-path "contacts://bounties-network"
|
||||
:description "Bounties on any task, paid in any token"}
|
||||
{:name "Emoon"
|
||||
:dapp-url "https://www.emoon.io/"
|
||||
:photo-path "contacts://emoon"
|
||||
:description "A decentralized marketplace for buying & selling crypto assets"}
|
||||
{:name "SuperRare"
|
||||
:dapp-url "https://superrare.co/market"
|
||||
:photo-path "contacts://superrare"
|
||||
:description "Buy, sell and collect unique digital creations by artists around the world"}]}
|
||||
{:title (i18n/label :t/default-dapps-fun-games)
|
||||
:data [{:name "CryptoKitties"
|
||||
:dapp-url "https://www.cryptokitties.co"
|
||||
:photo-path "contacts://cryptokitties"
|
||||
:description "Collect and breed adorable digital cats."}
|
||||
{:name "CryptoFighters"
|
||||
:dapp-url "https://cryptofighters.io"
|
||||
:photo-path "contacts://cryptofighters"
|
||||
:description "Collect train and fight digital fighters."}
|
||||
{:name "Cryptographics"
|
||||
:dapp-url "https://cryptographics.app/"
|
||||
:photo-path "contacts://cryptographics"
|
||||
:description "Cryptographics is a digital art hub where artists, creators and collectors can submit asset packs, create unique cryptographics and trade them."}
|
||||
{:name "CryptoPunks"
|
||||
:dapp-url "https://www.larvalabs.com/cryptopunks"
|
||||
:photo-path "contacts://cryptopunks"
|
||||
:description "10,000 unique collectible punks"}
|
||||
{:name "Crypto Takeovers"
|
||||
:dapp-url "https://cryptotakeovers.com/"
|
||||
:photo-path "contacts://cryptotakeovers"
|
||||
:description "Predict and conquer the world. Make a crypto fortune."}
|
||||
{:name "Decentraland"
|
||||
:dapp-url "https://market.decentraland.org/"
|
||||
:photo-path "contacts://decentraland"
|
||||
:description "Decentraland is a virtual reality platform powered by the Ethereum blockchain."}
|
||||
{:name "Dragonereum"
|
||||
:dapp-url "https://dapp.dragonereum.io"
|
||||
:photo-path "contacts://dragonereum"
|
||||
:description "Own and trade dragons, fight with other players."}
|
||||
{:name "Etherbots"
|
||||
:dapp-url "https://etherbots.io/"
|
||||
:photo-path "contacts://etherbots"
|
||||
:description "Robot wars on the Ethereum Platform"}
|
||||
{:name "Etheremon"
|
||||
:dapp-url "https://www.etheremon.com/"
|
||||
:photo-path "contacts://etheremon"
|
||||
:description "Decentralized World of Ether Monsters"}
|
||||
{:name "CryptoStrikers"
|
||||
:dapp-url "https://www.cryptostrikers.com/"
|
||||
:photo-path "contacts://cryptostrikers"
|
||||
:description "The Beautiful (card) Game"}
|
||||
{:name "Etherman"
|
||||
:dapp-url "https://www.etherman.app"
|
||||
:photo-path "contacts://etherman"
|
||||
:description "Bomberman on Ethereum"}]}
|
||||
{:title (i18n/label :t/default-dapps-social-networks)
|
||||
:data [{:name "Cent"
|
||||
:dapp-url "https://beta.cent.co/"
|
||||
:photo-path "contacts://cent"
|
||||
:description "Get wisdom, get money"}
|
||||
{:name "Kickback"
|
||||
:dapp-url "https://kickback.events/"
|
||||
:photo-path "contacts://kickback"
|
||||
:description "Event no shows? No problem. Kickback asks event attendees to put skin in the game with Ethereum."}
|
||||
{:name "Peepeth"
|
||||
:dapp-url "https://peepeth.com/"
|
||||
:photo-path "contacts://peepeth"
|
||||
:description "Blockchain-powered microblogging"}
|
||||
{:name "Purrbook"
|
||||
:dapp-url "https://cryptopurr.co/"
|
||||
:photo-path "contacts://cryptopurr"
|
||||
:description "A social network for CryptoKitties"}]}
|
||||
{:title (i18n/label :t/default-dapps-media)
|
||||
:data [{:name "livepeer.tv"
|
||||
:dapp-url "http://livepeer.tv/"
|
||||
:photo-path "contacts://livepeer"
|
||||
:description "Decentralized video broadcasting"}]}
|
||||
{:title (i18n/label :t/default-dapps-social-utilities)
|
||||
:data [{:name "3Box"
|
||||
:dapp-url "https://3box.io/"
|
||||
:photo-path "contacts://3box"
|
||||
:description "Create and manage your Ethereum Profile."}
|
||||
{:name "Aragon"
|
||||
:dapp-url "https://mainnet.aragon.org/"
|
||||
:photo-path "contacts://aragon"
|
||||
:description "Build unstoppable organizations on Ethereum."}
|
||||
{:name "Civitas"
|
||||
:dapp-url "https://communities.colu.com/"
|
||||
:photo-path "contacts://civitas"
|
||||
:description "Blockchain-powered local communities"}
|
||||
{:name "ETHLend"
|
||||
:dapp-url "https://app.ethlend.io"
|
||||
:photo-path "contacts://ethlend"
|
||||
:description "Decentralized lending on Ethereum"}
|
||||
{:name "Hexel"
|
||||
:dapp-url "https://www.onhexel.com/"
|
||||
:photo-path "contacts://hexel"
|
||||
:description "Create your own cryptocurrency"}
|
||||
{:name "Livepeer"
|
||||
:dapp-url "https://explorer.livepeer.org/"
|
||||
:photo-path "contacts://livepeer"
|
||||
:description "Decentralized video broadcasting"}
|
||||
{:name "Smartz"
|
||||
:dapp-url "https://smartz.io"
|
||||
:photo-path "contacts://smartz"
|
||||
:description "Easy smart contract management"}
|
||||
{:name "SNT Voting DApp"
|
||||
:dapp-url "https://vote.status.im"
|
||||
:photo-path "contacts://snt-voting"
|
||||
:description "Let your SNT be heard! Vote on decisions exclusive to SNT holders, or create a poll of your own."}
|
||||
{:name "Status Test DApp"
|
||||
:dapp-url "simpledapp.eth"
|
||||
:description "Request test assets and test basic web3 functionality."
|
||||
:developer? true}]}])
|
||||
|
||||
(re-frame/reg-cofx
|
||||
:get-default-dapps
|
||||
(fn [coeffects _]
|
||||
(assoc coeffects :default-dapps all)))
|
|
@ -17,5 +17,28 @@
|
|||
{:flex 1
|
||||
:padding-horizontal 14
|
||||
:desktop {:height 30
|
||||
:width "100%"}
|
||||
:width "100%"}
|
||||
:android {:padding 0}})
|
||||
|
||||
(def browser-icon-container
|
||||
{:width 40
|
||||
:height 40
|
||||
:border-radius 20
|
||||
:background-color colors/gray-lighter
|
||||
:align-items :center
|
||||
:justify-content :center})
|
||||
|
||||
(def dapp-store-container
|
||||
{:margin 16
|
||||
:border-color colors/gray-lighter
|
||||
:border-width 1
|
||||
:border-radius 12
|
||||
:padding-vertical 16
|
||||
:padding-horizontal 44
|
||||
:align-items :center})
|
||||
|
||||
(def open-dapp-store
|
||||
{:margin-top 12
|
||||
:font-size 15
|
||||
:font-weight "500"
|
||||
:line-height 22})
|
||||
|
|
|
@ -7,64 +7,46 @@
|
|||
[status-im.ui.components.status-bar.view :as status-bar]
|
||||
[status-im.ui.screens.browser.open-dapp.styles :as styles]
|
||||
[status-im.ui.components.list.views :as list]
|
||||
[status-im.ui.screens.home.views.inner-item :as inner-item]
|
||||
[status-im.ui.components.common.common :as components.common]
|
||||
[status-im.ui.screens.wallet.components.views :as components]
|
||||
[status-im.ui.components.bottom-bar.styles :as tabs.styles]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon])
|
||||
[status-im.ui.components.list-item.views :as list-item]
|
||||
[status-im.ui.components.icons.vector-icons :as vector-icons])
|
||||
(:require-macros [status-im.utils.views :as views]))
|
||||
|
||||
(defn list-item [{:keys [browser-id] :as home-item}]
|
||||
(defn list-item [{:keys [browser-id name url]}]
|
||||
[list/deletable-list-item {:type :browsers
|
||||
:id browser-id
|
||||
:on-delete #(do
|
||||
(re-frame/dispatch [:set-swipe-position :browsers browser-id false])
|
||||
(re-frame/dispatch [:browser.ui/remove-browser-pressed browser-id]))}
|
||||
[inner-item/home-list-browser-item-inner-view home-item]])
|
||||
[list-item/list-item
|
||||
{:on-press #(re-frame/dispatch [:browser.ui/browser-item-selected browser-id])
|
||||
:title name
|
||||
:subtitle (or url (i18n/label :t/dapp))
|
||||
:image [react/view styles/browser-icon-container
|
||||
[vector-icons/icon :main-icons/browser {:color colors/gray}]]}]])
|
||||
|
||||
(defn- render-dapp [{:keys [dapp-url recent? description name] :as dapp}]
|
||||
(if recent?
|
||||
[list-item dapp]
|
||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:browser.ui/open-dapp-button-pressed dapp-url])}
|
||||
[react/view {:style {:padding-top 11 :padding-horizontal 16 :padding-bottom 7 :flex-direction :row}}
|
||||
[chat-icon/contact-icon-contacts-tab dapp]
|
||||
[react/view {:padding-left 16 :padding-right 2 :flex 1}
|
||||
[react/text {:style {:typography :main-medium}} name]
|
||||
[react/text {:flex 1}
|
||||
[react/text {:style {:font-size 13
|
||||
:color "#939BA1"
|
||||
:margin-top 5
|
||||
:margin-bottom 2}}
|
||||
description]]
|
||||
[react/text {:style {:font-size 12
|
||||
:color "#4360DF"}}
|
||||
(str dapp-url " ->")]]]]))
|
||||
(def dapp-image-data {:image (:dapp-store resources/ui) :width 768 :height 333})
|
||||
(def dapp-image (components.common/image-contain nil dapp-image-data))
|
||||
|
||||
(defn list-header [empty?]
|
||||
[react/view (when empty? {:flex 1})
|
||||
[react/view {:margin 16
|
||||
:border-color colors/gray-lighter
|
||||
:border-width 1
|
||||
:border-radius 12
|
||||
:padding-vertical 16
|
||||
:padding-horizontal 44
|
||||
:align-items :center}
|
||||
[components.common/image-contain {:container-style {}} {:image (:dapp-store resources/ui) :width 768 :height 333}]
|
||||
[react/text {:style {:typography :main-medium
|
||||
:margin-top 12}}
|
||||
"Open the ÐApp Store"]
|
||||
[react/text {:style {:color colors/blue
|
||||
:font-size 13}} "https://discover.dapps.eth ->"]]
|
||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:browser.ui/dapp-url-submitted "https://dap.ps"])}
|
||||
[react/view styles/dapp-store-container
|
||||
[dapp-image nil dapp-image-data]
|
||||
[react/text {:style styles/open-dapp-store} (i18n/label :t/open-dapp-store)]
|
||||
[react/text {:style {:color colors/blue :font-size 13 :line-height 22}} "https://dap.ps ->"]]]
|
||||
(if empty?
|
||||
[react/view {:flex 1 :align-items :center :justify-content :center}
|
||||
[react/text {:style {:color colors/gray}} "Browsed websites will appear here."]]
|
||||
[react/text {:style {:color colors/gray :font-size 15}} (i18n/label :t/browsed-websites)]]
|
||||
[react/view {:margin-top 14 :margin-left 16 :margin-bottom 4}
|
||||
[react/text {:style {:color colors/gray}} (i18n/label :t/recent)]])])
|
||||
[react/text {:style {:line-height 22 :font-size 15 :color colors/gray}}
|
||||
(i18n/label :t/recent)]])])
|
||||
|
||||
(views/defview open-dapp []
|
||||
(views/letsubs [browsers [:browser/browsers-vals]
|
||||
dapps [:contacts/all-dapps]
|
||||
url-text (atom nil)]
|
||||
[react/keyboard-avoiding-view {:style {:flex 1}}
|
||||
[status-bar/status-bar]
|
||||
|
@ -78,25 +60,13 @@
|
|||
:accessibility-label :dapp-url-input
|
||||
:return-key-type :go}]]
|
||||
[components/separator]
|
||||
[list/section-list {:sections (cond-> dapps
|
||||
(not (empty? browsers))
|
||||
(conj {:title (i18n/label :t/recent)
|
||||
:data (map #(assoc % :dapp-url (:url %) :recent? true) browsers)}))
|
||||
:key-fn :dapp-url
|
||||
:render-fn render-dapp
|
||||
:enableEmptySections true
|
||||
:footer [react/view
|
||||
{:style {:height tabs.styles/tabs-diff
|
||||
:align-self :stretch}}]
|
||||
:keyboardShouldPersistTaps :always}]
|
||||
;;TODO next iteration in next PR
|
||||
#_(if (empty? browsers)
|
||||
[list-header true]
|
||||
[list/flat-list {:header [list-header false]
|
||||
:data (vals browsers)
|
||||
:footer [react/view
|
||||
{:style {:height tabs.styles/tabs-diff
|
||||
:align-self :stretch}}]
|
||||
:key-fn :browser-id
|
||||
:end-fill-color colors/white
|
||||
:render-fn list-item}])]))
|
||||
(if (empty? browsers)
|
||||
[list-header true]
|
||||
[list/flat-list {:header [list-header false]
|
||||
:data browsers
|
||||
:footer [react/view
|
||||
{:style {:height tabs.styles/tabs-diff
|
||||
:align-self :stretch}}]
|
||||
:key-fn :browser-id
|
||||
:end-fill-color colors/white
|
||||
:render-fn list-item}])]))
|
|
@ -10,12 +10,9 @@
|
|||
(re-frame/reg-sub
|
||||
:browser/browsers
|
||||
:<- [:browsers]
|
||||
:<- [:contacts/dapps-by-name]
|
||||
(fn [[browsers dapps]]
|
||||
(reduce (fn [acc [k {:keys [dapp? name] :as browser}]]
|
||||
(cond-> (update acc k assoc
|
||||
:url (browser/get-current-url browser))
|
||||
dapp? (assoc-in [k :dapp] (get dapps name))))
|
||||
(fn [browsers]
|
||||
(reduce (fn [acc [k browser]]
|
||||
(update acc k assoc :url (browser/get-current-url browser)))
|
||||
browsers
|
||||
browsers)))
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
[status-im.i18n :as i18n]
|
||||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.components.icons.vector-icons :as icons]
|
||||
[status-im.ui.components.list-selection :as list-selection]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.ui.components.status-bar.view :as status-bar]
|
||||
[status-im.ui.components.styles :as components.styles]
|
||||
|
@ -17,7 +16,6 @@
|
|||
[status-im.ui.screens.browser.permissions.views :as permissions.views]
|
||||
[status-im.ui.screens.browser.site-blocked.views :as site-blocked.views]
|
||||
[status-im.ui.screens.browser.styles :as styles]
|
||||
[status-im.ui.screens.wallet.actions :as wallet.actions]
|
||||
[status-im.utils.ethereum.core :as ethereum]
|
||||
[status-im.utils.http :as http]
|
||||
[status-im.utils.js-resources :as js-res]
|
||||
|
@ -94,7 +92,7 @@
|
|||
:accessibility-label :modal-chat-button}
|
||||
[icons/icon :main-icons/message]]
|
||||
[react/touchable-highlight
|
||||
{:on-press #(wallet.actions/share-link browser-id)
|
||||
{:on-press #(browser/share-link url)
|
||||
:accessibility-label :modal-share-link-button}
|
||||
[icons/icon :main-icons/share]]
|
||||
[react/touchable-highlight {:on-press #(.reload @webview)
|
||||
|
|
|
@ -200,7 +200,6 @@
|
|||
(spec/def :extensions/profile (spec/nilable any?))
|
||||
|
||||
(spec/def ::db (spec/keys :opt [:contacts/contacts
|
||||
:contacts/dapps
|
||||
:contacts/new-identity
|
||||
:contacts/new-identity-error
|
||||
:contacts/identity
|
||||
|
|
|
@ -27,14 +27,6 @@
|
|||
:android {:height 76}
|
||||
:ios {:height 74}})
|
||||
|
||||
(def browser-icon-container
|
||||
{:width 40
|
||||
:height 40
|
||||
:border-radius 20
|
||||
:background-color colors/gray-lighter
|
||||
:align-items :center
|
||||
:justify-content :center})
|
||||
|
||||
(defstyle chat-info-container
|
||||
{:margin-bottom 13
|
||||
:justify-content :space-between
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
[status-im.ui.components.icons.vector-icons :as vector-icons]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
|
||||
[status-im.ui.components.common.common :as components.common]
|
||||
[status-im.ui.components.list-item.views :as list-item]
|
||||
[clojure.string :as string]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
||||
[status-im.ui.components.list.views :as list]))
|
||||
|
||||
(defview command-short-preview [message]
|
||||
|
@ -123,18 +120,4 @@
|
|||
:on-delete #(do
|
||||
(re-frame/dispatch [:set-swipe-position :chats home-item-id false])
|
||||
(re-frame/dispatch [delete-action home-item-id]))}
|
||||
[home-list-chat-item-inner-view home-item]]))
|
||||
|
||||
(defn home-list-browser-item-inner-view [{:keys [dapp url name browser-id]}]
|
||||
(let [photo-path (:photo-path dapp)]
|
||||
[list-item/list-item
|
||||
(merge
|
||||
{:title name
|
||||
:subtitle (or url (i18n/label :t/dapp))
|
||||
:on-press #(re-frame/dispatch [:browser.ui/browser-item-selected browser-id])}
|
||||
(if dapp
|
||||
(if (and photo-path (not (string/blank? (:photo-path dapp))))
|
||||
{:image-path photo-path}
|
||||
{:image [chat-icon/default-browser-icon name]})
|
||||
{:image [react/view styles/browser-icon-container
|
||||
[vector-icons/icon :main-icons/browser {:color colors/gray}]]}))]))
|
||||
[home-list-chat-item-inner-view home-item]]))
|
|
@ -1,17 +0,0 @@
|
|||
(ns status-im.ui.screens.wallet.actions
|
||||
(:require [status-im.i18n :as i18n]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.utils.universal-links.core :as universal-links]
|
||||
[status-im.ui.components.list-selection :as list-selection]))
|
||||
|
||||
(defn share-link [browser-id]
|
||||
(let [link (universal-links/generate-link :browse :external browser-id)
|
||||
message (i18n/label :t/share-dapp-text {:link link})]
|
||||
(list-selection/open-share {:message message})))
|
||||
|
||||
(defn share [browser-id]
|
||||
{:label (i18n/label :t/share-link)
|
||||
:action #(share-link browser-id)})
|
||||
|
||||
(defn actions [browser-id]
|
||||
[(share browser-id)])
|
|
@ -1,11 +1,7 @@
|
|||
(ns status-im.utils.image
|
||||
(:require [clojure.string :as string]
|
||||
[status-im.react-native.resources :as resources]))
|
||||
(:require [clojure.string :as string]))
|
||||
|
||||
(defn source [photo-path]
|
||||
(if (and (not (string/blank? photo-path))
|
||||
(string/starts-with? photo-path "contacts://"))
|
||||
(->> (string/replace photo-path #"contacts://" "")
|
||||
(keyword)
|
||||
(get resources/contacts))
|
||||
(when-not (and (not (string/blank? photo-path))
|
||||
(string/starts-with? photo-path "contacts://"))
|
||||
{:uri photo-path}))
|
|
@ -1,7 +1,7 @@
|
|||
(ns status-im.test.browser.core
|
||||
(:require [cljs.test :refer-macros [deftest is testing]]
|
||||
[status-im.browser.core :as browser]
|
||||
[status-im.utils.types :as types]))
|
||||
[status-im.utils.http :as http]))
|
||||
|
||||
(defn has-navigated-to-browser? [result]
|
||||
(and (= (get result :status-im.ui.screens.navigation/navigate-to)
|
||||
|
@ -20,23 +20,28 @@
|
|||
nil
|
||||
(keys expected-browser))))
|
||||
|
||||
(defn get-dapp-id [result dapp-url]
|
||||
(some #(when (= (http/normalize-and-decode-url dapp-url) (first (:history %))) (:browser-id %))
|
||||
(vals (get-in result [:db :browser/browsers]))))
|
||||
|
||||
(deftest browser-test
|
||||
(let [dapp1-url "cryptokitties.co"
|
||||
dapp2-url "http://test2.com"]
|
||||
|
||||
(testing "user opens a dapp"
|
||||
(let [result-open (browser/open-url {:db {} :now 1} dapp1-url)]
|
||||
(is (= dapp1-url (get-in result-open [:db :browser/options :browser-id]))
|
||||
(let [result-open (browser/open-url {:db {} :now 1} dapp1-url)
|
||||
dapp1-id (get-dapp-id result-open dapp1-url)]
|
||||
(is (= dapp1-id (get-in result-open [:db :browser/options :browser-id]))
|
||||
"browser-id should be dapp1-url")
|
||||
(is (has-navigated-to-browser? result-open)
|
||||
"should navigate to :browser")
|
||||
(is (not (has-wrong-properties? result-open
|
||||
dapp1-url
|
||||
{:browser-id "cryptokitties.co"
|
||||
dapp1-id
|
||||
{:browser-id dapp1-id
|
||||
:history-index 0
|
||||
:history ["http://cryptokitties.co"]
|
||||
:dapp? true
|
||||
:name "CryptoKitties"
|
||||
:dapp? false
|
||||
:name "browser"
|
||||
:timestamp 1}))
|
||||
"some properties of the browser are not correct")
|
||||
|
||||
|
@ -44,14 +49,14 @@
|
|||
(let [result-open-2 (browser/open-url {:db (:db result-open)
|
||||
:now 2}
|
||||
dapp2-url)
|
||||
dapp2-host "test2.com"]
|
||||
(is (= dapp2-host (get-in result-open-2 [:db :browser/options :browser-id]))
|
||||
dapp2-id (get-dapp-id result-open-2 dapp2-url)]
|
||||
(is (= dapp2-id (get-in result-open-2 [:db :browser/options :browser-id]))
|
||||
"browser-id should be dapp2 host")
|
||||
(is (has-navigated-to-browser? result-open-2)
|
||||
"should navigate to :browser")
|
||||
(is (not (has-wrong-properties? result-open-2
|
||||
dapp2-host
|
||||
{:browser-id "test2.com"
|
||||
dapp2-id
|
||||
{:browser-id dapp2-id
|
||||
:history-index 0
|
||||
:history ["http://test2.com"]
|
||||
:dapp? false
|
||||
|
@ -59,24 +64,23 @@
|
|||
"some properties of the browser are not correct")
|
||||
|
||||
(testing "then removes the second dapp"
|
||||
(let [result-remove-2 (browser/remove-browser {:db (:db result-open-2)} dapp2-host)]
|
||||
(is (= #{dapp1-url}
|
||||
(let [result-remove-2 (browser/remove-browser {:db (:db result-open-2)} dapp2-id)]
|
||||
(is (= #{dapp1-id}
|
||||
(set (keys (get-in result-remove-2 [:db :browser/browsers]))))
|
||||
"the second dapp shouldn't be in the browser list anymore")))))
|
||||
|
||||
(testing "then opens the dapp again"
|
||||
(let [result-open-existing (browser/open-existing-browser {:db (:db result-open)
|
||||
:now 2}
|
||||
dapp1-url)
|
||||
dapp1-url2 (str "http://" dapp1-url "/nav2")
|
||||
browser (get-in result-open-existing [:db :browser/browsers dapp1-url])]
|
||||
dapp1-id)
|
||||
dapp1-url2 (str "http://" dapp1-url "/nav2")]
|
||||
(is (not (has-wrong-properties? result-open-existing
|
||||
dapp1-url
|
||||
{:browser-id "cryptokitties.co"
|
||||
dapp1-id
|
||||
{:browser-id dapp1-id
|
||||
:history-index 0
|
||||
:history ["http://cryptokitties.co"]
|
||||
:dapp? true
|
||||
:name "CryptoKitties"
|
||||
:dapp? false
|
||||
:name "browser"
|
||||
:timestamp 2}))
|
||||
"some properties of the browser are not correct")
|
||||
(is (nil? (browser/navigate-to-next-page result-open-existing))
|
||||
|
@ -92,12 +96,12 @@
|
|||
"loading" false})
|
||||
false)]
|
||||
(is (not (has-wrong-properties? result-navigate
|
||||
dapp1-url
|
||||
{:browser-id "cryptokitties.co"
|
||||
dapp1-id
|
||||
{:browser-id dapp1-id
|
||||
:history-index 1
|
||||
:history ["http://cryptokitties.co" dapp1-url2]
|
||||
:dapp? true
|
||||
:name "CryptoKitties"
|
||||
:dapp? false
|
||||
:name "browser"
|
||||
:timestamp 4}))
|
||||
"some properties of the browser are not correct")
|
||||
|
||||
|
@ -105,12 +109,12 @@
|
|||
(let [result-previous (browser/navigate-to-previous-page {:db (:db result-navigate)
|
||||
:now 5})]
|
||||
(is (not (has-wrong-properties? result-previous
|
||||
dapp1-url
|
||||
{:browser-id "cryptokitties.co"
|
||||
dapp1-id
|
||||
{:browser-id dapp1-id
|
||||
:history-index 0
|
||||
:history ["http://cryptokitties.co" dapp1-url2]
|
||||
:dapp? true
|
||||
:name "CryptoKitties"
|
||||
:dapp? false
|
||||
:name "browser"
|
||||
:timestamp 5}))
|
||||
"some properties of the browser are not correct")
|
||||
|
||||
|
@ -118,11 +122,11 @@
|
|||
(let [result-next (browser/navigate-to-next-page {:db (:db result-previous)
|
||||
:now 6})]
|
||||
(is (not (has-wrong-properties? result-next
|
||||
dapp1-url
|
||||
{:browser-id "cryptokitties.co"
|
||||
dapp1-id
|
||||
{:browser-id dapp1-id
|
||||
:history-index 1
|
||||
:history ["http://cryptokitties.co" dapp1-url2]
|
||||
:dapp? true
|
||||
:name "CryptoKitties"
|
||||
:dapp? false
|
||||
:name "browser"
|
||||
:timestamp 6}))
|
||||
"some properties of the browser are not correct"))))))))))))
|
||||
|
|
|
@ -2,16 +2,18 @@
|
|||
(:require [cljs.test :refer-macros [deftest is testing]]
|
||||
[status-im.browser.permissions :as permissions]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.browser.core :as browser]))
|
||||
[status-im.browser.core :as browser]
|
||||
[status-im.test.browser.core :as core.tests]))
|
||||
|
||||
(deftest permissions-test
|
||||
(let [dapp-name "test.com"
|
||||
dapp-name2 "test2.org"
|
||||
cofx {:db (assoc-in (:db (browser/open-url {:db {}} dapp-name))
|
||||
[:account/account :public-key] "public-key")}]
|
||||
[:account/account :public-key] "public-key")}
|
||||
dapp-id (core.tests/get-dapp-id cofx dapp-name)]
|
||||
(testing "dapps permissions are initialized"
|
||||
(is (zero? (count (get-in cofx [:db :dapps/permissions]))))
|
||||
(is (= dapp-name (get-in cofx [:db :browser/options :browser-id]))))
|
||||
(is (= dapp-id (get-in cofx [:db :browser/options :browser-id]))))
|
||||
|
||||
(testing "receiving an unsupported permission"
|
||||
(let [result-ask (browser/process-bridge-message cofx
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
(ns status-im.test.chat.views.photos
|
||||
(:require [cljs.test :refer [deftest testing is]]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.utils.image :as utils.image]))
|
||||
|
||||
(deftest photos-test
|
||||
(testing "a normal string"
|
||||
(let [actual (utils.image/source "some-string")]
|
||||
(is (= {:uri "some-string"} actual))))
|
||||
(testing "a contact string"
|
||||
(with-redefs [resources/contacts {:test "something"}]
|
||||
(let [actual (utils.image/source "contacts://test")]
|
||||
(is (= "something" actual))))))
|
||||
(is (= {:uri "some-string"} actual)))))
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
(:require [cljs.test :refer-macros [deftest is are testing]]
|
||||
[status-im.accounts.login.core :as login.core]
|
||||
[status-im.events :as events]
|
||||
[status-im.ui.screens.browser.default-dapps :as default-dapps]
|
||||
[status-im.test.sign-in.data :as data]
|
||||
[status-im.signals.core :as signals]))
|
||||
|
||||
|
@ -41,7 +40,6 @@
|
|||
:all-installations []
|
||||
:all-stored-browsers []
|
||||
:all-dapp-permissions []
|
||||
:default-dapps default-dapps/all
|
||||
:get-all-stored-chats data/get-chats}
|
||||
efx (events/account-change-success cofx [nil "address"])
|
||||
new-db (:db efx)]
|
||||
|
|
|
@ -998,5 +998,7 @@
|
|||
"invalid-format": "Invalid format\nMust be {{format}}",
|
||||
"mailserver-format": "enode://{enode-id}:{password}@{ip-address}:{port}",
|
||||
"bootnode-format": "enode://{enode-id}@{ip-address}:{port}",
|
||||
"fetch-messages": "↓ Fetch messages"
|
||||
"fetch-messages": "↓ Fetch messages",
|
||||
"open-dapp-store": "Discover ÐApps",
|
||||
"browsed-websites": "Browsed websites will appear here."
|
||||
}
|
||||
|
|