Skip to content

Commit

Permalink
Merge branch 'develop' into milad/17321-about-tab-collectible-page
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilad75 authored Jan 9, 2024
2 parents ebde44b + fb13c30 commit 511e473
Show file tree
Hide file tree
Showing 20 changed files with 216 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ CHECKOUT OPTIONS:
:submodules: true

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
boost: 64032b9e9b938fda23325e68a3771f0fabf414dc
BVLinearGradient: 612a04ff38e8480291f3379ee5b5a2c571f03fe0
CryptoSwift: c4f2debceb38bf44c80659afe009f71e23e4a082
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
Expand Down
9 changes: 9 additions & 0 deletions nix/deps/nodejs-patched/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ stdenv.mkDerivation {
"patchBuildIdPhase"
"patchKeyChainPhase"
"patchGlogPhase"
"patchBoostPodSpec"
"installPhase"
];

Expand Down Expand Up @@ -77,6 +78,14 @@ stdenv.mkDerivation {
--replace 'export CXX="' '#export CXX="'
'';

# to fix pod checksum issue : https://github.com/facebook/react-native/issues/42180
# TODO remove this patch after upgrading to react-native 0.73.2
patchBoostPodSpec = ''
substituteInPlace ./node_modules/react-native/third-party-podspecs/boost.podspec \
--replace 'https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2' \
'https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2' \
'';

# The ELF types are incompatible with the host platform, so let's not even try
# TODO: Use Android NDK to strip binaries manually
dontPatchELF = true;
Expand Down
Binary file added resources/images/icons2/20x20/touch-id@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icons2/20x20/touch-id@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 30 additions & 1 deletion src/status_im/common/biometric/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@

(defn get-label-by-type
[biometric-type]
(case biometric-type
(condp = biometric-type
:fingerprint (i18n/label :t/biometric-fingerprint)
:FaceID (i18n/label :t/biometric-faceid)
(i18n/label :t/biometric-touchid)))

(defn get-icon-by-type
[biometric-type]
(condp = biometric-type
:FaceID :i/face-id
:i/touch-id))

(re-frame/reg-fx
:biometric/get-supported-biometric-type
(fn []
Expand Down Expand Up @@ -126,3 +132,26 @@
{:events [:biometric/authenticate]}
[_ opts]
{:biometric/authenticate opts})

(rf/reg-event-fx
:biometric/on-enable-success
(fn [{:keys [db]} [password]]
(let [key-uid (get-in db [:profile/profile :key-uid])]
{:db (assoc db :auth-method constants/auth-method-biometric)
:dispatch [:keychain/save-password-and-auth-method
{:key-uid key-uid
:masked-password password}]})))

(rf/reg-event-fx
:biometric/enable
(fn [_ [password]]
{:dispatch [:biometric/authenticate
{:on-success #(rf/dispatch [:biometric/on-enable-success password])
:on-fail #(rf/dispatch [:biometric/show-message %])}]}))

(rf/reg-event-fx
:biometric/disable
(fn [{:keys [db]}]
(let [key-uid (get-in db [:profile/profile :key-uid])]
{:db (assoc db :auth-method constants/auth-method-none)
:keychain/clear-user-password key-uid})))
6 changes: 6 additions & 0 deletions src/status_im/common/keychain/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
:keychain/clear-user-password
(fn [key-uid]
(keychain/reset-credentials (password-migration-key-name key-uid))
(keychain/reset-credentials (str key-uid "-auth"))
(keychain/reset-credentials key-uid)))

(re-frame/reg-fx
Expand All @@ -142,6 +143,11 @@
(.then #(when on-success (on-success)))
(.catch #(when on-error (on-error %))))))

(re-frame/reg-event-fx
:keychain/save-password-and-auth-method
(fn [_ [opts]]
{:keychain/save-password-and-auth-method opts}))

;; NOTE: migrating the plaintext password in the keychain
;; with the hashed one. Added due to the sync onboarding
;; flow, where the password arrives already hashed.
Expand Down
5 changes: 5 additions & 0 deletions src/status_im/common/standard_authentication/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@
(fn [{:keys [db]} [callback]]
(let [key-uid (get-in db [:profile/profile :key-uid])]
{:fx [[:keychain/get-user-password [key-uid callback]]]})))

(rf/reg-event-fx
:standard-auth/reset-login-password
(fn [{:keys [db]}]
{:db (update db :profile/login dissoc :password :error)}))
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.common.standard-authentication.standard-auth.authorize
(:require
[native-module.core :as native-module]
[react-native.touch-id :as biometric]
[status-im.common.standard-authentication.enter-password.view :as enter-password]
[taoensso.timbre :as log]
Expand All @@ -18,11 +17,11 @@
auth-button-label theme blur? auth-button-icon-left]}]
(let [handle-auth-success (fn [biometric?]
(fn [entered-password]
(let [sha3-pwd (if biometric?
(str (security/safe-unmask-data entered-password))
(native-module/sha3 (str (security/safe-unmask-data
entered-password))))]
(on-auth-success sha3-pwd))))
(let [sha3-masked-password (if biometric?
entered-password
(security/hash-masked-password
entered-password))]
(on-auth-success sha3-masked-password))))
password-login (fn [{:keys [on-press-biometrics]}]
(rf/dispatch [:show-bottom-sheet
{:on-close on-close
Expand Down Expand Up @@ -53,10 +52,12 @@
(password-login {:on-press-biometrics
#(on-press-biometrics
on-press-biometrics)}))}))]
(biometric/get-supported-type
(fn [biometric-type]
(if (and biometric-auth? biometric-type)
(biometrics-login biometrics-login)
(do
(reset-password)
(password-login {})))))))
(if biometric-auth?
(biometric/get-supported-type
(fn [biometric-type]
(if biometric-type
(biometrics-login biometrics-login)
(do
(reset-password)
(password-login {})))))
(password-login {}))))
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.common.standard-authentication.standard-auth.authorize :as authorize]
[status-im.constants :as constants]
[utils.re-frame :as rf]))

(defn- view-internal
Expand All @@ -15,7 +16,7 @@
#(reset! reset-slider? true)
200))
auth-method (rf/sub [:auth-method])
biometric-auth? (= auth-method "biometric")]
biometric-auth? (= auth-method constants/auth-method-biometric)]
(fn [{:keys [track-text
customization-color
auth-button-label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@
[{:keys [content chat-id edited-at style-override on-layout]}]
^{:key (:parsed-text content)}
[rn/view
{:style style-override
:on-layout on-layout}
{:style style-override
:on-layout on-layout
:accessibility-label :message-text-content}
(reduce (fn [acc e]
(render-block acc e chat-id style-override))
[:<>]
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/contexts/profile/settings/list_items.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:blur? true
:action :arrow}
{:title (i18n/label :t/password)
:on-press not-implemented/alert
:on-press #(rf/dispatch [:open-modal :settings-password])
:image-props :i/password
:image :icon
:blur? true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(ns status-im.contexts.profile.settings.screens.password.style)

(defn navigation
[top-inset]
{:padding-top top-inset})

(def header
{:padding-horizontal 20
:padding-bottom 8
:padding-top 12})
86 changes: 86 additions & 0 deletions src/status_im/contexts/profile/settings/screens/password/view.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
(ns status-im.contexts.profile.settings.screens.password.view
(:require [quo.core :as quo]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.common.biometric.events :as biometric]
[status-im.common.not-implemented :as not-implemented]
[status-im.common.standard-authentication.standard-auth.authorize :as authorize]
[status-im.constants :as constants]
[status-im.contexts.profile.settings.screens.password.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn- on-press-biometric-enable
[button-label theme]
(fn []
(authorize/authorize
{:biometric-auth? false
:blur? true
:theme theme
:auth-button-label (i18n/label :t/biometric-enable-button {:bio-type-label button-label})
:on-close (fn [] (rf/dispatch [:standard-auth/reset-login-password]))
:on-auth-success (fn [password]
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:standard-auth/reset-login-password])
(rf/dispatch [:biometric/enable password]))})))

(defn- get-biometric-item
[theme]
(let [auth-method (rf/sub [:auth-method])
biometric-type (rf/sub [:biometric/supported-type])
label (biometric/get-label-by-type biometric-type)
icon (biometric/get-icon-by-type biometric-type)
supported? (boolean biometric-type)
enabled? (= auth-method constants/auth-method-biometric)
biometric-on? (and supported? enabled?)
press-handler (if biometric-on?
(fn [] (rf/dispatch [:biometric/disable]))
(on-press-biometric-enable label theme))]
{:title label
:image-props icon
:image :icon
:blur? true
:action :selector
:action-props {:disabled? (not supported?)
:on-change press-handler
:checked? biometric-on?}
:on-press press-handler}))

(defn- get-change-password-item
[]
{:title (i18n/label :t/change-password)
:on-press not-implemented/alert
:blur? true
:image :icon
:image-props :i/password
:action :arrow})

(defn- view-internal
[{:keys [theme]}]
(let [insets (safe-area/get-insets)]
[quo/overlay {:type :shell}
[rn/view
{:key :navigation
:style (style/navigation (:top insets))}
[quo/page-nav
{:background :blur
:icon-name :i/arrow-left
:on-press #(rf/dispatch [:navigate-back])}]]
[rn/view
{:key :header
:style style/header}
[quo/text
{:accessibility-label :password-settings-label
:weight :semi-bold
:number-of-lines 1
:size :heading-1}
(i18n/label :t/password)]]
[quo/category
{:key :category
:data [(get-biometric-item theme)
(get-change-password-item)]
:blur? true
:list-type :settings}]]))

(def view (quo.theme/with-theme view-internal))
4 changes: 3 additions & 1 deletion src/status_im/contexts/syncing/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[status-im.contexts.syncing.utils :as sync-utils]
[taoensso.timbre :as log]
[utils.re-frame :as rf]
[utils.security.core :as security]
[utils.transforms :as transforms]))

(rf/defn local-pairing-update-role
Expand Down Expand Up @@ -106,7 +107,8 @@
config-map (.stringify js/JSON
(clj->js {:senderConfig {:keyUID key-uid
:keystorePath ""
:password sha3-pwd
:password (security/safe-unmask-data
sha3-pwd)
:deviceType platform/os}
:serverConfig {:timeout 0}}))]
(native-module/get-connection-string-for-bootstrapping-another-device
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/contexts/wallet/create_account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.responsiveness :refer [iphone-11-Pro-20-pixel-from-width]]
[utils.security.core :as security]
[utils.string]))

(defn keypair-string
Expand Down Expand Up @@ -119,9 +120,8 @@
:track-text (i18n/label :t/slide-to-create-account)
:customization-color @account-color
:on-auth-success (fn [entered-password]
(prn entered-password)
(rf/dispatch [:wallet/derive-address-and-add-account
{:sha3-pwd entered-password
{:sha3-pwd (security/safe-unmask-data entered-password)
:emoji @emoji
:color @account-color
:path @derivation-path
Expand Down
9 changes: 8 additions & 1 deletion src/status_im/navigation/screens.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
[status-im.contexts.profile.edit.name.view :as edit-name]
[status-im.contexts.profile.edit.view :as edit-profile]
[status-im.contexts.profile.profiles.view :as profiles]
[status-im.contexts.profile.settings.screens.password.view :as settings-password]
[status-im.contexts.profile.settings.view :as settings]
[status-im.contexts.shell.activity-center.view :as activity-center]
[status-im.contexts.shell.jump-to.view :as shell]
Expand Down Expand Up @@ -367,7 +368,13 @@
:options (merge
options/dark-screen
{:modalPresentationStyle :overCurrentContext})
:component scan-profile-qr-page/view}]
:component scan-profile-qr-page/view}

;; Settings

{:name :settings-password
:options options/transparent-screen-options
:component settings-password/view}]

(when js/goog.DEBUG
[{:name :dev-component-preview
Expand Down
26 changes: 24 additions & 2 deletions test/appium/tests/critical/chats/test_1_1_public_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,13 +654,35 @@ def test_1_1_chat_mute_chat(self):
def test_1_1_chat_delete_via_long_press_relogin(self):
self.home_2.navigate_back_to_home_view()
self.home_2.chats_tab.click()
self.home_2.get_chat(self.username_1).click()
self.home_2.just_fyi("Getting chat history")
chat_history = list()
for element in self.chat_2.chat_element_by_text(text='').message_text_content.find_elements():
chat_history.append(element.text)
if not chat_history:
self.errors.append("No chat history was loaded")

self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app")
self.home_2.navigate_back_to_home_view()
self.home_2.chats_tab.click()
self.home_2.delete_chat_long_press(username=self.username_1)
if self.home_2.get_chat_from_home_view(self.username_1).is_element_displayed():
chat = self.home_2.get_chat_from_home_view(self.username_1)
if chat.is_element_displayed():
self.errors.append("Deleted '%s' chat is shown, but the chat has been deleted" % self.username_1)
self.home_2.reopen_app()
if self.home_2.get_chat_from_home_view(self.username_1).is_element_displayed(15):
if chat.is_element_displayed(15):
self.errors.append(
"Deleted chat '%s' is shown after re-login, but the chat has been deleted" % self.username_1)
chat.click()
else:
self.home_2.contacts_tab.click()
chat.click()
self.chat_2.profile_send_message_button.click()

lost_messages = list()
for message_text in chat_history:
if not self.chat_2.chat_element_by_text(message_text).is_element_displayed():
lost_messages.append(message_text)
if lost_messages:
self.errors.append("Message(s) missed in 1-1 chat after deleting the chat and relogin: %s" % lost_messages)
self.errors.verify_no_errors()
7 changes: 7 additions & 0 deletions test/appium/views/chat_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ def __init__(self, driver, parent_locator: str):

return PinnedByLabelText(self.driver, self.locator)

@property
def message_text_content(self):
return Text(
self.driver,
xpath="//%s//*[@content-desc='message-text-content']/android.widget.TextView" % self.chat_item_locator
)


class UsernameOptions(Button):
def __init__(self, driver, username):
Expand Down
Loading

0 comments on commit 511e473

Please sign in to comment.