[#7527] Extension is not shown in chat if Development mode is switched off

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2019-03-06 15:55:46 +01:00
parent 0887a5299a
commit 38aca129cd
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
3 changed files with 15 additions and 2 deletions

View File

@ -594,7 +594,7 @@
(handlers/register-handler-fx
:extensions.ui/install-extension-button-pressed
(fn [cofx [_ url]]
(extensions.registry/load cofx url true)))
(extensions.registry/install-from-message cofx url true)))
(handlers/register-handler-fx
:extensions.ui/install-button-pressed

View File

@ -89,6 +89,17 @@
:active? true}]
:follow-up (if modal? :extensions/stage-modal :extensions/stage)}}))
(fx/defn install-from-message
[cofx url modal?]
(if (get-in cofx [:db :account/account :dev-mode?])
(load cofx url modal?)
{:ui/show-confirmation
{:title (i18n/label :t/confirm-install)
:content (i18n/label :t/extension-install-alert)
:on-accept #(do
(re-frame/dispatch [:accounts.ui/dev-mode-switched true])
(re-frame/dispatch [:extensions.ui/install-extension-button-pressed url]))}}))
(fx/defn initialize
[{{:account/keys [account]} :db}]
(let [{:keys [extensions dev-mode?]} account]

View File

@ -978,5 +978,7 @@
"mobile-network-go-to-settings": "Go to settings",
"mobile-network-use-mobile-data": "Status tends to use a lot of data when syncing chats. You can choose not to sync when on mobile network",
"status-not-sent": "",
"status-not-sent-without-tap": ""
"status-not-sent-without-tap": "",
"confirm-install": "Confirm Install",
"extension-install-alert": "Development mode is required to install an extension. Do you want to enable and continue installing?"
}