mirror of
https://github.com/status-im/status-react.git
synced 2025-02-09 17:44:27 +00:00
[#8516] Cannot delete dapp from "Recent"
This commit is contained in:
parent
e91375a97b
commit
222c6ac20c
@ -52,6 +52,15 @@
|
|||||||
:params [browser-id]
|
:params [browser-id]
|
||||||
:on-success #()}]})
|
:on-success #()}]})
|
||||||
|
|
||||||
|
(fx/defn clear-all-browsers
|
||||||
|
{:events [:browser.ui/clear-all-browsers-pressed]}
|
||||||
|
[{:keys [db]}]
|
||||||
|
{:db (dissoc db :browser/browsers)
|
||||||
|
::json-rpc/call (for [browser-id (keys (get db :browser/browsers))]
|
||||||
|
{:method "browsers_deleteBrowser"
|
||||||
|
:params [browser-id]
|
||||||
|
:on-success #()})})
|
||||||
|
|
||||||
(defn update-dapp-name [{:keys [name] :as browser}]
|
(defn update-dapp-name [{:keys [name] :as browser}]
|
||||||
(assoc browser :dapp? false :name (or name (i18n/label :t/browser))))
|
(assoc browser :dapp? false :name (or name (i18n/label :t/browser))))
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
[status-im.ui.components.list-item.views :as list-item]
|
[status-im.ui.components.list-item.views :as list-item]
|
||||||
[status-im.ui.components.list.styles :as styles]
|
[status-im.ui.components.list.styles :as styles]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.screens.home.animations.responder :as responder]
|
|
||||||
[status-im.utils.platform :as platform]
|
[status-im.utils.platform :as platform]
|
||||||
[status-im.ui.components.radio :as radio])
|
[status-im.ui.components.radio :as radio])
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
(:require-macros [status-im.utils.views :as views]))
|
||||||
@ -324,19 +323,4 @@
|
|||||||
[react/view (merge styles/list-with-label-wrapper style)
|
[react/view (merge styles/list-with-label-wrapper style)
|
||||||
[react/text {:style styles/label}
|
[react/text {:style styles/label}
|
||||||
label]
|
label]
|
||||||
list])
|
list])
|
||||||
|
|
||||||
;;TODO DEPRECATED, use long-press
|
|
||||||
(views/defview deletable-list-item [{:keys [type id on-delete]} body]
|
|
||||||
(views/letsubs [swiped? [:delete-swipe-position type id]]
|
|
||||||
(let [offset-x (animation/create-value (if swiped? styles/delete-button-width 0))
|
|
||||||
swipe-pan-responder (responder/swipe-pan-responder offset-x styles/delete-button-width id swiped?)
|
|
||||||
swipe-pan-handler (responder/pan-handlers swipe-pan-responder)]
|
|
||||||
[react/view swipe-pan-handler
|
|
||||||
[react/animated-view {:style {:flex 1
|
|
||||||
:transform [{:translateX offset-x}]}}
|
|
||||||
body
|
|
||||||
[react/touchable-highlight {:style styles/delete-icon-highlight
|
|
||||||
:on-press on-delete}
|
|
||||||
[react/view {:style styles/delete-icon-container}
|
|
||||||
[vector-icons/icon :main-icons/delete {:color colors/red}]]]]])))
|
|
@ -18,18 +18,35 @@
|
|||||||
[reagent.core :as reagent])
|
[reagent.core :as reagent])
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
(:require-macros [status-im.utils.views :as views]))
|
||||||
|
|
||||||
|
(defn hide-sheet-and-dispatch [event]
|
||||||
|
(re-frame/dispatch [:bottom-sheet/hide-sheet])
|
||||||
|
(re-frame/dispatch event))
|
||||||
|
|
||||||
(defn list-item [{:keys [browser-id name url]}]
|
(defn list-item [{:keys [browser-id name url]}]
|
||||||
[list/deletable-list-item {:type :browsers
|
[list-item/list-item
|
||||||
:id browser-id
|
{:on-press #(re-frame/dispatch [:browser.ui/browser-item-selected browser-id])
|
||||||
:on-delete #(do
|
:on-long-press (fn []
|
||||||
(re-frame/dispatch [:set-swipe-position :browsers browser-id false])
|
(re-frame/dispatch
|
||||||
(re-frame/dispatch [:browser.ui/remove-browser-pressed browser-id]))}
|
[:bottom-sheet/show-sheet
|
||||||
[list-item/list-item
|
{:content (fn []
|
||||||
{:on-press #(re-frame/dispatch [:browser.ui/browser-item-selected browser-id])
|
[react/view {:flex 1}
|
||||||
:title name
|
[list-item/list-item
|
||||||
:subtitle (or url :t/dapp)
|
{:theme :action
|
||||||
:icon [react/view styles/browser-icon-container
|
:title :t/remove
|
||||||
[vector-icons/icon :main-icons/browser {:color colors/gray}]]}]])
|
:accessibility-label :remove-dapp-from-list
|
||||||
|
:icon :main-icons/delete
|
||||||
|
:on-press #(hide-sheet-and-dispatch [:browser.ui/remove-browser-pressed browser-id])}]
|
||||||
|
[list-item/list-item
|
||||||
|
{:theme :action-destructive
|
||||||
|
:title :t/clear-all
|
||||||
|
:accessibility-label :clear-all-dapps
|
||||||
|
:icon :main-icons/delete
|
||||||
|
:on-press #(hide-sheet-and-dispatch [:browser.ui/clear-all-browsers-pressed])}]])
|
||||||
|
:content-height 128}]))
|
||||||
|
:title name
|
||||||
|
:subtitle (or url :t/dapp)
|
||||||
|
:icon [react/view styles/browser-icon-container
|
||||||
|
[vector-icons/icon :main-icons/browser {:color colors/gray}]]}])
|
||||||
|
|
||||||
(def dapp-image-data {:image (resources/get-image :dapp-store) :width 768 :height 333})
|
(def dapp-image-data {:image (resources/get-image :dapp-store) :width 768 :height 333})
|
||||||
(defn dapp-image [] [components.common/image-contain nil dapp-image-data])
|
(defn dapp-image [] [components.common/image-contain nil dapp-image-data])
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
(ns status-im.ui.screens.home.animations.responder
|
|
||||||
(:require [status-im.ui.components.react :as react]
|
|
||||||
[re-frame.core :as re-frame]
|
|
||||||
[status-im.ui.components.animation :as animation]))
|
|
||||||
|
|
||||||
(defn get-updated-value [gesture end-offset-x swiped?]
|
|
||||||
(let [base-value (if swiped? end-offset-x 0)]
|
|
||||||
(- base-value (.-dx gesture))))
|
|
||||||
|
|
||||||
(defn on-start [_ gesture]
|
|
||||||
(> (js/Math.abs (.-dx gesture)) 10))
|
|
||||||
|
|
||||||
(defn on-move [animated-offset-x end-offset-x swiped?]
|
|
||||||
(fn [_ gesture]
|
|
||||||
(let [to-value (get-updated-value gesture end-offset-x swiped?)]
|
|
||||||
(animation/start (animation/spring animated-offset-x
|
|
||||||
{:toValue (- to-value)
|
|
||||||
:useNativeDriver true})))))
|
|
||||||
|
|
||||||
(defn on-release [animated-offset-x end-offset-x chat-id swiped?]
|
|
||||||
(fn [_ gesture]
|
|
||||||
(let [updated-value (get-updated-value gesture end-offset-x swiped?)
|
|
||||||
should-open? (> updated-value (/ end-offset-x 2))
|
|
||||||
to-value (if should-open? end-offset-x 0)]
|
|
||||||
(re-frame/dispatch [:set-swipe-position :chats chat-id should-open?])
|
|
||||||
(animation/start (animation/spring animated-offset-x
|
|
||||||
{:toValue (- to-value)
|
|
||||||
:useNativeDriver true})))))
|
|
||||||
|
|
||||||
(defn swipe-pan-responder [animated-offset-x end-offset-x chat-id swiped?]
|
|
||||||
(.create react/pan-responder
|
|
||||||
(clj->js {:onMoveShouldSetPanResponder on-start
|
|
||||||
:onPanResponderMove (on-move animated-offset-x end-offset-x swiped?)
|
|
||||||
:onPanResponderRelease (on-release animated-offset-x end-offset-x chat-id swiped?)
|
|
||||||
:onPanResponderTerminate (on-release animated-offset-x end-offset-x chat-id swiped?)})))
|
|
||||||
|
|
||||||
(defn pan-handlers [pan-responder]
|
|
||||||
(js->clj (.-panHandlers pan-responder)))
|
|
@ -128,6 +128,7 @@
|
|||||||
"check-your-recovery-phrase": "Check your seed phrase",
|
"check-your-recovery-phrase": "Check your seed phrase",
|
||||||
"choose-authentication-method": "Choose an authentication method to protect your multiaccount",
|
"choose-authentication-method": "Choose an authentication method to protect your multiaccount",
|
||||||
"clear": "Clear",
|
"clear": "Clear",
|
||||||
|
"clear-all": "Clear all",
|
||||||
"clear-history": "Clear history",
|
"clear-history": "Clear history",
|
||||||
"clear-history-action": "Clear",
|
"clear-history-action": "Clear",
|
||||||
"clear-history-confirmation": "Clear history?",
|
"clear-history-confirmation": "Clear history?",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user