From d094cd286c54695b3fa5a2606eb115d175a74eb4 Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Wed, 1 Jun 2016 11:41:50 +0300 Subject: [PATCH] implemented #119 and #120 Former-commit-id: c81276e3b70616511a6f1f98f452dc50b08fe975 --- .re-natal | 4 +- android/app/build.gradle | 1 + .../main/java/com/statusim/MainActivity.java | 3 + .../res/drawable-hdpi/corner_left_bottom.png | Bin 0 -> 526 bytes .../res/drawable-hdpi/corner_left_top.png | Bin 0 -> 614 bytes .../res/drawable-hdpi/corner_right_bottom.png | Bin 0 -> 613 bytes .../res/drawable-hdpi/corner_right_top.png | Bin 0 -> 537 bytes .../res/drawable-mdpi/corner_left_bottom.png | Bin 0 -> 330 bytes .../res/drawable-mdpi/corner_left_top.png | Bin 0 -> 333 bytes .../res/drawable-mdpi/corner_right_bottom.png | Bin 0 -> 340 bytes .../res/drawable-mdpi/corner_right_top.png | Bin 0 -> 334 bytes .../res/drawable-xhdpi/corner_left_bottom.png | Bin 0 -> 826 bytes .../res/drawable-xhdpi/corner_left_top.png | Bin 0 -> 686 bytes .../drawable-xhdpi/corner_right_bottom.png | Bin 0 -> 823 bytes .../res/drawable-xhdpi/corner_right_top.png | Bin 0 -> 825 bytes .../drawable-xxhdpi/corner_left_bottom.png | Bin 0 -> 1212 bytes .../res/drawable-xxhdpi/corner_left_top.png | Bin 0 -> 1413 bytes .../drawable-xxhdpi/corner_right_bottom.png | Bin 0 -> 1420 bytes .../res/drawable-xxhdpi/corner_right_top.png | Bin 0 -> 1434 bytes .../drawable-xxxhdpi/corner_left_bottom.png | Bin 0 -> 1809 bytes .../res/drawable-xxxhdpi/corner_left_top.png | Bin 0 -> 2058 bytes .../drawable-xxxhdpi/corner_right_bottom.png | Bin 0 -> 2078 bytes .../res/drawable-xxxhdpi/corner_right_top.png | Bin 0 -> 2001 bytes android/settings.gradle | 2 + package.json | 2 + src/status_im/android/core.cljs | 4 + src/status_im/components/camera.cljs | 7 ++ src/status_im/components/qr-code.cljs | 7 ++ src/status_im/components/styles.cljs | 24 ++++++ src/status_im/components/toolbar.cljs | 25 ++++--- src/status_im/contacts/handlers.cljs | 12 +++ src/status_im/contacts/screen.cljs | 45 ++++++++--- src/status_im/contacts/styles.cljs | 33 +++++++-- src/status_im/contacts/views/new_contact.cljs | 70 ++++++++++++++++++ src/status_im/db.cljs | 4 + src/status_im/profile/screen.cljs | 17 ++++- src/status_im/profile/styles.cljs | 5 ++ src/status_im/qr_scanner/screen.cljs | 43 +++++++++++ src/status_im/qr_scanner/styles.cljs | 59 +++++++++++++++ src/status_im/translations/en.cljs | 6 ++ src/status_im/utils/types.cljs | 5 +- 41 files changed, 342 insertions(+), 36 deletions(-) create mode 100644 android/app/src/main/res/drawable-hdpi/corner_left_bottom.png create mode 100644 android/app/src/main/res/drawable-hdpi/corner_left_top.png create mode 100644 android/app/src/main/res/drawable-hdpi/corner_right_bottom.png create mode 100644 android/app/src/main/res/drawable-hdpi/corner_right_top.png create mode 100644 android/app/src/main/res/drawable-mdpi/corner_left_bottom.png create mode 100644 android/app/src/main/res/drawable-mdpi/corner_left_top.png create mode 100644 android/app/src/main/res/drawable-mdpi/corner_right_bottom.png create mode 100644 android/app/src/main/res/drawable-mdpi/corner_right_top.png create mode 100644 android/app/src/main/res/drawable-xhdpi/corner_left_bottom.png create mode 100644 android/app/src/main/res/drawable-xhdpi/corner_left_top.png create mode 100644 android/app/src/main/res/drawable-xhdpi/corner_right_bottom.png create mode 100644 android/app/src/main/res/drawable-xhdpi/corner_right_top.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/corner_left_bottom.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/corner_left_top.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/corner_right_bottom.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/corner_right_top.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/corner_left_bottom.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/corner_left_top.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/corner_right_bottom.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/corner_right_top.png create mode 100644 src/status_im/components/camera.cljs create mode 100644 src/status_im/components/qr-code.cljs create mode 100644 src/status_im/contacts/views/new_contact.cljs create mode 100644 src/status_im/qr_scanner/screen.cljs create mode 100644 src/status_im/qr_scanner/styles.cljs diff --git a/.re-natal b/.re-natal index 1455b14c43..f5a732806b 100644 --- a/.re-natal +++ b/.re-natal @@ -16,7 +16,9 @@ "react-native-randombytes", "dismissKeyboard", "react-native-linear-gradient", - "react-native-android-sms-listener" + "react-native-android-sms-listener", + "react-native-camera", + "react-native-qrcode" ], "imageDirs": [ "images" diff --git a/android/app/build.gradle b/android/app/build.gradle index 379551061c..21e197ea42 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -130,6 +130,7 @@ dependencies { compile project(':react-native-i18n') compile project(':react-native-linear-gradient') compile project(':ReactNativeAndroidSmsListener') + compile project(':react-native-camera') // compile(name:'geth', ext:'aar') compile(group: 'status-im', name: 'android-geth', version: '1.4.0-201604110816-a97a114', ext: 'aar') diff --git a/android/app/src/main/java/com/statusim/MainActivity.java b/android/app/src/main/java/com/statusim/MainActivity.java index 3d411d9213..e60faddecc 100644 --- a/android/app/src/main/java/com/statusim/MainActivity.java +++ b/android/app/src/main/java/com/statusim/MainActivity.java @@ -18,9 +18,11 @@ import java.util.List; import java.util.Properties; import java.io.File; +import com.lwansbrough.RCTCamera.*; import com.i18n.reactnativei18n.ReactNativeI18n; import io.realm.react.RealmReactPackage; + public class MainActivity extends ReactActivity { @Override @@ -82,6 +84,7 @@ public class MainActivity extends ReactActivity { new ReactNativeI18n(), new RandomBytesPackage(), new LinearGradientPackage(), + new RCTCameraPackage(), new SmsListener(this) ); } diff --git a/android/app/src/main/res/drawable-hdpi/corner_left_bottom.png b/android/app/src/main/res/drawable-hdpi/corner_left_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..1c9c9b446d204c1b232d516d35c4239604d99a68 GIT binary patch literal 526 zcmeAS@N?(olHy`uVBq!ia0vp^At21b1|(&&1r7o!#^NA%Cx&(BWL^TmI`S~mUMy9U~OifKQL{(QT*uWr@?#$ZC`oKb3OGAg@_{{*v zL`I8qZCqU32MWzX0wNgtHZN>C#8fbcS5!o-;c?E;(8AT+_f=m^YG(P(yJp|kwLP@u zxLqjoo;#T{WW!z7bwyum^1uJS7b9SC`rpkqJ&n?J@vpsKF8)06`g7Jk?h@<$<(D-- zM9BXvm9tIZvy!j=yZk_S-Q6{xO8>Y{Rd;XU0Y)%` Mr>mdKI;Vst02?aQCIA2c literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-hdpi/corner_left_top.png b/android/app/src/main/res/drawable-hdpi/corner_left_top.png new file mode 100644 index 0000000000000000000000000000000000000000..1a0a4e57f825570d0433da1e0f026277f4261d9f GIT binary patch literal 614 zcmeAS@N?(olHy`uVBq!ia0vp^At21b1|(&&1r7o!#^NA%Cx&(BWL`2bFe!MtIEGX( zzP)SRC+sNUnkeOXDo(A5cLS%H6Njd>VxuSzr;3NL;AU1KIZ2gg`X-6h=jJ4CvQwRU zYgP5`rT?C6lij(E-PmvW<)bq9&eT|aK6&QYTh=cz!i9 zP3UFbnsk9*q#;LUg=ll#0)~{w4r?X8FtaL1vu7P$Ag{r2(;`5d?XLsliDQjXhA-H; z9L)Gegc1LkVt+Hvm45C2UfL<4aoyf2=Xz&vDt<0gU0W8pW5&DC97>IL-}KSlWDSPkf+?$VqkM~2=S<(HqHIeX^rne{Vo&n(}qAM(&K;lsW&Hnw%=I|IJoQ)&M8 zZ{-vF`T6?a;x_y}EGiMh%4LITkO~UKfhl7#c6r=Peo#O=WCW6-IUApdg6Z*;b&&+)3;xftul|! zpMN(eaq@v(&i8X}33C;|5y+9W-c(_`SLa}-7t8%`njxgN@xNAzwY@K literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-hdpi/corner_right_top.png b/android/app/src/main/res/drawable-hdpi/corner_right_top.png new file mode 100644 index 0000000000000000000000000000000000000000..6eaca3cd9a0dec8e76564134eb952fcb912091c8 GIT binary patch literal 537 zcmeAS@N?(olHy`uVBq!ia0vp^At21b1|(&&1r7o!#^NA%Cx&(BWL^Tsv?* zXZ*g-Ts`~!*Zj*z>z<{DKd`&J`<-z6Vc(l zMvHT8TwL4-3e7?SA{hEMFKjx*R4|8ER79-dan6bb8yIBLompF1A6Q5a87)1>|DKV# z8N1Ht^Bs5D#$DB~F3hSfd(rbbX7h(@JF^~|Z{B5j)>KPihih4E;>W3b&&8#_H`w0v Wq-bCK;UK?pTGuM#j>LyFO1mF0wy4_|4g8OKRk=8;0Mu&aGW- z61~ErPg477wqUm1qFViDUW~iXl<-|SI%j_D*MDW9kFRWJzO*c)RBeS<+b<)>TT@n@ zV+lPO5U=JjJLu}n1zM7?PP1eNud)&jQFX4JsgUaxn%=Z3Wre=*65o}td;+HOd`)fI zq8U1ubJe7U`+O#tEnQ{o7;1E7Iwui^?wbFA$fs>%iV_P3C9%XTJaS x-1vE}{7jd~(s_~v9dnaD?_Fy&Q`MMPyMAWSfnSa)8oa+KGPOahRV%9L)vh?X? QVE8b2y85}Sb4q9e052zm@&Et; literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-mdpi/corner_right_bottom.png b/android/app/src/main/res/drawable-mdpi/corner_right_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..e74544e83ba5fb7f65070d446f176f0bc450cad4 GIT binary patch literal 340 zcmeAS@N?(olHy`uVBq!ia0vp^79h;Q1|(OsS<3+_#^NA%Cx&(BWL^TY(NVX;BsGD`?1FXkSk#u?YwuMpUF8=a5;s@h{nw&Qn;Uf-mTtNB%EVXy z46|{v(HddJvNJ&f1xNeS+d{-8x5<4taPaRVgTwL9c{T4zPWp4w;Clmi+TkzX&F*T= z6na>kZRoE)qssEZiwfThEJvk3XlwCx+%k5Inz-Wt%TdO_YBdjSA@LatEEKZNvt+tH zViFc%cX>NgVXa3@Lery$6}G}lL_4{C0%QcXrZ;U-Ds1HJVqWykXF`~Yo`GYb!g5aT00W4@ M)78&qol`;+0EB{o`2YX_ literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xhdpi/corner_left_bottom.png b/android/app/src/main/res/drawable-xhdpi/corner_left_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..b43f25a58dabed5cf2e67658648c65a1e7892436 GIT binary patch literal 826 zcmeAS@N?(olHy`uVBq!ia0vp^1t8491|*L?_~H$u7>k44ofy`glX=O&!1Tq_#WAFU z@$Gc)ykJKW*3X-`za2Dbb2Vg2J=Jlwg;!xln(Rrfj-9$Uc^EVWwWj`=lC|>bkIBXB zR{wdudi7;1xqkD_@6+t(eEaqLSxx=SA~R+~vb`+vxkGi`ydgD`WZ#Ib(L0ZoSAN zaV znX4WrbYJ~LPxAcf@xnX&3!kr)zrOy$*P}OXX*Q}B{9Tp#cJhJ0zc_5qyt$v2|GS27 zec7whKh@>6R{nR+O+DBAyHZyt{I$f#$KQ9q`{MVk44ofy`glX=O&z?9+X;uuoF z_;$LZ*WmyOw%!WP_YbeVVBOQJ-K~9a>hhKB0wuGHw=Caq{{QqHnM!+(YVWzI>5?6F zsjzMR(!)1vw3qf2ez)seZK3!4^1oN757-qfvxsX;tnlBWSnsmO_fOTYpVsFqU*9^Q z_(D$k(Psnw_qu*_%6oP0Y;5eQn9aDo@cFwRf&bkkD$X|ScKB+{e=(bJ=lSivk9GGH z`2E;pr{^#H@QKYt;SPh$eO4)fJchpaOuQWC49CkG*;=F<9`ANwKE!+AW9$OPhingi z=v`v>4bvE^ILCUDQu(u?{$r|a~ODbLuv zG?Qi8E$VjH9%D}aEdH(OEsx6rUzuz{<9p7#!#{bc8&A;gPL@8NXZPvf*OPGk44ofy`glX=O&!1U46#WAFU z@$GeAui1$*u7!{F?zk`Kx*O~+I;Z5;)g4Tk%hw%VvuNL6`?V8;xGXo%n?6TePUsP9 z{=4%v6{S~~#wFa|cH6SQIPTuLUG=N=Vt3x>=DG6R(*D_>+P&wPzrR(9OK5oa><{<* zmYo9ckN7{_w3_!^)oPn^TRFXIwfCFlcTUeNFJAW0@PIM*-}UnAr_24kdtD{u*lvf0 zIO!`o4knY$MHXCVGvyXI`-GSE#a73&OfJTi&Wu&L0h<{v`rHc`RW>vNm0_tU&*jUW70zj;ws%eHR&*$-tc z-_ozL?y&p3t8ACUeW!A+?_s}pFwFn{S4MBw-_O5nneM{8eC4 zGvAuO_!@KU?}&uiv-p$0zx{hV{r`#gPVX#que;y7-nw1tKa1nH)tv_!9s~k&0)wZk KpUXO@geCw2SY?v{ literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xhdpi/corner_right_top.png b/android/app/src/main/res/drawable-xhdpi/corner_right_top.png new file mode 100644 index 0000000000000000000000000000000000000000..2ae2e61860b347472d92c51c192433dc42b6bdf7 GIT binary patch literal 825 zcmeAS@N?(olHy`uVBq!ia0vp^1t8491|*L?_~H$u7>k44ofy`glX=O&!1USE#WAFU z@$Gd-zu-g}*TU0!H`;?cyOUHdb{4j*E@X9EzNUGd)2si+tpbZJWv>*>v(*2&;L7Z8 z&;A9~yor-tfB0d6DgXNCd*&5a*6hk($NDY!dEU9_ck{mIhTdMQ-&}5d-_Gveo_Vi> z^gkH9wc~lT{O-re-%IEHXkEE3cIR_$nP=_W#XqP1y~XqXr^)S#J!jTkSN~8a_oe=x z*@e3No$>Pztb40hu#@3>tnYO<@rZ`)#n*r=Ht`)ZqA$L`{QK`50dtNYCEst#f0Dj3 z`;>pf?KS`ZZ=1(|<(D=8`gcx+O63X;+xfR~3#b>dGnM>K*v&91G!#Q(kvR7o|BC0e z4eD#YI8EFweDC{|Go1RtPu_6L@U^eDoIaIf`! v>#tt_a~i*D&ibP0l+XkKgL+J} literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxhdpi/corner_left_bottom.png b/android/app/src/main/res/drawable-xxhdpi/corner_left_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..0fff3412209a3c9eb4b41ee47ef81416f39ce347 GIT binary patch literal 1212 zcmeAS@N?(olHy`uVBq!ia0vp^D?pfo4M>)FFWmy97>k44ofy`glX=O&z*6Sv;uuoF z`1Y1#UU0fZ>%%)svJ=jU33TYStUAlKGQnedU;^jcHB(naFlbDutDoXEjooCI&@<7> zbtR(K8=pQdmb-c6;hQ%PcI?|{H~;f=%lNZDug{Us+rRGh>)+4W&C3IsmuDw@u$}Yy z?3{S3Yv<+X=}mRNbiic8g|k23c^mQ9ZOdcVv|OH(-`e)JUG{siIPaaEjbFKTu|KbB*!z8Vv4#1ShWke(JCP_DSzx`LaXkx;O71wv0?ZApb`-%p_)3!iWAul{Fp@Y?e4 ze7qu35n|WpTidS>KfihBhvPMsR?mZ8UpTNmCqeR0;oq6XtvC24-`RKfzs>#Kb3T8Z z!~g7y;FT#4eq`~={L5eV_4kGD+vQ(pv;Ps_Ep69buseSdusCAyboFyt=akR{0Bi>W AVgLXD literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxhdpi/corner_left_top.png b/android/app/src/main/res/drawable-xxhdpi/corner_left_top.png new file mode 100644 index 0000000000000000000000000000000000000000..e25037ece322645bda80c0051c58df5b1b32158d GIT binary patch literal 1413 zcmeAS@N?(olHy`uVBq!ia0vp^D?pfo4M>)FFWmy97>k44ofy`glX=O&z-sU5;uuoF z`1V#{UP!4-+e5xxtUh~MR3&=#T3iYnRbS2BZ4kEofUJtDj)QW~{`$i+s#N9fU7CER zc+%u)r)r*mnQ3n9VHtDBs_*#Y=ATcu7u(JKeA?1}_UFl#vMles9-QTgKVND3{OKHf zIllJopFcjcm}587LjL@7`?EifzRb20+QHs<|M@I`wM)-m-!gCXo74a7bNsWK9s6D= z6r5*T|Lj-%dJq2h_pa5?)vtKE=Xv_kr~g$q#Ch(IYFuZZzwUb-d*fbCo7n%sTbN1( zZY)0V{k7r{I6pkE>K1>lH(%P^lxcnV0zRf{ z(H%lB;^s?z-^!wQeZFJA4#%5-2hZL+?rnPaVP>JX_-l2~*T?7Pv#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mz{-9(Z$7bt0e|M*|$muq& zHh(0q%Xn1KLZNZ`=kt?oSZp6Kz58`hsKWTk@7itZ4;KHG4EW=~aFMlSpLZ@pHn}f`s3{PpT4l{QF$oUSjt&*vEFmzu7<-OR`1^wzrBC6;sy5u z#RvBJnsO;Q99Xc?<*l;AC~q_*MpMCPei$taNGlZ$SZ(4B-_Lp;WjHNZaf2^Y@PW;u zi`Q1J6HT@hWxB0mz*@6EX-m2GywfWMR;U9N$8LNIQyj>&`|i688TsRd*H6noW^tEZ zt0~5GTh-u*<<8Z$kAKh4-@Y(~BWKP5ffrw8Rcf|=ta_xlA(zQ{pZfMGAFlqnm%Dv3 zU!wq%^Rk}>C3f?F??1h#w|%bS?yjA_Os9P}wncnCI_2@-k2x{+ckk!zJ8ynJYsUJr od3vWmW&SS>=TIo%X8O-Cr?NwVeMRh5VCBx>>FVdQ&MBb@014!trT_o{ literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxxhdpi/corner_right_bottom.png b/android/app/src/main/res/drawable-xxxhdpi/corner_right_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..1fa347dffe8325dda232d092f7e4aba50a1cd9ac GIT binary patch literal 2078 zcmeAS@N?(olHy`uVBq!ia0vp^4?viM4MV87w%;uuoF z`1a00zbWZ5M-%OZ%iU8=D0v@t&u%RH40H*@@s9k}`JXWE|How9r6^4A~x{J2K%^rzC_ zpYI7MTo91>IJf`#^N%$z4D!c*W}GbN=|}zs^_he*Sm*XLdM0N5g?&7CFiL z>yDpZzGqv!cfwVs#f!RQJ^d?QU%nXnU+>dFd#?nRa-(_wpJ(rDzxBsxdyU?&74^Jz z7rR)`9Y6kW*N2b$rKF!T>3GbFn0nw(ne*#HwF6>H=WgYgBW8c$@=}Ymt^@x12K(}U zm)A_t_mY3n%iujJ?V6&&|CFUaC;k%IvNE&VK||qyz!}TNWep6oXKmwXVPfJrI7c{x zi(|v6i-)7jp{`>0+?L&tjSGSgO|FN_CbMw~Q$G`8h-}&3J zf5Ps`AEr5kKA6AJ%>M14&+lIGGoCBY``^~`U-f9LroGw(&O1Gyf7*WAf4sPE`NPA1 gX65hsd;YOBqjYD+)f?UiffYW3r>mdKI;Vst08AEDdjJ3c literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xxxhdpi/corner_right_top.png b/android/app/src/main/res/drawable-xxxhdpi/corner_right_top.png new file mode 100644 index 0000000000000000000000000000000000000000..a26ebe0e614b70ff9ceb16c1cc7457cf58619ab9 GIT binary patch literal 2001 zcmeAS@N?(olHy`uVBq!ia0vp^4?viM4MVDI*HaSW+o ze0#^yFFKr|?V?>sTBKv!+a;e<6er{@ow%u0Ej#nD(}^9E)tt=&(k8yT*PZjkq%-QH zGJp;Yr9-p*`;Sl&y&$RvV<-B7b z^JKywSM1g~eZ27R$<&`u;vdT^?-PIg>a0cGkMGC-%w}k0=iVcKdb;wV?YFlV$UoqC zpHuVTdf}fv}|IV3D+`h4>3RgRDED_7sozq{qfHiJE$4<@q2_1&K9U-S9byWX?Y z=k7mSzC%D^gLvco8t#iF4F)0J&(HHhocPsca9uZ{}9^v@yV87uh`{3G`@Y$C~sh{=&*o; zW5bJ^LLE#@Jq^!Tx*8a|=jk?TC>-F(@EesH4UN&XF`6AlVBs)t(Sf&o@?X|6l&^TX z%+KjTT6_N|w+8DgCBf>7AM${lC@803>tXkur*GeSc(*8+r7t95Yt-ES$A2weJw0E@ z{M`MQ!ChUZjs (merge {:inverted true} props)))) \ No newline at end of file diff --git a/src/status_im/components/qr-code.cljs b/src/status_im/components/qr-code.cljs new file mode 100644 index 0000000000..6c1d7d066d --- /dev/null +++ b/src/status_im/components/qr-code.cljs @@ -0,0 +1,7 @@ +(ns status-im.components.qr-code + (:require [reagent.core :as r])) + +(def class (js/require "react-native-qrcode")) + +(defn qr-code [props] + (r/create-element class (clj->js (merge {:inverted true} props)))) \ No newline at end of file diff --git a/src/status_im/components/styles.cljs b/src/status_im/components/styles.cljs index 5aa0bf675d..7625353a19 100644 --- a/src/status_im/components/styles.cljs +++ b/src/status_im/components/styles.cljs @@ -28,5 +28,29 @@ (def toolbar-background2 color-light-gray) (def default-chat-color color-purple) +(def toolbar-height 56) + (def flex {:style {:flex 1}}) + +(def hamburger-icon + {:width 16 + :height 12}) + +(def search-icon + {:width 17 + :height 17}) + +(def create-icon + {:fontSize 20 + :height 22 + :color :white}) + +(def import-qr-icon + {:margin 4}) + +(def form-text-input + {:marginLeft -4 + :fontSize 14 + :fontFamily font + :color text1-color}) diff --git a/src/status_im/components/toolbar.cljs b/src/status_im/components/toolbar.cljs index 3f21fc8a35..832fa5811e 100644 --- a/src/status_im/components/toolbar.cljs +++ b/src/status_im/components/toolbar.cljs @@ -1,18 +1,19 @@ (ns status-im.components.toolbar (:require [re-frame.core :refer [subscribe dispatch]] [status-im.components.react :refer [view - text-input - icon - text - image - touchable-highlight]] + text-input + icon + text + image + touchable-highlight]] [status-im.components.styles :refer [font - title-font - color-white - color-purple - text1-color - text2-color - toolbar-background1]] + title-font + color-white + color-purple + text1-color + text2-color + toolbar-background1 + toolbar-height]] [status-im.components.realm :refer [list-view]] [reagent.core :as r])) @@ -20,7 +21,7 @@ background-color custom-content style]}] (let [style (merge {:flexDirection :row :backgroundColor (or background-color toolbar-background1) - :height 56 + :height toolbar-height :elevation 2} style)] [view {:style style} (when (not hide-nav?) diff --git a/src/status_im/contacts/handlers.cljs b/src/status_im/contacts/handlers.cljs index 268b701815..aad3ec2bd6 100644 --- a/src/status_im/contacts/handlers.cljs +++ b/src/status_im/contacts/handlers.cljs @@ -99,3 +99,15 @@ (register-handler :add-contacts (after save-contacts!) add-new-contacts) + +(defn add-new-contact [db [_ {:keys [whisper-identity] :as contact}]] + (-> db + (update :contacts assoc whisper-identity contact) + (assoc :new-contact {:name "" + :address "" + :whisper-identity "" + :phone-number ""}))) + +(register-handler :add-new-contact + (after save-contact) + add-new-contact) \ No newline at end of file diff --git a/src/status_im/contacts/screen.cljs b/src/status_im/contacts/screen.cljs index b8672807da..e1502b171a 100644 --- a/src/status_im/contacts/screen.cljs +++ b/src/status_im/contacts/screen.cljs @@ -6,9 +6,18 @@ touchable-highlight list-view list-item]] + [status-im.components.action-button :refer [action-button + action-button-item]] [status-im.contacts.views.contact :refer [contact-view]] [status-im.components.styles :refer [toolbar-background2]] [status-im.components.toolbar :refer [toolbar]] + [status-im.components.drawer.view :refer [drawer-view open-drawer]] + [status-im.components.icons.ionicons :refer [icon]] + [status-im.components.styles :refer [color-blue + hamburger-icon + search-icon + create-icon + toolbar-background2]] [status-im.contacts.styles :as st] [status-im.utils.listview :as lw] [status-im.i18n :refer [label]])) @@ -17,20 +26,34 @@ (list-item [contact-view row])) (defn contact-list-toolbar [] - [toolbar {:title (label :t/contacts) + [toolbar {:nav-action {:image {:source {:uri :icon_hamburger} + :style hamburger-icon} + :handler open-drawer} + :title (label :t/contacts) :background-color toolbar-background2 :action {:image {:source {:uri :icon_search} - :style st/search-icon} + :style search-icon} :handler (fn [])}}]) (defview contact-list [] [contacts [:get-contacts]] - [view st/contacts-list-container - [contact-list-toolbar] - ;; todo what if there is no contacts, should we show some information - ;; about this? - (when contacts - [list-view {:dataSource (lw/to-datasource contacts) - :enableEmptySections true - :renderRow render-row - :style st/contacts-list}])]) + [drawer-view + [view st/contacts-list-container + [contact-list-toolbar] + ;; todo what if there is no contacts, should we show some information + ;; about this? + (when contacts + [list-view {:dataSource (lw/to-datasource contacts) + :enableEmptySections true + :renderRow render-row + :style st/contacts-list}]) + [action-button {:buttonColor color-blue + :offsetY 16 + :offsetX 16} + [action-button-item + {:title (label :t/new-contact) + :buttonColor :#9b59b6 + :onPress #(dispatch [:navigate-to :new-contact])} + [icon {:name :android-create + :style create-icon}]] + ]]]) diff --git a/src/status_im/contacts/styles.cljs b/src/status_im/contacts/styles.cljs index 4cbec2cdff..4c066ffa7c 100644 --- a/src/status_im/contacts/styles.cljs +++ b/src/status_im/contacts/styles.cljs @@ -1,13 +1,12 @@ (ns status-im.contacts.styles (:require [status-im.components.styles :refer [font - title-font - text1-color - color-white - online-color]])) + title-font + text1-color + color-white + toolbar-background2 + online-color]])) + -(def search-icon - {:width 17 - :height 17}) (def contacts-list-container {:flex 1 @@ -67,3 +66,23 @@ :fontSize 16 :fontFamily font :color text1-color}) + +(def import-qr-button + {:flex 1 + :height 50 + :alignItems :center + :backgroundColor "#EFF4F6"}) + +(def import-qr-button-content + {:flex 1 + :flexDirection :row + :height 50 + :alignItems :center + :alignSelf :center}) + +(def import-qr-text + {:flexDirection :column}) + +(def contact-form-container + {:flex 1 + :backgroundColor :white}) \ No newline at end of file diff --git a/src/status_im/contacts/views/new_contact.cljs b/src/status_im/contacts/views/new_contact.cljs new file mode 100644 index 0000000000..8b5864be3f --- /dev/null +++ b/src/status_im/contacts/views/new_contact.cljs @@ -0,0 +1,70 @@ +(ns status-im.contacts.views.new-contact + (:require-macros [status-im.utils.views :refer [defview]]) + (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] + [status-im.components.react :refer [view + text + text-input + image + touchable-highlight + list-view + list-item]] + [status-im.components.action-button :refer [action-button + action-button-item]] + [status-im.components.styles :refer [toolbar-background2]] + [status-im.components.toolbar :refer [toolbar]] + [status-im.components.drawer.view :refer [drawer-view open-drawer]] + [status-im.components.icons.ionicons :refer [icon]] + [status-im.components.styles :refer [color-blue + color-purple + hamburger-icon + search-icon + create-icon + import-qr-icon + toolbar-background2 + form-text-input]] + [status-im.i18n :refer [label]] + [status-im.contacts.styles :as st])) + +(defn import-qr-button [] + [touchable-highlight {:on-press #(dispatch [:navigate-to + :qr-scanner])} + [view st/import-qr-button + [view st/import-qr-button-content + [icon {:name :qr-scanner + :style import-qr-icon}] + [text {:style st/import-qr-text} (label :t/import-qr)]]]]) + +(defview contact-name-input [name] + [] + [text-input + {:underlineColorAndroid color-purple + :style form-text-input + :autoFocus true + :placeholder (label :t/contact-name) + :onChangeText #(dispatch [:set-in [:new-contact :name] %])} + name]) + +(defview contact-address-input [address] + [] + [text-input + {:underlineColorAndroid color-purple + :style form-text-input + :autoFocus true + :placeholder (label :t/contact-address) + :onChangeText #(dispatch [:set-in [:new-contact :address] %])} + address]) + +(defview new-contact [] + [{:keys [name address whisper-identity phone-number] :as new-contact} [:get :new-contact]] + [drawer-view + [view st/contact-form-container + [toolbar {:title (label :t/new-contact) + :background-color toolbar-background2 + :action {:image {:source {:uri :icon_add_gray} + :style search-icon} + :handler (fn [] (dispatch [:add-new-contact new-contact]))}}] + [import-qr-button] + [contact-name-input name] + [contact-address-input address] + [text (str "Whisper identity: " whisper-identity)] + ]]) \ No newline at end of file diff --git a/src/status_im/db.cljs b/src/status_im/db.cljs index a46c61f087..4dee5734f3 100644 --- a/src/status_im/db.cljs +++ b/src/status_im/db.cljs @@ -29,6 +29,10 @@ :email "myemail@gmail.com" :status "Hi, this is my status" :current-tag nil + :new-contact {:name "" + :address "" + :whisper-identity "" + :phone-number ""} :disable-group-creation false}) (def protocol-initialized-path [:protocol-initialized]) diff --git a/src/status_im/profile/screen.cljs b/src/status_im/profile/screen.cljs index f2de5dcb41..072f82a2c2 100644 --- a/src/status_im/profile/screen.cljs +++ b/src/status_im/profile/screen.cljs @@ -11,6 +11,8 @@ [status-im.components.chat-icon.screen :refer [profile-icon my-profile-icon]] [status-im.profile.styles :as st] + [status-im.components.qr-code :refer [qr-code]] + [status-im.utils.types :refer [clj->json]] [status-im.i18n :refer [label]])) (defn profile-property-view [{:keys [name value]}] @@ -64,8 +66,9 @@ photo-path [:get :photo-path] phone-number [:get :phone-number] email [:get :email] - status [:get :status]] - [scroll-view {:style st/profile} + status [:get :status] + identity [:get :identity]] + [view {:style st/profile} [touchable-highlight {:style st/back-btn-touchable :on-press #(dispatch [:navigate-back])} [view st/back-btn-container @@ -81,10 +84,16 @@ [my-profile-icon]] [text {:style st/user-name} username] [text {:style st/status} status]] - [view st/profile-properties-container + [scroll-view st/profile-properties-container [profile-property-view {:name (label :t/username) :value username}] [profile-property-view {:name (label :t/phone-number) :value phone-number}] [profile-property-view {:name (label :t/email) - :value email}]]]) + :value email}] + [view st/qr-code-container + [qr-code {:value (clj->json {:name username + :phone-number phone-number + :address email + :whisper-identity identity}) + :size 150}]]]]) diff --git a/src/status_im/profile/styles.cljs b/src/status_im/profile/styles.cljs index 95d230920e..fcaaad9b54 100644 --- a/src/status_im/profile/styles.cljs +++ b/src/status_im/profile/styles.cljs @@ -135,3 +135,8 @@ :color text2-color ;; IOS: :letterSpacing 0.5}) + +(def qr-code-container + {:flex 1 + :alignItems :center + :margin 15}) diff --git a/src/status_im/qr_scanner/screen.cljs b/src/status_im/qr_scanner/screen.cljs new file mode 100644 index 0000000000..79be0aef07 --- /dev/null +++ b/src/status_im/qr_scanner/screen.cljs @@ -0,0 +1,43 @@ +(ns status-im.qr-scanner.screen + (:require-macros [status-im.utils.views :refer [defview]]) + (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] + [status-im.components.react :refer [view + icon + text + image + touchable-highlight]] + [status-im.components.camera :refer [camera]] + [status-im.components.styles :refer [toolbar-background2]] + [status-im.components.toolbar :refer [toolbar]] + [status-im.components.icons.ionicons :refer [icon]] + [status-im.components.styles :refer [color-blue]] + [status-im.i18n :refer [label]] + [status-im.qr-scanner.styles :as st] + [status-im.utils.logging :as log])) + +(defn qr-scanner-toolbar [] + [toolbar {:title (label :t/new-contact) + :background-color toolbar-background2}]) + +(defview qr-scanner [] + [] + [view st/barcode-scanner-container + [qr-scanner-toolbar] + [camera {:onBarCodeRead (fn [{:keys [name address whisper-identity phone-number] :as contact}] + (when name (dispatch [:set-in [:new-contact :name] name])) + (when address (dispatch [:set-in [:new-contact :address] address])) + (when whisper-identity (dispatch [:set-in [:new-contact :whisper-identity] whisper-identity])) + (when phone-number (dispatch [:set-in [:new-contact :phone-number] phone-number])) + (dispatch [:navigate-back])) + :style st/barcode-scanner}] + [view st/rectangle-container + [view st/rectangle + [image {:source {:uri :corner_left_top} + :style st/corner-left-top}] + [image {:source {:uri :corner_right_top} + :style st/corner-right-top}] + [image {:source {:uri :corner_right_bottom} + :style st/corner-right-bottom}] + [image {:source {:uri :corner_left_bottom} + :style st/corner-left-bottom}]]] + ]) \ No newline at end of file diff --git a/src/status_im/qr_scanner/styles.cljs b/src/status_im/qr_scanner/styles.cljs new file mode 100644 index 0000000000..687854a3d8 --- /dev/null +++ b/src/status_im/qr_scanner/styles.cljs @@ -0,0 +1,59 @@ +(ns status-im.qr-scanner.styles + (:require [status-im.components.styles :refer [toolbar-height]])) + +(def barcode-scanner-container + {:flex 1 + :backgroundColor :white}) + +(def barcode-scanner + {:flex 1 + :justifyContent :flex-end + :alignItems :center}) + +(def rectangle-container + {:position :absolute + :left 0 + :top toolbar-height + :bottom 0 + :right 0 + :flex 1 + :alignItems :center + :justifyContent :center + :backgroundColor :transparent}) + +(def rectangle + {:height 250 + :width 250 + :backgroundColor :transparent}) + +(def corner-left-top + {:position :absolute + :left 0 + :top 0 + :width 56 + :height 56}) + +(def corner-right-top + {:position :absolute + :right 0 + :top 0 + :width 56 + :height 56}) + +(def corner-right-bottom + {:position :absolute + :right 0 + :bottom 0 + :width 56 + :height 56}) + +(def corner-left-bottom + {:position :absolute + :left 0 + :bottom 0 + :width 56 + :height 56}) + + +;:width 56 +;:height 56 \ No newline at end of file diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index be71f9037b..8f9b77e7b3 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -70,6 +70,7 @@ ;contacts :contacts "Contacts" :no-name "Noname" + :new-contact "New Contact" ;group-settings :remove "Remove" @@ -112,4 +113,9 @@ :removed "removed" :You "You" + ;new-contact + :import-qr "Import from QR" + :contact-name "Contact Name" + :contact-address "Contact Address" + }) \ No newline at end of file diff --git a/src/status_im/utils/types.cljs b/src/status_im/utils/types.cljs index aa256f0056..5476d58b27 100644 --- a/src/status_im/utils/types.cljs +++ b/src/status_im/utils/types.cljs @@ -6,4 +6,7 @@ s)) (defn to-edn-string [value] - (with-out-str (pr value))) \ No newline at end of file + (with-out-str (pr value))) + +(defn clj->json [ds] + (.stringify js/JSON (clj->js ds))) \ No newline at end of file