Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
tbenr 2019-05-09 12:36:57 +02:00 committed by Andrey Shovkoplyas
parent 74093f6843
commit 1ff0a937ac
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
16 changed files with 59 additions and 32 deletions

View File

@ -337,6 +337,26 @@
(on-failure {:value "extension is not currently showing wallet settings"})
{})))))
(handlers/register-handler-fx
:extensions/screen-open
(fn [cofx [_ _ {:keys [view on-open]}]]
(fx/merge cofx
(when on-open (on-open))
(navigation/navigate-to-cofx :extension-screen-holder {:view view}))))
(handlers/register-handler-fx
:extensions/screen-close
(fn [{:keys [db] :as cofx} [_ _ {:keys [on-close on-failure]}]]
(let [view-id (:view-id db)]
;; ensure the current view-id is the extension fullscreen holder
(if (= view-id :extension-screen-holder)
(fx/merge cofx
(when on-close (on-close))
(navigation/navigate-back))
(if on-failure
(on-failure {:value "extension is not currently showing a fullscreen view"})
{})))))
;;CAPACITIES
(def all
@ -463,6 +483,16 @@
:arguments {:chain-id :number
:on-success? :event
:on-failure? :event}}
'screen/open
{:permissions [:read]
:data :extensions/screen-open
:arguments {:view :view
:on-open? :event}}
'screen/close
{:permissions [:read]
:data :extensions/screen-close
:arguments {:on-close? :event
:on-failure? :event}}
'http/get
{:permissions [:read]
:data :http/get

View File

@ -0,0 +1,13 @@
(ns status-im.extensions.capacities.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [status-im.ui.components.react :as react]
[status-im.ui.components.status-bar.view :as status-bar]
[status-im.ui.screens.profile.photo-capture.styles :as styles]))
(defview screen-holder []
(letsubs [{:keys [view]} [:get-screen-params]]
(when view
(let [[_ _ reactview] (view)]
[react/view styles/container
[status-bar/status-bar]
reactview]))))

View File

@ -143,22 +143,16 @@
:ephemeral? ephemeral?}
:active? true}
new-extensions (assoc (:extensions account) url extension)]
(if ephemeral?
(fx/merge cofx
{:dispatch (if modal?
[:navigate-back]
[:navigate-to-clean :my-profile])}
(when on-activation (on-activation)))
(fx/merge cofx
{:utils/show-popup {:title (i18n/label :t/success)
:content (i18n/label :t/extension-installed)
:on-dismiss #(re-frame/dispatch (if modal?
[:navigate-back]
[:navigate-to-clean :my-profile]))}}
(when hooks (accounts.update/account-update {:extensions new-extensions} {}))
(when hooks (add-to-registry url extension-data true))
(when on-installation (on-installation))
(when on-activation (on-activation))))))
(fx/merge cofx
#(if modal?
(navigation/navigate-back %)
(navigation/navigate-to-clean % :my-profile nil))
#(when-not ephemeral?
(fx/merge %
(when hooks (accounts.update/account-update {:extensions new-extensions} {}))
(when hooks (add-to-registry url extension-data true))
(when on-installation (on-installation))))
(when on-activation (on-activation)))))
(fx/defn uninstall
[{:keys [db] :as cofx} extension-key]
@ -169,8 +163,6 @@
on-deactivation (get-in extension [:lifecycle :on-deactivation])
new-extensions (dissoc (:extensions account) extension-key)]
(fx/merge cofx
{:utils/show-popup {:title (i18n/label :t/success)
:content (i18n/label :t/extension-uninstalled)}}
(when (and active? on-deactivation) (on-deactivation))
(when on-deinstallation (on-deinstallation))
(remove-from-registry extension-key)

View File

@ -9,6 +9,7 @@
:new-chat
:qr-scanner
:take-picture
:extension-screen-holder
:new-group
:add-participants-toggle-list
:contact-toggle-list

View File

@ -17,6 +17,7 @@
:dapps-permissions
:manage-dapps-permissions
:extensions-settings
:extension-screen-holder
:edit-extension
:show-extension
:network-settings

View File

@ -2,6 +2,7 @@
(:require [status-im.extensions.capacities.camera.views
:as
extensions.camera.views]
[status-im.extensions.capacities.views :as extensions.views]
[status-im.ui.screens.about-app.views :as about-app]
[status-im.ui.screens.accounts.create.views :as accounts.create]
[status-im.ui.screens.accounts.login.views :as login]
@ -104,6 +105,7 @@
:qr-scanner qr-scanner/qr-scanner
:profile-qr-viewer [:modal profile.user/qr-viewer]
:take-picture extensions.camera.views/take-picture
:extension-screen-holder extensions.views/screen-holder
:new-group group/new-group
:add-participants-toggle-list group/add-participants-toggle-list
:contact-toggle-list group/contact-toggle-list

View File

@ -23,5 +23,6 @@
:unsigned-transactions
:transactions-history
:wallet-transaction-details
:wallet-settings-hook]
:wallet-settings-hook
:extension-screen-holder]
:config {:initialRouteName :wallet}})

View File

@ -550,7 +550,6 @@
"unknown-realm-error": "Something went wrong",
"notifications": "Notifications",
"currency-display-name-czk": "Czech Koruna",
"extension-installed": "You installed an extension",
"currency-display-name-bob": "Bolivia Bolíviano",
"privacy-policy": "Privacy Policy",
"currency-display-name-lak": "Laos Kip",
@ -971,7 +970,6 @@
"network-invalid-network-id": "Specified network id doesn't correspond to network id by RPC url",
"network-invalid-status-code": "Invalid status code: {{code}}",
"extension-is-already-added": "The extension is already installed",
"extension-uninstalled": "The extension was uninstalled",
"extension-hooks-cannot-be-added": "The following hooks from this extension cannot be added: {{hooks}}",
"to-see-this-message": "To see this message,",
"install-the-extension": "install the extension",

View File

@ -289,7 +289,6 @@
"extension": "Extensión",
"extension-address": "Dirección de extensión",
"extension-find": "Buscar extensión",
"extension-installed": "Has instalado una extensión",
"extension-url": "Ingresa la URL de una extensión",
"extensions": "Extensiones",
"failed": "Fallido",

View File

@ -289,7 +289,6 @@
"extension": "افزونه",
"extension-address": "آدرس افزونه",
"extension-find": "یافتن افزونه",
"extension-installed": "شما یک افزونه نصب کردید",
"extension-url": "آدرس اینترنتی یک افزونه را وارد کنید",
"extensions": "افزونه ها",
"failed": "ناموفق",

View File

@ -366,9 +366,7 @@
"extension-find": "확장 프로그램 찾기",
"extension-hooks-cannot-be-added": "이 확장 프로그램의 다음 후크(Hook)는 추가 할 수 없습니다 : {{hooks}}",
"extension-install-alert": "확장 프로그램을 설치하려면 개발 모드를 활성화 해야합니다. 개발 모드를 활성화하고 계속 하시겠습니까?",
"extension-installed": "확장 프로그램을 설치했습니다",
"extension-is-already-added": "확장 프로그램이 이미 추가되었습니다",
"extension-uninstalled": "확장 프로그램이 제거되었습니다",
"extension-url": "확장 프로그램 URL 입력",
"extensions": "확장 프로그램",
"extensions-camera-send-picture": "사진 보내기",

View File

@ -301,9 +301,7 @@
"extension-address": "Alamat sambungan",
"extension-find": "Cari sambungan",
"extension-hooks-cannot-be-added": "Cangkuk berikut dari sambungan ini tidak dapat ditambahkan: {{hooks}}",
"extension-installed": "Anda memasang satu sambungan",
"extension-is-already-added": "Sambungan telah ditambah sebelum ini",
"extension-uninstalled": "Sambungan telah dinyahpasang",
"extension-url": "Masukkan URL sambungan",
"extensions": "Sambungan",
"extensions-disclaimer": "Sambungan ini adalah dari pihak ketiga dan tidak dibina oleh Status. Pastikan anda mempercayai pemaju sebelum memasang",

View File

@ -295,7 +295,6 @@
"extension": "Sambungan",
"extension-address": "Alamat sambungan",
"extension-find": "एक्सटेन्सन खोज्नुहोस्",
"extension-installed": "Anda memasang satu sambungan",
"extension-url": "एक्सटेन्सन युआरएल प्रविष्ट गर्नुहोस्",
"extensions": "Sambungan",
"failed": "Gagal",

View File

@ -283,7 +283,6 @@
"extension": "Rozszerzenie",
"extension-address": "Adres rozszerzenia",
"extension-find": "Znajdź rozszerzenie",
"extension-installed": "Zainstalowałeś rozszerzenie",
"extension-url": "Wprowadź adres URL rozszerzenia",
"extensions": "Rozszerzenia",
"failed": "Niepowodzenie",

View File

@ -294,7 +294,6 @@
"extension": "Расширение",
"extension-address": "Адрес расширения",
"extension-find": "Найти расширение",
"extension-installed": "Вы установили расширение",
"extension-url": "Введите URL-адрес расширения",
"extensions": "Расширения",
"failed": "Ошибка",

View File

@ -301,9 +301,7 @@
"extension-address": "扩展地址",
"extension-find": "查找扩展",
"extension-hooks-cannot-be-added": "无法添加此扩展程序中的以下挂钩: {{hooks}}",
"extension-installed": "您安装了扩展程序",
"extension-is-already-added": "扩展已添加",
"extension-uninstalled": "扩展程序已卸载",
"extension-url": "输入扩展 URL",
"extensions": "扩展",
"extensions-disclaimer": "此扩展程序来自第三方而不是由Status构建。在安装之前请确保您信任此第三方开发人员",