[#11354] Add error alerts on denying access

This commit is contained in:
Roman Volosovskyi 2020-11-04 11:22:22 +02:00
parent d17f7c67b9
commit e7807202c9
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
4 changed files with 34 additions and 20 deletions

View File

@ -8,18 +8,31 @@
[re-frame.core :as re-frame]
[quo.design-system.colors :as colors]
[status-im.chat.models.images :as images]
[quo.core :as quo]))
[quo.core :as quo]
[status-im.utils.utils :as utils]
[status-im.i18n :as i18n]))
(defn take-picture []
(permissions/request-permissions
{:permissions [:camera]
:on-allowed (fn []
(react/show-image-picker-camera #(re-frame/dispatch [:chat.ui/image-captured (.-path %)]) {}))}))
(react/show-image-picker-camera
#(re-frame/dispatch [:chat.ui/image-captured (.-path %)]) {}))
:on-denied (fn []
(utils/set-timeout
#(utils/show-popup (i18n/label :t/error)
(i18n/label :t/camera-access-error))
50))}))
(defn show-image-picker []
(permissions/request-permissions
{:permissions [:read-external-storage :write-external-storage]
:on-allowed #(re-frame/dispatch [:chat.ui/open-image-picker])}))
:on-allowed #(re-frame/dispatch [:chat.ui/open-image-picker])
:on-denied (fn []
(utils/set-timeout
#(utils/show-popup (i18n/label :t/error)
(i18n/label :t/external-storage-denied))
50))}))
(defn buttons []
[react/view
@ -85,10 +98,16 @@
[image-preview second-img selected false height])]))]))
(defview image-view []
{:component-did-mount (fn []
(permissions/request-permissions
{:permissions [:read-external-storage :write-external-storage]
:on-allowed #(re-frame/dispatch [:chat.ui/camera-roll-get-photos 20])}))}
{:component-did-mount
(fn []
(permissions/request-permissions
{:permissions [:read-external-storage :write-external-storage]
:on-allowed #(re-frame/dispatch [:chat.ui/camera-roll-get-photos 20])
:on-denied (fn []
(utils/set-timeout
#(utils/show-popup (i18n/label :t/error)
(i18n/label :t/external-storage-denied))
50))}))}
[react/animated-view {:style {:background-color (:ui-background @colors/theme)
:flex 1}}
[react/scroll-view {:horizontal true :style {:flex 1}}

View File

@ -51,8 +51,7 @@ mailserver_ams_01 = 'mail-01.do-ams3.{}'.format(used_fleet)
camera_access_error_text = "To grant the required camera permission, please go to your system settings " \
"and make sure that Status > Camera is selected."
photos_access_error_text = "To grant the required photos permission, please go to your system settings " \
"and make sure that Status > Photos is selected."
photos_access_error_text = "Access to external storage is denied"
delete_alert_text = "Warning: If you dont have your seed phrase written down, you will lose access to your funds after you delete your profile"
connection_not_secure_text = "Connection is not secure! " \

View File

@ -296,19 +296,14 @@ class TestChatManagement(SingleDeviceTestCase):
contacts_view.ok_button.click()
home.get_back_to_home_view()
# TODO: blocked due to 11354
# home.just_fyi("Denying access to gallery at attempt to send image")
home.just_fyi("Denying access to gallery at attempt to send image")
chat = home.add_contact(basic_user['public_key'])
# chat.show_images_button.click()
# chat.deny_button.click()
# chat.image_from_gallery_button.click()
# chat.deny_button.click()
# contacts_view.element_by_text(photos_access_error_text).wait_for_visibility_of_element(3)
# contacts_view.ok_button.click()
# home.get_back_to_home_view()
chat.show_images_button.click()
chat.deny_button.click()
contacts_view.element_by_text(photos_access_error_text).wait_for_visibility_of_element(3)
contacts_view.ok_button.click()
home.just_fyi("Denying access to audio at attempt to record audio")
# chat = home.get_chat(basic_user['username']).click()
chat.audio_message_button.click()
chat.deny_button.click()
contacts_view.element_by_text(recorded_error).wait_for_visibility_of_element(3)

View File

@ -1324,5 +1324,6 @@
"warning-sending-to-contract-descr": "The address you entered is a smart contract, sending funds to this address may result in loss of funds. To interact with a DApp, open the DApp in the Status DApp Browser.",
"dont-ask": "Don't ask me again",
"enable-link-previews": "Enable link previews in chat?",
"once-enabled-share-metadata": "Once enabled, links posted in the chat may share your metadata with the site"
"once-enabled-share-metadata": "Once enabled, links posted in the chat may share your metadata with the site",
"external-storage-denied": "Access to external storage is denied"
}