Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
zefeng huang 2018-08-18 16:04:30 +08:00 committed by Andrey Shovkoplyas
parent 1b9c8d3d6f
commit 6a03d90432
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
4 changed files with 20 additions and 3 deletions

View File

@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.9.26 - Unreleased]
### Added
- Allow user to remove custom avatar
### Fixed
### Changed

View File

@ -195,6 +195,7 @@
:image-source-title "Edit picture"
:image-source-make-photo "Capture"
:image-source-gallery "Select from gallery"
:image-remove-current "Remove current photo"
;;sharing
:sharing-copy-to-clipboard "Copy to clipboard"

View File

@ -2,6 +2,7 @@
(:require [re-frame.core :as re-frame]
[status-im.ui.screens.profile.navigation]
[status-im.utils.handlers :as handlers]
[status-im.utils.identicon :as identicon]
[status-im.ui.screens.profile.models :as profile.models]))
(re-frame/reg-fx
@ -25,6 +26,14 @@
(fn [cofx [this-event base64-image]]
(profile.models/update-picture this-event base64-image cofx)))
(handlers/register-handler-fx
:my-profile/remove-current-photo
(fn [{:keys [db]}]
{:db (-> db
(assoc-in [:my-profile/profile :photo-path]
(identicon/identicon (:current-public-key db)))
(assoc :my-profile/editing? true))}))
(handlers/register-handler-fx
:my-profile/start-editing-profile
(fn [cofx _]

View File

@ -21,6 +21,7 @@
[status-im.utils.utils :as utils]
[status-im.ui.components.icons.vector-icons :as icons]
[status-im.ui.components.common.common :as components.common]
[status-im.utils.identicon :as identicon]
[clojure.string :as string]))
(defn my-profile-toolbar []
@ -59,6 +60,10 @@
(i18n/label :t/camera-access-error))
50))}]))}])
(defn- profile-icon-options-ext []
(conj profile-icon-options {:label (i18n/label :t/image-remove-current)
:action #(re-frame/dispatch [:my-profile/remove-current-photo])}))
(defn qr-viewer-toolbar [label value]
[toolbar/toolbar {}
[toolbar/default-done {:icon-opts {:color colors/black}
@ -182,7 +187,7 @@
[advanced-settings params on-show])]))
(defview my-profile []
(letsubs [{:keys [public-key] :as current-account} [:get-current-account]
(letsubs [{:keys [public-key photo-path] :as current-account} [:get-current-account]
editing? [:get :my-profile/editing?]
changed-account [:get :my-profile/profile]
currency [:wallet/currency]
@ -210,7 +215,9 @@
:edited-contact changed-account
:editing? editing?
:allow-icon-change? true
:options profile-icon-options
:options (if (not= (identicon/identicon public-key) photo-path)
(profile-icon-options-ext)
profile-icon-options)
:on-change-text-event :my-profile/update-name}]]
[react/view action-button.styles/actions-list
[share-contact-code current-account public-key]]