diff --git a/src/status_im/ui/screens/chat/image/views.cljs b/src/status_im/ui/screens/chat/image/views.cljs index 57e710b85f..42a982e3f6 100644 --- a/src/status_im/ui/screens/chat/image/views.cljs +++ b/src/status_im/ui/screens/chat/image/views.cljs @@ -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}} diff --git a/test/appium/tests/__init__.py b/test/appium/tests/__init__.py index a1adf34fc8..1cb4af8994 100644 --- a/test/appium/tests/__init__.py +++ b/test/appium/tests/__init__.py @@ -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 don’t 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! " \ diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 07c3b7c785..3c876e96c0 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -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) diff --git a/translations/en.json b/translations/en.json index c8dc9b0763..49a6c97398 100644 --- a/translations/en.json +++ b/translations/en.json @@ -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" }