From d094cd286c54695b3fa5a2606eb115d175a74eb4 Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Wed, 1 Jun 2016 11:41:50 +0300 Subject: [PATCH 01/10] 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?7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K&%(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 From 4870fef74ba984de95d6b775c94805c7db6c63e6 Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Wed, 1 Jun 2016 14:01:58 +0300 Subject: [PATCH 02/10] fix qr code decoding and remove extra data Former-commit-id: 755e9bf2b3afe92d0bf426cd47b7bbfa572f7c82 --- src/status_im/profile/screen.cljs | 6 ++---- src/status_im/qr_scanner/screen.cljs | 14 ++++++++------ src/status_im/utils/types.cljs | 7 +++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/status_im/profile/screen.cljs b/src/status_im/profile/screen.cljs index 072f82a2c2..4451febd36 100644 --- a/src/status_im/profile/screen.cljs +++ b/src/status_im/profile/screen.cljs @@ -67,7 +67,7 @@ phone-number [:get :phone-number] email [:get :email] status [:get :status] - identity [:get :identity]] + identity [:get-in [:user-identity :public]]] [view {:style st/profile} [touchable-highlight {:style st/back-btn-touchable :on-press #(dispatch [:navigate-back])} @@ -93,7 +93,5 @@ :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}]]]]) + :size 200}]]]]) diff --git a/src/status_im/qr_scanner/screen.cljs b/src/status_im/qr_scanner/screen.cljs index 79be0aef07..a791042f87 100644 --- a/src/status_im/qr_scanner/screen.cljs +++ b/src/status_im/qr_scanner/screen.cljs @@ -13,6 +13,7 @@ [status-im.components.styles :refer [color-blue]] [status-im.i18n :refer [label]] [status-im.qr-scanner.styles :as st] + [status-im.utils.types :refer [json->clj]] [status-im.utils.logging :as log])) (defn qr-scanner-toolbar [] @@ -23,12 +24,13 @@ [] [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])) + [camera {:onBarCodeRead (fn [data] + (let [{:keys [name address whisper-identity phone-number] :as contact} (json->clj (.-data data))] + (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 diff --git a/src/status_im/utils/types.cljs b/src/status_im/utils/types.cljs index 5476d58b27..6ce9fdfce8 100644 --- a/src/status_im/utils/types.cljs +++ b/src/status_im/utils/types.cljs @@ -8,5 +8,8 @@ (defn to-edn-string [value] (with-out-str (pr value))) -(defn clj->json [ds] - (.stringify js/JSON (clj->js ds))) \ No newline at end of file +(defn clj->json [data] + (.stringify js/JSON (clj->js data))) + +(defn json->clj [data] + (js->clj (.parse js/JSON data))) \ No newline at end of file From 8250e8d225aedaa37e72dce3897477fc3f7d6b9c Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Wed, 1 Jun 2016 14:35:22 +0300 Subject: [PATCH 03/10] fix translation pluralization Former-commit-id: 13c506491fb4181ee8df9fcec8a0426fb2067f7f --- src/status_im/chat/screen.cljs | 16 ++++++++-------- src/status_im/i18n.cljs | 3 +++ src/status_im/translations/en.cljs | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index 8c20bb1136..3ff250e238 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -3,12 +3,12 @@ (:require [re-frame.core :refer [subscribe dispatch]] [clojure.string :as s] [status-im.components.react :refer [view - text - image - icon - touchable-highlight - list-view - list-item]] + text + image + icon + touchable-highlight + list-view + list-item]] [status-im.components.chat-icon.screen :refer [chat-icon-view-action chat-icon-view-menu-item]] [status-im.chat.styles.screen :as st] @@ -18,7 +18,7 @@ [status-im.components.toolbar :refer [toolbar]] [status-im.chat.views.message :refer [chat-message]] [status-im.chat.views.new-message :refer [chat-message-new]] - [status-im.i18n :refer [label]])) + [status-im.i18n :refer [label label-pluralize]])) (defn contacts-by-identity [contacts] @@ -186,7 +186,7 @@ [icon :group st/group-icon] [text {:style st/members} (let [cnt (inc (count @contacts))] - (label :t/members {:count cnt}))]] + (label-pluralize cnt :t/members))]] ;; TODO stub data: last activity [text {:style st/last-activity} (label :t/last-active)])]))) diff --git a/src/status_im/i18n.cljs b/src/status_im/i18n.cljs index 9abde5c46e..ae33e2f243 100644 --- a/src/status_im/i18n.cljs +++ b/src/status_im/i18n.cljs @@ -11,6 +11,9 @@ (defn label [path & options] (.t js/I18n (name path) (clj->js options))) +(defn label-pluralize [count path] + (.p js/I18n count (name path))) + (comment (defn deep-merge [& maps] (if (every? map? maps) diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index 8f9b77e7b3..cf3424d440 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -18,7 +18,8 @@ :and-you "and you" :search-chat "Search chat" :members {:one "1 member, 1 active" - :other "{{count}} members, {{count}} active"} + :other "{{count}} members, {{count}} active" + :zero "no members"} :last-active "Active a minute ago" ;profile From a156c8f865fa3671cd05bb2eda8299ed371a50fe Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Thu, 2 Jun 2016 13:43:26 +0300 Subject: [PATCH 04/10] make qr-scanner callable multiple times from different screens Former-commit-id: 6eeefb2efbd460376eb00b9714422e1c23724402 --- src/status_im/contacts/handlers.cljs | 12 +++++++++++- src/status_im/contacts/views/new_contact.cljs | 13 ++++++++----- src/status_im/db.cljs | 1 + src/status_im/handlers.cljs | 1 + src/status_im/i18n.cljs | 4 ++-- src/status_im/qr_scanner/handlers.cljs | 12 ++++++++++++ src/status_im/qr_scanner/screen.cljs | 9 +++------ 7 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 src/status_im/qr_scanner/handlers.cljs diff --git a/src/status_im/contacts/handlers.cljs b/src/status_im/contacts/handlers.cljs index aad3ec2bd6..4d6237bd55 100644 --- a/src/status_im/contacts/handlers.cljs +++ b/src/status_im/contacts/handlers.cljs @@ -110,4 +110,14 @@ (register-handler :add-new-contact (after save-contact) - add-new-contact) \ No newline at end of file + add-new-contact) + +(defn set-new-contact-from-qr [db [_ identifier]] + (let [new-contact (:new-contact db) + qr-contact (get-in db [:qr-codes identifier])] + (-> db + (assoc :new-contact (merge new-contact qr-contact)) + (update-in db [:qr-codes] dissoc identifier)))) + +(register-handler :set-new-contact-from-qr + (-> set-new-contact-from-qr)) \ 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 index 8b5864be3f..955e92b648 100644 --- a/src/status_im/contacts/views/new_contact.cljs +++ b/src/status_im/contacts/views/new_contact.cljs @@ -23,11 +23,11 @@ toolbar-background2 form-text-input]] [status-im.i18n :refer [label]] - [status-im.contacts.styles :as st])) + [status-im.contacts.styles :as st] + [status-im.utils.logging :as log])) (defn import-qr-button [] - [touchable-highlight {:on-press #(dispatch [:navigate-to - :qr-scanner])} + [touchable-highlight {:on-press #(dispatch [:scan-qr-code :new-contact])} [view st/import-qr-button [view st/import-qr-button-content [icon {:name :qr-scanner @@ -55,7 +55,10 @@ address]) (defview new-contact [] - [{:keys [name address whisper-identity phone-number] :as new-contact} [:get :new-contact]] + [{:keys [name address whisper-identity phone-number] :as new-contact} [:get :new-contact] + qr-contact [:get-in [:qr-codes :new-contact]]] + (let [_ (log/debug qr-contact) + _ (when qr-contact (dispatch [:set-new-contact-from-qr :new-contact]))] [drawer-view [view st/contact-form-container [toolbar {:title (label :t/new-contact) @@ -67,4 +70,4 @@ [contact-name-input name] [contact-address-input address] [text (str "Whisper identity: " whisper-identity)] - ]]) \ No newline at end of file + ]])) \ No newline at end of file diff --git a/src/status_im/db.cljs b/src/status_im/db.cljs index 4dee5734f3..c8ebde0d3b 100644 --- a/src/status_im/db.cljs +++ b/src/status_im/db.cljs @@ -29,6 +29,7 @@ :email "myemail@gmail.com" :status "Hi, this is my status" :current-tag nil + :qr-codes {:identifier nil} :new-contact {:name "" :address "" :whisper-identity "" diff --git a/src/status_im/handlers.cljs b/src/status_im/handlers.cljs index 4010049665..a5c839bf61 100644 --- a/src/status_im/handlers.cljs +++ b/src/status_im/handlers.cljs @@ -17,6 +17,7 @@ status-im.discovery.handlers status-im.new-group.handlers status-im.participants.handlers + status-im.qr-scanner.handlers status-im.protocol.handlers)) ;; -- Middleware ------------------------------------------------------------ diff --git a/src/status_im/i18n.cljs b/src/status_im/i18n.cljs index ae33e2f243..de557041fc 100644 --- a/src/status_im/i18n.cljs +++ b/src/status_im/i18n.cljs @@ -11,8 +11,8 @@ (defn label [path & options] (.t js/I18n (name path) (clj->js options))) -(defn label-pluralize [count path] - (.p js/I18n count (name path))) +(defn label-pluralize [count path & options] + (.p js/I18n count (name path) (clj->js options))) (comment (defn deep-merge [& maps] diff --git a/src/status_im/qr_scanner/handlers.cljs b/src/status_im/qr_scanner/handlers.cljs new file mode 100644 index 0000000000..b8bc1bb300 --- /dev/null +++ b/src/status_im/qr_scanner/handlers.cljs @@ -0,0 +1,12 @@ +(ns status-im.qr-scanner.handlers + (:require [re-frame.core :refer [register-handler after dispatch debug enrich]])) + +(defn set-current-identifier [db [_ identifier]] + (assoc-in db [:qr-codes :identifier] identifier)) + +(register-handler :scan-qr-code + (-> set-current-identifier + ((after (fn [_ _] (dispatch [:navigate-to :qr-scanner])))))) + +(register-handler :clear-qr-code [db [_ identifier]] + (update-in db [:qr-codes] dissoc identifier)) diff --git a/src/status_im/qr_scanner/screen.cljs b/src/status_im/qr_scanner/screen.cljs index a791042f87..f0846830ca 100644 --- a/src/status_im/qr_scanner/screen.cljs +++ b/src/status_im/qr_scanner/screen.cljs @@ -21,15 +21,12 @@ :background-color toolbar-background2}]) (defview qr-scanner [] - [] + [identifier [:get-in [:qr-codes :identifier]]] [view st/barcode-scanner-container [qr-scanner-toolbar] [camera {:onBarCodeRead (fn [data] - (let [{:keys [name address whisper-identity phone-number] :as contact} (json->clj (.-data data))] - (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])) + (let [data (json->clj (.-data data))] + (dispatch [:set-in [:qr-codes (or identifier :current)] data]) (dispatch [:navigate-back]))) :style st/barcode-scanner}] [view st/rectangle-container From ea06b2da584d06aa99a7678f5c4073608fbded5c Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 2 Jun 2016 15:48:57 +0300 Subject: [PATCH 05/10] fix label function Former-commit-id: 11edd55b5a5a8205195c02e52cd3fc20a606889a --- src/status_im/chat/screen.cljs | 4 ++-- src/status_im/i18n.cljs | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index 3ff250e238..a77f78bcc0 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -18,7 +18,7 @@ [status-im.components.toolbar :refer [toolbar]] [status-im.chat.views.message :refer [chat-message]] [status-im.chat.views.new-message :refer [chat-message-new]] - [status-im.i18n :refer [label label-pluralize]])) + хыефегы-шьюш18т Жкуаук хдфиудъъ)) (defn contacts-by-identity [contacts] @@ -186,7 +186,7 @@ [icon :group st/group-icon] [text {:style st/members} (let [cnt (inc (count @contacts))] - (label-pluralize cnt :t/members))]] + (label :t/members {:count cnt}))]] ;; TODO stub data: last activity [text {:style st/last-activity} (label :t/last-active)])]))) diff --git a/src/status_im/i18n.cljs b/src/status_im/i18n.cljs index de557041fc..6d3815715a 100644 --- a/src/status_im/i18n.cljs +++ b/src/status_im/i18n.cljs @@ -8,11 +8,10 @@ (set! (.-translations js.I18n) (clj->js {:en en/translations})) -(defn label [path & options] - (.t js/I18n (name path) (clj->js options))) - -(defn label-pluralize [count path & options] - (.p js/I18n count (name path) (clj->js options))) +(defn label + ([path] (label path {})) + ([path options] + (.t js/I18n (name path) (clj->js options)))) (comment (defn deep-merge [& maps] @@ -23,4 +22,4 @@ (defn add-translations [new-translations] (let [translations (.-translations js/I18n)] (set! (.-translations js/I18n) (clj->js (deep-merge (js->clj translations) new-translations))))) - ) \ No newline at end of file + ) From 18e6b80e181af496505a80c4eefbd8a93bb8b27f Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 2 Jun 2016 15:57:33 +0300 Subject: [PATCH 06/10] fix typo Former-commit-id: 485718d8719411456968560a56f58172a0d85299 --- src/status_im/chat/screen.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index a77f78bcc0..b405ca3adb 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -18,7 +18,7 @@ [status-im.components.toolbar :refer [toolbar]] [status-im.chat.views.message :refer [chat-message]] [status-im.chat.views.new-message :refer [chat-message-new]] - хыефегы-шьюш18т Жкуаук хдфиудъъ)) + [status-im.i18n :refer [label]])) (defn contacts-by-identity [contacts] From 1d3a91c0ee4e103cc9f22646e4599fc4e025b998 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 2 Jun 2016 17:39:26 +0300 Subject: [PATCH 07/10] updated qr flow Former-commit-id: db46a3a3cb4de5ef843759751661d9f41d8f26ad --- src/status_im/contacts/handlers.cljs | 13 ++---- src/status_im/contacts/views/new_contact.cljs | 46 +++++++++---------- src/status_im/db.cljs | 2 +- src/status_im/qr_scanner/handlers.cljs | 41 ++++++++++++++--- src/status_im/qr_scanner/screen.cljs | 14 +++--- src/status_im/utils/types.cljs | 2 +- 6 files changed, 68 insertions(+), 50 deletions(-) diff --git a/src/status_im/contacts/handlers.cljs b/src/status_im/contacts/handlers.cljs index 4d6237bd55..6e50de8e78 100644 --- a/src/status_im/contacts/handlers.cljs +++ b/src/status_im/contacts/handlers.cljs @@ -112,12 +112,9 @@ (after save-contact) add-new-contact) -(defn set-new-contact-from-qr [db [_ identifier]] - (let [new-contact (:new-contact db) - qr-contact (get-in db [:qr-codes identifier])] - (-> db - (assoc :new-contact (merge new-contact qr-contact)) - (update-in db [:qr-codes] dissoc identifier)))) +(defn set-new-contact-from-qr + [{:keys [new-contact] :as db} [_ _ qr-contact]] + (println "WWUUUUUUTTT" qr-contact) + (assoc db :new-contact (merge new-contact qr-contact))) -(register-handler :set-new-contact-from-qr - (-> set-new-contact-from-qr)) \ No newline at end of file +(register-handler :set-new-contact-from-qr set-new-contact-from-qr) diff --git a/src/status_im/contacts/views/new_contact.cljs b/src/status_im/contacts/views/new_contact.cljs index 955e92b648..3920aeed49 100644 --- a/src/status_im/contacts/views/new_contact.cljs +++ b/src/status_im/contacts/views/new_contact.cljs @@ -27,47 +27,43 @@ [status-im.utils.logging :as log])) (defn import-qr-button [] - [touchable-highlight {:on-press #(dispatch [:scan-qr-code :new-contact])} + [touchable-highlight + {:on-press #(dispatch [:scan-qr-code :new-contact :set-new-contact-from-qr])} [view st/import-qr-button [view st/import-qr-button-content - [icon {:name :qr-scanner + [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]) + [] + [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]) + [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] - qr-contact [:get-in [:qr-codes :new-contact]]] - (let [_ (log/debug qr-contact) - _ (when qr-contact (dispatch [:set-new-contact-from-qr :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]))}}] + :handler #(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 + [text (str "Whisper identity: " whisper-identity)]]]) diff --git a/src/status_im/db.cljs b/src/status_im/db.cljs index c8ebde0d3b..283a09a1a9 100644 --- a/src/status_im/db.cljs +++ b/src/status_im/db.cljs @@ -29,7 +29,7 @@ :email "myemail@gmail.com" :status "Hi, this is my status" :current-tag nil - :qr-codes {:identifier nil} + :qr-codes {} :new-contact {:name "" :address "" :whisper-identity "" diff --git a/src/status_im/qr_scanner/handlers.cljs b/src/status_im/qr_scanner/handlers.cljs index b8bc1bb300..27ae0b5eca 100644 --- a/src/status_im/qr_scanner/handlers.cljs +++ b/src/status_im/qr_scanner/handlers.cljs @@ -1,12 +1,39 @@ (ns status-im.qr-scanner.handlers - (:require [re-frame.core :refer [register-handler after dispatch debug enrich]])) + (:require [re-frame.core :refer [register-handler after dispatch debug enrich]] + [status-im.navigation.handlers :as nav] + [status-im.utils.handlers :as u])) -(defn set-current-identifier [db [_ identifier]] - (assoc-in db [:qr-codes :identifier] identifier)) +(defmethod nav/preload-data! :qr-scanner + [db [_ _ identifier]] + (assoc db :current-qr-context identifier)) + +(defn set-current-identifier [db [_ identifier handler]] + (assoc-in db [:qr-codes identifier] handler)) + +(defn navigate-to-scanner + [_ [_ identifier]] + (dispatch [:navigate-to :qr-scanner identifier])) (register-handler :scan-qr-code - (-> set-current-identifier - ((after (fn [_ _] (dispatch [:navigate-to :qr-scanner])))))) + (after navigate-to-scanner) + set-current-identifier) -(register-handler :clear-qr-code [db [_ identifier]] - (update-in db [:qr-codes] dissoc identifier)) +(register-handler :clear-qr-code + (fn [db [_ identifier]] + (update db :qr-codes dissoc identifier))) + +(defn handle-qr-request + [db [_ context data]] + (let [handler (get-in db [:qr-codes context])] + (println handler context data) + (dispatch [handler context data]))) + +(defn clear-qr-request [db [_ context]] + (-> db + (update :qr-codes dissoc context) + (dissoc :current-qr-context))) + +(register-handler :set-qr-code + (-> (u/side-effect! handle-qr-request) + ((enrich clear-qr-request)) + ((after #(dispatch [:navigate-back]))))) diff --git a/src/status_im/qr_scanner/screen.cljs b/src/status_im/qr_scanner/screen.cljs index f0846830ca..430afc3582 100644 --- a/src/status_im/qr_scanner/screen.cljs +++ b/src/status_im/qr_scanner/screen.cljs @@ -21,14 +21,13 @@ :background-color toolbar-background2}]) (defview qr-scanner [] - [identifier [:get-in [:qr-codes :identifier]]] + [identifier [:get :current-qr-context]] [view st/barcode-scanner-container [qr-scanner-toolbar] - [camera {:onBarCodeRead (fn [data] - (let [data (json->clj (.-data data))] - (dispatch [:set-in [:qr-codes (or identifier :current)] data]) - (dispatch [:navigate-back]))) - :style st/barcode-scanner}] + [camera {;:on-bar-code-read #(js/alert "ok") + :onBarCodeRead #(let [data (json->clj (.-data %))] + (dispatch [:set-qr-code identifier data])) + :style st/barcode-scanner}] [view st/rectangle-container [view st/rectangle [image {:source {:uri :corner_left_top} @@ -38,5 +37,4 @@ [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 + :style st/corner-left-bottom}]]]]) diff --git a/src/status_im/utils/types.cljs b/src/status_im/utils/types.cljs index 6ce9fdfce8..93c942df77 100644 --- a/src/status_im/utils/types.cljs +++ b/src/status_im/utils/types.cljs @@ -12,4 +12,4 @@ (.stringify js/JSON (clj->js data))) (defn json->clj [data] - (js->clj (.parse js/JSON data))) \ No newline at end of file + (js->clj (.parse js/JSON data) :keywordize-keys true)) From 13d689bb4a0e64ff95920bc72970c698ba2af2ba Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 2 Jun 2016 17:40:58 +0300 Subject: [PATCH 08/10] println Former-commit-id: 72b9afce9985c73a1c98a13cdbd7615da775cd4a --- src/status_im/contacts/handlers.cljs | 1 - src/status_im/qr_scanner/handlers.cljs | 1 - src/status_im/utils/subs.cljs | 1 - 3 files changed, 3 deletions(-) diff --git a/src/status_im/contacts/handlers.cljs b/src/status_im/contacts/handlers.cljs index 6e50de8e78..b374edd438 100644 --- a/src/status_im/contacts/handlers.cljs +++ b/src/status_im/contacts/handlers.cljs @@ -114,7 +114,6 @@ (defn set-new-contact-from-qr [{:keys [new-contact] :as db} [_ _ qr-contact]] - (println "WWUUUUUUTTT" qr-contact) (assoc db :new-contact (merge new-contact qr-contact))) (register-handler :set-new-contact-from-qr set-new-contact-from-qr) diff --git a/src/status_im/qr_scanner/handlers.cljs b/src/status_im/qr_scanner/handlers.cljs index 27ae0b5eca..be05d7fb65 100644 --- a/src/status_im/qr_scanner/handlers.cljs +++ b/src/status_im/qr_scanner/handlers.cljs @@ -25,7 +25,6 @@ (defn handle-qr-request [db [_ context data]] (let [handler (get-in db [:qr-codes context])] - (println handler context data) (dispatch [handler context data]))) (defn clear-qr-request [db [_ context]] diff --git a/src/status_im/utils/subs.cljs b/src/status_im/utils/subs.cljs index 3be283c37e..60bb24c53b 100644 --- a/src/status_im/utils/subs.cljs +++ b/src/status_im/utils/subs.cljs @@ -5,7 +5,6 @@ "Creates subscrition that cheks if collection (map or set) contains element" [collection] (fn [db [_ element]] - (println "WWWWWWWWWW" (type db)) (-> (collection @db) (contains? element) (reaction)))) From a424ba14473747a90a4376e3d3db2a38cd2438cf Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Fri, 3 Jun 2016 15:47:52 +0300 Subject: [PATCH 09/10] qr-scanner screen title, code cleaning, style fixes Former-commit-id: fbd66a840fc7f43b212f16f7cf3ae619267ce429 --- src/status_im/contacts/views/new_contact.cljs | 22 +++++----------- src/status_im/qr_scanner/screen.cljs | 25 ++++++++----------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/status_im/contacts/views/new_contact.cljs b/src/status_im/contacts/views/new_contact.cljs index 3920aeed49..d14c4f8dd8 100644 --- a/src/status_im/contacts/views/new_contact.cljs +++ b/src/status_im/contacts/views/new_contact.cljs @@ -4,31 +4,21 @@ [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]] + touchable-highlight]] [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 + [status-im.components.styles :refer [color-purple search-icon - create-icon import-qr-icon - toolbar-background2 + toolbar-background1 form-text-input]] [status-im.i18n :refer [label]] - [status-im.contacts.styles :as st] - [status-im.utils.logging :as log])) + [status-im.contacts.styles :as st])) (defn import-qr-button [] [touchable-highlight - {:on-press #(dispatch [:scan-qr-code :new-contact :set-new-contact-from-qr])} + {:on-press #(dispatch [:scan-qr-code {:toolbar-title (label :t/new-contact)} :set-new-contact-from-qr])} [view st/import-qr-button [view st/import-qr-button-content [icon {:name :qr-scanner @@ -59,7 +49,7 @@ [drawer-view [view st/contact-form-container [toolbar {:title (label :t/new-contact) - :background-color toolbar-background2 + :background-color toolbar-background1 :action {:image {:source {:uri :icon_add_gray} :style search-icon} :handler #(dispatch [:add-new-contact new-contact])}}] diff --git a/src/status_im/qr_scanner/screen.cljs b/src/status_im/qr_scanner/screen.cljs index 430afc3582..dd2742a04b 100644 --- a/src/status_im/qr_scanner/screen.cljs +++ b/src/status_im/qr_scanner/screen.cljs @@ -2,28 +2,25 @@ (: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]] + image]] [status-im.components.camera :refer [camera]] - [status-im.components.styles :refer [toolbar-background2]] + [status-im.components.styles :refer [toolbar-background1 + search-icon]] [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.types :refer [json->clj]] - [status-im.utils.logging :as log])) + [status-im.utils.types :refer [json->clj]])) -(defn qr-scanner-toolbar [] - [toolbar {:title (label :t/new-contact) - :background-color toolbar-background2}]) +(defn qr-scanner-toolbar [title] + [toolbar {:title title + :background-color toolbar-background1 + :action {:image {:source {:uri :icon_lock_white} + :style search-icon} + :handler #()}}]) (defview qr-scanner [] [identifier [:get :current-qr-context]] [view st/barcode-scanner-container - [qr-scanner-toolbar] + [qr-scanner-toolbar (:toolbar-title identifier)] [camera {;:on-bar-code-read #(js/alert "ok") :onBarCodeRead #(let [data (json->clj (.-data %))] (dispatch [:set-qr-code identifier data])) From c00bc75346a4fd0b19234ecced560145d707bede Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Fri, 10 Jun 2016 03:03:40 +0300 Subject: [PATCH 10/10] updated new contact screen; some code cleaning Former-commit-id: e0ce4217bb27ed4f9015833ad19eb3bb441fc79c --- .../res/drawable-hdpi/icon_back_white.png | Bin 0 -> 202 bytes .../src/main/res/drawable-hdpi/icon_qr.png | Bin 0 -> 800 bytes .../res/drawable-mdpi/icon_back_white.png | Bin 0 -> 174 bytes .../src/main/res/drawable-mdpi/icon_qr.png | Bin 0 -> 422 bytes .../res/drawable-xhdpi/icon_back_white.png | Bin 0 -> 233 bytes .../src/main/res/drawable-xhdpi/icon_qr.png | Bin 0 -> 767 bytes .../res/drawable-xxhdpi/icon_back_white.png | Bin 0 -> 370 bytes .../src/main/res/drawable-xxhdpi/icon_qr.png | Bin 0 -> 1596 bytes .../res/drawable-xxxhdpi/icon_back_white.png | Bin 0 -> 467 bytes .../src/main/res/drawable-xxxhdpi/icon_qr.png | Bin 0 -> 1841 bytes src/status_im/components/styles.cljs | 51 ++++++++++- src/status_im/components/toolbar.cljs | 21 ++--- src/status_im/contacts/screen.cljs | 4 +- src/status_im/contacts/styles.cljs | 31 +++---- src/status_im/contacts/views/new_contact.cljs | 81 +++++++++++------- src/status_im/qr_scanner/screen.cljs | 4 +- src/status_im/qr_scanner/styles.cljs | 79 ++++++++++------- .../qr_scanner/views/import-qr-button.cljs | 23 +++++ src/status_im/translations/en.cljs | 14 ++- 19 files changed, 208 insertions(+), 100 deletions(-) create mode 100644 android/app/src/main/res/drawable-hdpi/icon_back_white.png create mode 100644 android/app/src/main/res/drawable-hdpi/icon_qr.png create mode 100644 android/app/src/main/res/drawable-mdpi/icon_back_white.png create mode 100644 android/app/src/main/res/drawable-mdpi/icon_qr.png create mode 100644 android/app/src/main/res/drawable-xhdpi/icon_back_white.png create mode 100644 android/app/src/main/res/drawable-xhdpi/icon_qr.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/icon_back_white.png create mode 100644 android/app/src/main/res/drawable-xxhdpi/icon_qr.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/icon_back_white.png create mode 100644 android/app/src/main/res/drawable-xxxhdpi/icon_qr.png create mode 100644 src/status_im/qr_scanner/views/import-qr-button.cljs diff --git a/android/app/src/main/res/drawable-hdpi/icon_back_white.png b/android/app/src/main/res/drawable-hdpi/icon_back_white.png new file mode 100644 index 0000000000000000000000000000000000000000..6bd5aec7c425ed9cca7027d64360ea32ccde6fba GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bC!3HFwb&h8MDaPU;cPEB*=VV?2IW3+pjv*SN z$q5P!|Nj4f&w50>p@J`NsRJvc!yoRBgAB`)7U*<2Df~AHI~pMp$I{iApdqKkRonQk zg`Iyw?_Fbs`;4md84Y#@JN&>&;M#IFX)3%@8S@EWmLGkBHt yXZ`qJulMaiW7nc~p}3<8o(tN-6#nrZF=wo`ub7p2<#Q^~Jq(_%elF{r5}E+Qlti%r literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-hdpi/icon_qr.png b/android/app/src/main/res/drawable-hdpi/icon_qr.png new file mode 100644 index 0000000000000000000000000000000000000000..6b2f825374b2b58a610c5ff72ec90c72cc97efec GIT binary patch literal 800 zcmV+*1K<3KP)Px%+DSw~R9Fe^mc43KK@i7tjd&p-Xo?gn_zXb^TKG{}N-CR(T`Jo|5QBxSg*HBb zPau*Yh^P_4BC(1VzCa$pGJ-k&{(E-TxqJ7199-lU4$PgI|IF;p-QBZ0b8}GBH1qH# zybmA2B@!;b;^viCB7A4z=kRy<7%tHd!1wU2GzNx>5ZHwjKU56Z1^BSbK*T-{#h~2p zm}udf>EA>J$7^$TkiUq%tZn(?k{+U;$|sO59G2f`-^T%-hHWdfjW^+*k1-wm4Ezc< zdZG#ZnJ5E2Hb)pBcIX%@Y`ZmmZZ5+J9lU-!tO>0+#*QhSR40000Px$U`a$lR5%gUlrc`jKoCW}2&LlyNgFsq?tqkriUMj7JryS)2LTEynn+X>kvK&} z8A>RqsFwH5PBgK-#E#^Gk$z_O&)@N6?b#y6H~=%S0#y^I+@NsAdIDa-H}Iyl_(>@z z(B^G6v)TxU;B(7{59tbi-ji@@1czag@Y{-5UzcR3af&P~Et|C+eQwSA%MyCoG` zQp{|b<2rwesgM;eeU4LcFW9(S{3gX_Y-rVabwbB=GonC0Bxb<23QbW|~ZfPnkF4uYIA!>R6#cM$ f8YRM#Ef^TCMfKf?kCK`ObS{IZtDnm{r-UW|5sOu5 literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-xhdpi/icon_qr.png b/android/app/src/main/res/drawable-xhdpi/icon_qr.png new file mode 100644 index 0000000000000000000000000000000000000000..c55551f6873e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q~)(or}STnF@ zV9mgqfi(l4RR%tb2}`qEbSYEtW)nFZf*>v@M4Ru%%ok z<;A35prOLH;ummO2Q7mKpeDa_5xe^%4)(m5q@ejuXmfPVVi~jy9)P&T<~Ury?WmB8 z*u%8s!!G8X6yN#LyEdipcDJ%Xd<$*zI~Q6~g}UVTOn^6LJ60yRJ}TbZa<^E-;|4B7 z#KY^vq3_l>Gq*f?*QOL6dvx31xo{~6U#2FR9>#3P%0k&3Y_Y|xN5ba)&P8ZQT|2~+ zCBC~XFc>>L_UQX=MOZ$?ZT!E5y5!;x^Qi$~aWl-@sb-?B=ih#-NcUF*+u~-Jw^PlN z;l6v1(L&EV8e5LFOD!wyA9y(@!%Kua7=4w(bHlsTJhf=|CWF-PBeq5GvJ;Ih&b=b} zWucM4a*KY-02q7NvkV@Rq>4rwhMZAqpOTpDdmWA^_>`M61GE?(fK+h-_)8cuAT7xb zcaraQ^!dSYxr;!blAVv|vLP+|0rY>Peatn5qiYBbOY-Z=UAx#N?EOQUgLF%NmZ;=q zQXS8Em6lR~9ZAW|FMp-r_-zO4lHIA5bE_u}?_d@)j5@l8;1ZSU-`StaGJDiNJ`S<7*Vvrex1JxCrSHIbr&O|!#0iF0Z>Vx4bz zN75YuZ7e7QxVZMxeE=eVJDC%{tJFnJ@To`}qS$9Rv~u zj;dXJ55QKriKNR`9PazY-_qn6dR~?9b-?K}%`xgMZiaa~ z)lBrcL5GKq*GP8j-|H~Kn75iI!$mznQ#zfNFF*U zTWIiKanPW$kju8Rk5KqB_Y9pk>>`VJY}dt8YKgq?@R~mb?-K&xA|6EV$5i4s@{)g1 z$tMEP_P=xClb&E5dGW95plBdb*LZf6Va_f19QttpRcD1h=qu^L^9gcX#D)5}7lL2J f_d1GXDih>?5L7+R)KsN?00000NkvXXu0mjfXb_ej literal 0 HcmV?d00001 diff --git a/src/status_im/components/styles.cljs b/src/status_im/components/styles.cljs index 7625353a19..70e907c631 100644 --- a/src/status_im/components/styles.cljs +++ b/src/status_im/components/styles.cljs @@ -19,6 +19,7 @@ (def text1-color color-black) (def text2-color color-gray) (def text3-color color-blue) +(def text4-color color-white) (def online-color color-blue) (def new-messages-count-color color-blue-transparent) (def chat-background color-light-gray) @@ -37,7 +38,7 @@ {:width 16 :height 12}) -(def search-icon +(def icon-search {:width 17 :height 17}) @@ -46,11 +47,55 @@ :height 22 :color :white}) -(def import-qr-icon - {:margin 4}) +(def icon-back + {:width 8 + :height 14}) + +(def icon-add + {:width 14 + :height 14}) + +(def icon-ok + {:width 18 + :height 14}) + +(def icon-qr + {:width 23 + :height 22}) + +(def icon-plus + {:width 18 + :height 18}) (def form-text-input {:marginLeft -4 :fontSize 14 :fontFamily font :color text1-color}) + +(def white-form-text-input + {:marginLeft -4 + :fontSize 14 + :fontFamily font + :color color-white}) + +(def toolbar-title-container + {:flex 1 + :alignItems :center + :justifyContent :center}) + +(def toolbar-title-text + {:marginTop -2.5 + :color text1-color + :fontSize 16 + :fontFamily font}) + +(def button-input-container + {:flex 1 + :flexDirection :row + :height 50}) + +(def button-input + {:flex 1 + :flexDirection :column + :height 50}) \ No newline at end of file diff --git a/src/status_im/components/toolbar.cljs b/src/status_im/components/toolbar.cljs index 832fa5811e..a757e56dbd 100644 --- a/src/status_im/components/toolbar.cljs +++ b/src/status_im/components/toolbar.cljs @@ -13,6 +13,9 @@ text1-color text2-color toolbar-background1 + toolbar-title-container + toolbar-title-text + icon-back toolbar-height]] [status-im.components.realm :refer [list-view]] [reagent.core :as r])) @@ -34,20 +37,14 @@ [image (:image nav-action)]]] [touchable-highlight {:on-press #(dispatch [:navigate-back])} [view {:width 56 - :height 56} + :height 56 + :alignItems :center + :justifyContent :center} [image {:source {:uri :icon_back} - :style {:marginTop 21 - :marginLeft 23 - :width 8 - :height 14}}]]])) + :style icon-back}]]])) (or custom-content - [view {:style {:flex 1 - :alignItems :center - :justifyContent :center}} - [text {:style {:marginTop -2.5 - :color text1-color - :fontSize 16 - :fontFamily font}} + [view {:style toolbar-title-container} + [text {:style toolbar-title-text} title]]) custom-action (when action diff --git a/src/status_im/contacts/screen.cljs b/src/status_im/contacts/screen.cljs index e1502b171a..a763c2ea50 100644 --- a/src/status_im/contacts/screen.cljs +++ b/src/status_im/contacts/screen.cljs @@ -15,7 +15,7 @@ [status-im.components.icons.ionicons :refer [icon]] [status-im.components.styles :refer [color-blue hamburger-icon - search-icon + icon-search create-icon toolbar-background2]] [status-im.contacts.styles :as st] @@ -32,7 +32,7 @@ :title (label :t/contacts) :background-color toolbar-background2 :action {:image {:source {:uri :icon_search} - :style search-icon} + :style icon-search} :handler (fn [])}}]) (defview contact-list [] diff --git a/src/status_im/contacts/styles.cljs b/src/status_im/contacts/styles.cljs index 4c066ffa7c..4b64148fc9 100644 --- a/src/status_im/contacts/styles.cljs +++ b/src/status_im/contacts/styles.cljs @@ -67,22 +67,19 @@ :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}) +; new contact (def contact-form-container - {:flex 1 - :backgroundColor :white}) \ No newline at end of file + {:flex 1 + :color :white}) + +(def gradient-background + {:position :absolute + :top 0 + :right 0 + :bottom 0 + :left 0}) + +(def form-container + {:marginLeft 16 + :margin-top 50}) \ 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 index d14c4f8dd8..469ed6b914 100644 --- a/src/status_im/contacts/views/new_contact.cljs +++ b/src/status_im/contacts/views/new_contact.cljs @@ -4,56 +4,75 @@ [status-im.components.react :refer [view text text-input + image + linear-gradient touchable-highlight]] [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-purple - search-icon - import-qr-icon + color-white + icon-search + icon-back + icon-qr toolbar-background1 - form-text-input]] + toolbar-title-container + toolbar-title-text + button-input-container + button-input + white-form-text-input]] + [status-im.qr-scanner.views.import-button :refer [import-button]] [status-im.i18n :refer [label]] [status-im.contacts.styles :as st])) -(defn import-qr-button [] - [touchable-highlight - {:on-press #(dispatch [:scan-qr-code {:toolbar-title (label :t/new-contact)} :set-new-contact-from-qr])} - [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)]]]]) + + +(def toolbar-title + [view toolbar-title-container + [text {:style (merge toolbar-title-text {:color color-white})} + (label :t/new-contact)]]) (defview contact-name-input [name] [] [text-input - {:underlineColorAndroid color-purple - :style form-text-input + {:underlineColorAndroid color-white + :placeholderTextColor color-white + :style white-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 contact-whisper-id-input [whisper-identity] + [view button-input-container + [text-input + {:underlineColorAndroid color-white + :placeholderTextColor color-white + :style (merge white-form-text-input button-input) + :autoFocus true + :placeholder (label :t/whisper-identity) + :onChangeText #(dispatch [:set-in [:new-contact :whisper-identity] %])} + whisper-identity] + [import-button #(dispatch [:scan-qr-code {:toolbar-title (label :t/new-contact)} :set-new-contact-from-qr])]]) (defview new-contact [] - [{:keys [name address whisper-identity phone-number] :as new-contact} [:get :new-contact]] + [{:keys [name 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-background1 - :action {:image {:source {:uri :icon_add_gray} - :style search-icon} + [linear-gradient {:colors ["rgba(182, 116, 241, 1)" "rgba(107, 147, 231, 1)" "rgba(43, 171, 238, 1)"] + :start [0, 0] + :end [0.5, 1] + :locations [0, 0.8 ,1] + :style st/gradient-background}] + + [toolbar {:background-color :transparent + :nav-action {:image {:source {:uri :icon_back_white} + :style icon-back} + :handler #(dispatch [:navigate-back])} + :custom-content toolbar-title + :action {:image {:source {:uri :icon_add} + :style icon-search} :handler #(dispatch [:add-new-contact new-contact])}}] - [import-qr-button] - [contact-name-input name] - [contact-address-input address] - [text (str "Whisper identity: " whisper-identity)]]]) + [view st/form-container + [contact-whisper-id-input whisper-identity] + [contact-name-input name] + ]]]) diff --git a/src/status_im/qr_scanner/screen.cljs b/src/status_im/qr_scanner/screen.cljs index dd2742a04b..2f27d30b9f 100644 --- a/src/status_im/qr_scanner/screen.cljs +++ b/src/status_im/qr_scanner/screen.cljs @@ -5,7 +5,7 @@ image]] [status-im.components.camera :refer [camera]] [status-im.components.styles :refer [toolbar-background1 - search-icon]] + icon-search]] [status-im.components.toolbar :refer [toolbar]] [status-im.qr-scanner.styles :as st] [status-im.utils.types :refer [json->clj]])) @@ -14,7 +14,7 @@ [toolbar {:title title :background-color toolbar-background1 :action {:image {:source {:uri :icon_lock_white} - :style search-icon} + :style icon-search} :handler #()}}]) (defview qr-scanner [] diff --git a/src/status_im/qr_scanner/styles.cljs b/src/status_im/qr_scanner/styles.cljs index 687854a3d8..05198031b1 100644 --- a/src/status_im/qr_scanner/styles.cljs +++ b/src/status_im/qr_scanner/styles.cljs @@ -1,59 +1,76 @@ (ns status-im.qr-scanner.styles - (:require [status-im.components.styles :refer [toolbar-height]])) + (:require [status-im.components.styles :refer [toolbar-height + color-white]])) (def barcode-scanner-container {:flex 1 :backgroundColor :white}) (def barcode-scanner - {:flex 1 + {:flex 1 :justifyContent :flex-end - :alignItems :center}) + :alignItems :center}) (def rectangle-container - {:position :absolute - :left 0 - :top toolbar-height - :bottom 0 - :right 0 - :flex 1 - :alignItems :center - :justifyContent :center + {: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 + {:height 250 + :width 250 :backgroundColor :transparent}) (def corner-left-top {:position :absolute - :left 0 - :top 0 - :width 56 - :height 56}) + :left 0 + :top 0 + :width 56 + :height 56}) (def corner-right-top {:position :absolute - :right 0 - :top 0 - :width 56 - :height 56}) + :right 0 + :top 0 + :width 56 + :height 56}) (def corner-right-bottom {:position :absolute - :right 0 - :bottom 0 - :width 56 - :height 56}) + :right 0 + :bottom 0 + :width 56 + :height 56}) (def corner-left-bottom {:position :absolute - :left 0 - :bottom 0 - :width 56 - :height 56}) + :left 0 + :bottom 0 + :width 56 + :height 56}) +(def import-button + {:position :absolute + :right 16 + :flex 1 + :height 50 + :alignItems :center}) -;:width 56 -;:height 56 \ No newline at end of file +(def import-button-content + {:flex 1 + :flexDirection :row + :height 50 + :alignItems :center + :alignSelf :center}) + +(def import-text + {:flex 1 + :flexDirection :column + :color color-white + :margin-left 8}) diff --git a/src/status_im/qr_scanner/views/import-qr-button.cljs b/src/status_im/qr_scanner/views/import-qr-button.cljs new file mode 100644 index 0000000000..99b7dbc7b7 --- /dev/null +++ b/src/status_im/qr_scanner/views/import-qr-button.cljs @@ -0,0 +1,23 @@ +(ns status-im.qr-scanner.views.import-button + (:require-macros [status-im.utils.views :refer [defview]]) + (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] + [status-im.components.react :refer [view + text + image + touchable-highlight]] + [status-im.components.toolbar :refer [toolbar]] + [status-im.components.drawer.view :refer [drawer-view open-drawer]] + [status-im.components.styles :refer [icon-qr]] + [status-im.i18n :refer [label]] + [status-im.qr-scanner.styles :as st])) + + +(defview import-button [handler] + [] + [view st/import-button + [touchable-highlight + {:on-press handler} + [view st/import-button-content + [image {:source {:uri :icon_qr} + :style icon-qr}] + [text {:style st/import-text} (label :t/import-qr)]]]]) \ No newline at end of file diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index cf3424d440..37fac291a0 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -115,8 +115,18 @@ :You "You" ;new-contact - :import-qr "Import from QR" + :import-qr "Import" :contact-name "Contact Name" - :contact-address "Contact Address" + :whisper-identity "Whisper Identity" + + ;login + :recover-from-passphrase "Recover from passphrase" + :connect "Connect" + :address "Address" + :password "Password" + :login "Login" + + ;users + :add-account "Add account" }) \ No newline at end of file