From f659cbf242d1224cc6d2321e33bce1714aeb91d0 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Thu, 14 May 2020 15:00:06 +0200 Subject: [PATCH] camera roll --- android/app/src/main/AndroidManifest.xml | 3 +- ios/Podfile.lock | 45 +-- ios/StatusIm.xcodeproj/project.pbxproj | 16 +- ios/StatusIm/Info.plist | 4 +- mobile/js_files/package.json | 3 +- mobile/js_files/yarn.lock | 19 +- nix/deps/gradle/deps.json | 320 ++---------------- nix/deps/gradle/deps.list | 12 +- nix/deps/gradle/deps.urls | 25 +- nix/deps/gradle/proj.list | 1 + resources/images/icons/camera@2x.png | Bin 399 -> 455 bytes resources/images/icons/camera@3x.png | Bin 576 -> 706 bytes .../images/icons/camera_permission@2x.png | Bin 0 -> 1034 bytes .../images/icons/camera_permission@3x.png | Bin 0 -> 1463 bytes resources/images/icons/collection@2x.png | Bin 0 -> 376 bytes resources/images/icons/collection@3x.png | Bin 0 -> 610 bytes shadow-cljs.edn | 2 +- src/status_im/chat/models.cljs | 22 +- src/status_im/chat/models/images.cljs | 123 +++++++ src/status_im/chat/models/input.cljs | 46 ++- src/status_im/data_store/messages_test.cljs | 1 + src/status_im/events.cljs | 5 +- src/status_im/subs.cljs | 7 + src/status_im/ui/components/camera.cljs | 16 +- src/status_im/ui/components/colors.cljs | 1 + src/status_im/ui/components/react.cljs | 12 + .../ui/components/status_bar/view.cljs | 3 +- .../ui/screens/chat/image/preview/views.cljs | 34 ++ .../ui/screens/chat/image/styles.cljs | 3 - .../ui/screens/chat/image/views.cljs | 113 ++++--- .../ui/screens/chat/input/input.cljs | 69 ++-- .../ui/screens/chat/message/message.cljs | 141 +++++--- src/status_im/ui/screens/chat/sheets.cljs | 48 +++ .../ui/screens/chat/styles/input/input.cljs | 19 +- .../screens/chat/styles/message/message.cljs | 7 + .../ui/screens/home/views/inner_item.cljs | 5 + src/status_im/ui/screens/profile/events.cljs | 11 - src/status_im/ui/screens/profile/models.cljs | 24 -- .../screens/profile/photo_capture/styles.cljs | 13 - .../screens/profile/photo_capture/views.cljs | 43 --- .../ui/screens/profile/user/sheet/views.cljs | 44 --- .../ui/screens/qr_scanner/views.cljs | 22 +- src/status_im/ui/screens/routing/main.cljs | 8 +- .../ui/screens/routing/profile_stack.cljs | 3 - src/status_im/utils/image_processing.cljs | 19 +- status-go-version.json | 4 +- translations/en.json | 7 +- 47 files changed, 604 insertions(+), 719 deletions(-) mode change 100644 => 100755 resources/images/icons/camera@2x.png mode change 100644 => 100755 resources/images/icons/camera@3x.png create mode 100644 resources/images/icons/camera_permission@2x.png create mode 100644 resources/images/icons/camera_permission@3x.png create mode 100644 resources/images/icons/collection@2x.png create mode 100644 resources/images/icons/collection@3x.png create mode 100644 src/status_im/chat/models/images.cljs create mode 100644 src/status_im/ui/screens/chat/image/preview/views.cljs delete mode 100644 src/status_im/ui/screens/chat/image/styles.cljs delete mode 100644 src/status_im/ui/screens/profile/photo_capture/styles.cljs delete mode 100644 src/status_im/ui/screens/profile/photo_capture/views.cljs delete mode 100644 src/status_im/ui/screens/profile/user/sheet/views.cljs diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 2895b74210..cc5f6f072f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -35,7 +35,8 @@ android:theme="@style/AppTheme" android:name=".MainApplication" android:largeHeap="true" - android:usesCleartextTraffic="true"> + android:usesCleartextTraffic="true" + android:requestLegacyExternalStorage="true"> NSCameraUsageDescription - The app uses your camera to scan QR codes. + Status uses camera to take pictures and scan QR codes. NSLocationAlwaysUsageDescription Location access is required for some DApps to function properly. NSLocationWhenInUseUsageDescription Location access is required for some DApps to function properly. NSPhotoLibraryUsageDescription - Photos access is required to give you the ability to choose custom profile pictures. + Photos access is required to give you the ability to send images. UIAppFonts Inter-Bold.otf diff --git a/mobile/js_files/package.json b/mobile/js_files/package.json index 2a722ffee6..9519db9848 100644 --- a/mobile/js_files/package.json +++ b/mobile/js_files/package.json @@ -10,6 +10,7 @@ "app:android": "react-native run-android" }, "dependencies": { + "@react-native-community/cameraroll": "^1.6.1", "@react-native-community/clipboard": "^1.2.2", "@react-native-community/masked-view": "^0.1.6", "@react-native-community/netinfo": "^4.4.0", @@ -38,7 +39,7 @@ "react-native-fs": "^2.14.1", "react-native-gesture-handler": "^1.6.0", "react-native-haptic-feedback": "^1.9.0", - "react-native-image-crop-picker": "^0.25.0", + "react-native-image-crop-picker": "^0.31.1", "react-native-image-resizer": "git+https://github.com/status-im/react-native-image-resizer.git#1.0.0-2-status", "react-native-keychain": "git+https://github.com/status-im/react-native-keychain.git#v.3.0.0-5-status", "react-native-languages": "^3.0.2", diff --git a/mobile/js_files/yarn.lock b/mobile/js_files/yarn.lock index 6c3636900a..f8a043077b 100644 --- a/mobile/js_files/yarn.lock +++ b/mobile/js_files/yarn.lock @@ -1207,6 +1207,11 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" +"@react-native-community/cameraroll@^1.6.1": + version "1.6.2" + resolved "https://registry.yarnpkg.com/@react-native-community/cameraroll/-/cameraroll-1.6.2.tgz#a4dedcf8ba7bc938f805dd07dd43a275edb1f411" + integrity sha512-5R/2Tpi7APoNBDmRV23OcRIN9YiaRMJAHrXkGDpj7jVo2yQpJCCrARnZ9qhJ9dYEMybdP/XhXI1vVjuad5xqNQ== + "@react-native-community/cli-debugger-ui@^4.8.0": version "4.8.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-4.8.0.tgz#9a6419b29be69422e0056bbb1874775750351d22" @@ -6451,9 +6456,9 @@ react-native-background-timer@^2.1.1: integrity sha512-Y7N6diSFko/FCJPMmB0PoBlmY1kEcma7qDVwn8t7zi12GLqpe/Vwls97onkSD8/QL+BR33BygUHOrLTPwgeKfg== react-native-camera@^3.3.3: - version "3.23.1" - resolved "https://registry.yarnpkg.com/react-native-camera/-/react-native-camera-3.23.1.tgz#fb6fe52f8a357852de6dcd81d0d187cd632dc7dd" - integrity sha512-ghQT2IhiZiNMDgixD/MrfwgFx9arwOb2z79xDJ8dsz8DFcpBMbXjXZETaAK0WaZ/MWOaY84k0eGlx1hoVT77wQ== + version "3.26.0" + resolved "https://registry.yarnpkg.com/react-native-camera/-/react-native-camera-3.26.0.tgz#80f37124c524d76ae79f55f3975ed73b6515aa49" + integrity sha512-W/h89LN+jujlzc89nWpvukbfnbFO+Fskf6PR23pP6zminpJDIArHabWLd1mQoJ3p6r+gUJ8I4bgsxUmSMgLAgA== dependencies: prop-types "^15.6.2" @@ -6505,10 +6510,10 @@ react-native-haptic-feedback@^1.9.0: resolved "https://registry.yarnpkg.com/react-native-haptic-feedback/-/react-native-haptic-feedback-1.9.0.tgz#7d62c54536f04dd5d8f1c2bb8ee444009f2294b9" integrity sha512-tIRbq8k7HK9AoyvXrOHUEFmJd65ZAh1HP9mDyD/gDisG1ApY4Im9UKn0q0of9z7s8AJY3sZA9GMuSKdSBGdKKQ== -react-native-image-crop-picker@^0.25.0: - version "0.25.3" - resolved "https://registry.yarnpkg.com/react-native-image-crop-picker/-/react-native-image-crop-picker-0.25.3.tgz#46ee28b4a0a187240e388bd28a44cf8c274caec6" - integrity sha512-jQ416WXEiEQ3w057QOYU++8/mDqYb2A/AGZY/NwR5eKda/z8a4wncWKj7oF9KBAHNKE1TmPrl9Rm0GZ0Jrzp6A== +react-native-image-crop-picker@^0.31.1: + version "0.31.1" + resolved "https://registry.yarnpkg.com/react-native-image-crop-picker/-/react-native-image-crop-picker-0.31.1.tgz#b56248a9e31d62f1c6e7c2f85d296869c32af4cd" + integrity sha512-I5z7DcTKYYASevIalkqKdiw9Fe4CVCKPVMMkLGDVGUYgZZWlbOS9G1+oNWtWwoB5S9e931GkDrZ/HL5UhADG/Q== "react-native-image-resizer@git+https://github.com/status-im/react-native-image-resizer.git#1.0.0-2-status": version "1.0.0" diff --git a/nix/deps/gradle/deps.json b/nix/deps/gradle/deps.json index 5889b92c2c..036f33690a 100644 --- a/nix/deps/gradle/deps.json +++ b/nix/deps/gradle/deps.json @@ -503,6 +503,20 @@ } }, + { + "path": "androidx/exifinterface/exifinterface/1.1.0-beta01/exifinterface-1.1.0-beta01", + "host": "https://dl.google.com/dl/android/maven2", + "type": "aar", + "pom": { + "sha1": "113ca4bcf7feed9865496b8980cb92dec0d99d12", + "sha256": "1hxg57hchc87vzzwc7a5n7jdfa82zwycl38scds957crxap57sah" + }, + "jar": { + "sha1": "3a3ae85030468e63b28989401fe69db581e40c82", + "sha256": "174rrl18rq5yrrmjcvl3chjhqs051dlf2j1fipwcgv0v737jk67w" + } + }, + { "path": "androidx/fragment/fragment/1.0.0/fragment-1.0.0", "host": "https://dl.google.com/dl/android/maven2", @@ -965,6 +979,20 @@ } }, + { + "path": "androidx/transition/transition/1.2.0-rc01/transition-1.2.0-rc01", + "host": "https://dl.google.com/dl/android/maven2", + "type": "aar", + "pom": { + "sha1": "7fe296c768d13fdd86a0dcd5e15083d5b6f5290f", + "sha256": "1gkxz4mfa6pb5k5dz6j9hbpx1kkgp9sf33r6wcxcqg74nyn7jpd4" + }, + "jar": { + "sha1": "40bdbe5a245edd0393b7b0e1d9dd6c446dd9008d", + "sha256": "1fkfzqnppj6ky7d7i42n2hjyhrlll26b5cmik85qfzqq42b1zrbj" + } + }, + { "path": "androidx/transition/transition/1.2.0/transition-1.2.0", "host": "https://dl.google.com/dl/android/maven2", @@ -1133,34 +1161,6 @@ } }, - { - "path": "android/arch/core/common/1.1.0/common-1.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "jar", - "pom": { - "sha1": "a5bed3736b36ebb3b7c100983fd5d0e880305a6a", - "sha256": "0i5ywqk14h224a20vcvf929r314597zj7krl33gcnl8m1lpf5n5q" - }, - "jar": { - "sha1": "8007981f7d7540d89cd18471b8e5dcd2b4f99167", - "sha256": "1zcbkc77gw64saspaw5lwl6r5pkkghxb36vscj7zz4mwjjvj8j6k" - } - }, - - { - "path": "android/arch/core/runtime/1.1.0/runtime-1.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "49ed9c19afbc009dbfcf17a7daad4198e28c9a7e", - "sha256": "170s3l8nw7cf1fqdqffblrgpg71jww1vb4mzgvzi74w3vxx72gzs" - }, - "jar": { - "sha1": "0dabc0064464782c5014c7e8be5e93bd76466c41", - "sha256": "1qs5hj3ma3nj2i13majn3vnzlyq31xchakn6xqp8myxwfmshyh43" - } - }, - { "path": "android/arch/lifecycle/common/1.0.0/common-1.0.0", "host": "https://dl.google.com/dl/android/maven2", @@ -1175,34 +1175,6 @@ } }, - { - "path": "android/arch/lifecycle/common/1.1.0/common-1.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "jar", - "pom": { - "sha1": "01d1ca8193bf2fe61614750c1e3c32b4bea135f5", - "sha256": "1vzj0nlkxwwghwr8a1jzbjxf0p7wg3p8dgz2yhqi0zpfaj6i81qq" - }, - "jar": { - "sha1": "0edf3f7bfb84a7521d0599efa3b0113a0ee90f85", - "sha256": "01q8qc28007dqffsfhsnlg1bnbxylv7n53jxbx6xqm9jsg7k2kk1" - } - }, - - { - "path": "android/arch/lifecycle/livedata-core/1.1.0/livedata-core-1.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "9b955481cd49f9a2540e97498627d3daaaff956f", - "sha256": "0ch0niir5p6rl45xncqji9gd1im9f4jafqqw6205ss91l1blnna1" - }, - "jar": { - "sha1": "d6827a080a137fa345a0ed4a438e14e5633e0032", - "sha256": "0sr0nmz159h33qkccd7jf0lszkfcd83z549dwz3q0nmnzzw7zr8l" - } - }, - { "path": "android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0", "host": "https://dl.google.com/dl/android/maven2", @@ -1217,34 +1189,6 @@ } }, - { - "path": "android/arch/lifecycle/runtime/1.1.0/runtime-1.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "57175c3b6e8acf3eee00890df352e0aa417f7cc0", - "sha256": "132z65g4kba11b2wxhsjgk872jn8api5zxflq10grl2xnysxmjhy" - }, - "jar": { - "sha1": "95428e5f6bf6875a6a1125d2157c3836a1a837f5", - "sha256": "0biy4a682zdsjjv8c4s099zi9a3lh6n9krakcw9sbmjdja9xfkq9" - } - }, - - { - "path": "android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "6455d9c23b43dc23b57caa216e26eae3e3343922", - "sha256": "0cw4a1myg9fkpmz6bksj5njy2shy79q7hlpqz8wfvpaiay47c9l0" - }, - "jar": { - "sha1": "74ee369b874da61b5b81bebd7b8df0c2577309c8", - "sha256": "0mr5ph6dfd8wmsdyd3i2szpwrppksrl00am4vihhd1d9bqxcj1v4" - } - }, - { "path": "com/android/databinding/baseLibrary/3.0.0/baseLibrary-3.0.0", "host": "https://dl.google.com/dl/android/maven2", @@ -1371,20 +1315,6 @@ } }, - { - "path": "com/android/support/animated-vector-drawable/27.1.0/animated-vector-drawable-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "359012d7abf2815fad47a7b368b6707918a0964f", - "sha256": "0v9lzwz7vagacqrz8h02kls66kdm1mr406k0mg2pgmwgja0336ym" - }, - "jar": { - "sha1": "de8e39a293c7ae0bdb75306d60b40aa1a4e88d05", - "sha256": "0bskm6c27pzg30p49xai2fybfjw5jwq50q7yipx87l33zylv65hj" - } - }, - { "path": "com/android/support/appcompat-v7/26.0.2/appcompat-v7-26.0.2", "host": "https://dl.google.com/dl/android/maven2", @@ -1413,20 +1343,6 @@ } }, - { - "path": "com/android/support/appcompat-v7/27.1.0/appcompat-v7-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "57564e50039cb70a26b8b87c9bc8c562101aecd1", - "sha256": "0j3wh3x5bz55m5d3dzn1pzrpsmaz9hcgg33nfhhybmgawih5jh5m" - }, - "jar": { - "sha1": "41d5bc28ca11447234a8b9ab5fb133eaa3cc7fa5", - "sha256": "12x9sfrx31mbx2y1fhsg0f3idr9kp7fbpzc3k1m1wqg99hn9ikdz" - } - }, - { "path": "com/android/support/recyclerview-v7/27.0.1/recyclerview-v7-27.0.1", "host": "https://dl.google.com/dl/android/maven2", @@ -1483,20 +1399,6 @@ } }, - { - "path": "com/android/support/support-annotations/27.1.0/support-annotations-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "jar", - "pom": { - "sha1": "6d9073e2877892ac198c704a9e20eef24a2f6b04", - "sha256": "0llkhlliwjl6vd4hg4qakack67ask82kbf0ayimcymlwaq644w9m" - }, - "jar": { - "sha1": "39ded76b5e1ce1c5b2688e1d25cdc20ecee32007", - "sha256": "1kwrj8189qsbdkk6kcq05y6zrvzqi1zmwmazhjgb1ln30q19cr9k" - } - }, - { "path": "com/android/support/support-compat/26.0.2/support-compat-26.0.2", "host": "https://dl.google.com/dl/android/maven2", @@ -1539,20 +1441,6 @@ } }, - { - "path": "com/android/support/support-compat/27.1.0/support-compat-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "232b5c21f55a0b4e2a325e0e3392879c7b2b58e1", - "sha256": "0z6zya2c0b0lkar3n53x9l2fhyrdzbn4wlpi35x1l0lia7djc9iv" - }, - "jar": { - "sha1": "a7eea3cb0c9f9bf5ce0f0899a9bee721ffd191e0", - "sha256": "0217jq31qkv2dlryi51mfm7dg7h6lhnyzd89jy9362hrihjs6sc3" - } - }, - { "path": "com/android/support/support-core-ui/26.0.2/support-core-ui-26.0.2", "host": "https://dl.google.com/dl/android/maven2", @@ -1595,20 +1483,6 @@ } }, - { - "path": "com/android/support/support-core-ui/27.1.0/support-core-ui-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "2911a40f8f086cbc34b0eaf6249b35b82917993a", - "sha256": "04r4bj5q58cm2l0q4ixs45m5r36i22a7ahxpmzpjic1c7q46d271" - }, - "jar": { - "sha1": "54b6f9853ff5e53174622f3f6f7eb208aacebd56", - "sha256": "0sp0hr5hyga50b8xgk8208b1w2vj1hl4xk3183l7cip608rx6bgd" - } - }, - { "path": "com/android/support/support-core-utils/26.0.2/support-core-utils-26.0.2", "host": "https://dl.google.com/dl/android/maven2", @@ -1651,20 +1525,6 @@ } }, - { - "path": "com/android/support/support-core-utils/27.1.0/support-core-utils-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "1a83c651b465dbbc595cfd2386947a5c6d0c7426", - "sha256": "1x1x13gyy0prvjc3c6j306p6qcmb8z2zi51s4bzidl94w1zzk262" - }, - "jar": { - "sha1": "1f21723126baf81f154326bb5f2e901cec82d03b", - "sha256": "19kdq4v6rx4p1kvyg9hsnp4yk4ln2lv4np6i3xzb8fzi3l9v4ya5" - } - }, - { "path": "com/android/support/support-fragment/26.0.2/support-fragment-26.0.2", "host": "https://dl.google.com/dl/android/maven2", @@ -1707,20 +1567,6 @@ } }, - { - "path": "com/android/support/support-fragment/27.1.0/support-fragment-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "531e097c13a83a62561f761d67a3b50bfec2a3c9", - "sha256": "1lvl7l4qmlyb3j5zqd33hq6j5q410rqhqk5pzdm70jdrd0iyyygw" - }, - "jar": { - "sha1": "2db3ef0a4733b8e65977621e161d1529c0020751", - "sha256": "04wbcslz0an5b328wphld1z0341d20il55p6br3pljnzmw7ywpmk" - } - }, - { "path": "com/android/support/support-media-compat/26.0.2/support-media-compat-26.0.2", "host": "https://dl.google.com/dl/android/maven2", @@ -1805,20 +1651,6 @@ } }, - { - "path": "com/android/support/support-vector-drawable/27.1.0/support-vector-drawable-27.1.0", - "host": "https://dl.google.com/dl/android/maven2", - "type": "aar", - "pom": { - "sha1": "fd58f7bb5386a55664be50b634e6173d97c4400d", - "sha256": "0h2zipsxg1jdng32q18ql6lksbqzb9nfkbbbk481zlk25v0xdhjf" - }, - "jar": { - "sha1": "cbfd5d8020f0cbd4b66a09f8d21e2265a55f529b", - "sha256": "01nai97hncvfwf32zqfxvz1mq3r76s30kkkbf6h6ilpgj0hfk4md" - } - }, - { "path": "com/android/tools/analytics-library/crash/26.2.1/crash-26.2.1", "host": "https://dl.google.com/dl/android/maven2", @@ -4269,20 +4101,6 @@ } }, - { - "path": "com/facebook/flipper/flipper-network-plugin/0.35.0/flipper-network-plugin-0.35.0", - "host": "https://repository.sonatype.org/content/groups/sonatype-public-grid", - "type": "aar", - "pom": { - "sha1": "366a68d0df95951a73453d305b83fad53143b902", - "sha256": "15xm3xpf6r4sfzi92jl1i26dsmlm888w7j06rrzc46zf0aymnwx9" - }, - "jar": { - "sha1": "5180a9a0456bccee56206713393878b964101e55", - "sha256": "0ajhgyirpvmix5j0gdk174k272034inj037si925zdigglw5nh0q" - } - }, - { "path": "com/facebook/flipper/flipper/0.35.0/flipper-0.35.0", "host": "https://repository.sonatype.org/content/groups/sonatype-public-grid", @@ -4354,16 +4172,16 @@ }, { - "path": "com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native", + "path": "com/github/yalantis/ucrop/2.2.5-native/ucrop-2.2.5-native", "host": "https://repository.sonatype.org/content/groups/sonatype-public-grid", "type": "aar", "pom": { - "sha1": "02df11f4174862c446a3dc2ef14cec1cd5755c4a", - "sha256": "1g5qsc6zfbjg7a5vdyx7g02qnv8vswxik29rnwnw8n075vns0h21" + "sha1": "54e36a57a744bd8ac522da81284a6366bb6939a6", + "sha256": "19x239zg1bjf97zgkv6jvba1la6sn4j6b76w5rnc4kp5jlh89pql" }, "jar": { - "sha1": "6f5312e3163bf668b0f66c3068926b700e410a8d", - "sha256": "0c50s95achsswsf7125k4ibr60l4m53yn5m501an2wk1658q7kx8" + "sha1": "34281fb5e7e7a2681b2482881fcfceba1a322b84", + "sha256": "0nrm55pihyq1fy6iwi21abv7wdsjdz4g9dwsrn1a3dbppwwjbkr1" } }, @@ -6525,20 +6343,6 @@ } }, - { - "path": "com/squareup/okhttp3/okhttp/3.8.1/okhttp-3.8.1", - "host": "https://repo.maven.apache.org/maven2", - "type": "jar", - "pom": { - "sha1": "fb78f48ceb52df1ca8eea576716c34c99a5890d0", - "sha256": "0kny2snb3ihja7pm7qh2wky8767pyrc8i3yjzncys5c327m22pap" - }, - "jar": { - "sha1": "4d060ca3190df0eda4dc13415532a12e15ca5f11", - "sha256": "0h988ydigk449lcsp80jzjpn36ms4cksjl229m11vxkl7y8pzmf1" - } - }, - { "path": "com/squareup/okhttp3/okhttp/3.12.1/okhttp-3.12.1", "host": "https://repo.maven.apache.org/maven2", @@ -6553,20 +6357,6 @@ } }, - { - "path": "com/squareup/okhttp3/okhttp/3.14.1/okhttp-3.14.1", - "host": "https://repo.maven.apache.org/maven2", - "type": "jar", - "pom": { - "sha1": "92952bd2db127114ec7069b05317c1fe033de54b", - "sha256": "0x2v74z227bhfl23p5vzd1b9lccmgsjgfwzm01kcfrgxxlkddabs" - }, - "jar": { - "sha1": "67612a22d4b8f33c55263b188bf5a72774d06d18", - "sha256": "0qz5qggrvrs9pbvb30n8bm5hn1p48pjd4qfkvijalxihcn8ycsss" - } - }, - { "path": "com/squareup/okhttp3/okhttp/4.7.2/okhttp-4.7.2", "host": "https://repo.maven.apache.org/maven2", @@ -6581,16 +6371,6 @@ } }, - { - "path": "com/squareup/okhttp3/parent/3.8.1/parent-3.8.1", - "host": "https://repo.maven.apache.org/maven2", - "type": "pom", - "pom": { - "sha1": "e81c3f3a398182176b819aa4bd2d70418a5c69f3", - "sha256": "0msfhnyx0wc2sqrm9l2hz017ddiq0mva3icarcl2ysbap0zp59gj" - } - }, - { "path": "com/squareup/okhttp3/parent/3.12.1/parent-3.12.1", "host": "https://repo.maven.apache.org/maven2", @@ -6601,16 +6381,6 @@ } }, - { - "path": "com/squareup/okhttp3/parent/3.14.1/parent-3.14.1", - "host": "https://repo.maven.apache.org/maven2", - "type": "pom", - "pom": { - "sha1": "32696e235dfe284f78e05f9bd24345a2d261633c", - "sha256": "0hpw4vnnfxvd9yhhmrlq0hqczd1lpa7nrk25zglficjwb15wsm96" - } - }, - { "path": "com/squareup/okio/okio-parent/1.15.0/okio-parent-1.15.0", "host": "https://repo.maven.apache.org/maven2", @@ -6621,16 +6391,6 @@ } }, - { - "path": "com/squareup/okio/okio-parent/1.17.2/okio-parent-1.17.2", - "host": "https://repo.maven.apache.org/maven2", - "type": "pom", - "pom": { - "sha1": "57554cc5eac8170d5ea09c38ff7d6b86d7c8db23", - "sha256": "097h2vz0wxjb9nj8lhdaazkzpfasr1ss38qgn6ab63iadwa407z8" - } - }, - { "path": "com/squareup/okio/okio/1.15.0/okio-1.15.0", "host": "https://repo.maven.apache.org/maven2", @@ -6645,20 +6405,6 @@ } }, - { - "path": "com/squareup/okio/okio/1.17.2/okio-1.17.2", - "host": "https://repo.maven.apache.org/maven2", - "type": "jar", - "pom": { - "sha1": "abe9c87bf8b3b4e19cabc0014b76fd633fa467a5", - "sha256": "1w03pgj28lsb9x7g10gaky8hxvb4xsa1k99x415p2smb8dagfmyd" - }, - "jar": { - "sha1": "78c7820b205002da4d2d137f6f312bd64b3d6049", - "sha256": "1f72kw6ap0a5rw2ng20sxdy28kb01nc6y7byqka7mi7s5wny837q" - } - }, - { "path": "com/squareup/okio/okio/2.6.0/okio-2.6.0", "host": "https://repo.maven.apache.org/maven2", diff --git a/nix/deps/gradle/deps.list b/nix/deps/gradle/deps.list index a05261065f..6c365c9452 100644 --- a/nix/deps/gradle/deps.list +++ b/nix/deps/gradle/deps.list @@ -1,3 +1,4 @@ +androidx.activity:activity:1.0.0 androidx.activity:activity:1.1.0 androidx.annotation:annotation:1.0.0 androidx.annotation:annotation:1.1.0 @@ -27,21 +28,26 @@ androidx.databinding:databinding-compiler-common:3.5.3 androidx.documentfile:documentfile:1.0.0 androidx.drawerlayout:drawerlayout:1.0.0 androidx.exifinterface:exifinterface:1.0.0 +androidx.exifinterface:exifinterface:1.1.0-beta01 androidx.fragment:fragment:1.0.0 +androidx.fragment:fragment:1.1.0 androidx.fragment:fragment:1.2.1 androidx.interpolator:interpolator:1.0.0 androidx.legacy:legacy-support-core-ui:1.0.0 androidx.legacy:legacy-support-core-utils:1.0.0 androidx.legacy:legacy-support-v4:1.0.0 androidx.lifecycle:lifecycle-common:2.0.0 +androidx.lifecycle:lifecycle-common:2.1.0 androidx.lifecycle:lifecycle-common:2.2.0 androidx.lifecycle:lifecycle-livedata-core:2.0.0 androidx.lifecycle:lifecycle-livedata-core:2.2.0 androidx.lifecycle:lifecycle-livedata:2.0.0 androidx.lifecycle:lifecycle-runtime:2.0.0 +androidx.lifecycle:lifecycle-runtime:2.1.0 androidx.lifecycle:lifecycle-runtime:2.2.0 androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0 androidx.lifecycle:lifecycle-viewmodel:2.0.0 +androidx.lifecycle:lifecycle-viewmodel:2.1.0 androidx.lifecycle:lifecycle-viewmodel:2.2.0 androidx.loader:loader:1.0.0 androidx.localbroadcastmanager:localbroadcastmanager:1.0.0 @@ -56,6 +62,7 @@ androidx.swiperefreshlayout:swiperefreshlayout:1.0.0 androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02 androidx.transition:transition:1.1.0 androidx.transition:transition:1.2.0 +androidx.transition:transition:1.2.0-rc01 androidx.vectordrawable:vectordrawable-animated:1.0.0 androidx.vectordrawable:vectordrawable-animated:1.1.0 androidx.vectordrawable:vectordrawable:1.0.1 @@ -295,7 +302,6 @@ com.drewnoakes:metadata-extractor:2.11.0 com.facebook.conceal:conceal:1.1.3 com.facebook.fbjni:fbjni-java-only:0.0.3 com.facebook.flipper:flipper-fresco-plugin:0.35.0 -com.facebook.flipper:flipper-network-plugin:0.35.0 com.facebook.flipper:flipper:0.35.0 com.facebook.fresco:animated-base:2.0.0 com.facebook.fresco:animated-drawable:2.0.0 @@ -321,7 +327,7 @@ com.facebook.yoga:proguard-annotations:1.14.1 com.github.status-im.status-keycard-java:android:3.0.1 com.github.status-im.status-keycard-java:lib:3.0.1 com.github.status-im:function:0.0.1 -com.github.yalantis:ucrop:2.2.2-native +com.github.yalantis:ucrop:2.2.5-native com.googlecode.json-simple:json-simple:1.1 com.googlecode.juniversalchardet:juniversalchardet:1.0.3 com.google.android.gms:play-services-auth-base:16.0.0 @@ -371,9 +377,7 @@ com.intellij:annotations:12.0 com.parse.bolts:bolts-tasks:1.4.0 com.squareup.okhttp3:okhttp-urlconnection:3.12.1 com.squareup.okhttp3:okhttp:3.12.1 -com.squareup.okhttp3:okhttp:3.14.1 com.squareup.okio:okio:1.15.0 -com.squareup.okio:okio:1.17.2 com.squareup:javapoet:1.8.0 com.squareup:javawriter:2.5.0 com.sun.activation:javax.activation:1.2.0 diff --git a/nix/deps/gradle/deps.urls b/nix/deps/gradle/deps.urls index fd9bd0fb10..04f5771537 100644 --- a/nix/deps/gradle/deps.urls +++ b/nix/deps/gradle/deps.urls @@ -34,6 +34,7 @@ https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compile https://dl.google.com/dl/android/maven2/androidx/documentfile/documentfile/1.0.0/documentfile-1.0.0.pom https://dl.google.com/dl/android/maven2/androidx/drawerlayout/drawerlayout/1.0.0/drawerlayout-1.0.0.pom https://dl.google.com/dl/android/maven2/androidx/exifinterface/exifinterface/1.0.0/exifinterface-1.0.0.pom +https://dl.google.com/dl/android/maven2/androidx/exifinterface/exifinterface/1.1.0-beta01/exifinterface-1.1.0-beta01.pom https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.0.0/fragment-1.0.0.pom https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.1.0/fragment-1.1.0.pom https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom @@ -67,6 +68,7 @@ https://dl.google.com/dl/android/maven2/androidx/slidingpanelayout/slidingpanela https://dl.google.com/dl/android/maven2/androidx/swiperefreshlayout/swiperefreshlayout/1.0.0/swiperefreshlayout-1.0.0.pom https://dl.google.com/dl/android/maven2/androidx/swiperefreshlayout/swiperefreshlayout/1.1.0-alpha02/swiperefreshlayout-1.1.0-alpha02.pom https://dl.google.com/dl/android/maven2/androidx/transition/transition/1.1.0/transition-1.1.0.pom +https://dl.google.com/dl/android/maven2/androidx/transition/transition/1.2.0-rc01/transition-1.2.0-rc01.pom https://dl.google.com/dl/android/maven2/androidx/transition/transition/1.2.0/transition-1.2.0.pom https://dl.google.com/dl/android/maven2/androidx/vectordrawable/vectordrawable-animated/1.0.0/vectordrawable-animated-1.0.0.pom https://dl.google.com/dl/android/maven2/androidx/vectordrawable/vectordrawable-animated/1.1.0/vectordrawable-animated-1.1.0.pom @@ -79,14 +81,8 @@ https://dl.google.com/dl/android/maven2/androidx/versionedparcelable/versionedpa https://dl.google.com/dl/android/maven2/androidx/viewpager2/viewpager2/1.0.0/viewpager2-1.0.0.pom https://dl.google.com/dl/android/maven2/androidx/viewpager/viewpager/1.0.0/viewpager-1.0.0.pom https://dl.google.com/dl/android/maven2/android/arch/core/common/1.0.0/common-1.0.0.pom -https://dl.google.com/dl/android/maven2/android/arch/core/common/1.1.0/common-1.1.0.pom -https://dl.google.com/dl/android/maven2/android/arch/core/runtime/1.1.0/runtime-1.1.0.pom https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common/1.0.0/common-1.0.0.pom -https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common/1.1.0/common-1.1.0.pom -https://dl.google.com/dl/android/maven2/android/arch/lifecycle/livedata-core/1.1.0/livedata-core-1.1.0.pom https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.pom -https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/1.1.0/runtime-1.1.0.pom -https://dl.google.com/dl/android/maven2/android/arch/lifecycle/viewmodel/1.1.0/viewmodel-1.1.0.pom https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.0.0/baseLibrary-3.0.0.pom https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.0.1/baseLibrary-3.0.1.pom https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.2.1/baseLibrary-3.2.1.pom @@ -96,38 +92,30 @@ https://dl.google.com/dl/android/maven2/com/android/databinding/compilerCommon/3 https://dl.google.com/dl/android/maven2/com/android/databinding/compilerCommon/3.0.1/compilerCommon-3.0.1.pom https://dl.google.com/dl/android/maven2/com/android/support/animated-vector-drawable/26.0.2/animated-vector-drawable-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/animated-vector-drawable/27.0.1/animated-vector-drawable-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/animated-vector-drawable/27.1.0/animated-vector-drawable-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.0.2/appcompat-v7-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/27.1.0/appcompat-v7-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/recyclerview-v7/27.0.1/recyclerview-v7-27.0.1.pom https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/26.0.2/support-annotations-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/27.1.0/support-annotations-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-compat/26.0.2/support-compat-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-compat/26.1.0/support-compat-26.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-compat/27.0.1/support-compat-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/support-compat/27.1.0/support-compat-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-core-ui/26.0.2/support-core-ui-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-core-ui/26.1.0/support-core-ui-26.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-core-ui/27.0.1/support-core-ui-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/support-core-ui/27.1.0/support-core-ui-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/26.0.2/support-core-utils-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/26.1.0/support-core-utils-26.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/27.1.0/support-core-utils-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-fragment/26.0.2/support-fragment-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-fragment/26.1.0/support-fragment-26.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-fragment/27.0.1/support-fragment-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/support-fragment/27.1.0/support-fragment-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-media-compat/26.0.2/support-media-compat-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-media-compat/26.1.0/support-media-compat-26.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-v4/26.0.2/support-v4-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-v4/26.1.0/support-v4-26.1.0.pom https://dl.google.com/dl/android/maven2/com/android/support/support-vector-drawable/26.0.2/support-vector-drawable-26.0.2.pom https://dl.google.com/dl/android/maven2/com/android/support/support-vector-drawable/27.0.1/support-vector-drawable-27.0.1.pom -https://dl.google.com/dl/android/maven2/com/android/support/support-vector-drawable/27.1.0/support-vector-drawable-27.1.0.pom https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.2.1/crash-26.2.1.pom https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.3.1/crash-26.3.1.pom https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.5.3/crash-26.5.3.pom @@ -303,13 +291,12 @@ https://repository.sonatype.org/content/groups/sonatype-public-grid/com/android/ https://repository.sonatype.org/content/groups/sonatype-public-grid/com/android/tools/sdk-common/25.2.3/sdk-common-25.2.3.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/com/facebook/flipper/flipper-fresco-plugin/0.35.0/flipper-fresco-plugin-0.35.0.pom -https://repository.sonatype.org/content/groups/sonatype-public-grid/com/facebook/flipper/flipper-network-plugin/0.35.0/flipper-network-plugin-0.35.0.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/com/facebook/flipper/flipper/0.35.0/flipper-0.35.0.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/com/github/status-im/function/0.0.1/function-0.0.1.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/com/github/status-im/status-keycard-java/android/3.0.1/android-3.0.1.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/com/github/status-im/status-keycard-java/lib/3.0.1/lib-3.0.1.pom -https://repository.sonatype.org/content/groups/sonatype-public-grid/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom +https://repository.sonatype.org/content/groups/sonatype-public-grid/com/github/yalantis/ucrop/2.2.5-native/ucrop-2.2.5-native.pom https://repository.sonatype.org/content/groups/sonatype-public-grid/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom https://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.pom https://repo.maven.apache.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.pom @@ -471,17 +458,11 @@ https://repo.maven.apache.org/maven2/com/parse/bolts/bolts-tasks/1.4.0/bolts-tas https://repo.maven.apache.org/maven2/com/squareup/javapoet/1.8.0/javapoet-1.8.0.pom https://repo.maven.apache.org/maven2/com/squareup/javawriter/2.5.0/javawriter-2.5.0.pom https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp-urlconnection/3.12.1/okhttp-urlconnection-3.12.1.pom -https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/3.8.1/okhttp-3.8.1.pom https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/3.12.1/okhttp-3.12.1.pom -https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/3.14.1/okhttp-3.14.1.pom https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/4.7.2/okhttp-4.7.2.pom -https://repo.maven.apache.org/maven2/com/squareup/okhttp3/parent/3.8.1/parent-3.8.1.pom https://repo.maven.apache.org/maven2/com/squareup/okhttp3/parent/3.12.1/parent-3.12.1.pom -https://repo.maven.apache.org/maven2/com/squareup/okhttp3/parent/3.14.1/parent-3.14.1.pom https://repo.maven.apache.org/maven2/com/squareup/okio/okio-parent/1.15.0/okio-parent-1.15.0.pom -https://repo.maven.apache.org/maven2/com/squareup/okio/okio-parent/1.17.2/okio-parent-1.17.2.pom https://repo.maven.apache.org/maven2/com/squareup/okio/okio/1.15.0/okio-1.15.0.pom -https://repo.maven.apache.org/maven2/com/squareup/okio/okio/1.17.2/okio-1.17.2.pom https://repo.maven.apache.org/maven2/com/squareup/okio/okio/2.6.0/okio-2.6.0.pom https://repo.maven.apache.org/maven2/com/squareup/okio/okio/2.7.0-alpha.lockfree.1/okio-2.7.0-alpha.lockfree.1.pom https://repo.maven.apache.org/maven2/com/sun/activation/all/1.2.0/all-1.2.0.pom diff --git a/nix/deps/gradle/proj.list b/nix/deps/gradle/proj.list index aa2973666a..8b3dde7b6b 100644 --- a/nix/deps/gradle/proj.list +++ b/nix/deps/gradle/proj.list @@ -1,6 +1,7 @@ app react-native-background-timer react-native-camera +react-native-community_cameraroll react-native-community_clipboard react-native-community_masked-view react-native-community_netinfo diff --git a/resources/images/icons/camera@2x.png b/resources/images/icons/camera@2x.png old mode 100644 new mode 100755 index c22675bbe6116063d615cc9e8bd62a67c8d5eabd..c968d143ca5b63508484257a49cbec9f869ab2ca GIT binary patch delta 429 zcmV;e0aE^t1IGi9B!7-cL_t(|+U-|enS>w|JrRgN1S8O3ZQwLm8)$@SpbgvxL@)vo zjNm@3GB|J)#C@3W^YSKmf6u)ffLlI89?+ODJ8ObQb&YZXy;1G10V3Z(Pu0(u(d8#+ zK3HXrdI__rF(}B+1bH_1jZ;_|Fg{u1Rf>_)L(Ggec(Q&w6@P&&8AMD=&$ofohDYr(ASyJNz50k;u2mw`6a`+ywY5ECnf(=%WGw!Wlw1|Gv2B=cUOTaq}UqwQ7L z1beau7mF@dN~(t&C;~|N^Rl?YfF$bKm`FBY9PlX!0Lnp&&NWbyetz|^$}`YY@G@8@ z8W@S6fU;=HGJn9aB~t&`KQ55%Qh380rf9sT$eNOY%pxoMz1e(k=-fS$ihmz=?6%gaC8$Ex!B$ Xgk+FFm!?&T00000NkvXXu0mjfAuP+O delta 372 zcmV-)0gL{}1CIlcB!5;(L_t(|+U-~Eal;@C)d-B>5i$asgbmsanhnARuz|Y)BX|Tx z@CeO0XH$C718k8Wy|eVs$a?yC;)CdvQ{F8X3iJat&>(X^P%OA#G?J14*oyl_KP3RM z0U+$Jx>@xrIpNBn(&|V0!_ehOOC7KdpeqA*KeNARU~fRtW`8~p#Fz;4RUjb1Et9p) zWm;m1`D5v5Og?U}#uHvTKx~Fv8@6mVRq6u-kP7ru1JLAF8cgI0c^(2#S^GA<_XALX zz*8>(5BH&a4*;D-te^RqEF&!k@XU1nPQ8@_Ol+(gZX~+_`0r|`eFK0J1yopwY>5n{ z>TUp=TyafyJ#A?kSDNaKrbCZG8{weYf3j695WXpT;dbrUp^IeUML+=X_5()@FjsCt zt@lEBCXe--S%dqHZ{JiHs2qGRb%Vv0|un$8sHdcHeP=`9Z#6^eL) SR_9~@00001!V5TLN7L0f#6@M4N zMn@~uVB+$AyY~PpjO@-TKRndaWL$ldDU3Rqacu&ZowgCOJgLf$kWUKOj?G&P1K11*p!SSlvP{LA=yNeGWR zm~kOep~00LN2-yCYwBeoqY&kpkrSS{2CPa!btY1JC>$Ps*cZ|=l({|vGaqfJqT#b+ zG}JCg8|Zm2*m%NEMn!yCo+-BoWTwmVdp1@`Zi{O<0#)0>LX4j@rPb+4*O`l;bKoFMpO|Ts7uUx*m{;u_NXXMeOjHD0rvHPJ+hb2vGxN z@GWdFD7=s-q)OSf)aoYH@!gN1W9`Vas#+Qd9H1# zyT<9*CP8v+6VvK@Azoz5yVCw>4PdcYEEbE!VzF2(7K`P7gXsobT+P}_!5DwO)ja7Q zA2v8XY|qmF8hvr=!r^@du+JFOp*)uO{PDVX*o4*qlgrs1n7{Nx@2LGQE-*G=k>FzZ zo@||d>fY;ya@_!YnDL7%1`qLTT6t9dE4-xg;fp|B)cAbly4rcQ22e_#q7wJoak%=9 zl*7182g z&dkL3$-s{9oH0;+GGNMv4W(2AgIwog`fcn9G{hF$eH}(I0IRq;Y*WE8I7j6>x?!Yz z&FAw_c?}B32;VHno1ito=S#PfMftF1P;l=1@_p~HtyPGimB%gL0CO5Oyax(E>jI4N zlay#i>87YH_?R)0E3fEWp=8$=u%vk=SMGtrz#2bC&`y|4-J9M~cL6ytae>6j;K~k) zQl5y4m%otmfg|@wvDG}i!|ruZlY8lkRAR7%oMf&8ijKm_hxi3ouy%Kmj4|0wjODNo zIVr6Y%s^s?9Urwf7EI(434zLgw61~y5 zX9ULGb-N&xQHdQN%GB#O0B5N)0yQ%Nemja*n-mYrV~^ja>k-dWL&(X_4G`vWCeIT> zGJ@jYC)1h2s_&P8HI*n3JPJMcnOt`K@@G8>?% zb9foh$r3VRU;wpv|!?R|<@>L>OM#$_CxEf$N#VzF2(7K_DVvHTnS0VNM|2Wf}dVgLXD07*qoM6N<$ Ef>kx$uK)l5 literal 0 HcmV?d00001 diff --git a/resources/images/icons/camera_permission@3x.png b/resources/images/icons/camera_permission@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..8589f3b1058632880e848acc62d52bca0f281f19 GIT binary patch literal 1463 zcmZ`(c|6k#0RN3`ubJ7$2QOzH&zUJ>cEx0F&U}+j7pqQr&u0st$5@aU`7U8;u8^;VU29V_!i+StFq=eqhD4X8C=Ih`>c(a> z8bO%~g$I~_Am8x#LS3=l!b71mD5>+RHxM4eTH0Ry%xz`q$=T3=8is>E_tC~c7_~VV zKF~FhA>#URee^kxr61l3QfNF*b{g1c`f046>P(HMd4+cuN^c$;%Ny^y>ZS9E?>uKI ztK|5I>q`kof(Og!GLF_E@dYXT-cS`VBGiE+?B=k}tu`hK)D;6yIWOu|%U@1~eEh|8 z)<*G>R)`tFkgdrtexVPm*<~Wv6jzOd@q?#UI{mJN8Y^wBI@9sk23r4Zxqt-Upn>IR zK|Pu%zXF>_iHF-qE_R#j$BJD;W8Mt)0hR&!tp>ZAI;4HujxaLBDcOk;6gXYNIJCkK zO7E=(idLn0_jlYQJ3v2825<0B^>G{4)kIMIB?lOxp5UeXxRYq3pz01|i?3?}4FC$7Z} zx3-sDo-?&7<^>6;rk$lHB*jPoG6AEhwf?r^NmIMUDZ1Y`%aDamyo4ICzihJ6c!pzV z{Tn-x3Ao9M2@&h;#`Aq(ks*3h@E?K8Ft?boujqK<3z5mK-p}rL{8EpiW!2Ay{|d~% zWA=|zXP%NA8efLAeX(MhP>7p`kais}b^AsS&PIO<)m>iSw>t5l-gqEQ=oMq8bM1Y2 z`}%gO`f(2Vh&bI;+Mp{X*N0!Yk)=4X zI=3x}&xJYDLQ4s1_j9)|6u40*=;xwQ3nyN&)JPW~RZU{760L0HD# zlv`A_{`F2vdGOLzQWx5?&l7U>Qbgw2l!?Mo_Fi)^t0(KS?5@q4ypJc$iR!)JoJM_B z+_zt>v$*Yvn)8}Gihi=Eykm_i2@qY=|1d3TTFZyxxktSX{S8s)6Ozu^aa8otuJQc@ zDBgPrQb`gRBbk_0HG+b-*3nxu7ddx3ydJqRc4d{+?3#@ke9GcfqPZzKB;_gUgF2(%asrrzbM?6vn$fOn11?h}w3o-;R+k{*}UQ{eHH2cT#`mGH#1$R?6P@~29?RP@C zTw7k}YVPafrfRhcdVpI;gP7e1NKqJWMMCMOl1J5Z35t*Se}k@k%(potQX~vb%sTm5 Nz}E7jMGb~P{1-;0t!w}Q literal 0 HcmV?d00001 diff --git a/resources/images/icons/collection@2x.png b/resources/images/icons/collection@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..edfd31ca6bb51e5f3d5bfa688d5d4ef5c63fa5c1 GIT binary patch literal 376 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC&H|6fVg?2=RS;(M3{v?36l5$8 za(7}_cTVOdki(Mh=6yi7+m+5yI&Id z$fx>b?xVezk2*3h1)@UJ51ZzRwgxh~uiDOKG3N&J^2Hwxyv+EoV14RzhGzYf>rHXT zo*!Cb+?A2IUf5N9zn{K|$p6O|gPxRrchP4^VBIFv1h(BUN42a%vU%zi;cY_CD>qKn z;FSWQvw_i_Gu|GI&r@B+yr*Z{C-*wt7pV!_fd^hMRm@Rk_>pkG$B+ufx3eAw9&!+9ogbFKnavvIWYxg8 zg=MY78kQ|gxd(1AhCK*m3}~#7JWzP-O>U9r1HSv_pZ}#y+Iu`%t)QA)z==a~XHi?3 zNSt}x^*HgkOAltYUcdGF@awCuS?_8HefYrsQERW6?TLjq+r2J2>s~eA`s(D3xYe1eVToJ|yQGZZogs3urC- zJlTU^i#2?Py? (max width height) maximum-image-size-px)] + (image-processing/resize + uri + (if resize? maximum-image-size-px width) + (if resize? maximum-image-size-px height) + 60 + (fn [resized-image] + (let [path (aget resized-image "path") + path (if (string/starts-with? path "file") path (str "file://" path))] + (cb path))) + #(log/error "could not resize image" %)))))) + +(re-frame/reg-fx + ::save-image-to-gallery + (fn [base64-uri] + (if platform/ios? + (.saveToCameraRoll CameraRoll base64-uri) + (react/image-get-size + base64-uri + (fn [width height] + (image-processing/resize + base64-uri + width + height + 100 + (fn [resized-image] + (let [path (aget resized-image "path") + path (if (string/starts-with? path "file") path (str "file://" path))] + (.saveToCameraRoll CameraRoll path))) + #(log/error "could not resize image" %))))))) + +(re-frame/reg-fx + ::resize-camera-roll-images + (fn [photos] + (doseq [photo photos] + (resize-and-call + (-> photo :node :image :uri) + #(re-frame/dispatch [:add-resized-image-to-roll %]))))) + +(re-frame/reg-fx + ::chat-open-image-picker + (fn [] + (react/show-image-picker + (fn [result] + (resize-and-call + (aget result "path") + #(re-frame/dispatch [:chat.ui/image-selected %]))) + "photo"))) + +(re-frame/reg-fx + ::image-captured + (fn [uri] + (resize-and-call + uri + #(re-frame/dispatch [:chat.ui/image-selected %])))) + +(re-frame/reg-fx + ::camera-roll-get-photos + (fn [num] + (-> (.getPhotos CameraRoll (clj->js {:first num :assetType "Photos"})) + (.then #(re-frame/dispatch [:on-camera-roll-get-photos (:edges (types/js->clj %))])) + (.catch #(log/error "could not get cameraroll photos"))))) + +(fx/defn image-captured + {:events [:chat.ui/image-captured]} + [_ uri] + {::image-captured uri}) + +(fx/defn camera-roll-get-photos + {:events [:chat.ui/camera-roll-get-photos]} + [_ num] + {::camera-roll-get-photos num}) + +(fx/defn add-resized-image-to-roll + {:events [:add-resized-image-to-roll]} + [{db :db} uri] + {:db (update db :camera-roll-photos conj uri)}) + +(fx/defn on-camera-roll-get-photos + {:events [:on-camera-roll-get-photos]} + [{db :db} photos] + (when-not (seq (:camera-roll-photos db)) + {:db (assoc db :camera-roll-photos []) + ::resize-camera-roll-images photos})) + +(fx/defn cancel-sending-image + {:events [:chat.ui/cancel-sending-image]} + [{:keys [db]}] + (let [current-chat-id (:current-chat-id db)] + {:db (update-in db [:chats current-chat-id :metadata] dissoc :sending-image)})) + +(fx/defn image-selected + {:events [:chat.ui/image-selected]} + [{:keys [db]} uri] + (let [current-chat-id (:current-chat-id db)] + {:db (assoc-in db [:chats current-chat-id :metadata :sending-image :uri] uri)})) + +(fx/defn chat-open-image-picker + {:events [:chat.ui/open-image-picker]} + [_] + {::chat-open-image-picker nil}) + +(fx/defn save-image-to-gallery + {:events [:chat.ui/save-image-to-gallery]} + [_ base64-uri] + {::save-image-to-gallery base64-uri}) diff --git a/src/status_im/chat/models/input.cljs b/src/status_im/chat/models/input.cljs index 47ce0a1ff7..56eb62a89c 100644 --- a/src/status_im/chat/models/input.cljs +++ b/src/status_im/chat/models/input.cljs @@ -78,8 +78,11 @@ [{:keys [db] :as cofx} message] (let [current-chat-id (:current-chat-id db)] (fx/merge cofx - {:db (assoc-in db [:chats current-chat-id :metadata :responding-to-message] - message)} + {:db (-> db + (assoc-in [:chats current-chat-id :metadata :responding-to-message] + message) + (update-in [:chats current-chat-id :metadata] + dissoc :sending-image))} (chat-input-focus :input-ref)))) (fx/defn cancel-message-reply @@ -90,9 +93,9 @@ {:db (assoc-in db [:chats current-chat-id :metadata :responding-to-message] nil)} (chat-input-focus :input-ref)))) -(defn plain-text-message-fx +(fx/defn send-plain-text-message "when not empty, proceed by sending text message" - [input-text current-chat-id {:keys [db] :as cofx}] + [{:keys [db] :as cofx} input-text current-chat-id] (when-not (string/blank? input-text) (let [{:keys [message-id]} (get-in db [:chats current-chat-id :metadata :responding-to-message]) @@ -113,19 +116,18 @@ (process-cooldown))))) (fx/defn send-image - {:events [:chat.ui/send-image]} - [{{:keys [current-chat-id] :as db} :db :as cofx} send-image] - (println "SENDING" send-image) - (fx/merge cofx - {:db (chat/set-chat-ui-props db {:send-image-loading? true})} - (when-not (string/blank? send-image) - (chat.message/send-message {:chat-id current-chat-id - :content-type constants/content-type-image - :image-path send-image - :text "Update to latest version to see a nice image here!"})))) + [{{:keys [current-chat-id] :as db} :db :as cofx}] + (let [image-path (get-in db [:chats current-chat-id :metadata :sending-image :uri])] + (fx/merge cofx + {:db (update-in db [:chats current-chat-id :metadata] dissoc :sending-image)} + (when-not (string/blank? image-path) + (chat.message/send-message {:chat-id current-chat-id + :content-type constants/content-type-image + :image-path (string/replace image-path #"file://" "") + :text "Update to latest version to see a nice image here!"}))))) -(fx/defn send-sticker-fx - [{:keys [db] :as cofx} {:keys [hash pack]} current-chat-id] +(fx/defn send-sticker-message + [cofx {:keys [hash pack]} current-chat-id] (when-not (string/blank? hash) (chat.message/send-message cofx {:chat-id current-chat-id :content-type constants/content-type-sticker @@ -137,15 +139,9 @@ "Sends message from current chat input" [{{:keys [current-chat-id] :as db} :db :as cofx}] (let [{:keys [input-text]} (get-in db [:chat/inputs current-chat-id])] - (plain-text-message-fx input-text current-chat-id cofx))) - -(fx/defn send-transaction-result - {:events [:chat/send-transaction-result]} - [cofx chat-id params result]) - ;;TODO: should be implemented on status-go side - ;;see https://github.com/status-im/team-core/blob/6c3d67d8e8bd8500abe52dab06a59e976ec942d2/rfc-001.md#status-gostatus-react-interface - -;; effects + (fx/merge cofx + (send-image) + (send-plain-text-message input-text current-chat-id)))) (re-frame/reg-fx ::focus-rn-component diff --git a/src/status_im/data_store/messages_test.cljs b/src/status_im/data_store/messages_test.cljs index 9728ea4569..5ab862fe66 100644 --- a/src/status_im/data_store/messages_test.cljs +++ b/src/status_im/data_store/messages_test.cljs @@ -16,6 +16,7 @@ :ens-name "ens-name" :parsed-text "parsed-text" :rtl? false + :image nil :response-to "a"} :whisper-timestamp 1 :outgoing-status :sending diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 43d104d86b..c7d8aa6cd4 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -69,7 +69,8 @@ status-im.ui.screens.group.events status-im.utils.universal-links.events status-im.search.core - status-im.ui.screens.profile.events)) + status-im.ui.screens.profile.events + status-im.chat.models.images)) ;; init module (handlers/register-handler-fx @@ -575,7 +576,7 @@ :stickers/recent-stickers (conj (remove #(= hash %) (:stickers/recent-stickers multiaccount)) hash) {}) - (chat.input/send-sticker-fx sticker current-chat-id)))) + (chat.input/send-sticker-message sticker current-chat-id)))) (handlers/register-handler-fx :chat/disable-cooldown diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 9732651db8..ea8972e2a8 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -119,6 +119,7 @@ (reg-root-key-sub :group-chat-profile/profile :group-chat-profile/profile) (reg-root-key-sub :selected-participants :selected-participants) (reg-root-key-sub :chat/inputs :chat/inputs) +(reg-root-key-sub :camera-roll-photos :camera-roll-photos) ;;browser (reg-root-key-sub :browsers :browser/browsers) @@ -837,6 +838,12 @@ (fn [{:keys [metadata]}] (:responding-to-message metadata))) +(re-frame/reg-sub + :chats/sending-image + :<- [:chats/current-chat] + (fn [{:keys [metadata]}] + (get-in metadata [:sending-image]))) + (re-frame/reg-sub :public-chat.new/topic-error-message :<- [:public-group-topic] diff --git a/src/status_im/ui/components/camera.cljs b/src/status_im/ui/components/camera.cljs index a1e20e4dd5..f8c10bcea6 100644 --- a/src/status_im/ui/components/camera.cljs +++ b/src/status_im/ui/components/camera.cljs @@ -3,6 +3,7 @@ [reagent.core :as reagent] [clojure.string :as string] [clojure.walk :as walk] + [oops.core :refer [oget]] ["react-native-camera" :refer (RNCamera)])) (defn- constants [t] @@ -24,9 +25,20 @@ (.then (fn [allowed?] (if allowed? (then) (else)))) (.catch else))) -(defn camera [props] - (reagent/create-element RNCamera (clj->js (merge {:inverted true} props)))) +(def camera (reagent/adapt-react-class RNCamera)) (defn get-qr-code-data [^js code] (when-let [data (.-data code)] (string/trim data))) + +(defn on-layout [layout] + (fn [evt] + (reset! layout {:width (oget evt "nativeEvent" "layout" "width") + :height (oget evt "nativeEvent" "layout" "height")}))) + +(defn on-tap [camera-ref layout focus-object] + (fn [coord] + (when (and @camera-ref (:width @layout)) + (let [{:keys [width height]} @layout + {:keys [x y]} (js->clj coord :keywordize-keys true)] + (reset! focus-object (clj->js {:x (/ x width) :y (/ y height) :autoExposure true})))))) \ No newline at end of file diff --git a/src/status_im/ui/components/colors.cljs b/src/status_im/ui/components/colors.cljs index 844453638f..fb97027b6f 100644 --- a/src/status_im/ui/components/colors.cljs +++ b/src/status_im/ui/components/colors.cljs @@ -47,6 +47,7 @@ (def black-transparent-40-persist (alpha black 0.4)) (def black-transparent-50 (alpha black 0.5)) (def black-light "#2d2d2d") ;; sign-with-keycard-button +(def black-transparent-86 "rgba(0, 0, 0, 0.86)") ;; DARK GREY (def gray (:gray light)) ;; Dark grey, used as a background for a light foreground and as section header and secondary text color diff --git a/src/status_im/ui/components/react.cljs b/src/status_im/ui/components/react.cljs index a7d3b0e8a4..cf320c1805 100644 --- a/src/status_im/ui/components/react.cljs +++ b/src/status_im/ui/components/react.cljs @@ -29,6 +29,9 @@ (def text-class (reagent/adapt-react-class (.-Text react-native))) (def text-input-class (reagent/adapt-react-class (.-TextInput react-native))) (def image-class (reagent/adapt-react-class (.-Image react-native))) + +(defn image-get-size [uri callback] (.getSize (.-Image react-native) uri callback)) + (defn valid-source? [source] (or (not (map? source)) (not (contains? source :uri)) @@ -192,6 +195,15 @@ (.then images-fn) (.catch show-access-error)))) +(defn show-image-picker-camera + ([images-fn] + (show-image-picker-camera images-fn nil)) + ([images-fn props] + (-> ^js image-picker + (.openCamera (clj->js props)) + (.then images-fn) + (.catch show-access-error)))) + ;; Clipboard (def sharing diff --git a/src/status_im/ui/components/status_bar/view.cljs b/src/status_im/ui/components/status_bar/view.cljs index 349a7fe7b3..81ed3e2db1 100644 --- a/src/status_im/ui/components/status_bar/view.cljs +++ b/src/status_im/ui/components/status_bar/view.cljs @@ -3,7 +3,8 @@ [status-im.ui.components.status-bar.styles :as styles] [status-im.utils.platform :as platform])) -(def route->bar-type (merge {:qr-scanner {:type :black}} +(def route->bar-type (merge {:qr-scanner {:type :black} + :image-preview {:type :black}} (when platform/ios? {:new-chat {:type :black} :new-public-chat {:type :black}}))) diff --git a/src/status_im/ui/screens/chat/image/preview/views.cljs b/src/status_im/ui/screens/chat/image/preview/views.cljs new file mode 100644 index 0000000000..363ff4c71f --- /dev/null +++ b/src/status_im/ui/screens/chat/image/preview/views.cljs @@ -0,0 +1,34 @@ +(ns status-im.ui.screens.chat.image.preview.views + (:require-macros [status-im.utils.views :refer [defview letsubs]]) + (:require [status-im.ui.components.colors :as colors] + [status-im.ui.components.react :as react] + [re-frame.core :as re-frame] + [status-im.ui.components.button :as button] + [status-im.ui.components.icons.vector-icons :as icons] + [status-im.ui.screens.chat.sheets :as sheets])) + +(defview preview-image [] + (letsubs [{:keys [content] :as message} [:get-screen-params] + {:keys [width height]} [:dimensions/window]] + [react/view {:flex 1 :background-color colors/black-persist} + [react/safe-area-view {:style {:flex 1 :justify-content :flex-end}} + [react/view {:flex 1 :align-items :center :justify-content :center} + [react/image {:style (merge {:width width + :height (- height 200) + :background-color :black}) + :resize-mode :contain + :source {:uri (:image content)}}]] + [react/view {:flex-direction :row :padding-horizontal 8 + :justify-content :space-between :align-items :center} + [react/view {:width 64}] + [button/button {:on-press #(re-frame/dispatch [:navigate-back]) + :type :secondary + :label :t/close + :text-style {:color colors/white-persist}}] + [react/touchable-highlight + {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + {:content (sheets/image-long-press message true) + :height 64}])} + [icons/icon :main-icons/more {:container-style {:width 24 :height 24 + :margin 20} + :color colors/white-persist}]]]]])) diff --git a/src/status_im/ui/screens/chat/image/styles.cljs b/src/status_im/ui/screens/chat/image/styles.cljs deleted file mode 100644 index 0b54f58f8e..0000000000 --- a/src/status_im/ui/screens/chat/image/styles.cljs +++ /dev/null @@ -1,3 +0,0 @@ -(ns status-im.ui.screens.chat.image.styles) - -(def image-panel-height 263) \ No newline at end of file diff --git a/src/status_im/ui/screens/chat/image/views.cljs b/src/status_im/ui/screens/chat/image/views.cljs index f17aa6fbfa..2e6306c2b9 100644 --- a/src/status_im/ui/screens/chat/image/views.cljs +++ b/src/status_im/ui/screens/chat/image/views.cljs @@ -5,12 +5,19 @@ [re-frame.core :as re-frame] [status-im.ui.components.colors :as colors] [status-im.ui.components.animation :as anim] - [status-im.ui.screens.chat.image.styles :as styles] - [status-im.utils.utils :as utils] - [status-im.i18n :as i18n] [status-im.ui.components.icons.vector-icons :as icons])) -(defn button [images-showing?] +(defn show-panel-anim + [bottom-anim-value alpha-value] + (anim/start + (anim/parallel + [(anim/spring bottom-anim-value {:toValue 0 + :useNativeDriver true}) + (anim/timing alpha-value {:toValue 1 + :duration 500 + :useNativeDriver true})]))) + +(defn input-button [images-showing?] [react/touchable-highlight {:on-press (fn [_] @@ -23,61 +30,55 @@ {:container-style {:margin 14 :margin-right 6} :color (if images-showing? colors/blue colors/gray)}]]) -(defn show-panel-anim - [bottom-anim-value alpha-value] - (anim/start - (anim/parallel - [(anim/spring bottom-anim-value {:toValue 0 - :useNativeDriver true}) - (anim/timing alpha-value {:toValue 1 - :duration 500 - :useNativeDriver true})]))) - -(defn select-button [title icon on-press] - [react/touchable-highlight {:on-press on-press :style {:flex 1}} - [react/view {:background-color colors/black :max-height 223 :flex 1 :border-radius 16 - :align-items :center :justify-content :center} - [react/view {:height 48 :width 48 :align-items :center :justify-content :center :border-radius 24 - :border-width 2 :border-color colors/gray} - [icons/icon icon {:color :white}]] - [react/text {:style {:margin-top 9 :typography :caption :color colors/gray}} title]]]) - (defn take-picture [] - (re-frame/dispatch [:request-permissions - {:permissions [:camera] - :on-allowed #(re-frame/dispatch [:navigate-to :profile-photo-capture]) - :on-denied (fn [] - (utils/set-timeout - #(utils/show-popup (i18n/label :t/error) - (i18n/label :t/camera-access-error)) - 50))}])) + (react/show-image-picker-camera #(re-frame/dispatch [:chat.ui/image-captured (.-path %)]) {})) -(defn round-button [on-press cancel? loading?] - [react/touchable-highlight {:on-press (when-not loading? on-press)} - [react/view {:width 32 :height 32 :border-radius 16 :background-color (if cancel? colors/gray colors/blue) - :align-items :center :justify-content :center} - (if loading? - [react/activity-indicator {:color :white - :animating true}] - [icons/icon (if cancel? :main-icons/close :main-icons/arrow-up) {:color :white}])]]) +(defn buttons [] + [react/view + [react/touchable-highlight {:on-press take-picture} + [react/view {:style {:width 44 :height 44 + :align-items :center :justify-content :center}} + [icons/icon :camera {:color colors/black}]]] + [react/touchable-highlight {:on-press #(re-frame/dispatch [:chat.ui/open-image-picker]) + :style {:margin-top 8}} + [react/view {:width 44 :height 44 + :align-items :center :justify-content :center} + [icons/icon :collection {:color colors/black}]]]]) + +(defn image-preview [uri first? panel-height] + (let [wh (/ (- panel-height 8) 2)] + [react/touchable-highlight {:on-press #(re-frame/dispatch [:chat.ui/image-selected uri])} + [react/image {:style (merge {:width wh + :height wh + :background-color :black + :border-radius 4} + (when first? + {:margin-bottom 8})) + :source {:uri uri}}]])) + +(defview photos [panel-height] + (letsubs [camera-roll-photos [:camera-roll-photos]] + [react/view {:flex 1 :flex-direction :row} + (for [[first-img second-img] (partition 2 camera-roll-photos)] + ^{:key (str "image" first-img)} + [react/view {:margin-left 8} + (when first-img + [image-preview first-img true panel-height]) + (when second-img + [image-preview second-img false panel-height])])])) (defview image-view [] - (letsubs [send-image [:chats/current-chat-ui-prop :send-image] - loading? [:chats/current-chat-ui-prop :send-image-loading?] - bottom-anim-value (anim/create-value styles/image-panel-height) - alpha-value (anim/create-value 0)] - {:component-did-mount #(show-panel-anim bottom-anim-value alpha-value)} - [react/animated-view {:style {:background-color :white - :height styles/image-panel-height + (letsubs [panel-height [:chats/chat-panel-height] + bottom-anim-value (anim/create-value @panel-height) + alpha-value (anim/create-value 0)] + {:component-did-mount (fn [] + (show-panel-anim bottom-anim-value alpha-value) + (re-frame/dispatch [:chat.ui/camera-roll-get-photos 20]))} + [react/animated-view {:style {:background-color colors/white + :height panel-height :transform [{:translateY bottom-anim-value}] :opacity alpha-value}} - (if send-image - [react/view {:align-items :center :flex-direction :row :flex 1 :justify-content :space-between - :padding-horizontal 20} - [round-button #(re-frame/dispatch [:chat.ui/set-chat-ui-props {:send-image nil}]) true false] - [react/image {:source {:uri send-image} :style {:width 150 :height 150 :border-radius 8}}] - [round-button #(re-frame/dispatch [:chat.ui/send-image send-image]) false loading?]] - [react/view {:flex-direction :row :padding-horizontal 16 :padding-top 12 :flex 1} - [select-button "Take a picture" :main-icons/camera take-picture] - [react/view {:width 16}] - [select-button "Choose photo" :main-icons/photo #(re-frame/dispatch [:chat.ui/open-image-picker])]])])) \ No newline at end of file + [react/scroll-view {:horizontal true :style {:flex 1}} + [react/view {:flex 1 :flex-direction :row :margin-horizontal 8} + [buttons] + [photos panel-height]]]])) \ No newline at end of file diff --git a/src/status_im/ui/screens/chat/input/input.cljs b/src/status_im/ui/screens/chat/input/input.cljs index 72282a0397..d469c751aa 100644 --- a/src/status_im/ui/screens/chat/input/input.cljs +++ b/src/status_im/ui/screens/chat/input/input.cljs @@ -33,46 +33,67 @@ :placeholder-text-color colors/gray :auto-capitalize :sentences}]) -(defview reply-message [from alias message-text] +(defview reply-message [from alias content] (letsubs [{:keys [ens-name]} [:contacts/contact-name-by-identity from] current-public-key [:multiaccount/public-key]] [react/scroll-view {:style style/reply-message-content} [react/view {:style style/reply-message-to-container} (chat-utils/format-reply-author from alias ens-name current-public-key style/reply-message-author)] - [react/text {:style (assoc (message-style/style-message-text false) :font-size 14) :number-of-lines 3} message-text]])) + (if (:image content) + [react/image {:style {:width 56 + :height 56 + :background-color :black + :border-radius 4} + :source {:uri (:image content)}}] + [react/text {:style (assoc (message-style/style-message-text false) :font-size 14) + :number-of-lines 3} (:text content)])])) -(defview reply-message-view [] - (letsubs [{:keys [content from alias] :as message} [:chats/reply-message]] - (when message - [react/view {:style style/reply-message} - [photos/member-photo from] - [reply-message from alias (:text content)] - [react/touchable-highlight - {:style style/cancel-reply-highlight - :on-press #(re-frame/dispatch [:chat.ui/cancel-message-reply]) - :accessibility-label :cancel-message-reply} - [react/view {:style style/cancel-reply-container} - [vector-icons/icon :main-icons/close {:container-style style/cancel-reply-icon - :width 19 - :height 19 - :color colors/white}]]]]))) +(defn close-button [on-press] + [react/touchable-highlight + {:style style/cancel-reply-highlight + :on-press on-press + :accessibility-label :cancel-message-reply} + [vector-icons/icon :main-icons/close {:container-style style/cancel-reply-icon + :width 19 + :height 19 + :color colors/white}]]) + +(defn reply-message-view [{:keys [content from alias]}] + [react/view {:style style/reply-message} + [photos/member-photo from] + [reply-message from alias content] + [close-button #(re-frame/dispatch [:chat.ui/cancel-message-reply])]]) + +(defn send-image-view [{:keys [uri]}] + [react/view {:style style/reply-message} + [react/image {:style {:width 56 :height 56 + :border-radius 4} + :source {:uri uri}}] + [close-button #(re-frame/dispatch [:chat.ui/cancel-sending-image])]]) (defview container [] (letsubs [mainnet? [:mainnet?] input-text [:chats/current-chat-input-text] cooldown-enabled? [:chats/cooldown-enabled?] input-bottom-sheet [:chats/current-chat-ui-prop :input-bottom-sheet] - one-to-one-chat? [:current-chat/one-to-one-chat?]] - (let [input-text-empty? (string/blank? (string/trim (or input-text "")))] + one-to-one-chat? [:current-chat/one-to-one-chat?] + reply-message [:chats/reply-message] + sending-image [:chats/sending-image]] + (let [input-text-empty? (and (string/blank? (string/trim (or input-text ""))) + (not sending-image))] [react/view {:style (style/root)} - [reply-message-view] + (when reply-message + [reply-message-view reply-message]) + (when sending-image + [send-image-view sending-image]) [react/view {:style style/input-container} [basic-text-input input-text cooldown-enabled?] - (when input-text-empty? - [image/button (= :images input-bottom-sheet)]) - (when (and input-text-empty? mainnet?) + (when (and input-text-empty? (not reply-message)) + [image/input-button (= :images input-bottom-sheet)]) + (when (and input-text-empty? mainnet? (not reply-message)) [stickers/button (= :stickers input-bottom-sheet)]) - (when (and one-to-one-chat? input-text-empty? (or config/commands-enabled? mainnet?)) + (when (and one-to-one-chat? input-text-empty? (or config/commands-enabled? mainnet?) + (not reply-message)) [extensions/button (= :extensions input-bottom-sheet)]) (when-not input-text-empty? [send-button/send-button-view input-text-empty? diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index 8e67d08dd0..b13efea84c 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -13,7 +13,8 @@ [status-im.utils.contenthash :as contenthash] [status-im.utils.http :as http] [status-im.utils.platform :as platform] - [status-im.utils.security :as security]) + [status-im.utils.security :as security] + [reagent.core :as reagent]) (:require-macros [status-im.utils.views :refer [defview letsubs]])) (defview mention-element [from] @@ -37,7 +38,7 @@ appender]) (defview quoted-message - [_ {:keys [from text]} outgoing current-public-key] + [_ {:keys [from text image]} outgoing current-public-key] (letsubs [{:keys [ens-name alias]} [:contacts/contact-name-by-identity from]] [react/view {:style (style/quoted-message-container outgoing)} [react/view {:style style/quoted-message-author-container} @@ -47,10 +48,15 @@ ens-name current-public-key (partial style/quoted-message-author outgoing)]] - - [react/text {:style (style/quoted-message-text outgoing) - :number-of-lines 5} - text]])) + (if image + [react/image {:style {:width 56 + :height 56 + :background-color :black + :border-radius 4} + :source {:uri image}}] + [react/text {:style (style/quoted-message-text outgoing) + :number-of-lines 5} + text])])) (defn render-inline [message-text outgoing content-type acc {:keys [type literal destination]}] (case type @@ -149,15 +155,24 @@ ;; Append timestamp to new block (conj elements timestamp)))) +(defn text-message-press-handlers [message] + {:on-press (fn [_] + (re-frame/dispatch [:chat.ui/set-chat-ui-props {:input-bottom-sheet nil}]) + (react/dismiss-keyboard!)) + :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet + {:content (sheets/message-long-press message) + :height 192}])}) + (defn text-message [{:keys [content outgoing current-public-key] :as message}] - [message-bubble-wrapper message - (let [response-to (:response-to content)] - [react/view - (when (and (seq response-to) (:quoted-message message)) - [quoted-message response-to (:quoted-message message) outgoing current-public-key]) - [render-parsed-text-with-timestamp message (:parsed-text content)]]) - [message-timestamp message true]]) + [react/touchable-highlight (text-message-press-handlers message) + [message-bubble-wrapper message + (let [response-to (:response-to content)] + [react/view + (when (and (seq response-to) (:quoted-message message)) + [quoted-message response-to (:quoted-message message) outgoing current-public-key]) + [render-parsed-text-with-timestamp message (:parsed-text content)]]) + [message-timestamp message true]]]) (defn unknown-content-type [{:keys [outgoing content-type content] :as message}] @@ -177,13 +192,14 @@ (defn emoji-message [{:keys [content current-public-key outgoing] :as message}] (let [response-to (:response-to content)] - [message-bubble-wrapper message - [react/view {:style (style/style-message-text outgoing)} - (when (and (seq response-to) (:quoted-message message)) - [quoted-message response-to (:quoted-message message) outgoing current-public-key]) - [react/text {:style (style/emoji-message message)} - (:text content)]] - [message-timestamp message]])) + [react/touchable-highlight (text-message-press-handlers message) + [message-bubble-wrapper message + [react/view {:style (style/style-message-text outgoing)} + (when (and (seq response-to) (:quoted-message message)) + [quoted-message response-to (:quoted-message message) outgoing current-public-key]) + [react/text {:style (style/emoji-message message)} + (:text content)]] + [message-timestamp message]]])) (defn message-activity-indicator [] @@ -224,24 +240,6 @@ (letsubs [{:keys [ens-name]} [:contacts/contact-name-by-identity from]] (chat.utils/format-author alias style/message-author-name-container ens-name))) -(defn message-press-handlers [{:keys [outgoing from content-type content] :as message}] - (let [pack (get-in content [:sticker :pack])] - {:on-press (fn [_] - (when (and (= content-type constants/content-type-sticker) pack) - (re-frame/dispatch [:stickers/open-sticker-pack pack])) - (re-frame/dispatch [:chat.ui/set-chat-ui-props {:input-bottom-sheet nil}]) - (react/dismiss-keyboard!)) - :on-long-press #(cond (or (= content-type constants/content-type-text) - (= content-type constants/content-type-emoji)) - (re-frame/dispatch [:bottom-sheet/show-sheet - {:content (sheets/message-long-press message) - :height 192}]) - (and (= content-type constants/content-type-sticker) - from (not outgoing)) - (re-frame/dispatch [:bottom-sheet/show-sheet - {:content (sheets/sticker-long-press message) - :height 64}]))})) - (defn message-content-wrapper "Author, userpic and delivery wrapper" [{:keys [alias first-in-group? display-photo? identicon display-username? @@ -276,26 +274,61 @@ [react/view (style/system-message-body message) [react/view child]]]) +(defn message-content-image [{:keys [content outgoing]}] + (let [dimensions (reagent/atom [260 260]) + uri (:image content)] + (react/image-get-size + uri + (fn [width height] + (let [k (/ (max width height) 260)] + (reset! dimensions [(/ width k) (/ height k)])))) + (fn [] + [react/view {:style (style/image-content outgoing)} + [react/image {:style {:width (first @dimensions) :height (last @dimensions)} + :resize-mode :contain + :source {:uri uri}}]]))) + +(defn image-message-press-handlers [{:keys [content] :as message}] + {:on-press (fn [_] + (when (:image content) + (re-frame/dispatch [:navigate-to :image-preview message])) + (re-frame/dispatch [:chat.ui/set-chat-ui-props {:input-bottom-sheet nil}]) + (react/dismiss-keyboard!)) + :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet + {:content (sheets/image-long-press message false) + :height 160}])}) + +(defn sticker-message-press-handlers [{:keys [content] :as message}] + (let [pack (get-in content [:sticker :pack])] + {:on-press (fn [_] + (when pack + (re-frame/dispatch [:stickers/open-sticker-pack pack])) + (re-frame/dispatch [:chat.ui/set-chat-ui-props {:input-bottom-sheet nil}]) + (react/dismiss-keyboard!)) + :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet + {:content (sheets/sticker-long-press message) + :height 64}])})) + (defn chat-message [{:keys [content content-type] :as message}] (if (= content-type constants/content-type-command) [message.command/command-content message-content-wrapper message] (if (= content-type constants/content-type-system-text) [system-message-content-wrapper message [system-text-message message]] - [react/touchable-highlight (message-press-handlers message) - [message-content-wrapper - message - (if (= content-type constants/content-type-text) - ;; text message - [text-message message] - (if (= content-type constants/content-type-status) - [message-content-status message] - (if (= content-type constants/content-type-emoji) - [emoji-message message] - (if (= content-type constants/content-type-sticker) + [message-content-wrapper + message + (if (= content-type constants/content-type-text) + ;; text message + [text-message message] + (if (= content-type constants/content-type-status) + [message-content-status message] + (if (= content-type constants/content-type-emoji) + [emoji-message message] + (if (= content-type constants/content-type-sticker) + [react/touchable-highlight (sticker-message-press-handlers message) [react/image {:style {:margin 10 :width 140 :height 140} ;;TODO (perf) move to event - :source {:uri (contenthash/url (-> content :sticker :hash))}}] - (if (= content-type constants/content-type-image) - [react/image {:style {:margin-vertical 10 :width 140 :height 140 :border-radius 8} - :source {:uri (:image content)}}] - [unknown-content-type message])))))]]))) + :source {:uri (contenthash/url (-> content :sticker :hash))}}]] + (if (= content-type constants/content-type-image) + [react/touchable-highlight (image-message-press-handlers message) + [message-content-image message]] + [unknown-content-type message])))))]))) diff --git a/src/status_im/ui/screens/chat/sheets.cljs b/src/status_im/ui/screens/chat/sheets.cljs index f12e75a6f9..79361e7223 100644 --- a/src/status_im/ui/screens/chat/sheets.cljs +++ b/src/status_im/ui/screens/chat/sheets.cljs @@ -210,3 +210,51 @@ :accessibility-label :view-chat-details-button :accessories [:chevron] :on-press #(hide-sheet-and-dispatch [:chat.ui/show-profile from])}]]))) + +(defn image-long-press [{:keys [content identicon from outgoing] :as message} from-preview?] + (fn [] + (let [{:keys [ens-name alias]} @(re-frame/subscribe [:contacts/contact-name-by-identity from])] + [react/view + (when-not outgoing + [list-item/list-item + {:theme :action + :icon (multiaccounts/displayed-photo {:identicon identicon + :public-key from}) + :title [view-profile {:name (or ens-name alias) + :helper :t/view-profile}] + :accessibility-label :view-chat-details-button + :accessories [:chevron] + :on-press #(do + (when from-preview? + (re-frame/dispatch [:navigate-back])) + (hide-sheet-and-dispatch [:chat.ui/show-profile from]))}]) + [list-item/list-item + {:theme :action + :title :t/message-reply + :icon :main-icons/reply + :on-press #(do + (when from-preview? + (re-frame/dispatch [:navigate-back])) + (hide-sheet-and-dispatch [:chat.ui/reply-to-message message]))}] + ;; we have only base64 string for image, so we need to find a way how to copy it + #_[list-item/list-item + {:theme :action + :title :t/sharing-copy-to-clipboard + :icon :main-icons/copy + :on-press (fn [] + (re-frame/dispatch [:bottom-sheet/hide-sheet]) + (react/copy-to-clipboard (:image content)))}] + [list-item/list-item + {:theme :action + :title :t/save + :icon :main-icons/download + :on-press (fn [] + (hide-sheet-and-dispatch [:chat.ui/save-image-to-gallery (:image content)]))}] + ;; we have only base64 string for image, so we need to find a way how to share it + #_[list-item/list-item + {:theme :action + :title :t/sharing-share + :icon :main-icons/share + :on-press (fn [] + (re-frame/dispatch [:bottom-sheet/hide-sheet]) + (list-selection/open-share {:message (:image content)}))}]]))) diff --git a/src/status_im/ui/screens/chat/styles/input/input.cljs b/src/status_im/ui/screens/chat/styles/input/input.cljs index 7151dd03f0..5ead2d8b48 100644 --- a/src/status_im/ui/screens/chat/styles/input/input.cljs +++ b/src/status_im/ui/screens/chat/styles/input/input.cljs @@ -18,7 +18,6 @@ :justify-content :space-between :padding-top 8 :padding-bottom 8 - :padding-right 8 :padding-left 8}) (def reply-message-content @@ -47,22 +46,18 @@ :justify-content :flex-start}) (def cancel-reply-highlight - {:align-self :flex-start - :width 19 - :height 19}) - -(def cancel-reply-container - {:flex-direction :row - :justify-content :flex-end - :height "100%"}) + {:align-items :center + :width 44 + :height 44}) (def cancel-reply-icon {:background-color colors/gray - :width 21 - :height 21 + :width 20 + :height 20 + :margin-top 4 :align-items :center :justify-content :center - :border-radius 12}) + :border-radius 10}) (def input-container {:flex-direction :row diff --git a/src/status_im/ui/screens/chat/styles/message/message.cljs b/src/status_im/ui/screens/chat/styles/message/message.cljs index 22f727dba7..f8af73b15e 100644 --- a/src/status_im/ui/screens/chat/styles/message/message.cljs +++ b/src/status_im/ui/screens/chat/styles/message/message.cljs @@ -309,3 +309,10 @@ (if outgoing (outgoing-blockquote-text-style) (default-blockquote-text-style))) + +(defn image-content [outgoing] + {:overflow :hidden + :border-top-left-radius 16 + :border-top-right-radius 16 + :border-bottom-left-radius (if outgoing 16 4) + :border-bottom-right-radius (if outgoing 4 16)}) diff --git a/src/status_im/ui/screens/home/views/inner_item.cljs b/src/status_im/ui/screens/home/views/inner_item.cljs index c9931d81c3..7d8227bc22 100644 --- a/src/status_im/ui/screens/home/views/inner_item.cljs +++ b/src/status_im/ui/screens/home/views/inner_item.cljs @@ -80,6 +80,11 @@ ;;TODO (perf) move to event :source {:uri (contenthash/url (-> content :sticker :hash))}}] + (= constants/content-type-image content-type) + [react/text {:style styles/last-message-text + :accessibility-label :no-messages-text} + (i18n/label :t/image)] + (string/blank? (:text content)) [react/text {:style styles/last-message-text} ""] diff --git a/src/status_im/ui/screens/profile/events.cljs b/src/status_im/ui/screens/profile/events.cljs index 968acdad69..d3a53eea2a 100644 --- a/src/status_im/ui/screens/profile/events.cljs +++ b/src/status_im/ui/screens/profile/events.cljs @@ -8,12 +8,6 @@ [status-im.utils.universal-links.core :as universal-links] [status-im.utils.fx :as fx])) -(re-frame/reg-fx - :open-image-picker - ;; the image picker is only used here for now, this effect can be use in other scenarios as well - (fn [callback-event] - (profile.models/open-image-picker! callback-event))) - (handlers/register-handler-fx :profile/send-transaction (fn [cofx [_ chat-id]] @@ -24,11 +18,6 @@ (fn [cofx [_ name]] (profile.models/update-name name cofx))) -(handlers/register-handler-fx - :my-profile/update-picture - (fn [cofx [this-event base64-image]] - (profile.models/update-picture this-event base64-image cofx))) - (handlers/register-handler-fx :my-profile/remove-current-photo (fn [{:keys [db] :as cofx}] diff --git a/src/status_im/ui/screens/profile/models.cljs b/src/status_im/ui/screens/profile/models.cljs index 46a046457c..9f0075a5d8 100644 --- a/src/status_im/ui/screens/profile/models.cljs +++ b/src/status_im/ui/screens/profile/models.cljs @@ -5,22 +5,9 @@ [status-im.ui.components.react :as react] [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.chat.models :as chat-models] - [status-im.utils.image-processing :as image-processing] [taoensso.timbre :as log] [status-im.utils.fx :as fx])) -(defn open-image-picker! [callback-event] - (react/show-image-picker - (fn [image] - (let [path (get (js->clj image) "path") - _ (log/debug path) - on-success (fn [base64] - (re-frame/dispatch [callback-event base64])) - on-error (fn [type error] - (.log js/console type error))] - (image-processing/img->base64 path on-success on-error 150 150))) - "photo")) - (defn send-transaction [chat-id cofx] ;;TODO start send transaction command flow (chat-models/start-chat cofx chat-id {:navigation-reset? true})) @@ -59,17 +46,6 @@ (when photo-path (multiaccounts.update/multiaccount-update :photo-path photo-path {}))))) -(defn update-picture [this-event base64-image {:keys [db] :as cofx}] - (if base64-image - (fx/merge cofx - {:db (-> db - (assoc-in [:my-profile/profile :photo-path] - (str "data:image/jpeg;base64," base64-image)) - (assoc :my-profile/editing? true) - (assoc :profile/photo-added? true))} - save) - {:open-image-picker this-event})) - (defn start-editing-group-chat-profile [{:keys [db]}] (let [current-chat-name (get-in db [:chats (:current-chat-id db) :name])] {:db (-> db diff --git a/src/status_im/ui/screens/profile/photo_capture/styles.cljs b/src/status_im/ui/screens/profile/photo_capture/styles.cljs deleted file mode 100644 index 8c6d8b16e7..0000000000 --- a/src/status_im/ui/screens/profile/photo_capture/styles.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.ui.screens.profile.photo-capture.styles - (:require [status-im.ui.components.colors :as colors])) - -(def container - {:flex 1 - :background-color colors/white}) - -(def button-container - {:align-items :center}) - -(def button - {:position :absolute - :bottom 10}) \ No newline at end of file diff --git a/src/status_im/ui/screens/profile/photo_capture/views.cljs b/src/status_im/ui/screens/profile/photo_capture/views.cljs deleted file mode 100644 index 570bc2d6f5..0000000000 --- a/src/status_im/ui/screens/profile/photo_capture/views.cljs +++ /dev/null @@ -1,43 +0,0 @@ -(ns status-im.ui.screens.profile.photo-capture.views - (:require [re-frame.core :as re-frame] - [reagent.core :as reagent] - [status-im.ui.components.camera :as camera] - [status-im.ui.components.react :as react] - [status-im.ui.screens.profile.photo-capture.styles :as styles] - [status-im.utils.image-processing :as image-processing] - [taoensso.timbre :as log] - [status-im.ui.components.icons.vector-icons :as icons] - [status-im.ui.components.topbar :as topbar] - [status-im.ui.components.colors :as colors])) - -(defn image-captured [^js data] - (let [path (.-uri data) - _ (log/debug "Captured image: " path) - on-success (fn [base64] - (log/debug "Captured success: " base64) - (re-frame/dispatch [:my-profile/update-picture base64]) - (re-frame/dispatch [:navigate-back])) - on-error (fn [type error] - (log/debug type error))] - (image-processing/img->base64 path on-success on-error 150 150))) - -(defn profile-photo-capture [] - (let [camera-ref (reagent/atom nil)] - [react/view styles/container - [topbar/topbar {:title :t/image-source-title}] - [camera/camera {:style {:flex 1} - ;;:aspect (:fill camera/aspects) - :captureQuality "480p" - ;;:captureTarget (:disk camera/capture-targets) - :type "front" - :ref #(reset! camera-ref %)}] - [react/view styles/button-container - [react/view styles/button - [react/touchable-highlight - {:on-press (fn [] - (let [^js camera @camera-ref] - (-> (.takePictureAsync camera) - (.then image-captured) - (.catch #(log/debug "Error capturing image: " %)))))} - [react/view - [icons/icon :main-icons/camera {:color colors/white}]]]]]])) diff --git a/src/status_im/ui/screens/profile/user/sheet/views.cljs b/src/status_im/ui/screens/profile/user/sheet/views.cljs deleted file mode 100644 index f51682f1e4..0000000000 --- a/src/status_im/ui/screens/profile/user/sheet/views.cljs +++ /dev/null @@ -1,44 +0,0 @@ -(ns status-im.ui.screens.profile.user.sheet.views - (:require [re-frame.core :as re-frame] - [status-im.i18n :as i18n] - [status-im.ui.components.react :as react] - [status-im.utils.utils :as utils] - [status-im.ui.components.list-item.views :as list-item])) - -(defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide-sheet]) - (re-frame/dispatch event)) - -(defn profile-icon-actions [include-remove-action?] - (fn [] - [react/view {:flex 1} - [list-item/list-item - {:theme :action - :title :t/image-source-gallery - :accessibility-label :group-info-button - :icon :main-icons/photo - :on-press #(hide-sheet-and-dispatch [:my-profile/update-picture])}] - [list-item/list-item - {:theme :action - :title :t/image-source-make-photo - :accessibility-label :delete-and-leave-group-button - :icon :main-icons/camera - :on-press (fn [] - (hide-sheet-and-dispatch - [:request-permissions - {:permissions [:camera :write-external-storage] - :on-allowed #(re-frame/dispatch - [:navigate-to :profile-photo-capture]) - :on-denied - (fn [] - (utils/set-timeout - #(utils/show-popup (i18n/label :t/error) - (i18n/label :t/camera-access-error)) - 50))}]))}] - (when include-remove-action? - [list-item/list-item - {:theme :action-destructive - :title :t/image-remove-current - :accessibility-label :group-info-button - :icon :main-icons/delete - :on-press #(hide-sheet-and-dispatch [:my-profile/remove-current-photo])}])])) diff --git a/src/status_im/ui/screens/qr_scanner/views.cljs b/src/status_im/ui/screens/qr_scanner/views.cljs index baf8de46ff..3876679dbe 100644 --- a/src/status_im/ui/screens/qr_scanner/views.cljs +++ b/src/status_im/ui/screens/qr_scanner/views.cljs @@ -9,7 +9,8 @@ [status-im.ui.screens.qr-scanner.styles :as styles] [status-im.ui.components.colors :as colors] [status-im.utils.config :as config] - [status-im.ui.components.button :as button])) + [status-im.ui.components.button :as button] + [reagent.core :as reagent])) (defn- topbar [_ {:keys [title] :as opts}] [topbar/toolbar @@ -65,7 +66,10 @@ (letsubs [read-once? (atom false) {:keys [height width]} [:dimensions/window] camera-flashlight [:wallet.send/camera-flashlight] - opts [:get-screen-params]] + opts [:get-screen-params] + camera-ref (atom nil) + focus-object (reagent/atom nil) + layout (atom nil)] (if config/qr-test-menu-enabled? [qr-test-view opts] [react/safe-area-view {:style {:flex 1 @@ -74,9 +78,13 @@ [react/with-activity-indicator {} [camera/camera - {:style {:flex 1} - :captureAudio false - :onBarCodeRead #(when-not @read-once? - (reset! read-once? true) - (on-barcode-read opts %))}]] + {:ref #(reset! camera-ref %) + :style {:flex 1} + :capture-audio false + :on-layout (camera/on-layout layout) + :auto-focus-point-of-interest @focus-object + :on-tap (camera/on-tap camera-ref layout focus-object) + :on-bar-code-read #(when-not @read-once? + (reset! read-once? true) + (on-barcode-read opts %))}]] [viewfinder (int (* 2 (/ (min height width) 3)))]]))) diff --git a/src/status_im/ui/screens/routing/main.cljs b/src/status_im/ui/screens/routing/main.cljs index 51aaa9ee69..7769a8e762 100644 --- a/src/status_im/ui/screens/routing/main.cljs +++ b/src/status_im/ui/screens/routing/main.cljs @@ -18,7 +18,8 @@ [status-im.ui.screens.routing.browser-stack :as browser-stack] [status-im.ui.components.tabbar.core :as tabbar] [status-im.ui.screens.routing.core :as navigation] - [status-im.utils.platform :as platform])) + [status-im.utils.platform :as platform] + [status-im.ui.screens.chat.image.preview.views :as image-preview])) (defonce main-stack (navigation/create-stack)) (defonce bottom-tabs (navigation/create-bottom-tabs)) @@ -87,4 +88,7 @@ :component wallet.components/contact-code} {:name :qr-scanner :insets {:top false} - :component qr-scanner/qr-scanner}]])) + :component qr-scanner/qr-scanner} + {:name :image-preview + :insets {:top false} + :component image-preview/preview-image}]])) diff --git a/src/status_im/ui/screens/routing/profile_stack.cljs b/src/status_im/ui/screens/routing/profile_stack.cljs index 0f41c2484a..b06ce072ed 100644 --- a/src/status_im/ui/screens/routing/profile_stack.cljs +++ b/src/status_im/ui/screens/routing/profile_stack.cljs @@ -3,7 +3,6 @@ [status-im.ui.screens.ens.views :as ens] [status-im.ui.screens.contacts-list.views :as contacts-list] [status-im.ui.screens.profile.contact.views :as profile.contact] - [status-im.ui.screens.profile.photo-capture.views :as photo-capture] [status-im.ui.screens.bootnodes-settings.edit-bootnode.views :as edit-bootnode] @@ -69,8 +68,6 @@ {:name :profile :insets {:top false} :component profile.contact/profile} - {:name :profile-photo-capture - :component photo-capture/profile-photo-capture} {:name :bootnodes-settings :component bootnodes-settings/bootnodes-settings} {:name :installations diff --git a/src/status_im/utils/image_processing.cljs b/src/status_im/utils/image_processing.cljs index 706ff32e90..a22e366545 100644 --- a/src/status_im/utils/image_processing.cljs +++ b/src/status_im/utils/image_processing.cljs @@ -1,20 +1,7 @@ (ns status-im.utils.image-processing - (:require [goog.object :as object] - [status-im.utils.fs :as fs] - ["react-native-image-resizer" :default image-resizer])) + (:require ["react-native-image-resizer" :default image-resizer])) -(defn resize [path max-width max-height on-resize on-error] - (-> (.createResizedImage image-resizer path max-width max-height "JPEG" 75 0 nil) +(defn resize [path max-width max-height quality on-resize on-error] + (-> (.createResizedImage image-resizer path max-width max-height "JPEG" quality 0 nil) (.then on-resize) (.catch on-error))) - -(defn- image-base64-encode [path on-success on-error] - (fs/read-file path "base64" on-success #(on-error :base64 %))) - -(defn img->base64 [path on-success on-error max-width max-height] - (let [on-resized (fn [image] - (let [path (object/get image "path")] - (image-base64-encode path on-success on-error))) - on-error (fn [error] - (on-error :resize error))] - (resize path max-width max-height on-resized on-error))) diff --git a/status-go-version.json b/status-go-version.json index 69a913969e..3c0b726052 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,6 +3,6 @@ "owner": "status-im", "repo": "status-go", "version": "feature/content-type-images", - "commit-sha1": "514923e84df1426a85cac1f2470f064820ab6d4b", - "src-sha256": "03k55hn20ijr98j80p20j38i2lpl6f3dib70b3d83zjcz00wpgqh" + "commit-sha1": "6301aac7823edca3c670586890af731d1cf9c249", + "src-sha256": "0qk56d0la7v93akq9133al8fxq66r8x4xfglf0wb4nxqz2hvkjh8" } diff --git a/translations/en.json b/translations/en.json index d675f87de9..1ef6fc5a3c 100644 --- a/translations/en.json +++ b/translations/en.json @@ -877,7 +877,7 @@ "share-public-chat-text": "Check out this public chat on the Status app: {{link}}", "sharing-copied-to-clipboard": "Copied", "sharing-copy-to-clipboard": "Copy", - "sharing-share": "Share...", + "sharing-share": "Share", "show-less": "Show less", "show-more": "Show more", "show-qr": "Show QR code", @@ -1122,5 +1122,8 @@ "preference": "Preference", "light": "Light", "dark": "Dark", - "system": "System" + "system": "System", + "give-permissions-camera": "Give permission\nto access camera", + "photos": "Photos", + "image": "Image" }