Skip to content

Commit

Permalink
[#8966] biometric
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
  • Loading branch information
flexsurfer committed Oct 4, 2019
1 parent da4fb01 commit b3d04bb
Show file tree
Hide file tree
Showing 37 changed files with 505 additions and 444 deletions.
124 changes: 0 additions & 124 deletions CHANGELOG.md

This file was deleted.

24 changes: 24 additions & 0 deletions ICONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# new icons

## android
1. copy files to corresponding directories at `/Users/romanvolosovskyi/clj/status-react/android/app/src/main/res` (one of `drawable-hdpi`, `drawable-mdpi`, `drawable-xhdpi`, `drawable-xxhdpi`, `drawable-xxxhdpi` for corresponding resolution)
If you only have 3 pngs 1x, 2x and 3x put them in mdpi, xhdpi and xxhdpi
3. if necessary, rename file so that filename contains only lower case chars, and dashes instead of hyphens, e.g. `"Icon-Name.png"` should be renamed to `"icon_name.png"`.
4. In the app `icon_name.png` still can be accessed as `icon-name`, so in order to use can add the next code:
```clojure
;; icon_name.png
[vector-icons/icon :icon-name {:color ...}]
```

## ios
1. open xcode (on macos run `open ios/StatusIm.xcworkspace` from project's root dir)
2. go to `StatusIm/StatusIm/Images.xcassets` in xcode
![](https://notes.status.im/uploads/upload_be25e49db97cb114ff4aa0c9d94422fa.png)
3. add images there
4. if necessary, rename file so that filename contains only lower case chars, e.g. `"Icon-Name.png"` should be renamed to `"icon-name"`.
5. **IMPORTANT** there is no need to replace hyphens with dashes, and if you do so you will need to use names with dashes in both android and ios versions. So use dashes for android resources names and hyphens for ios.
6. And now `"icon-name"` can be added in app the same way as it was added for android version
```clojure
;; icon-name
[vector-icons/icon :icon-name {:color ...}]
```
Binary file added android/app/src/main/res/drawable-mdpi/faceid.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 android/app/src/main/res/drawable-mdpi/print.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 android/app/src/main/res/drawable-xhdpi/faceid.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 android/app/src/main/res/drawable-xhdpi/print.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions ios/StatusIm/Images.xcassets/faceid.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "faceid@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "faceid@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "faceid@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions ios/StatusIm/Images.xcassets/print.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "print@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "print@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "print@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 0 additions & 93 deletions src/status_im/biometric_auth/core.cljs

This file was deleted.

24 changes: 1 addition & 23 deletions src/status_im/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[status-im.multiaccounts.logout.core :as multiaccounts.logout]
[status-im.multiaccounts.recover.core :as multiaccounts.recover]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.biometric-auth.core :as biomentric-auth]
status-im.multiaccounts.biometric.core
[status-im.bootnodes.core :as bootnodes]
[status-im.browser.core :as browser]
[status-im.browser.permissions :as browser.permissions]
Expand Down Expand Up @@ -120,20 +120,6 @@
:on-accept open-chaos-unicorn-day-link}})
(multiaccounts/switch-chaos-mode chaos-mode?)))))

(handlers/register-handler-fx
:multiaccounts.ui/biometric-auth-switched
(fn [cofx [_ biometric-auth?]]
(if biometric-auth?
(biomentric-auth/authenticate-fx
cofx
(fn [{:keys [bioauth-success bioauth-message]}]
(when bioauth-success
(re-frame/dispatch [:multiaccounts.ui/switch-biometric-auth true]))
(when bioauth-message
(utils/show-popup (i18n/label :t/biometric-auth-reason-verify) bioauth-message)))
{:reason (i18n/label :t/biometric-auth-reason-verify)})
(multiaccounts/switch-biometric-auth cofx false))))

(handlers/register-handler-fx
:multiaccounts.ui/notifications-enabled
(fn [cofx [_ desktop-notifications?]]
Expand Down Expand Up @@ -175,14 +161,6 @@
(fn [cofx [_ address photo-path name public-key]]
(multiaccounts.login/open-login cofx address photo-path name public-key)))

(handlers/register-handler-fx
:multiaccounts.login.callback/get-user-password-success
(fn [{:keys [db] :as cofx} [_ password address]]
(let [biometric-auth? (get-in db [:multiaccounts/multiaccounts address :settings :biometric-auth?])]
(if (and password biometric-auth?)
(multiaccounts.login/do-biometric-auth cofx password)
(multiaccounts.login/open-login-callback cofx password {:bioauth-notrequired true})))))

;; multiaccounts logout module

(handlers/register-handler-fx
Expand Down
15 changes: 2 additions & 13 deletions src/status_im/init/core.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.init.core
(:require [re-frame.core :as re-frame]
[status-im.biometric-auth.core :as biometric-auth]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.native-module.core :as status]
[status-im.network.net-info :as network]
Expand Down Expand Up @@ -33,11 +32,6 @@
:view-id view-id
:push-notifications/stored stored)})

(fx/defn set-supported-biometric-auth
{:events [:init.callback/get-supported-biometric-auth-success]}
[{:keys [db]} supported-biometric-auth]
{:db (assoc db :supported-biometric-auth supported-biometric-auth)})

(fx/defn initialize-views
[cofx]
(let [{{:multiaccounts/keys [multiaccounts] :as db} :db} cofx]
Expand Down Expand Up @@ -75,7 +69,7 @@

(fx/defn start-app [cofx]
(fx/merge cofx
{::get-supported-biometric-auth nil
{:get-supported-biometric-auth nil
::init-keystore nil
::restore-native-settings nil
::open-multiaccounts #(re-frame/dispatch [::initialize-multiaccounts %])
Expand All @@ -100,9 +94,4 @@
(re-frame/reg-fx
::init-keystore
(fn []
(status/init-keystore)))

(re-frame/reg-fx
::get-supported-biometric-auth
(fn []
(biometric-auth/get-supported #(re-frame/dispatch [:init.callback/get-supported-biometric-auth-success %]))))
(status/init-keystore)))
Loading

0 comments on commit b3d04bb

Please sign in to comment.