Compare commits

...
Author SHA1 Message Date
Yevheniia Berdnyk d2a2c2f48e android 12 try 2023-04-12 03:45:52 +03:00
Yevheniia Berdnyk 7ebf035506 requirements roll back 2023-04-11 23:41:02 +03:00
Yevheniia Berdnyk 7256c66760 fix for stale element 2023-04-10 22:36:17 +03:00
Yevheniia Berdnyk 6a9a6fb52c appium 1.22.1 2023-04-10 21:32:19 +03:00
Yevheniia Berdnyk de05976353 android 11 2023-04-10 16:54:47 +03:00
Yevheniia Berdnyk db9e3bde17 newCommandTimeout 2023-04-10 15:45:41 +03:00
Yevheniia Berdnyk cb0e15eff0 capabilities 2023-04-07 01:34:09 +03:00
Yevheniia Berdnyk d4c275cb09 find element 2023-04-06 22:48:19 +03:00
Yevheniia Berdnyk dc781b73fa updated versions 2023-04-06 14:28:57 +03:00
Yevheniia Berdnyk 321efa053c temp 2023-04-06 09:23:58 +03:00
Yevheniia Berdnyk bdbf00257a e2e: fix for MaxRetryError 2023-04-06 08:46:34 +03:00
Siddarth Kumar 4123fde91b fix chat layout breaking when combining normal text with code blocks (#15585) 2023-04-05 21:11:45 +05:30
Omar Basem e55a9326d6 fix: image desktop (#15562)
* fix: image desktop not opening
2023-04-03 18:31:29 +04:00
Parvesh Monu 6bdadd9f0d fix create profile issues (#15561) 2023-04-03 19:49:25 +05:30
Brian Sztamfater 79cd7f7df5 fix: add min 5 characters validation for display names
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-04-03 10:40:50 -03:00
jakub c5de054324 Revert "set signing to auto for debug builds (#15420)"
This reverts commit 3f3cbe98a4.
2023-04-03 08:52:09 +02:00
Ibrahem Khalil 7ed4bc5a5c Add accessibility id for community unread indicators (#15485) 2023-04-02 20:16:51 +02:00
flexsurferandChurikova Tetiana 103e154076 improve navigation and bottom sheet (#15467)
Co-authored-by: Churikova Tetiana <tatiana@status.im>
2023-03-31 16:13:27 +02:00
John Ngei abe4dc7ac1 Update communities discover screen
* Fix: discover communities missing data

* made community tags scrollable
2023-03-31 13:25:56 +03:00
Jamie Caprani 2ab491f12b chore: update to new ui on intro screen of syncing (#15450) 2023-03-31 02:49:36 -07:00
Andrea Maria Piana 6417d90e1c Bump version to 1.22.0 2023-03-30 17:30:05 +01:00
Parvesh Monu 21d409ce36 fix display name issues 2023-03-30 19:45:11 +05:30
Ibrahem Khalil d458bca193 Allow/Add mobile link previews for YouTube and Twitter (#15407) 2023-03-30 16:12:56 +02:00
Churikova Tetiana 4f2f8dea4c e2e: new onboarding 2023-03-30 15:15:42 +02:00
Andrea Maria Piana f744d761c0 Set log directory correctly
https://github.com/status-im/status-go/compare/bb6139ae...b38b3817
2023-03-30 13:54:29 +01:00
Jamie Caprani 7ad5e2181d chore: clean up ui for onboarding screens (#15470) 2023-03-30 04:05:42 -07:00
Andrea Maria Piana a10425e318 Save biometrics 2023-03-30 09:17:23 +01:00
frank 9c0ab739ea add simple validation for password, fix #15478 (#15503) 2023-03-30 08:01:22 +08:00
Omar Basem 0503f5cfc9 Image index fix (#15525)
* image index fix
2023-03-29 22:12:38 +04:00
yqrashawn a441156ff9 fix: crash on wallet view (#15502) 2023-03-29 19:50:29 +08:00
Alexanderandpavloburykh 006b11d508 Scrollable list of pinned messages (#15506)
* Scrollable list of pinned messages

* e2e: fix accessibility id

---------

Co-authored-by: pavloburykh <pavlo@status.im>
2023-03-28 20:23:30 +02:00
Parvesh Monu 8f0a990e71 fix user is not navigated to Sign in by syncing page (#15520) 2023-03-28 21:53:55 +05:30
Parvesh Monu f0ca6372cd Implement onboarding slide animation (#15489) 2023-03-28 20:57:54 +05:30
Brian Sztamfater 0f8aec00f2 Add guidelines for defining styles with apply-animations-to-style
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-03-28 11:58:06 -03:00
Roman Volosovskyi de86586208 [#15475] (issue 1) Prevent restoring of an existing multiacc 2023-03-28 12:43:48 +02:00
yqrashawn ac2d10bc5d fix: disable edit image message until it's implemented (#15496) 2023-03-28 17:04:01 +08:00
Ibrahem Khalil e825f930fa Add accessibility label for community options button (#15484) 2023-03-28 07:50:07 +02:00
frank 394dfde87b fixed #15446 (App crashes on syncing QR...) (#15464)
https://github.com/status-im/status-go/compare/4cc53630...458f2817
2023-03-28 12:27:22 +08:00
Alexander e4db23b0a9 Center input value within the field (#15472) 2023-03-27 23:00:33 +02:00
Ulises Manuel CárdenasandJamie Caprani 94ddbbcd2e Add checked? property, dark blur variant & tests to disclaimer component
Co-authored-by: Jamie Caprani <jamiecaprani@gmail.com>
2023-03-27 14:06:09 -06:00
Parvesh Monu ac27314547 fix login/forget password button overlaps password input (#15488) 2023-03-27 22:08:05 +05:30
Icaro Motta 7a4b12acf4 Make component test helpers usable from the REPL (#15468)
This commit makes the test-helpers.component namespace loadable in the REPL,
plus other changes that allow for a reasonably enjoyable RDD (REPL-Driven
Development) workflow.

Why? I want to be able to get instant feedback when I render a component with
the RN Testing Library (RNTL), and only once I'm satisfied with my findings is
when I proceed to write/update the tests. This nearly instant feedback loop is
only feasible using the ClojureScript REPL, and I'd rather not endure long
recompilation cycles.

Note that by REPL I mean connecting to the CLJS REPL of the Shadow-CLJS :mobile
target.

Essentially, this is what this commit does:

- [x] Allow the test-helpers.component namespace to be evaluated in the REPL.
      This is now possible because I changed all functions that assumed js/jest
      existed with a guard clause using the CLJS macro exists?. Without the
      guard clauses, evaluating the namespace explodes due to stuff like
      js/jest.useFakeTimers that fail in compile time (it's a syntax sugar
      macro).
- [x] Change the family of functions to get the translation by text to either
      translate using i18n/label or translate with the dummy prefix tx:,
      depending if the code is running inside the Jest runtime or not.
- [x] Wrap remaining RNTL query functions, except for the find-* ones, since
      they don't work at all outside the Jest runtime.
- [x] All wrapped functions support the original arguments supported by RNTL.
      Arguments are always converted with clj->js.
- [x] All wrapped functions can optionally take a node (ReactTestInstance) as
      their first argument, otherwise the global screen object will be used.
      This is very important! See the explanation on section Doesn't RNTL
      recommend using the screen object?
- [x] Update Shadow-CLJS preloads, so that (in development) you can fire off the
      REPL and always be ready to call component test helpers. This is critical!

What else would be possible? Just an idea, but now that we can easily render
components using the same machinery provided by RNTL in the tests, we can
roughly implement Storybook's Play function
https://storybook.js.org/docs/react/writing-stories/play-function

Lesson learned: In the REPL, you may need to call
(re-frame.core/clear-subscription-cache!), otherwise you will experience
subscriptions returning the same value if their arguments are the same. For
example, I faced this while playing with the namespace
status-im2.contexts.communities.menus.community-options.component-spec. There
are better ways to solve this particular problem in the context of tests if we
use the tooling provided by day8.re-frame.test.

Doesn't RNTL recommend using the screen object? Indeed, it is recommended to use
the screen object instead of destructuring the results of RNTL render. It's just
easier and less error prone, but this only works reliably within the Jest
runtime, since it automatically cleans up rendered state after each test. When
using the REPL this is no longer the case, and I faced some errors, like Unable
to find node on an unmounted component, where RNTL would refuse to re-render
components, even if I explicitly unmounted them or called cleanup.

The only reliable solution I found was to store the result of render (a node)
and pass it to every subsequent call. This is not a workaround, it's officially
supported, but it's a tad less convenient. You can also not pass the node
reference and it should work most of the time.

Practical examples

Workflow suggestion: write your local experiments in the same namespace as the
component spec and within the comment macro. This way, you can have the Jest
watcher running and a REPL connected to :mobile, and they won't step on each
other. For the test watcher, I usually change quo2-core-spec or
status-im2.core-spec to only require what I'm interested, otherwise Jest
consumes way too many resources.

```clojure
;; Namespace quo2.components.colors.color-picker.component-spec
(h/test "color picker color changed"
  (let [selected (reagent/atom nil)]
    (h/render [color-picker/view {:on-change #(reset! selected %)}])
    (h/fire-event :press (get (h/get-all-by-label-text :color-picker-item) 0))
    (-> (h/expect @selected)
        (.toStrictEqual :blue))))

(comment
  (def selected (atom nil))
  (def c (h/render [color-picker/view {:on-change #(reset! selected %)}]))

  (h/fire-event :press (get (h/get-all-by-label-text c :color-picker-item) 0))

  ;; Options are passed down converted to JS types.
  (h/debug c {:message "Rendering header"})

  @selected ; => :blue
)
```

```clojure
;; Namespace quo2.components.tags.--tests--.status-tags-component-spec
(h/test "renders status tag with pending type"
  (render-status-tag {:status {:type :pending}
                      :label  "Pending"
                      :size   :small})
  (-> (h/expect (h/get-all-by-label-text :status-tag-pending))
      (.toBeTruthy))
  (-> (h/expect (h/get-by-text "Pending"))
      (.toBeTruthy)))

(comment
  (def c (render-status-tag {:status {:type :pending}
                             :label  "Pending"
                             :size   :small}))

  (h/get-all-by-label-text c :status-tag-pending))
```

```clojure
;; Namespace status-im2.contexts.communities.menus.community-options.component-spec
(h/test "joined and muted community"
  (setup-subs {:communities/my-pending-request-to-join nil
               :communities/community                  {:joined       true
                                                        :muted        true
                                                        :token-gated? true}})
  (h/render [options/community-options-bottom-sheet {:id "test"}])
  (-> (h/expect (h/get-by-translation-text :unmute-community))
      (.toBeTruthy)))

(comment
  (setup-subs {:communities/my-pending-request-to-join nil
               :communities/community                  {:joined       true
                                                        :muted        true
                                                        :token-gated? true}})
  (def c (h/render [options/community-options-bottom-sheet {:id "test"}]))
  (some? (h/get-by-translation-text c :invite-people-from-contacts)) ; => true
)
```
2023-03-27 11:54:56 -03:00
Brian Sztamfater 4e6dea6b36 feat: enable biometrics screen 2023-03-27 14:23:23 +01:00
Ulises M 899f89c800 Implement create password screens 2023-03-27 14:21:39 +01:00
Volodymyr Kozieiev b121678281 Fix mentions component remounting that forced user to click 2 times (#15474) 2023-03-27 12:29:09 +01:00
Roman Volosovskyi 7f87c007c1 [#15471] Add PreviewPrivacy to CreateAccountRequest 2023-03-27 09:57:07 +02:00
Churikova Tetiana 11726df060 e2e: add to run_in_parallel args handling 2023-03-26 20:57:06 +02:00
John Ngei 2f84cfd354 Onboarding notifications flow
* enable notifications onboarding

* added blurred background

* support navigate to previous screen
2023-03-25 01:40:36 +03:00
Parvesh Monu 7b60a5f867 Refactor app theme management (#15455) 2023-03-24 22:04:55 +05:30
Mohamed Javid 7d4be37111 [Feature] Sign in by scanning sync QR code (#15416) 2023-03-24 20:36:25 +05:30
Jamie Caprani 2f19badc6c Add seed phrase flow & customization color 2023-03-24 14:24:18 +00:00
Roman Volosovskyi 3b034265c0 [#15443] Show community name/description in message on Android 2023-03-24 12:53:13 +01:00
Churikova Tetiana 5fffc230c9 e2e: new community screens 2023-03-24 11:22:02 +01:00
Parvesh Monu 5c92b7eb1e remove navigate-to-nav2 event (#15454) 2023-03-24 11:14:17 +01:00
frank 45da51bea6 changes corresponding to refactor of local pair of status-go (PR #3248) (#15412) 2023-03-23 20:23:26 +08:00
Alexander 8d166a3a52 Fix for sender's name, profile icon, chat key, timestamp being lost for messages that contain images (#15426)
* Fix for sender's name, profile icon, chat key, timestamp being lost for messages that contain images

Lint fix

Lint fix

* Lint fix

* Text fix
2023-03-23 10:10:07 +01:00
Churikova Tetiana 401f7d7383 e2e: activity centre and more checks 2023-03-22 18:20:48 +01:00
erikseppanen c238ebe36e Add validation for when adding a contact (#15192) 2023-03-22 13:13:56 -04:00
Jamie Caprani a502da6ea4 https://github.com/status-im/status-go/compare/9c1c01c6...48eb7052 (#15401)
feat: add create profile to onboarding
2023-03-22 06:51:38 -07:00
Omar Basem f9255100a1 feat: bottom sheet screen (#15399)
* feat: bottom sheet screen
2023-03-22 17:31:20 +04:00
yqrashawn daa78b4171 fix: still need this fix to run-ios on m1 mac (#15439) 2023-03-22 21:13:51 +08:00
yqrashawn f2c8f21336 fix: reply with album (#15424) 2023-03-22 21:04:39 +08:00
Icaro Motta 554476ede9 Remove support for cancelling outgoing contact requests (#15415)
Removes the feature that allows users to cancel outgoing contact requests (possible spam vector). From now on, the user who sent the contact request will only be able to see the notification in the pending state. It seems this feature will be revisited in the future, but for now the agreement is to do the simplest thing and remove it.

Fixes https://github.com/status-im/status-mobile/issues/15357

Steps to test:

- Send CR from A to B.
- A should see a new notification in the pending state.
- B should receive a notification. If B accepts the CR, then A's pending CR disappears. If B declines the CR, then A's notification stays pending forever.

Note: As expected, A can swipe left->right to mark the outgoing pending notification as read or swipe right->left to delete it.
2023-03-22 08:59:32 -03:00
pavloburykh 8c358d4ae4 e2e: fix login
Signed-off-by: Parvesh Monu <parvesh.dhullmonu@gmail.com>
2023-03-22 13:52:16 +05:30
Parvesh Monu 937c128c08 Onboarding app locked flow 2023-03-22 13:41:05 +05:30
Parvesh Monu 03cf4cec0e fix intro navigation (#15430) 2023-03-22 01:27:09 +05:30
Ulises Manuel Cárdenas 554f8aff09 Add input tests
Also fixes text align on non-multiline inputs
2023-03-21 12:28:02 -06:00
jakub d71cfd12c1 nix: unpatched Node modules for Gradle deps update
Otherwise we can end up with Gradle failing to find the dependencies
because we've patched away all entries referencing external repos.

Also made the regex in AWS parser a but more strict.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-03-21 15:21:58 +01:00
Omar Basem a5d767515d Remove 100ms delay when opening image (#15422)
* remove image delay
2023-03-21 17:57:26 +04:00
jakub c38fdec5b7 ci: upgrade Node.js from 16.17.1 to 18.9.1
The End-of-Life for Node.js 16 is set to 11th of September 2023.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-03-21 13:12:56 +01:00
303 changed files with 6399 additions and 3526 deletions
+1 -1
View File
@@ -1 +1 @@
1.21.0
1.22.0
+51
View File
@@ -61,6 +61,57 @@ the source file. For a real example, see
[rn/view (do-something)]])
```
### Always add styles inside the `:style` key
Although when compiling ReactNative for mobile some components are able work with
their styles in the top-level of the properties map, prefer to add them inside the
`:style` key in order to separate styles from properties:
```clojure
;; bad
[rn/button {:flex 1
:padding-vertical 10
:padding-horizontal 20
:on-press #(js/alert "Hi!")
:title "Button"}]
;; good
[rn/button {:style {:flex 1
:padding-vertical 10
:padding-horizontal 20}
:on-press #(js/alert "Hi!")
:title "Button"}]
;; better
;; (define them in a style ns & place them inside `:style` key)
[rn/button {:style (style/button)
:on-press #(js/alert "Hi!")
:title "Button"}
]
```
### Always apply animated styles in the style file
When implementing styles for reanimated views, we should always define
them in the style file and apply animations with reanimated/apply-animations-to-style
in the style definition.
```clojure
;; bad
(defn circle
[]
(let [opacity (reanimated/use-shared-value 1)]
[reanimated/view {:style (reanimated/apply-animations-to-style
{:opacity opacity}
style/circle-container)}]))
;; good
(defn circle
[]
(let [opacity (reanimated/use-shared-value 1)]
[reanimated/view {:style (style/circle-container opacity)}]))
```
### Don't use percents to define width/height
In ReactNative, all layouts use the [flexbox
+10
View File
@@ -35,6 +35,16 @@ abstract_target 'Status' do
target 'StatusImPR' do
end
post_install do |installer|
# some of libs wouldn't be build for x86_64 otherwise and that is
# necessary for ios simulators
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end
use_native_modules!
end
+12 -6
View File
@@ -417,7 +417,9 @@
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = 8B5X2M6H2Y;
LastSwiftMigration = 1140;
ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
@@ -841,8 +843,9 @@
BUNDLE_ID_SUFFIX = .debug;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = StatusIm/StatusIm.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CUSTOM_PRODUCT_NAME = "Status Debug";
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 8B5X2M6H2Y;
@@ -895,7 +898,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = im.status.ethereum;
PRODUCT_NAME = StatusIm;
PROVISIONING_PROFILE_SPECIFIER = "";
PROVISIONING_PROFILE = "9da75626-9594-43d9-a827-0f6d43c28f54";
PROVISIONING_PROFILE_SPECIFIER = "match Development im.status.ethereum";
SWIFT_OBJC_BRIDGING_HEADER = "StatusIm-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@@ -913,8 +917,9 @@
BUNDLE_ID_SUFFIX = "";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = StatusIm/StatusIm.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CUSTOM_PRODUCT_NAME = Status;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 8B5X2M6H2Y;
@@ -959,7 +964,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = im.status.ethereum;
PRODUCT_NAME = StatusIm;
PROVISIONING_PROFILE_SPECIFIER = "";
PROVISIONING_PROFILE = "e2202b12-7a66-4ff7-af3c-a52e35f32dc1";
PROVISIONING_PROFILE_SPECIFIER = "match AdHoc im.status.ethereum";
SWIFT_OBJC_BRIDGING_HEADER = "StatusIm-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
@@ -149,11 +149,15 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
this.getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("gethEvent", params);
}
private File getLogsFile() {
private File getPublicStorageDirectory() {
final Context context = this.getReactApplicationContext();
// Environment.getExternalStoragePublicDirectory doesn't work as expected on Android Q
// https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String)
final File pubDirectory = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
return context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
}
private File getLogsFile() {
final File pubDirectory = this.getPublicStorageDirectory();
final File logFile = new File(pubDirectory, gethLogFileName);
return logFile;
@@ -323,6 +327,30 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
callback.invoke(finalConfig);
}
@ReactMethod
public void createAccountAndLogin(final String createAccountRequest) {
Log.d(TAG, "createAccountAndLogin");
String result = Statusgo.createAccountAndLogin(createAccountRequest);
if (result.startsWith("{\"error\":\"\"")) {
Log.d(TAG, "createAccountAndLogin success: " + result);
Log.d(TAG, "Geth node started");
} else {
Log.e(TAG, "createAccountAndLogin failed: " + result);
}
}
@ReactMethod
public void restoreAccountAndLogin(final String restoreAccountRequest) {
Log.d(TAG, "restoreAccountAndLogin");
String result = Statusgo.restoreAccountAndLogin(restoreAccountRequest);
if (result.startsWith("{\"error\":\"\"")) {
Log.d(TAG, "restoreAccountAndLogin success: " + result);
Log.d(TAG, "Geth node started");
} else {
Log.e(TAG, "restoreAccountAndLogin failed: " + result);
}
}
@ReactMethod
public void saveAccountAndLogin(final String multiaccountData, final String password, final String settings, final String config, final String accountsData) {
try {
@@ -520,6 +548,8 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
return;
}
Log.d(TAG, "[Opening accounts" + rootDir);
Runnable r = new Runnable() {
@Override
public void run() {
@@ -785,9 +815,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
@ReactMethod
public void getConnectionStringForBootstrappingAnotherDevice(final String configJSON, final Callback callback) throws JSONException {
final JSONObject jsonConfig = new JSONObject(configJSON);
final String keyUID = jsonConfig.getString("keyUID");
final JSONObject senderConfig = jsonConfig.getJSONObject("senderConfig");
final String keyUID = senderConfig.getString("keyUID");
final String keyStorePath = this.getKeyStorePath(keyUID);
jsonConfig.put("keystorePath", keyStorePath);
senderConfig.put("keystorePath", keyStorePath);
executeRunnableStatusGoMethod(() -> Statusgo.getConnectionStringForBootstrappingAnotherDevice(jsonConfig.toString()), callback);
}
@@ -795,9 +826,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
@ReactMethod
public void inputConnectionStringForBootstrapping(final String connectionString, final String configJSON, final Callback callback) throws JSONException {
final JSONObject jsonConfig = new JSONObject(configJSON);
final JSONObject receiverConfig = jsonConfig.getJSONObject("receiverConfig");
final String keyStorePath = pathCombine(this.getNoBackupDirectory(), "/keystore");
jsonConfig.put("keystorePath", keyStorePath);
jsonConfig.put("rootDataDir", this.getNoBackupDirectory());
receiverConfig.put("keystorePath", keyStorePath);
receiverConfig.getJSONObject("nodeConfig").put("rootDataDir", this.getNoBackupDirectory());
executeRunnableStatusGoMethod(() -> Statusgo.inputConnectionStringForBootstrapping(connectionString, jsonConfig.toString()), callback);
}
@@ -1129,6 +1161,23 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
executeRunnableStatusGoMethod(() -> Statusgo.deleteImportedKey(address, password, keyStoreDir), callback);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String keystoreDir() {
final String absRootDirPath = this.getNoBackupDirectory();
return pathCombine(absRootDirPath, "keystore");
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String backupDisabledDataDir() {
return this.getNoBackupDirectory();
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String logFileDirectory() {
return getPublicStorageDirectory().getAbsolutePath();
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String generateAlias(final String seed) {
return Statusgo.generateAlias(seed);
@@ -309,12 +309,14 @@ RCT_EXPORT_METHOD(getConnectionStringForBootstrappingAnotherDevice:(NSString *)c
callback:(RCTResponseSenderBlock)callback) {
NSData *configData = [configJSON dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *configDict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
NSString *keyUID = [configDict objectForKey:@"keyUID"];
NSError *error;
NSMutableDictionary *configDict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:&error];
NSMutableDictionary *senderConfig = configDict[@"senderConfig"];
NSString *keyUID = senderConfig[@"keyUID"];
NSURL *multiaccountKeystoreDir = [self getKeyStoreDir:keyUID];
NSString *keystoreDir = multiaccountKeystoreDir.path;
[configDict setValue:keystoreDir forKey:@"keystorePath"];
[senderConfig setValue:keystoreDir forKey:@"keystorePath"];
NSString *modifiedConfigJSON = [configDict bv_jsonStringWithPrettyPrint:NO];
NSString *result = StatusgoGetConnectionStringForBootstrappingAnotherDevice(modifiedConfigJSON);
@@ -326,17 +328,20 @@ RCT_EXPORT_METHOD(inputConnectionStringForBootstrapping:(NSString *)cs
callback:(RCTResponseSenderBlock)callback) {
NSData *configData = [configJSON dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *configDict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:nil];
NSError *error;
NSMutableDictionary *configDict = [NSJSONSerialization JSONObjectWithData:configData options:NSJSONReadingMutableContainers error:&error];
NSMutableDictionary *receiverConfig = configDict[@"receiverConfig"];
NSMutableDictionary *nodeConfig = receiverConfig[@"nodeConfig"];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *rootUrl =[[fileManager URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *rootDataDir = rootUrl.path;
NSURL *multiaccountKeystoreDir = [rootUrl URLByAppendingPathComponent:@"keystore"];
NSString *keystoreDir = multiaccountKeystoreDir.path;
NSString *rootDataDir = rootUrl.path;
[configDict setValue:keystoreDir forKey:@"keystorePath"];
[configDict setValue:rootDataDir forKey:@"rootDataDir"];
[receiverConfig setValue:keystoreDir forKey:@"keystorePath"];
[nodeConfig setValue:rootDataDir forKey:@"rootDataDir"];
NSString *modifiedConfigJSON = [configDict bv_jsonStringWithPrettyPrint:NO];
NSString *result = StatusgoInputConnectionStringForBootstrapping(cs,modifiedConfigJSON);
NSString *result = StatusgoInputConnectionStringForBootstrapping(cs, modifiedConfigJSON);
callback(@[result]);
}
@@ -857,6 +862,34 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(generateAlias:(NSString *)publicKey) {
return StatusgoGenerateAlias(publicKey);
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(keystoreDir) {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *rootUrl =[[fileManager
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
lastObject];
NSURL *commonKeystoreDir = [rootUrl URLByAppendingPathComponent:@"keystore"];
return commonKeystoreDir.path;
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(backupDisabledDataDir) {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *rootUrl =[[fileManager
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
lastObject];
return rootUrl.path;
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(logFileDirectory) {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *rootUrl =[[fileManager
URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]
lastObject];
return rootUrl.path;
}
RCT_EXPORT_METHOD(generateAliasAsync:(NSString *)publicKey
callback:(RCTResponseSenderBlock)callback) {
#if DEBUG
@@ -934,6 +967,20 @@ RCT_EXPORT_METHOD(identiconAsync:(NSString *)publicKey
callback(@[result]);
}
RCT_EXPORT_METHOD(createAccountAndLogin:(NSString *)request) {
#if DEBUG
NSLog(@"createAccountAndLogin() method called");
#endif
StatusgoCreateAccountAndLogin(request);
}
RCT_EXPORT_METHOD(restoreAccountAndLogin:(NSString *)request) {
#if DEBUG
NSLog(@"restoreAccountAndLogin() method called");
#endif
StatusgoRestoreAccountAndLogin(request);
}
RCT_EXPORT_METHOD(generateAliasAndIdenticonAsync:(NSString *)publicKey
callback:(RCTResponseSenderBlock)callback) {
#if DEBUG
+25 -25
View File
@@ -11572,57 +11572,57 @@
},
{
"path": "org/slf4j/jcl-over-slf4j/2.0.6",
"path": "org/slf4j/jcl-over-slf4j/2.0.7",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jcl-over-slf4j-2.0.6.pom": {
"sha1": "c9d9caedcca2a1564e47b55614960958c5f78773",
"sha256": "1swgy5hwv54b1i1117shn3wmwba3v78qvy6cnv8v243j7ac6vzqq"
"jcl-over-slf4j-2.0.7.pom": {
"sha1": "15536e4a74a7aa317322a3d7814db8251de60d6f",
"sha256": "1rzjwbmzf2hb85j6c41mch803vqwqdq1rfrrirfhp1lfpfnzyd23"
},
"jcl-over-slf4j-2.0.6.jar": {
"sha1": "839ff57e112f2e28ef372e96d135696a6896b9ad",
"sha256": "0s9scdwkxwj3al87ihanj10rscrjh44kligr5asb7qpl28d1xvks"
"jcl-over-slf4j-2.0.7.jar": {
"sha1": "f127fe5ee53404a8b3697cdd032dd1dd6a29dd77",
"sha256": "0hhpc2qdl4aa9mb8dk89wzbd5vkna557vjmjdmfswvfjw5bng021"
}
}
},
{
"path": "org/slf4j/slf4j-api/2.0.6",
"path": "org/slf4j/slf4j-api/2.0.7",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"slf4j-api-2.0.6.pom": {
"sha1": "2b93d5f66ad2ba259bf4b2c94da39f0d6c544400",
"sha256": "0dipzawn8rxikciij2z06c25rb2vdj83s8ga3a7n10r77p2qcklb"
"slf4j-api-2.0.7.pom": {
"sha1": "facf002401dbff2065d4257690651e3fa775e3f4",
"sha256": "10br4q2w50fn3mkvk1xji81wdpy86cm0wyv6m30xa0ha1v7kqh1d"
},
"slf4j-api-2.0.6.jar": {
"sha1": "88c40d8b4f33326f19a7d3c0aaf2c7e8721d4953",
"sha256": "1nkv0z4dpkvp6pr9ph8087z5r691bv95xdv3gnfi6s5j23a94aig"
"slf4j-api-2.0.7.jar": {
"sha1": "41eb7184ea9d556f23e18b5cb99cad1f8581fc00",
"sha256": "1x26v62ypzpp84yfad8mx53llbacq6580y34v8nc618r7awrhqjx"
}
}
},
{
"path": "org/slf4j/slf4j-jdk14/2.0.6",
"path": "org/slf4j/slf4j-jdk14/2.0.7",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"slf4j-jdk14-2.0.6.pom": {
"sha1": "96ac9d6ab608e787d54892b35205bc6a560aa007",
"sha256": "0gnsyy1n5v8xqdy6a6p1752m5c4afihpw0n36n6aqw01y9l86q1h"
"slf4j-jdk14-2.0.7.pom": {
"sha1": "31039eac9f263c48bda14efd90aef0fb7a5a0e6a",
"sha256": "1vx1ziyx36zf2lrpkvvm4c75hp8pw8vjpiyr5120ss8nwpd33qal"
},
"slf4j-jdk14-2.0.6.jar": {
"sha1": "13056cb341f2d8795120f8027766a058da874f85",
"sha256": "0jncm8a2ppliqpzkbqm26sn98mwif8c1nligc1zh4jbzr8mxyzhy"
"slf4j-jdk14-2.0.7.jar": {
"sha1": "d91cd16b55ffbd5f46c60d0173fd4eeccacfee2d",
"sha256": "1xvphj12jpnvr1sw8zx42p49in4xi61mjvpxrkk3q3qpyad7017r"
}
}
},
{
"path": "org/slf4j/slf4j-parent/2.0.6",
"path": "org/slf4j/slf4j-parent/2.0.7",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"slf4j-parent-2.0.6.pom": {
"sha1": "0f99f8426c64fc5e0c4b6749245e50484a16c372",
"sha256": "091il49sidk0lcmzdy0vl3a4l16kw6x1q0l9vk0hir1ipq66b0hl"
"slf4j-parent-2.0.7.pom": {
"sha1": "3f97e066227cc2353d212b8c43440b0bf4c033f3",
"sha256": "1rs55v9gqda5lks89dd81frps5c9g3zgxk832qyckw9srlvbp0n1"
}
}
},
+4 -4
View File
@@ -802,9 +802,9 @@ https://repo.maven.apache.org/maven2/org/ow2/asm/asm/6.0/asm-6.0.pom
https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.4/asm-9.4.pom
https://repo.maven.apache.org/maven2/org/ow2/ow2/1.3/ow2-1.3.pom
https://repo.maven.apache.org/maven2/org/ow2/ow2/1.5.1/ow2-1.5.1.pom
https://repo.maven.apache.org/maven2/org/slf4j/jcl-over-slf4j/2.0.6/jcl-over-slf4j-2.0.6.pom
https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/2.0.6/slf4j-api-2.0.6.pom
https://repo.maven.apache.org/maven2/org/slf4j/slf4j-jdk14/2.0.6/slf4j-jdk14-2.0.6.pom
https://repo.maven.apache.org/maven2/org/slf4j/slf4j-parent/2.0.6/slf4j-parent-2.0.6.pom
https://repo.maven.apache.org/maven2/org/slf4j/jcl-over-slf4j/2.0.7/jcl-over-slf4j-2.0.7.pom
https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/2.0.7/slf4j-api-2.0.7.pom
https://repo.maven.apache.org/maven2/org/slf4j/slf4j-jdk14/2.0.7/slf4j-jdk14-2.0.7.pom
https://repo.maven.apache.org/maven2/org/slf4j/slf4j-parent/2.0.7/slf4j-parent-2.0.7.pom
https://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom
https://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
+3 -3
View File
@@ -29,17 +29,17 @@ function findPackage(line, regex) {
if (line ~ "com.facebook.react:react-native") { continue }
# Example: +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.50
if (findPackage(line, "--- ([^:]+):([^:]+):([^ ]+)$")) {
if (findPackage(line, "--- ([^ :]+):([^ :]+):([^ :]+)$")) {
continue
}
# Example: +--- androidx.lifecycle:lifecycle-common:{strictly 2.0.0} -> 2.0.0 (c)
if (findPackage(line, "--- ([^:]+):([^:]+):[^ ]+ -> ([^: ]+) ?(\\([*c]\\))?$")) {
if (findPackage(line, "--- ([^ :]+):([^ :]+):[^:]+ -> ([^ :]+) ?(\\([*c]\\))?$")) {
continue
}
# Example: +--- com.android.support:appcompat-v7:28.0.0 -> androidx.appcompat:appcompat:1.0.2
if (findPackage(line, "--- [^:]+:[^:]+:[^ ]+ -> ([^:]+):([^:]+):([^ ]+)$")) {
if (findPackage(line, "--- [^ :]+:[^ :]+:[^ ]+ -> ([^ :]+):([^ :]+):([^ :]+)$")) {
continue
}
}
+2 -2
View File
@@ -46,8 +46,8 @@ in {
# Package version adjustments
gradle = super.gradle_5;
nodejs = super.nodejs-16_x;
yarn = super.yarn.override { nodejs = super.nodejs-16_x; };
nodejs = super.nodejs-18_x;
yarn = super.yarn.override { nodejs = super.nodejs-18_x; };
openjdk = super.openjdk8_headless;
xcodeWrapper = callPackage ./pkgs/xcodeenv/compose-xcodewrapper.nix { } {
version = "13.3";
+8 -1
View File
@@ -42,12 +42,19 @@ let
# for running gradle by hand
gradle = mkShell {
buildInputs = with pkgs; [ gradle maven goMavenResolver ];
inputsFrom = [ nodejs-sh ];
shellHook = ''
export STATUS_GO_ANDROID_LIBDIR="DUMMY"
export STATUS_NIX_MAVEN_REPO="${pkgs.deps.gradle}"
export ANDROID_SDK_ROOT="${pkgs.androidPkgs.sdk}"
export ANDROID_NDK_ROOT="${pkgs.androidPkgs.ndk}"
export STATUS_MOBILE_HOME=$(git rev-parse --show-toplevel)
# WARNING: Unpatched Node.js deps allow Gradle to use remote repos.
"$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh" ${pkgs.deps.nodejs}
function restore_patched_modules() {
"$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh" ${pkgs.deps.nodejs-patched}
}
trap restore_patched_modules EXIT
'';
};
+1 -1
View File
@@ -19,7 +19,7 @@
"@babel/preset-typescript": "^7.17.12",
"@react-native-async-storage/async-storage": "^1.17.9",
"@react-native-community/audio-toolkit": "git+https://github.com/tbenr/react-native-audio-toolkit.git#refs/tags/v2.0.3-status-v6",
"@react-native-community/blur": "git+https://github.com/status-im/react-native-blur#refs/tags/v4.3.1-status",
"@react-native-community/blur": "git+https://github.com/status-im/react-native-blur#refs/tags/v4.3.2-status",
"@react-native-community/cameraroll": "git+https://github.com/status-im/react-native-cameraroll.git#refs/tags/v4.0.4-status.0",
"@react-native-community/clipboard": "^1.2.2",
"@react-native-community/hooks": "^2.5.1",
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 MiB

+7 -1
View File
@@ -45,7 +45,13 @@
:devtools {:autobuild #shadow/env ["SHADOW_AUTOBUILD_ENABLED" :default true :as :bool]}
:dev {:devtools {:after-load status-im2.setup.hot-reload/reload
:build-notify status-im2.setup.hot-reload/build-notify
:preloads [re-frisk-remote.preload]}
:preloads [re-frisk-remote.preload
;; In order to use component test helpers in
;; the REPL we need to preload namespaces
;; that are not normally required by
;; production code, such as
;; @testing-library/react-native.
test-helpers.component]}
:closure-defines
{status-im2.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
status-im2.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"}
+3 -3
View File
@@ -6,10 +6,10 @@ export function useTranslateY(initialTranslationY, bottomSheetDy, panY) {
})
}
export function useBackgroundOpacity(translateY, backgroundHeight, windowHeight) {
export function useBackgroundOpacity(translateY, backgroundHeight, windowHeight, opacity) {
return useDerivedValue(() => {
const opacity = ((translateY.value - windowHeight) / -backgroundHeight) * 0.5
const calculatedOpacity = ((translateY.value - windowHeight) / -backgroundHeight) * opacity
return Math.max(Math.min(opacity, 0.5), 0)
return Math.max(Math.min(calculatedOpacity, opacity), 0)
})
}
+47
View File
@@ -0,0 +1,47 @@
import { useDerivedValue, withTiming, Easing } from 'react-native-reanimated';
const slideAnimationDuration = 300;
const easeOut = {
duration: slideAnimationDuration,
easing: Easing.bezier(0, 0, 0.58, 1),
}
// Derived Values
export function dynamicProgressBarWidth(staticProgressBarWidth, progress) {
return useDerivedValue(
function () {
'worklet'
return staticProgressBarWidth * (progress.value || 0) / 100;
}
);
}
export function carouselLeftPosition(windowWidth, progress) {
return useDerivedValue(
function () {
'worklet'
const progressValue = progress.value;
switch (true) {
case (progressValue < 25):
return 0;
case (progressValue === 25):
return withTiming(-windowWidth, easeOut);
case (progressValue < 50):
return -windowWidth;
case (progressValue === 50):
return withTiming(-2 * windowWidth, easeOut);
case (progressValue < 75):
return -2 * windowWidth;
case (progressValue === 75):
return withTiming(-3 * windowWidth, easeOut);
case (progressValue < 100):
return -3 * windowWidth;
case (progressValue === 100):
return withTiming(-4 * windowWidth, easeOut);
default:
return 0;
}
});
}
+6 -1
View File
@@ -293,7 +293,10 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
:createNativeWrapper identity
:default #js {}})
(def react-native-redash #js {:clamp nil})
(def react-native-redash
#js
{:clamp nil
:withPause (fn [])})
(def react-native-languages
(clj->js {:default {:language "en"
@@ -370,6 +373,7 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
"react-native-screens" (clj->js {})
"react-native-reanimated" react-native-reanimated
"react-native-redash/lib/module/v1" react-native-redash
"react-native-redash" react-native-redash
"react-native-fetch-polyfill" fetch
"react-native-status-keycard" status-keycard
"react-native-keychain" keychain
@@ -407,6 +411,7 @@ globalThis.__STATUS_MOBILE_JS_IDENTITY_PROXY__ = new Proxy({}, {get() { return (
"../src/js/worklets/bottom_sheet.js" #js {}
"../src/js/worklets/record_audio.js" #js {}
"../src/js/worklets/scroll_view.js" #js {}
"../src/js/worklets/onboarding_carousel.js" #js {}
"../src/js/worklets/lightbox.js" #js {}
"./fleets.js" default-fleets
"@walletconnect/client" wallet-connect-client
@@ -58,6 +58,18 @@
(h/test "Size :small"
(h/render (user-avatar-component :small))
(h/is-truthy (h/get-by-text "NU")))
(h/test "Two letters with excess whitespace"
(h/render [user-avatar/user-avatar
{:full-name "New User"
:size :big}])
(h/is-truthy (h/get-by-text "NU")))
(h/test "Two letters with leading whitespace"
(h/render [user-avatar/user-avatar
{:full-name " New User"
:size :big}])
(h/is-truthy (h/get-by-text "NU"))))
(h/describe "One letter"
@@ -5,14 +5,18 @@
[react-native.core :as rn]
[react-native.fast-image :as fast-image]))
(defn trim-whitespace [s] (string/join " " (string/split (string/trim s) #"\s+")))
(defn- extract-initials
[full-name amount-initials]
(let [upper-case-first-letter (comp string/upper-case first)
names-list (string/split full-name " ")]
(->> names-list
(map upper-case-first-letter)
(take amount-initials)
(string/join))))
names-list (string/split (trim-whitespace full-name) " ")]
(if (= (first names-list) "")
""
(->> names-list
(map upper-case-first-letter)
(take amount-initials)
(string/join)))))
(defn initials-avatar
[{:keys [full-name size draw-ring? customization-color]}]
+14 -16
View File
@@ -6,12 +6,13 @@
[react-native.core :as rn]
[reagent.core :as reagent]))
(def themes
(defn themes
[customization-color]
{:light {:primary {:icon-color colors/white
:label-color colors/white
:background-color {:default colors/primary-50
:pressed colors/primary-60
:disabled colors/primary-50}}
:background-color {:default (colors/custom-color customization-color 50)
:pressed (colors/custom-color customization-color 60)
:disabled (colors/custom-color customization-color 50)}}
:secondary {:icon-color colors/primary-50
:label-color colors/primary-50
:background-color {:default colors/primary-50-opa-20
@@ -74,9 +75,9 @@
:disabled colors/neutral-95}}}
:dark {:primary {:icon-color colors/white
:label-color colors/white
:background-color {:default colors/primary-60
:pressed colors/primary-50
:disabled colors/primary-60}}
:background-color {:default (colors/custom-color customization-color 60)
:pressed (colors/custom-color customization-color 50)
:disabled (colors/custom-color customization-color 60)}}
:secondary {:icon-color colors/primary-50
:label-color colors/primary-50
:background-color {:default colors/primary-50-opa-20
@@ -218,14 +219,15 @@
(let [pressed (reagent/atom false)]
(fn
[{:keys [on-press disabled type size community-color community-text-color before after above
width
width customization-color
override-theme override-background-color
on-long-press accessibility-label icon icon-no-color style inner-style test-ID]
:or {type :primary
size 40}}
:or {type :primary
size 40
customization-color :primary}}
children]
(let [{:keys [icon-color icon-secondary-color background-color label-color border-color]}
(get-in themes
(get-in (themes customization-color)
[(or
override-theme
(theme/get-theme)) type])
@@ -252,11 +254,7 @@
[rn/view
{:style (merge
(shape-style-container type icon size)
{:background-color
(if (= state :pressed)
(colors/theme-colors colors/neutral-100 colors/white)
:transparent)
:width width}
{:width width}
style)}
[rn/view
{:style (merge
@@ -3,6 +3,7 @@
[quo2.components.common.unread-grey-dot.style :as style]))
(defn unread-grey-dot
[]
[accessibility-label]
[rn/view
{:style style/unread-grey-dot}])
(cond-> {:style style/unread-grey-dot}
accessibility-label (assoc :accessibility-label accessibility-label :accessible true))])
@@ -16,15 +16,13 @@
:height 230
:border-radius 20}
:on-press on-press}
[rn/view
{:flex 1}
[rn/view {:style style/detail-container}
[rn/view (style/community-cover-container 60)
[rn/image
{:source cover
:style
{:flex 1
:border-top-right-radius 20
:border-top-left-radius 20}}]]
:style {:flex 1
:border-top-right-radius 20
:border-top-left-radius 20}}]]
[rn/view (style/card-view-content-container 12)
[rn/view (style/card-view-chat-icon 48)
[icon/community-icon {:images images} 48]]
@@ -38,7 +36,7 @@
{:title name
:description description}]
[rn/view {:style (style/card-stats-position)}
[community-view/community-stats-column :card-view]]
[community-view/community-stats-column
{:type :card-view}]]
[rn/view {:style (style/community-tags-position)}
[community-view/community-tags tags]]]]]]])
@@ -27,7 +27,7 @@
[counter/counter {:type :default} unread-mentions-count]
unread-messages?
[unread-grey-dot]))
[unread-grey-dot :unviewed-messages-public]))
(defn communities-list-view-item
[props
@@ -46,7 +46,7 @@
(merge {:style {:height 56
:border-radius 16}}
props)
[rn/view {:flex 1}
[rn/view {:style style/detail-container}
[rn/view (style/list-info-container)
[community-icon/community-icon
{:images community-icon} 32]
@@ -64,7 +64,8 @@
colors/neutral-40
colors/neutral-60))}}
name]
[community-view/community-stats-column :list-view]]
[community-view/community-stats-column
{:type :list-view}]]
(if (= status :gated)
[community-view/permission-tag-container
{:locked? locked?
@@ -5,6 +5,7 @@
[quo2.components.tags.permission-tag :as permission]
[quo2.components.tags.tag :as tag]
[quo2.foundations.colors :as colors]
[quo.gesture-handler :as gesture-handler] ;;TODO move to quo2
[react-native.core :as rn]))
(defn community-stats
@@ -23,7 +24,7 @@
members-count]])
(defn community-stats-column
[type]
[{:keys [type]}]
(let [icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40)]
[rn/view
(if (= type :card-view)
@@ -41,7 +42,9 @@
(defn community-tags
[tags]
[rn/view (style/community-tags-container)
[gesture-handler/scroll-view
{:shows-horizontal-scroll-indicator false
:horizontal true}
(for [{:keys [name emoji]} tags]
^{:key name}
[rn/view {:margin-right 8}
+4 -5
View File
@@ -22,6 +22,9 @@
colors/white
colors/neutral-90)})
(def detail-container
{:flex 1})
(defn stats-count-container
[]
{:flex-direction :row
@@ -37,10 +40,6 @@
{:flex-direction :row
:align-items :center})
(defn community-tags-container
[]
{:flex-direction :row})
(defn card-stats-position
[]
{:position :absolute
@@ -62,7 +61,7 @@
:bottom 0
:left 0
:right 0
:height 20
:border-radius 20
:padding-horizontal padding-horizontal
:border-top-right-radius 16
:border-top-left-radius 16
@@ -1,7 +1,10 @@
(ns quo2.components.drawers.drawer-buttons.style
(:require [quo2.foundations.colors :as colors]))
(:require [quo2.foundations.colors :as colors]
[react-native.platform :as platform]))
(def outer-container {:height 216})
(def outer-container
{:height 216
:border-radius 20})
(def top-card
{:flex 1
@@ -9,7 +12,9 @@
:padding-horizontal 20
:border-top-left-radius 20
:border-top-right-radius 20
:background-color colors/neutral-80})
:background-color (if platform/ios?
colors/neutral-80-opa-80-blur
colors/neutral-80)})
(def bottom-card
{:position :absolute
@@ -21,7 +26,7 @@
:padding-horizontal 20
:border-top-left-radius 20
:border-top-right-radius 20
:background-color (colors/alpha colors/white 0.05)})
:background-color colors/white-opa-5})
(def bottom-container
{:flex-direction :row
@@ -35,14 +40,14 @@
:width 28
:justify-content :center
:align-items :center
:border-color (colors/alpha colors/white 0.05)})
:border-color colors/white-opa-5})
(def bottom-text
{:flex 1
:color (colors/alpha colors/white 0.7)})
:color colors/white-70-blur})
(def top-text
{:color (colors/alpha colors/white 0.7)})
{:color colors/white-70-blur})
(defn heading-text
[gap]
@@ -3,6 +3,7 @@
[quo2.components.icon :as icon]
[quo2.components.markdown.text :as text]
[quo2.foundations.colors :as colors]
[react-native.blur :as blur]
[quo2.components.drawers.drawer-buttons.style :as style]))
(defn render-bottom
@@ -70,7 +71,7 @@
child-2 string, keyword or hiccup
"
[{:keys [container-style top-card bottom-card]} child-1 child-2]
[rn/view
[blur/ios-view
{:style (merge container-style style/outer-container)}
[card
(merge {:gap 4
+4 -4
View File
@@ -22,18 +22,18 @@
opts
{:type :default/:success/:error
:size :default/:tiny
:icon :main-icons/info ;; info message icon
:icon :i/info ;; info message icon
:text-color colors/white ;; text color override
:icon-color colors/white ;; icon color override
:no-icon-color? false ;; disable tint color for icon"
[{:keys [type size icon text-color icon-color no-icon-color?]} message]
[{:keys [type size icon text-color icon-color no-icon-color? style]} message]
(let [weight (if (= size :default) :regular :medium)
size (if (= size :default) :paragraph-2 :label)
text-color (or text-color (get-color type))
icon-color (or icon-color text-color)]
[rn/view
{:style {:flex-direction :row
:flex 1}}
{:style (merge {:flex-direction :row}
style)}
[quo2.icons/icon icon
{:color icon-color
:no-color no-icon-color?
@@ -0,0 +1,70 @@
(ns quo2.components.inputs.input.component-spec
(:require [quo2.components.inputs.input.view :as input]
[test-helpers.component :as h]))
(h/describe "Input"
(h/test "default render"
(h/render [input/input])
(h/is-truthy (h/query-by-label-text :input))
(h/is-null (h/query-by-label-text :password-input)))
(h/test "Password type"
(h/render [input/input {:type :password}])
(h/is-truthy (h/query-by-label-text :password-input))
(h/is-null (h/query-by-label-text :input)))
(h/describe "Icon"
(h/test "Doesn't exist in base input"
(h/render [input/input])
(h/is-null (h/query-by-label-text :input-icon)))
(h/test "Renders"
(h/render [input/input {:icon-name :i/placeholder}])
(h/is-truthy (h/get-by-label-text :input-icon))))
(h/describe "Right accessory"
(h/test "Doesn't exist in base input"
(h/render [input/input])
(h/is-null (h/query-by-label-text :input-right-icon)))
(h/test "Clear icon"
(h/render [input/input {:clearable? true}])
(h/is-truthy (h/query-by-label-text :input-right-icon)))
(h/test "Password icon"
(h/render [input/input {:type :password}])
(h/is-truthy (h/query-by-label-text :input-right-icon))))
(h/describe "Button"
(h/test "Doesn't exist in base input"
(h/render [input/input])
(h/is-null (h/query-by-label-text :input-button)))
(h/test "Renders with given text and it's pressable"
(let [button-text "This is a button"
button-callback (h/mock-fn)]
(h/render [input/input
{:button {:on-press button-callback
:text button-text}}])
(h/is-truthy (h/query-by-label-text :input-button))
(h/is-truthy (h/get-by-text button-text))
(h/fire-event :press (h/query-by-label-text :input-button))
(h/was-called button-callback))))
(h/describe "Label"
(h/test "Doesn't exist in base input"
(h/render [input/input])
(h/is-null (h/query-by-label-text :input-labels)))
(h/test "Renders with specified text"
(let [input-label "My label"]
(h/render [input/input {:label input-label}])
(h/is-truthy (h/query-by-label-text :input-labels))
(h/is-truthy (h/get-by-text input-label)))))
(h/test "Char limit counter"
(let [char-limit 100
char-limit-str (str "0/" char-limit)]
(h/render [input/input {:char-limit char-limit}])
(h/is-truthy (h/query-by-label-text :input-labels))
(h/is-truthy (h/get-by-text char-limit-str)))))
+11 -12
View File
@@ -66,7 +66,7 @@
:padding-horizontal 8
:border-width 1
:border-color (:border-color colors-by-status)
:border-radius (if small? 10 14)
:border-radius (if small? 10 12)
:opacity (if disabled? 0.3 1)})
(defn left-icon-container
@@ -83,15 +83,15 @@
(defn input
[colors-by-status small? multiple-lines?]
(merge (text/text-style {:size :paragraph-1 :weight :regular})
{:flex 1
:text-align-vertical :top
:padding-right 0
:padding-left (if small? 4 8)
:padding-vertical (if small? 4 8)
:color (:text colors-by-status)}
(when-not multiple-lines?
{:height (if small? 30 38)})))
(let [base-props (assoc (text/text-style {:size :paragraph-1 :weight :regular})
:flex 1
:padding-right 0
:padding-left (if small? 4 8)
:padding-vertical (if small? 4 8)
:color (:text colors-by-status))]
(if multiple-lines?
(assoc base-props :text-align-vertical :top)
(assoc base-props :height (if small? 30 38) :line-height nil))))
(defn right-icon-touchable-area
[small?]
@@ -110,8 +110,7 @@
:color (:clear-icon variant-colors)})
(def texts-container
{:flex 1
:flex-direction :row
{:flex-direction :row
:height 18
:margin-bottom 8})
+34 -22
View File
@@ -9,7 +9,9 @@
(defn- label-&-counter
[{:keys [label current-chars char-limit variant-colors]}]
(let [count-text (when char-limit (str current-chars "/" char-limit))]
[rn/view {:style style/texts-container}
[rn/view
{:accessibility-label :input-labels
:style style/texts-container}
[rn/view {:style style/label-container}
[text/text
{:style (style/label-color variant-colors)
@@ -25,36 +27,40 @@
(defn- left-accessory
[{:keys [variant-colors small? icon-name]}]
[rn/view {:style (style/left-icon-container small?)}
[rn/view
{:accessibility-label :input-icon
:style (style/left-icon-container small?)}
[icon/icon icon-name (style/icon variant-colors)]])
(defn- right-accessory
[{:keys [variant-colors small? disabled? on-press icon-style-fn icon-name]}]
[rn/touchable-opacity
{:style (style/right-icon-touchable-area small?)
:disabled disabled?
:on-press on-press}
{:accessibility-label :input-right-icon
:style (style/right-icon-touchable-area small?)
:disabled disabled?
:on-press on-press}
[icon/icon icon-name (icon-style-fn variant-colors)]])
(defn- right-button
[{:keys [variant-colors colors-by-status small? disabled? on-press text]}]
[rn/touchable-opacity
{:style (style/button variant-colors small?)
:disabled disabled?
:on-press on-press}
{:accessibility-label :input-button
:style (style/button variant-colors small?)
:disabled disabled?
:on-press on-press}
[rn/text {:style (style/button-text colors-by-status)}
text]])
(def ^:private custom-props
"Custom properties that must be removed from properties map passed to InputText."
[:type :blur? :override-theme :error? :right-icon :left-icon :disabled? :small? :button
:label :char-limit :on-char-limit-reach :icon-name :multiline?])
:label :char-limit :on-char-limit-reach :icon-name :multiline? :on-focus :on-blur])
(defn- base-input
[{:keys [on-change-text on-char-limit-reach]}]
(let [status (reagent/atom :default)
on-focus #(reset! status :focus)
on-blur #(reset! status :default)
internal-on-focus #(reset! status :focus)
internal-on-blur #(reset! status :default)
multiple-lines? (reagent/atom false)
set-multiple-lines! #(let [height (oops/oget % "nativeEvent.contentSize.height")]
(if (> height 57)
@@ -68,7 +74,7 @@
(when (>= amount-chars char-limit)
(on-char-limit-reach amount-chars))))]
(fn [{:keys [blur? override-theme error? right-icon left-icon disabled? small? button
label char-limit multiline? clearable?]
label char-limit multiline? clearable? on-focus on-blur]
:as props}]
(let [status-kw (cond
disabled? :disabled
@@ -77,7 +83,7 @@
colors-by-status (style/status-colors status-kw blur? override-theme)
variant-colors (style/variants-colors blur? override-theme)
clean-props (apply dissoc props custom-props)]
[rn/view
[:<>
(when (or label char-limit)
[label-&-counter
{:variant-colors variant-colors
@@ -92,11 +98,16 @@
:icon-name icon-name}])
[rn/text-input
(cond-> {:style (style/input colors-by-status small? @multiple-lines?)
:accessibility-label :input
:placeholder-text-color (:placeholder colors-by-status)
:cursor-color (:cursor variant-colors)
:editable (not disabled?)
:on-focus on-focus
:on-blur on-blur}
:on-focus (fn []
(when on-focus (on-focus))
(internal-on-focus))
:on-blur (fn []
(when on-blur (on-blur))
(internal-on-blur))}
:always (merge clean-props)
multiline? (assoc :multiline true
:on-content-size-change set-multiple-lines!)
@@ -126,12 +137,13 @@
(fn [props]
[base-input
(assoc props
:auto-capitalize :none
:auto-complete :new-password
:secure-text-entry (not @password-shown?)
:right-icon {:style-fn style/password-icon
:icon-name (if @password-shown? :i/hide :i/reveal)
:on-press #(swap! password-shown? not)})])))
:accessibility-label :password-input
:auto-capitalize :none
:auto-complete :new-password
:secure-text-entry (not @password-shown?)
:right-icon {:style-fn style/password-icon
:icon-name (if @password-shown? :i/hide :i/reveal)
:on-press #(swap! password-shown? not)})])))
(defn input
"This input supports the following properties:
@@ -146,7 +158,7 @@
- :clearable? - Booolean to specify if this input has a clear button at the end.
- :on-clear - Function executed when the clear button is pressed.
- :button - Map containing `:on-press` & `:text` keys, if provided renders a button
- :label - A label for this input.
- :label - A string to set as label for this input.
- :char-limit - A number to set a maximum char limit for this input.
- :on-char-limit-reach - Function executed each time char limit is reached or exceeded.
and supports the usual React Native's TextInput properties to control its behaviour:
@@ -6,6 +6,7 @@
[quo2.components.inputs.title-input.view :as title-input]
[quo2.foundations.colors :as colors]
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.hole-view :as hole-view]))
(defn profile-input
@@ -18,20 +19,29 @@
[rn/view
{:style (style/container customization-color)}
[rn/view
[hole-view/hole-view
{:holes [{:x 33
:y 23
:width 24
:height 24
:borderRadius 12}]}
[user-avatar/user-avatar
(merge image-picker-props
{:customization-color customization-color
(if platform/ios?
[hole-view/hole-view
{:holes [{:x 33
:y 23
:width 24
:height 24
:borderRadius 12}]}
[user-avatar/user-avatar
(assoc image-picker-props
:customization-color customization-color
:full-name (if (seq full-name)
full-name
placeholder)
:status-indicator? false
:size :medium)]]
[user-avatar/user-avatar
(assoc image-picker-props
:customization-color customization-color
:full-name (if (seq full-name)
full-name
placeholder)
:status-indicator? false
:size :medium})]]
:size :medium)])
[buttons/button
{:accessibility-label :select-profile-picture-button
:type :grey
@@ -47,5 +57,7 @@
[rn/view {:style style/input-container}
[title-input/title-input
(merge title-input-props
{:placeholder placeholder
{:blur? true
:override-theme :dark
:placeholder placeholder
:customization-color customization-color})]]]))
@@ -2,45 +2,48 @@
(:require [quo2.foundations.colors :as colors]))
(defn get-focused-placeholder-color
[blur?]
[blur? override-theme]
(if blur?
(colors/theme-colors colors/neutral-80-opa-20 (colors/alpha colors/white 0.2))
(colors/theme-colors colors/neutral-30 colors/neutral-60)))
(colors/theme-colors colors/neutral-80-opa-20 colors/white-opa-20 override-theme)
(colors/theme-colors colors/neutral-30 colors/neutral-60 override-theme))
)
(defn get-placeholder-color
[blur?]
[blur? override-theme]
(if blur?
(colors/theme-colors colors/neutral-80-opa-40 (colors/alpha colors/white 0.3))
(colors/theme-colors colors/neutral-40 colors/neutral-50)))
(colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-30 override-theme)
(colors/theme-colors colors/neutral-40 colors/neutral-50 override-theme)))
(defn- get-disabled-color
[blur?]
[blur? override-theme]
(if blur?
(colors/theme-colors colors/neutral-80-opa-40 (colors/alpha colors/white 0.3))
(colors/theme-colors colors/neutral-40 colors/neutral-50)))
(colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-30)
(colors/theme-colors colors/neutral-40 colors/neutral-50 override-theme)))
(defn- get-char-count-color
[blur?]
[blur? override-theme]
(if blur?
(colors/theme-colors colors/neutral-80-opa-40 (colors/alpha colors/white 0.4))
(colors/theme-colors colors/neutral-40 colors/neutral-50)))
(colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-40)
(colors/theme-colors colors/neutral-40 colors/neutral-50 override-theme)))
(defn get-selection-color
[customization-color blur?]
[customization-color blur? override-theme]
(if blur?
(colors/theme-colors colors/neutral-100 colors/white)
(colors/custom-color customization-color (if colors/dark? 60 50))))
(colors/theme-colors colors/neutral-100 colors/white override-theme)
(colors/custom-color customization-color (if (or (= :dark override-theme) colors/dark?) 60 50))))
(def text-input-container {:flex 1})
(defn title-text
[disabled? blur?]
[disabled? blur? override-theme]
{:text-align-vertical :bottom
:color (when disabled? (get-disabled-color blur?))})
:color (if disabled?
(get-disabled-color blur? override-theme)
(colors/theme-colors colors/neutral-100 colors/white override-theme))})
(defn char-count
[blur?]
{:color (get-char-count-color blur?)})
[blur? override-theme]
{:color (get-char-count-color blur? override-theme)})
(def container
{:flex-direction :row
@@ -16,7 +16,8 @@
on-change-text
placeholder
max-length
default-value]
default-value
override-theme]
:or {max-length 0
default-value ""}}]
(let [focused? (reagent/atom false)
@@ -34,7 +35,7 @@
(text/text-style
{:size :heading-2
:weight :semi-bold
:style (style/title-text disabled? blur?)})
:style (style/title-text disabled? blur? override-theme)})
:default-value default-value
:accessibility-label :profile-title-input
:on-focus #(swap! focused? (fn [] true))
@@ -44,21 +45,21 @@
:editable (not disabled?)
:max-length max-length
:placeholder placeholder
:selection-color (style/get-selection-color customization-color blur?)
:selection-color (style/get-selection-color customization-color blur? override-theme)
:placeholder-text-color (if @focused?
(style/get-focused-placeholder-color blur?)
(style/get-placeholder-color blur?))}]]
(style/get-focused-placeholder-color blur? override-theme)
(style/get-placeholder-color blur? override-theme))}]]
[rn/view
{:style style/counter-container}
[text/text
[text/text
{:style (style/char-count blur?)
{:style (style/char-count blur? override-theme)
:size :paragraph-2}
(pad-0
(str
(count @value)))]
[text/text
{:style (style/char-count blur?)
{:style (style/char-count blur? override-theme)
:size :paragraph-2}
(str "/"
(pad-0
+1 -1
View File
@@ -62,4 +62,4 @@
(not muted?)
(not (pos? (int mentions-count)))
unread-messages?)
[unread-grey-dot])]]])
[unread-grey-dot :unviewed-messages-public])]]])
+37 -31
View File
@@ -30,16 +30,16 @@
{:no-color true})))
(defn left-section-view
[{:keys [on-press icon accessibility-label type icon-override-theme] :or {type :grey}}
[{:keys [on-press icon accessibility-label type icon-background-color] :or {type :grey}}
put-middle-section-on-left?]
[rn/view {:style (when put-middle-section-on-left? {:margin-right 5})}
[button/button
{:on-press on-press
:icon true
:type type
:size 32
:accessibility-label accessibility-label
:override-theme icon-override-theme}
{:on-press on-press
:icon true
:type type
:size 32
:accessibility-label accessibility-label
:override-background-color icon-background-color}
icon]])
(defn- mid-section-comp
@@ -150,13 +150,15 @@
:justify-content :flex-end)}
(let [last-icon-index (-> right-section-buttons count dec)]
(map-indexed (fn [index
{:keys [icon on-press type style icon-override-theme]
{:keys [icon on-press type style icon-override-theme accessibility-label]
:or {type :grey}}]
^{:key index}
[rn/view
{:style (assoc style
:margin-right
(if (= index last-icon-index) 0 8))}
(cond-> {:style (assoc style
:margin-right
(if (= index last-icon-index) 0 8))}
accessibility-label (assoc :accessibility-label accessibility-label
:accessible true))
[button/button
{:on-press on-press
:icon true
@@ -201,8 +203,8 @@
}
}
"
[{:keys [one-icon-align-left? horizontal-description? align-mid?
page-nav-color page-nav-background-uri
[{:keys [container-style one-icon-align-left? horizontal-description?
align-mid? page-nav-color page-nav-background-uri
mid-section
left-section
right-section-buttons]}]
@@ -220,13 +222,14 @@
:left-icon (:left-icon mid-section)
:avatar (:avatar mid-section)}]
[rn/view
{:style (cond-> {:display :flex
:flex-direction :row
;; iPhone 11 Pro's height in Figma divided by Component height 56/1125
:align-items :center
:padding-horizontal 20
:height 56
:justify-content :space-between}
{:style (cond-> (merge {:display :flex
:flex-direction :row
;; iPhone 11 Pro's height in Figma divided by Component height 56/1125
:align-items :center
:padding-horizontal 20
:height 56
:justify-content :space-between}
container-style)
page-nav-background-uri (assoc :background-color page-nav-color)
page-nav-color (assoc :background page-nav-background-uri))}
[rn/view
@@ -235,15 +238,18 @@
:align-items :center}}
(when left-section
[left-section-view left-section put-middle-section-on-left?])
(when put-middle-section-on-left?
[mid-section-view
(assoc mid-section-props
:left-align? true
:description (:description mid-section)
:description-color (:description-color mid-section)
:description-icon (:description-icon mid-section)
:align-mid? align-mid?
:description-user-icon (:description-user-icon mid-section))])]
(when-not put-middle-section-on-left?
[mid-section-view mid-section-props])
(when mid-section
(cond
put-middle-section-on-left?
[mid-section-view
(assoc mid-section-props
:left-align? true
:description (:description mid-section)
:description-color (:description-color mid-section)
:description-icon (:description-icon mid-section)
:align-mid? align-mid?
:description-user-icon (:description-user-icon mid-section))]
(not put-middle-section-on-left?)
[mid-section-view mid-section-props]))]
[right-section-view right-section-buttons]]))
+2 -1
View File
@@ -16,7 +16,8 @@
[text/text
{:style (style/tip-text completed?)
:weight :regular
:size :paragraph-2} text]
:size :paragraph-2}
text]
(when completed?
[rn/view
{:style style/strike-through
@@ -2,14 +2,16 @@
(:require [quo2.foundations.colors :as colors]))
(defn card-container
[customization-color padding-bottom]
{:flex-direction :column
:padding-horizontal 12
:padding-top 12
:padding-bottom padding-bottom
:flex 1
:border-radius 16
:background-color (colors/custom-color customization-color 50 40)})
[{:keys [customization-color padding-bottom border-bottom-radius]}]
{:padding-horizontal 12
:padding-top 12
:padding-bottom padding-bottom
:flex 1
:border-top-left-radius 16
:border-top-right-radius 16
:border-bottom-left-radius border-bottom-radius
:border-bottom-right-radius border-bottom-radius
:background-color (colors/custom-color customization-color 50 40)})
(def card-header
{:flex-direction :row
@@ -4,77 +4,104 @@
[quo2.components.icon :as icon]
[quo2.components.tags.tag :as tag]
[quo2.foundations.colors :as colors]
[react-native.hole-view :as hole-view]
[quo2.components.markdown.text :as text]
[quo2.components.buttons.button :as button]
[quo2.components.avatars.user-avatar.view :as user-avatar]
[quo2.components.profile.profile-card.style :as style]))
[quo2.components.profile.profile-card.style :as style]
[quo2.components.avatars.user-avatar.view :as user-avatar]))
(defn profile-card
[{:keys [key-card? profile-picture name hash customization-color
emoji-hash on-options-press show-emoji-hash? padding-bottom
show-options-button? show-user-hash? show-logged-in? on-card-press]
(defn- profile-card-component
[{:keys [keycard-account? profile-picture name hash
customization-color emoji-hash on-options-press
show-emoji-hash? show-options-button? show-user-hash?
show-logged-in? on-card-press login-card? last-item? card-style]
:or {show-emoji-hash? false
show-user-hash? false
customization-color :turquoise
show-options-button? false
show-logged-in? false
key-card? false}}]
[rn/touchable-without-feedback
{:on-press on-card-press
:flex 1
:accessibility-label :profile-card}
[rn/view
(style/card-container
customization-color
(or padding-bottom (if show-emoji-hash? 12 10)))
[rn/view
{:style style/card-header}
[user-avatar/user-avatar
{:full-name name
:profile-picture profile-picture
:override-theme :dark
:size :medium
:status-indicator? false}]
[rn/view {:flex-direction :row}
(when show-logged-in?
[tag/tag
{:type :icon
:size 32
:blurred? true
:labelled? true
:resource :main-icons2/check
:accessibility-label :logged-in-tag
:icon-color colors/success-50
keycard-account? false
login-card? false
last-item? false
card-style {:padding-horizontal 20
:flex 1}}}]
(let [{:keys [width]} (rn/use-window-dimensions)
padding-bottom (cond
login-card? 38
show-emoji-hash? 12
:else 10)
border-bottom-radius (if (or (not login-card?) last-item?) 16 0)]
[rn/touchable-without-feedback
{:on-press on-card-press
:accessibility-label :profile-card}
[hole-view/hole-view
{:key (str name last-item?) ;; Key is required to force removal of holes
:style (merge {:flex-direction :row} card-style)
:holes (if (or (not login-card?) last-item?)
[]
[{:x 20
:y 108
:width (- width 40)
:height 50
:borderRadius 16}])}
[rn/view
{:style (style/card-container
{:customization-color customization-color
:padding-bottom padding-bottom
:border-bottom-radius border-bottom-radius})}
[rn/view
{:style style/card-header}
[user-avatar/user-avatar
{:full-name name
:profile-picture profile-picture
:override-theme :dark
:label (i18n/label :t/logged-in)}])
(when show-options-button?
[button/button
{:size 32
:type :blur-bg
:icon true
:override-theme :dark
:style style/option-button
:on-press on-options-press
:accessibility-label :profile-card-options}
:i/options])]]
[rn/view
{:style style/name-container}
[text/text
{:size :heading-2
:weight :semi-bold
:number-of-lines 1
:style style/user-name} name]
(when key-card?
(icon/icon
:i/keycard
style/keycard-icon))]
(when show-user-hash?
[text/text
{:weight :monospace
:number-of-lines 1
:style style/user-hash} hash])
(when (and show-emoji-hash? emoji-hash)
[text/text
{:weight :monospace
:number-of-lines 1
:style style/emoji-hash} emoji-hash])]])
:size :medium
:status-indicator? false
:customization-color customization-color}]
[rn/view {:flex-direction :row}
(when show-logged-in?
[tag/tag
{:type :icon
:size 32
:blurred? true
:labelled? true
:resource :main-icons2/check
:accessibility-label :logged-in-tag
:icon-color colors/success-50
:override-theme :dark
:label (i18n/label :t/logged-in)}])
(when show-options-button?
[button/button
{:size 32
:type :blur-bg
:icon true
:override-theme :dark
:style style/option-button
:on-press on-options-press
:accessibility-label :profile-card-options}
:i/options])]]
[rn/view
{:style style/name-container}
[text/text
{:size :heading-2
:weight :semi-bold
:number-of-lines 1
:style style/user-name} name]
(when keycard-account?
(icon/icon
:i/keycard
style/keycard-icon))]
(when show-user-hash?
[text/text
{:weight :monospace
:number-of-lines 1
:style style/user-hash} hash])
(when (and show-emoji-hash? emoji-hash)
[text/text
{:weight :monospace
:number-of-lines 1
:style style/emoji-hash} emoji-hash])]]]))
(defn profile-card
[props]
[:f> profile-card-component props])
@@ -0,0 +1,29 @@
(ns quo2.components.selectors.disclaimer.component-spec
(:require [quo2.components.selectors.disclaimer.view :as disclaimer]
[test-helpers.component :as h]))
(h/describe "Disclaimer tests"
(h/test "Default render of toggle component"
(h/render [disclaimer/view {:on-change (h/mock-fn)} "test"])
(h/is-truthy (h/get-by-label-text :checkbox-off)))
(h/test "Renders its text"
(let [text "I accept this disclaimer"]
(h/render [disclaimer/view {} text])
(h/is-truthy (h/get-by-text text))))
(h/test "On change event gets fire after press"
(let [mock-fn (h/mock-fn)]
(h/render [disclaimer/view {:on-change mock-fn} "test"])
(h/fire-event :press (h/get-by-label-text :checkbox-off))
(h/was-called mock-fn)))
(h/describe "It's rendered according to its `checked?` property"
(h/test "checked? true"
(h/render [disclaimer/view {:checked? true} "test"])
(h/is-null (h/query-by-label-text :checkbox-off))
(h/is-truthy (h/query-by-label-text :checkbox-on)))
(h/test "checked? false"
(h/render [disclaimer/view {:checked? false} "test"])
(h/is-null (h/query-by-label-text :checkbox-on))
(h/is-truthy (h/query-by-label-text :checkbox-off)))))
@@ -2,14 +2,16 @@
(:require [quo2.foundations.colors :as colors]))
(defn container
[]
{:flex-direction :row
:background-color (colors/theme-colors colors/neutral-5 colors/neutral-80-opa-40)
:padding 11
:align-self :stretch
:border-radius 12
:border-width 1
:border-color (colors/theme-colors colors/neutral-20 colors/neutral-70)})
[blur?]
(let [dark-background (if blur? colors/white-opa-5 colors/neutral-80-opa-40)
dark-border (if blur? colors/white-opa-10 colors/neutral-70)]
{:flex-direction :row
:background-color (colors/theme-colors colors/neutral-5 dark-background)
:padding 11
:align-self :stretch
:border-radius 12
:border-width 1
:border-color (colors/theme-colors colors/neutral-20 dark-border)}))
(def text
{:margin-left 8})
@@ -5,12 +5,13 @@
[react-native.core :as rn]))
(defn view
[{:keys [on-change accessibility-label container-style]} label]
[{:keys [checked? blur? on-change accessibility-label container-style]} label]
[rn/view
{:style (merge container-style (style/container))}
{:style (merge container-style (style/container blur?))}
[selectors/checkbox
{:accessibility-label accessibility-label
:on-change on-change}]
:on-change on-change
:checked? checked?}]
[text/text
{:size :paragraph-2
:style style/text}
+17 -10
View File
@@ -5,6 +5,10 @@
[react-native.core :as rn]
[reagent.core :as reagent]))
(def themes-for-blur
{:light {:background-color colors/neutral-80-opa-5}
:dark {:background-color colors/white-opa-5}})
(def themes
{:light {:background-color colors/neutral-20}
:dark {:background-color colors/neutral-80}})
@@ -12,11 +16,12 @@
(defn segmented-control
[{:keys [default-active on-change]}]
(let [active-tab-id (reagent/atom default-active)]
(fn [{:keys [data size]}]
(fn [{:keys [data size override-theme blur?]}]
(let [active-id @active-tab-id]
[rn/view
{:flex-direction :row
:background-color (get-in themes [(theme/get-theme) :background-color])
:background-color (get-in (if blur? themes-for-blur themes)
[(or override-theme (theme/get-theme)) :background-color])
:border-radius (case size
32 10
28 8
@@ -29,12 +34,14 @@
{:margin-left (if (= 0 indx) 0 2)
:flex 1}
[tab/view
{:id id
:segmented? true
:size size
:active (= id active-id)
:on-press (fn [tab-id]
(reset! active-tab-id tab-id)
(when on-change
(on-change tab-id)))}
{:id id
:segmented? true
:size size
:override-theme override-theme
:blur? blur?
:active (= id active-id)
:on-press (fn [tab-id]
(reset! active-tab-id tab-id)
(when on-change
(on-change tab-id)))}
label]])]))))
+6 -5
View File
@@ -79,11 +79,12 @@
[notification-dot/notification-dot
{:style style/notification-dot}])
[rn/view
{:style (style/tab {:size size
:disabled disabled
:segmented? segmented?
:background-color background-color
:show-notification-dot? show-notification-dot?})}
{:style (style/tab
{:size size
:disabled disabled
:segmented? segmented?
:background-color (if (and segmented? (not active)) :transparent background-color)
:show-notification-dot? show-notification-dot?})}
(when before
[rn/view
[icons/icon before {:color icon-color}]])
+22 -16
View File
@@ -11,12 +11,14 @@
(def small-container-style
(merge default-container-style
{:padding-horizontal 8
{:min-height 24
:padding-horizontal 8
:padding-vertical 1}))
(def large-container-style
(merge default-container-style
{:padding-horizontal 11
{:min-height 32
:padding-horizontal 11
:padding-vertical 4}))
(defn base-tag
@@ -36,6 +38,7 @@
:style (assoc (if (= size :small)
small-container-style
large-container-style)
:align-self :flex-start
:border-width 1
:border-color border-color
:background-color background-color)}
@@ -45,10 +48,11 @@
[rn/view
{:style {:justify-content :center
:align-items :center}}
[icon/icon
icon
{:no-color true
:size (if (= size :large) 20 12)}]]
(when icon
[icon/icon
icon
{:no-color true
:size (if (= size :large) 20 12)}])]
[text/text
{:size paragraph-size
:weight :medium
@@ -56,11 +60,11 @@
:color text-color}} label]]])))
(defn- positive
[size theme label _]
[size theme label _ no-icon?]
[base-tag
{:accessibility-label :status-tag-positive
:size size
:icon :i/positive-state
:icon (when-not no-icon? :i/positive-state)
:background-color colors/success-50-opa-10
:border-color colors/success-50-opa-20
:label label
@@ -68,11 +72,11 @@
:text-color (if (= theme :dark) colors/success-60 colors/success-50)}])
(defn- negative
[size theme label _]
[size theme label _ no-icon?]
[base-tag
{:accessibility-label :status-tag-negative
:size size
:icon :i/negative-state
:icon (when-not no-icon? :i/negative-state)
:background-color colors/danger-50-opa-10
:border-color colors/danger-50-opa-20
:label label
@@ -80,14 +84,15 @@
:text-color (if (= theme :light) colors/danger-50 colors/danger-60)}])
(defn- pending
[size theme label blur?]
[size theme label blur? no-icon?]
[base-tag
{:accessibility-label :status-tag-pending
:size size
:label label
:icon (if blur?
:i/pending-dark-blur
(if (= theme :light) :i/pending-light :i/pending-dark))
:icon (when-not no-icon?
(if blur?
:i/pending-dark-blur
(if (= theme :light) :i/pending-light :i/pending-dark)))
:background-color (if blur?
colors/white-opa-5
(colors/theme-colors colors/neutral-10 colors/neutral-80-opa-40 theme))
@@ -100,7 +105,7 @@
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))}])
(defn status-tag
[{:keys [status size override-theme label blur?]}]
[{:keys [status size override-theme label blur? no-icon?]}]
(when status
(when-let [status-component (case (:type status)
:positive positive
@@ -111,4 +116,5 @@
size
(or override-theme (quo2.theme/get-theme))
label
blur?])))
blur?
no-icon?])))
+2
View File
@@ -60,6 +60,7 @@
quo2.components.settings.accounts.view
quo2.components.settings.privacy-option
quo2.components.onboarding.small-option-card.view
quo2.components.tabs.segmented-tab
quo2.components.tabs.account-selector
quo2.components.tabs.tabs
quo2.components.tags.context-tags
@@ -91,6 +92,7 @@
(def audio-tag quo2.components.tags.context-tags/audio-tag)
(def community-tag quo2.components.tags.context-tags/community-tag)
(def tabs quo2.components.tabs.tabs/tabs)
(def segmented-control quo2.components.tabs.segmented-tab/segmented-control)
(def account-selector quo2.components.tabs.account-selector/account-selector)
(def floating-shell-button quo2.components.navigation.floating-shell-button/floating-shell-button)
(def page-nav quo2.components.navigation.page-nav/page-nav)
+4 -2
View File
@@ -2,21 +2,23 @@
(:require [quo2.components.avatars.user-avatar.component-spec]
[quo2.components.banners.banner.component-spec]
[quo2.components.buttons.--tests--.buttons-component-spec]
[quo2.components.colors.color-picker.component-spec]
[quo2.components.counter.--tests--.counter-component-spec]
[quo2.components.dividers.--tests--.divider-label-component-spec]
[quo2.components.dividers.strength-divider.component-spec]
[quo2.components.drawers.action-drawers.component-spec]
[quo2.components.drawers.drawer-buttons.component-spec]
[quo2.components.drawers.permission-context.component-spec]
[quo2.components.colors.color-picker.component-spec]
[quo2.components.inputs.input.component-spec]
[quo2.components.inputs.profile-input.component-spec]
[quo2.components.inputs.title-input.component-spec]
[quo2.components.markdown.--tests--.text-component-spec]
[quo2.components.onboarding.small-option-card.component-spec]
[quo2.components.password.tips.component-spec]
[quo2.components.profile.select-profile.component-spec]
[quo2.components.record-audio.record-audio.--tests--.record-audio-component-spec]
[quo2.components.record-audio.soundtrack.--tests--.soundtrack-component-spec]
[quo2.components.profile.select-profile.component-spec]
[quo2.components.selectors.--tests--.selectors-component-spec]
[quo2.components.selectors.disclaimer.component-spec]
[quo2.components.selectors.filter.component-spec]
[quo2.components.tags.--tests--.status-tags-component-spec]))
+8 -1
View File
@@ -85,6 +85,7 @@
;;100 with transparency
(def neutral-100-opa-0 (alpha neutral-100 0))
(def neutral-100-opa-10 (alpha neutral-100 0.1))
(def neutral-100-opa-30 (alpha neutral-100 0.3))
(def neutral-100-opa-60 (alpha neutral-100 0.6))
(def neutral-100-opa-70 (alpha neutral-100 0.7))
(def neutral-100-opa-80 (alpha neutral-100 0.8))
@@ -116,6 +117,7 @@
;;;;Blur
(def white-70-blur (alpha white 0.7))
(def neutral-80-opa-1-blur (alpha "#192438" 0.1))
(def neutral-5-opa-70-blur (alpha neutral-5 0.7))
(def neutral-80-opa-80-blur (alpha "#192438" 0.8))
(def neutral-90-opa-70-blur (alpha neutral-90 0.7))
@@ -126,6 +128,7 @@
;;Solid
(def black "#000000")
(def onboarding-header-black "#000716")
;;;;Primary
@@ -236,7 +239,11 @@
([color suffix]
(custom-color color suffix nil))
([color suffix opacity]
(let [base-color (get-in colors-map [(keyword color) suffix])]
(let [color-keyword (keyword color)
base-color (get-in colors-map
[(if (= color-keyword :yinyang)
(if (theme/dark?) :yang :yin)
(keyword color)) suffix])]
(if opacity (alpha base-color (/ opacity 100)) base-color))))))
(defn custom-color-by-theme
+6 -1
View File
@@ -1,5 +1,10 @@
(ns react-native.blur
(:require ["@react-native-community/blur" :as blur]
[reagent.core :as reagent]))
[react-native.platform :as platform]
[reagent.core :as reagent]
[react-native.core :as rn]))
(def view (reagent/adapt-react-class (.-BlurView blur)))
;; blur view is currently not working correctly on Android.
(def ios-view (if platform/ios? view rn/view))
+5
View File
@@ -0,0 +1,5 @@
(ns react-native.camera-kit
(:require ["react-native-camera-kit" :refer (CameraKitCamera)]
[reagent.core :as reagent]))
(def camera (reagent/adapt-react-class CameraKitCamera))
+5 -1
View File
@@ -6,7 +6,8 @@
Swipeable
TouchableWithoutFeedback
gestureHandlerRootHOC
FlatList)]
FlatList
ScrollView)]
[react-native.flat-list :as rn-flat-list]
[reagent.core :as reagent]))
@@ -69,6 +70,9 @@
children))
(def gesture-flat-list (reagent/adapt-react-class FlatList))
(defn flat-list
[props]
[gesture-flat-list (rn-flat-list/base-list-props props)])
(def scroll-view (reagent/adapt-react-class ScrollView))
+4
View File
@@ -6,3 +6,7 @@
(let [kb (.useKeyboard hooks)]
{:keyboard-shown (.-keyboardShown ^js kb)
:keyboard-height (.-keyboardHeight ^js kb)}))
(defn use-back-handler
[handler]
(.useBackHandler hooks handler))
+20 -9
View File
@@ -9,18 +9,22 @@
withDelay
withSpring
withRepeat
withSequence
withDecay
Easing
Keyframe
cancelAnimation
SlideInUp
SlideOutUp
LinearTransition)]
LinearTransition
runOnJS)]
[reagent.core :as reagent]
["react-native-redash" :refer (withPause)]
[react-native.flat-list :as rn-flat-list]
[utils.collection]
[utils.worklets.core :as worklets.core]))
(def ^:const default-duration 300)
;; Animations
(def slide-in-up-animation SlideInUp)
(def slide-out-up-animation SlideOutUp)
@@ -57,14 +61,19 @@
(def with-decay withDecay)
(def key-frame Keyframe)
(def with-repeat withRepeat)
(def with-sequence withSequence)
(def with-pause withPause)
(def cancel-animation cancelAnimation)
(def run-on-js runOnJS)
;; Easings
(def bezier (.-bezier ^js Easing))
(def in-out
(.-inOut ^js Easing))
;; trying to put default-easing inside easings map causes test to fail
(defn default-easing [] (in-out (.-quad ^js Easing)))
(def easings
@@ -115,13 +124,15 @@
(js-obj "duration" duration
"easing" (get easings easing))))))
(defn animate-shared-value-with-delay-default-easing
[anim val duration delay]
(set-shared-value anim
(with-delay delay
(with-timing val
(js-obj "duration" duration
"easing" (in-out (.-quad ^js Easing)))))))
(defn animate-delay
([animation val delay]
(animate-delay animation val delay default-duration))
([animation val delay duration]
(set-shared-value animation
(with-delay delay
(with-timing val
(clj->js {:duration duration
:easing (default-easing)}))))))
(defn animate-shared-value-with-repeat
[anim val duration easing number-of-repetitions reverse?]
+1 -1
View File
@@ -83,7 +83,7 @@
(if new-contact?
(rf/merge cofx
(contact/add-contact chat-key nickname ens-name)
(navigation/navigate-to-cofx :contacts-list {}))
(navigation/navigate-to :contacts-list {}))
(chat/start-chat cofx chat-key ens-name))
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:content (case validation-result
+30
View File
@@ -0,0 +1,30 @@
(ns status-im.bottom-sheet.events
(:require [utils.re-frame :as rf]))
(rf/defn show-bottom-sheet-old
[{:keys [db]} {:keys [view options]}]
{:dismiss-keyboard nil
:show-bottom-sheet-overlay-old nil
:db (assoc db
:bottom-sheet/show? true
:bottom-sheet/view view
:bottom-sheet/options options)})
(rf/defn show-bottom-sheet-event
{:events [:bottom-sheet/show-sheet-old]}
[cofx view options]
(show-bottom-sheet-old
cofx
{:view view
:options options}))
(rf/defn hide-bottom-sheet-old
{:events [:bottom-sheet/hide-old]}
[{:keys [db]}]
{:db (assoc db :bottom-sheet/show? false)
:dismiss-bottom-sheet-overlay-old nil})
(rf/defn hide-bottom-sheet-navigation-overlay
{:events [:bottom-sheet/hide-old-navigation-overlay]}
[{}]
{:dismiss-bottom-sheet-overlay-old nil})
@@ -1,4 +1,4 @@
(ns status-im2.common.bottom-sheet.sheets
(ns status-im.bottom-sheet.sheets
(:require [utils.re-frame :as rf]
[status-im.ui.screens.about-app.views :as about-app]
[status-im.ui.screens.home.sheet.views :as home.sheet]
@@ -6,16 +6,15 @@
[status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings]
[status-im.ui.screens.multiaccounts.key-storage.views :as key-storage]
[status-im.ui.screens.multiaccounts.recover.views :as recover.views]
[status-im2.common.bottom-sheet.view :as bottom-sheet]
[status-im2.contexts.chat.messages.pin.list.view :as pin.list]
[status-im.bottom-sheet.view :as bottom-sheet]
[react-native.core :as rn]))
(defn bottom-sheet
[]
(let [dismiss-bottom-sheet-callback (fn []
(rf/dispatch [:bottom-sheet/hide])
(rf/dispatch [:bottom-sheet/hide-old])
true)
{:keys [show? view options]} (rf/sub [:bottom-sheet])
{:keys [show? view options]} (rf/sub [:bottom-sheet-old])
{:keys [content]
:as opts}
(cond-> {:visible? show?}
@@ -31,12 +30,6 @@
(= view :add-new)
(merge home.sheet/add-new)
(= view :new-chat-bottom-sheet)
(merge home.sheet/new-chat-bottom-sheet-comp)
(= view :start-a-new-chat)
(merge home.sheet/start-a-new-chat)
(= view :keycard.login/more)
(merge keycard/more-sheet)
@@ -47,10 +40,8 @@
(merge recover.views/bottom-sheet)
(= view :migrate-account-password)
(merge key-storage/migrate-account-password)
(merge key-storage/migrate-account-password))]
(= view :pinned-messages-list)
(merge {:content pin.list/pinned-messages-list}))]
[:f>
(fn []
(rn/use-effect (fn []
+56
View File
@@ -0,0 +1,56 @@
(ns status-im.bottom-sheet.styles
(:require [quo2.foundations.colors :as colors]))
(def border-radius 20)
(defn handle
[override-theme]
{:position :absolute
:top 8
:width 32
:height 4
:background-color (colors/theme-colors colors/neutral-100 colors/white override-theme)
:opacity 0.1
:border-radius 100
:align-self :center})
(def backdrop
{:position :absolute
:left 0
:right 0
:bottom 0
:top 0
:background-color colors/neutral-100})
(def container
{:position :absolute
:left 0
:right 0
:top 0
:bottom 0
:overflow :hidden})
(defn content-style
[insets bottom-safe-area-spacing?]
{:position :absolute
:left 0
:right 0
:top 0
:padding-top border-radius
:padding-bottom (if bottom-safe-area-spacing? (:bottom insets) 0)})
(defn selected-background
[override-theme]
{:border-radius 12
:padding-left 12
:margin-horizontal 8
:margin-bottom 10
:height 48
:background-color (colors/theme-colors colors/white colors/neutral-90 override-theme)})
(defn background
[override-theme]
{:background-color (colors/theme-colors colors/white colors/neutral-95 override-theme)
:flex 1
:border-top-left-radius border-radius
:border-top-right-radius border-radius})
+240
View File
@@ -0,0 +1,240 @@
(ns status-im.bottom-sheet.view
(:require [oops.core :refer [oget]]
[quo.react :as react]
[status-im.bottom-sheet.styles :as styles]
[re-frame.core :as re-frame]
[react-native.background-timer :as timer]
[react-native.core :as rn]
[react-native.gesture :as gesture]
[react-native.hooks :as hooks]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[utils.worklets.bottom-sheet :as worklets.bottom-sheet]))
(def animation-delay 450)
(defn with-animation
[value & [options callback]]
(reanimated/with-spring
value
(clj->js (merge {:mass 2
:stiffness 500
:damping 200})
options)
callback))
(defn get-bottom-sheet-gesture
[pan-y translate-y bg-height bg-height-expanded
window-height keyboard-shown disable-drag? expandable?
show-bottom-sheet? expanded? close-bottom-sheet gesture-running?]
(-> (gesture/gesture-pan)
(gesture/on-start
(fn [_]
(reset! gesture-running? true)
(when (and keyboard-shown (not disable-drag?) show-bottom-sheet?)
(re-frame/dispatch [:dismiss-keyboard]))))
(gesture/on-update
(fn [evt]
(when (and (not disable-drag?) show-bottom-sheet?)
(let [max-pan-up (if (or @expanded? (not expandable?))
0
(- (- bg-height-expanded bg-height)))
max-pan-down (if @expanded?
bg-height-expanded
bg-height)]
(reanimated/set-shared-value pan-y
(max
(min
(.-translationY evt)
max-pan-down)
max-pan-up))))))
(gesture/on-end
(fn [_]
(reset! gesture-running? false)
(when (and (not disable-drag?) show-bottom-sheet?)
(let [end-pan-y (- window-height (.-value translate-y))
expand-threshold (min (* bg-height 1.1) (+ bg-height 50))
collapse-threshold (max (* bg-height-expanded 0.9) (- bg-height-expanded 50))
should-close-bottom-sheet? (< end-pan-y (max (* bg-height 0.7) 50))]
(cond
should-close-bottom-sheet?
(close-bottom-sheet)
(and (not @expanded?) (> end-pan-y expand-threshold))
(reset! expanded? true)
(and @expanded? (< end-pan-y collapse-threshold))
(reset! expanded? false))))))))
(defn handle-comp
[window-width override-theme]
[rn/view
{:style {:width window-width
:position :absolute
:background-color :transparent
:top 0
:height 20}}
[rn/view {:style (styles/handle override-theme)}]])
(defn bottom-sheet
[props children]
(let [{on-cancel :on-cancel
disable-drag? :disable-drag?
show-handle? :show-handle?
visible? :visible?
backdrop-dismiss? :backdrop-dismiss?
expandable? :expandable?
bottom-safe-area-spacing? :bottom-safe-area-spacing?
selected-item :selected-item
is-initially-expanded? :expanded?
override-theme :override-theme
:or {show-handle? true
backdrop-dismiss? true
expandable? false
bottom-safe-area-spacing? true
is-initially-expanded? false}}
props
content-height (reagent/atom nil)
show-bottom-sheet? (reagent/atom nil)
keyboard-was-shown? (reagent/atom false)
expanded? (reagent/atom is-initially-expanded?)
gesture-running? (reagent/atom false)
reset-atoms (fn []
(reset! show-bottom-sheet? nil)
(reset! content-height nil)
(reset! expanded? false)
(reset! keyboard-was-shown? false)
(reset! gesture-running? false))
close-bottom-sheet (fn []
(reset! show-bottom-sheet? false)
(when (fn? on-cancel) (on-cancel))
(timer/set-timeout
#(do
(re-frame/dispatch [:bottom-sheet/hide-old-navigation-overlay])
(reset-atoms))
animation-delay))]
[safe-area/consumer
(fn [insets]
[:f>
(fn []
(let [{height :height
window-width :width}
(rn/use-window-dimensions)
window-height (if selected-item (- height 72) height)
{:keys [keyboard-shown]} (hooks/use-keyboard)
bg-height-expanded (- window-height (:top insets))
bg-height (max (min @content-height bg-height-expanded) 109)
bottom-sheet-dy (reanimated/use-shared-value 0)
pan-y (reanimated/use-shared-value 0)
translate-y (worklets.bottom-sheet/use-translate-y window-height bottom-sheet-dy pan-y)
bg-opacity
(worklets.bottom-sheet/use-background-opacity translate-y bg-height window-height 0.7)
on-content-layout (fn [evt]
(let [height (oget evt "nativeEvent" "layout" "height")]
(reset! content-height height)))
on-expanded (fn []
(reanimated/set-shared-value bottom-sheet-dy bg-height-expanded)
(reanimated/set-shared-value pan-y 0))
on-collapsed (fn []
(reanimated/set-shared-value bottom-sheet-dy bg-height)
(reanimated/set-shared-value pan-y 0))
bottom-sheet-gesture (get-bottom-sheet-gesture
pan-y
translate-y
bg-height
bg-height-expanded
window-height
keyboard-shown
disable-drag?
expandable?
show-bottom-sheet?
expanded?
close-bottom-sheet
gesture-running?)
handle-comp [gesture/gesture-detector {:gesture bottom-sheet-gesture}
[handle-comp window-width override-theme]]]
(react/effect! #(do
(cond
(and
(nil? @show-bottom-sheet?)
visible?
(some? @content-height)
(> @content-height 0))
(reset! show-bottom-sheet? true)
(and @show-bottom-sheet? (not visible?))
(close-bottom-sheet)))
[@show-bottom-sheet? @content-height visible?])
(react/effect! #(do
(when @show-bottom-sheet?
(cond
keyboard-shown
(do
(reset! keyboard-was-shown? true)
(reset! expanded? true))
(and @keyboard-was-shown? (not keyboard-shown))
(reset! expanded? false))))
[@show-bottom-sheet? @keyboard-was-shown? keyboard-shown])
(react/effect! #(do
(when-not @gesture-running?
(cond
@show-bottom-sheet?
(if @expanded?
(do
(reanimated/set-shared-value
bottom-sheet-dy
(with-animation (+ bg-height-expanded (.-value pan-y))))
;; Workaround for
;; https://github.com/software-mansion/react-native-reanimated/issues/1758#issue-817145741
;; withTiming/withSpring callback not working
;; on-expanded should be called as a callback of
;; with-animation instead, once this issue has been resolved
(timer/set-timeout on-expanded animation-delay))
(do
(reanimated/set-shared-value
bottom-sheet-dy
(with-animation (+ bg-height (.-value pan-y))))
;; Workaround for
;; https://github.com/software-mansion/react-native-reanimated/issues/1758#issue-817145741
;; withTiming/withSpring callback not working
;; on-collapsed should be called as a callback of
;; with-animation instead, once this issue has been resolved
(timer/set-timeout on-collapsed animation-delay)))
(= @show-bottom-sheet? false)
(reanimated/set-shared-value bottom-sheet-dy (with-animation 0)))))
[@show-bottom-sheet? @expanded? @gesture-running?])
[:<>
[rn/touchable-without-feedback {:on-press (when backdrop-dismiss? close-bottom-sheet)}
[reanimated/view
{:style (reanimated/apply-animations-to-style
{:opacity bg-opacity}
styles/backdrop)}]]
(cond->> [reanimated/view
{:style (reanimated/apply-animations-to-style
{:transform [{:translateY translate-y}]}
{:width window-width
:height window-height})}
[rn/view {:style styles/container}
(when selected-item
[rn/view {:style (styles/selected-background override-theme)}
[selected-item]])
[rn/view {:style (styles/background override-theme)}
[rn/keyboard-avoiding-view
{:behaviour (if platform/ios? :padding :height)
:style {:flex 1}}
[rn/view
{:style (styles/content-style insets bottom-safe-area-spacing?)
:on-layout (when-not (and
(some? @content-height)
(> @content-height 0))
on-content-layout)}
children]]
(when show-handle?
handle-comp)]]]
(not show-handle?)
(conj [gesture/gesture-detector {:gesture bottom-sheet-gesture}]))]))])]))
+2 -2
View File
@@ -3,7 +3,7 @@
["eth-phishing-detect" :as eth-phishing-detect]
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im.browser.eip3085 :as eip3085]
[status-im.browser.eip3326 :as eip3326]
[status-im.browser.permissions :as browser.permissions]
@@ -572,7 +572,7 @@
[{:keys [db] :as cofx} address]
(rf/merge cofx
{:browser/clear-web-data nil}
(bottom-sheet/hide-bottom-sheet)
(bottom-sheet/hide-bottom-sheet-old)
(browser.permissions/clear-dapps-permissions)
(multiaccounts.update/multiaccount-update :dapps-address address {})
#(when (= (:view-id db) :browser)
+3 -3
View File
@@ -28,7 +28,7 @@
:on-success #(re-frame/dispatch [:eip3085/send-success-call-to-bridge cofx id
message-id])
:on-error #(log/error "failed to perform settings_saveSetting" %)}]
:dispatch [:bottom-sheet/hide]})
:dispatch [:bottom-sheet/hide-old]})
(rf/defn deny-permission
{:events [:eip3085.ui/dapp-permission-denied]}
@@ -37,7 +37,7 @@
:messageId message-id
:error {:code 4001
:message "User rejected the request."}}
:dispatch [:bottom-sheet/hide]})
:dispatch [:bottom-sheet/hide-old]})
(rf/defn handle-add-ethereum-chain
{:events [:eip3085/handle-add-ethereum-chain]}
@@ -64,7 +64,7 @@
:id id
:new-network network)]
(if (network/chain-id-available? networks network)
{:dispatch [:bottom-sheet/show-sheet
{:dispatch [:bottom-sheet/show-sheet-old
{:content (fn []
[sheet/permissions-panel dapp-name message-id params])}]}
(send-success-call-to-bridge cofx id message-id)))
+2 -2
View File
@@ -13,7 +13,7 @@
:messageId message-id
:error {:code 4001
:message "User rejected the request."}}
:dispatch [:bottom-sheet/hide]})
:dispatch [:bottom-sheet/hide-old]})
(rf/defn handle-switch-ethereum-chain
{:events [:eip3326/handle-switch-ethereum-chain]}
@@ -39,7 +39,7 @@
:target-network-id target-network-id
:network-from network-from
:network-to network-to)]
{:dispatch [:bottom-sheet/show-sheet
{:dispatch [:bottom-sheet/show-sheet-old
{:content (fn []
[sheet/permissions-panel dapp-name message-id params])}]}))
{:browser/send-to-bridge {:type constants/web3-send-async-callback
+5 -3
View File
@@ -147,8 +147,9 @@
(defn build-image-messages
[{db :db} chat-id input-text]
(let [images (get-in db [:chat/inputs chat-id :metadata :sending-image])
album-id (str (random-uuid))]
(let [images (get-in db [:chat/inputs chat-id :metadata :sending-image])
{:keys [message-id]} (get-in db [:chat/inputs chat-id :metadata :responding-to-message])
album-id (str (random-uuid))]
(mapv (fn [[_ {:keys [resized-uri width height]}]]
{:chat-id chat-id
:album-id album-id
@@ -159,7 +160,8 @@
;; TODO: message not received if text field is
;; nil or empty, issue:
;; https://github.com/status-im/status-mobile/issues/14754
:text (or input-text "placeholder")})
:text (or input-text "placeholder")
:response-to message-id})
images)))
(rf/defn clean-input
+8 -8
View File
@@ -8,7 +8,7 @@
[status-im.async-storage.core :as async-storage]
[status-im.ui.components.emoji-thumbnail.styles :as emoji-thumbnail-styles]
[status-im.utils.universal-links.core :as universal-links]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im2.common.toasts.events :as toasts]
[status-im2.constants :as constants]
[status-im2.contexts.activity-center.events :as activity-center]
@@ -276,7 +276,7 @@
(vals (get-in db [:communities community-id :chats])))]
(when (and id
(not= (:current-chat-id db) (str community-id id)))
(chat.events/navigate-to-chat cofx (str community-id id) nil))))
(chat.events/navigate-to-chat cofx (str community-id id)))))
(rf/defn fetch
[_]
@@ -445,7 +445,7 @@
[cofx id]
(rf/merge cofx
(reset-community-id-input id)
(bottom-sheet/hide-bottom-sheet)
(bottom-sheet/hide-bottom-sheet-old)
(navigation/open-modal :invite-people-community {:invite? true})))
(rf/defn share-community-pressed
@@ -453,7 +453,7 @@
[cofx id]
(rf/merge cofx
(reset-community-id-input id)
(bottom-sheet/hide-bottom-sheet)
(bottom-sheet/hide-bottom-sheet-old)
(navigation/open-modal :invite-people-community {})))
(rf/defn create-channel-pressed
@@ -575,7 +575,7 @@
{:events [::member-banned]}
[cofx response-js]
(rf/merge cofx
(bottom-sheet/hide-bottom-sheet)
(bottom-sheet/hide-bottom-sheet-old)
(handle-response response-js)
(activity-center/notifications-fetch-unread-count)))
@@ -596,7 +596,7 @@
{:events [::member-kicked]}
[cofx response-js]
(rf/merge cofx
(bottom-sheet/hide-bottom-sheet)
(bottom-sheet/hide-bottom-sheet-old)
(handle-response response-js)))
(rf/defn member-kick
@@ -817,13 +817,13 @@
[cofx community-id]
(rf/merge cofx
(navigation/pop-to-root :shell-stack)
(navigation/navigate-to-nav2 :community community-id true)))
(navigation/navigate-to :community-overview community-id)))
(rf/defn member-role-updated
{:events [:community.member/role-updated]}
[cofx response-js]
(rf/merge cofx
(bottom-sheet/hide-bottom-sheet)
(bottom-sheet/hide-bottom-sheet-old)
(handle-response response-js)))
(rf/defn add-role-to-member
+1 -1
View File
@@ -9,4 +9,4 @@
{:db (assoc db
:group/selected-contacts #{}
:new-chat-name "")}
(navigation/navigate-to-cofx :contact-toggle-list nil)))
(navigation/navigate-to :contact-toggle-list nil)))
+5 -5
View File
@@ -2,7 +2,7 @@
(:refer-clojure :exclude [name])
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
[status-im.ethereum.ens :as ens]
@@ -121,7 +121,7 @@
(let [{:keys [state username custom-domain?]} (:ens/registration db)]
(case state
(:available :owned)
(navigation/navigate-to-cofx cofx :ens-checkout {})
(navigation/navigate-to cofx :ens-checkout {})
:connected-with-different-key
(re-frame/dispatch [::set-pub-key])
:connected
@@ -261,7 +261,7 @@
[{:keys [db] :as cofx} _ {:keys [address]}]
(rf/merge cofx
{:db (assoc-in db [:ens/registration :address] address)}
(bottom-sheet/hide-bottom-sheet)))
(bottom-sheet/hide-bottom-sheet-old)))
(rf/defn save-preferred-name
{:events [::save-preferred-name]}
@@ -311,14 +311,14 @@
::resolve-pubkey
[chain-id username
#(re-frame/dispatch [::public-key-resolved username %])]}
(navigation/navigate-to-cofx :ens-name-details username))))
(navigation/navigate-to :ens-name-details username))))
(rf/defn start-registration
{:events [::add-username-pressed ::get-started-pressed]}
[{:keys [db] :as cofx}]
(rf/merge cofx
(set-username-candidate (get-in db [:ens/registration :username] ""))
(navigation/navigate-to-cofx :ens-search {})))
(navigation/navigate-to :ens-search {})))
(rf/defn remove-username
{:events [::remove-username]}
+1 -1
View File
@@ -202,7 +202,7 @@
(defn words-count
[s]
(if (empty? s)
nil
0
(-> s
passphrase->words
count)))
+2 -1
View File
@@ -57,6 +57,7 @@
status-im2.contexts.activity-center.events
status-im2.contexts.activity-center.notification.contact-requests.events
status-im2.contexts.shell.events
status-im2.contexts.onboarding.events
status-im.chat.models.gaps
[status-im2.navigation.events :as navigation]))
@@ -116,7 +117,7 @@
(let [current-theme-type (get-in cofx [:db :multiaccount :appearance])]
(when (and (multiaccounts.model/logged-in? cofx)
(= current-theme-type status-im2.constants/theme-type-system))
{:multiaccounts.ui/switch-theme
{:multiaccounts.ui/switch-theme-fx
[(get-in db [:multiaccount :appearance])
(:view-id db) true]})))
+3 -3
View File
@@ -15,7 +15,7 @@
{:events [:navigate-chat-updated]}
[cofx chat-id]
(when (get-in cofx [:db :chats chat-id])
(chat.events/navigate-to-chat cofx chat-id nil)))
(chat.events/navigate-to-chat cofx chat-id)))
(rf/defn handle-chat-removed
{:events [:chat-removed]}
@@ -245,7 +245,7 @@
{:db (-> db
(assoc :new-chat-name (get-in db [:chats chat-id :name]))
(assoc :current-chat-id chat-id))}
(navigation/navigate-to-cofx :group-chat-profile nil)))
(navigation/navigate-to :group-chat-profile nil)))
(rf/defn ui-leave-chat-pressed
{:events [:group-chats.ui/leave-chat-pressed]}
@@ -256,5 +256,5 @@
:content (i18n/label :t/leave-chat-confirmation)
:confirm-button-text (i18n/label :t/leave)
:on-accept #(do
(re-frame/dispatch [:bottom-sheet/hide])
(re-frame/dispatch [:bottom-sheet/hide-old])
(re-frame/dispatch [:group-chats.ui/leave-chat-confirmed chat-id]))}}))
+3 -3
View File
@@ -18,8 +18,8 @@
{:db (-> db
(assoc-in [:keycard :creating-backup?] backup-type))}
(when (:multiaccount db)
(navigation/navigate-to-cofx :my-profile nil))
(navigation/navigate-to-cofx :seed-phrase nil)))
(navigation/navigate-to :my-profile nil))
(navigation/navigate-to :seed-phrase nil)))
(rf/defn recovery-card-pressed
{:events [:keycard-settings.ui/recovery-card-pressed]}
@@ -69,4 +69,4 @@
(update :multiaccounts/key-storage dissoc :seed-phrase))
:dismiss-keyboard nil}
(common/listen-to-hardware-back-button)
(navigation/navigate-to-cofx :keycard-onboarding-intro nil)))
(navigation/navigate-to :keycard-onboarding-intro nil)))
+3 -3
View File
@@ -59,7 +59,7 @@
(common/clear-pin)
(common/hide-connection-sheet)
(if (get-in db [:keycard :pin :puk-restore?])
(navigation/navigate-to-cofx :multiaccounts nil)
(navigation/navigate-to :multiaccounts nil)
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings]))))
(rf/defn change-pin
@@ -150,7 +150,7 @@
:content (i18n/label :t/pin-changed)}}
(common/hide-connection-sheet)
(if puk-restore?
(navigation/navigate-to-cofx :multiaccounts nil)
(navigation/navigate-to :multiaccounts nil)
(navigation/set-stack-root :profile-stack [:my-profile :keycard-settings]))
(when (:multiaccounts/login db)
(common/get-keys-from-keycard)))))
@@ -211,5 +211,5 @@
:sign []
:error-label :t/pin-mismatch))}
(when (zero? pin-retries) (common/frozen-keycard-popup))
(navigation/navigate-to-cofx :enter-pin-settings nil))
(navigation/navigate-to :enter-pin-settings nil))
(common/show-wrong-keycard-alert))))))
+5 -6
View File
@@ -1,7 +1,7 @@
(ns status-im.keycard.common
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im.ethereum.core :as ethereum]
[utils.i18n :as i18n]
[status-im.keycard.nfc :as nfc]
@@ -195,8 +195,7 @@
connected?)
(rf/merge
cofx
{:dismiss-keyboard true}
(bottom-sheet/show-bottom-sheet
(bottom-sheet/show-bottom-sheet-old
{:view {:transparent platform/ios?
:show-handle? false
:backdrop-dismiss? false
@@ -231,7 +230,7 @@
{:db (assoc-in db [:keycard :card-read-in-progress?] false)}
(restore-on-card-connected)
(restore-on-card-read)
(bottom-sheet/hide-bottom-sheet)))
(bottom-sheet/hide-bottom-sheet-old)))
(rf/defn hide-connection-sheet
[cofx]
@@ -309,7 +308,7 @@
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (assoc-in db [:keycard :pin :current] [])}
(navigation/navigate-to-cofx :enter-pin-settings nil)))
(navigation/navigate-to :enter-pin-settings nil)))
(defn- tag-lost-exception?
[code error]
@@ -492,7 +491,7 @@
(if login?
(rf/merge cofx
(clear-on-card-read)
(navigation/navigate-to-cofx :not-keycard nil))
(navigation/navigate-to :not-keycard nil))
(rf/merge cofx
{:db (assoc-in db [:keycard :application-info-error] error)}
+8 -8
View File
@@ -40,7 +40,7 @@
{:enter-step :original
:original []
:confirmation []}))}
(navigation/navigate-to-cofx :keycard-onboarding-pin nil)))
(navigation/navigate-to :keycard-onboarding-pin nil)))
(rf/defn load-recovery-pin-screen
[{:keys [db] :as cofx}]
@@ -66,7 +66,7 @@
"instance-uid"
instance-uid)
(if (= flow :import)
(navigation/navigate-to-cofx cofx :keycard-recovery-no-key nil)
(navigation/navigate-to cofx :keycard-recovery-no-key nil)
(if paired?
(rf/merge cofx
(common/listen-to-hardware-back-button)
@@ -86,7 +86,7 @@
(assoc-in [:keycard :pin :on-verified] nil)
(assoc-in [:keycard :setup-step] nil))}
(common/clear-on-card-connected)
(navigation/navigate-to-cofx :keycard-settings nil)))
(navigation/navigate-to :keycard-settings nil)))
(rf/defn password-option-pressed
{:eevents [:keycard.ui/password-option-pressed]}
@@ -272,7 +272,7 @@
(not on-verified-failure))
(when exporting?
(navigation/navigate-back)))
;(navigation/navigate-to-cofx :enter-pin-settings nil)))
;(navigation/navigate-to :enter-pin-settings nil)))
(when (zero? pin-retries) (common/frozen-keycard-popup))
(when on-verified-failure
(fn [_]
@@ -505,7 +505,7 @@
(when multiaccount
(set-multiaccount-pairing multiaccount pairing paired-on))
(when (= flow :login)
(navigation/navigate-to-cofx :multiaccounts nil))
(navigation/navigate-to :multiaccounts nil))
(when (= flow :recovery)
(onboarding/proceed-with-generating-key))
(when (= flow :import)
@@ -531,7 +531,7 @@
:keycard/pair))
(common/hide-connection-sheet)
(when (= flow :import)
(navigation/navigate-to-cofx :keycard-recovery-pair nil))
(navigation/navigate-to :keycard-recovery-pair nil))
(when (not= setup-step :enter-pair-code)
(common/process-error code error))))))
@@ -579,7 +579,7 @@
(when (= card-state :pre-init)
(if (= flow :import)
(navigation/navigate-to-cofx :keycard-recovery-no-key nil)
(navigation/navigate-to :keycard-recovery-no-key nil)
(fn [cofx]
(rf/merge
cofx
@@ -596,7 +596,7 @@
(when (= card-state :blank)
(if (= flow :import)
(navigation/navigate-to-cofx :keycard-recovery-no-key nil)
(navigation/navigate-to :keycard-recovery-no-key nil)
(show-no-keycard-applet-alert)))
(when (and (= card-state :multiaccount)
+2 -2
View File
@@ -6,7 +6,7 @@
(rf/defn reset-card-pressed
{:events [:keycard-settings.ui/reset-card-pressed]}
[cofx]
(navigation/navigate-to-cofx cofx :reset-card nil))
(navigation/navigate-to cofx :reset-card nil))
(rf/defn delete-card
[{:keys [db] :as cofx}]
@@ -20,7 +20,7 @@
(rf/defn navigate-to-reset-card-screen
{:events [:keycard/navigate-to-reset-card-screen]}
[cofx]
(navigation/navigate-to-cofx cofx :reset-card nil))
(navigation/navigate-to cofx :reset-card nil))
(rf/defn reset-card-next-button-pressed
{:events [:keycard-settings.ui/reset-card-next-button-pressed]}
+11 -11
View File
@@ -1,5 +1,5 @@
(ns status-im.keycard.login
(:require [status-im2.common.bottom-sheet.events :as bottom-sheet]
(:require [status-im.bottom-sheet.events :as bottom-sheet]
[status-im.ethereum.core :as ethereum]
[status-im.keycard.common :as common]
status-im.keycard.fx
@@ -17,18 +17,18 @@
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db db}
(navigation/pop-to-root :multiaccounts-stack)))
(navigation/pop-to-root :profiles)))
(rf/defn login-pin-more-icon-pressed
{:events [:keycard.login.pin.ui/more-icon-pressed]}
[cofx]
(bottom-sheet/show-bottom-sheet cofx {:view :keycard.login/more}))
(bottom-sheet/hide-bottom-sheet-old cofx))
(rf/defn login-create-key-pressed
{:events [:keycard.login.ui/create-new-key-pressed]}
[cofx]
(rf/merge cofx
(bottom-sheet/hide-bottom-sheet)
(bottom-sheet/hide-bottom-sheet-old)
(onboarding/start-onboarding-flow)))
(rf/defn login-add-key-pressed
@@ -48,7 +48,7 @@
(log/debug "[keycard] load-pair-card-pressed")
(rf/merge cofx
{:db (assoc-in db [:keycard :flow] :login)}
(navigation/navigate-to-cofx :keycard-recovery-pair nil)))
(navigation/navigate-to :keycard-recovery-pair nil)))
(rf/defn reset-pin
{:events [::reset-pin]}
@@ -70,11 +70,11 @@
:status nil))
:hide-popover nil})
(when (:multiaccount db)
(navigation/navigate-to-cofx :my-profile nil))
(navigation/navigate-to :my-profile nil))
(when-not (:multiaccounts/login db)
(if (:popover/popover db)
(navigation/navigate-replace :keycard-pin nil)
(navigation/navigate-to-cofx :keycard-pin nil)))))
(navigation/navigate-to :keycard-pin nil)))))
(rf/defn dismiss-frozen-keycard-popover
{:events [::frozen-keycard-popover-dismissed]}
@@ -107,22 +107,22 @@
(empty? application-info)
(rf/merge cofx
(common/hide-connection-sheet)
(navigation/navigate-to-cofx :not-keycard nil))
(navigation/navigate-to :not-keycard nil))
(empty? key-uid)
(rf/merge cofx
(common/hide-connection-sheet)
(navigation/navigate-to-cofx :keycard-blank nil))
(navigation/navigate-to :keycard-blank nil))
multiaccount-mismatch?
(rf/merge cofx
(common/hide-connection-sheet)
(navigation/navigate-to-cofx :keycard-wrong nil))
(navigation/navigate-to :keycard-wrong nil))
(not paired?)
(rf/merge cofx
(common/hide-connection-sheet)
(navigation/navigate-to-cofx :keycard-unpaired nil))
(navigation/navigate-to :keycard-unpaired nil))
(and (zero? pin-retry-counter)
(or (nil? puk-retry-counter)
+6 -6
View File
@@ -36,7 +36,7 @@
(rf/merge cofx
{:utils/show-popup {:title (i18n/label :t/error)
:content (i18n/label :t/something-went-wrong)}}
(navigation/navigate-to-cofx :keycard-authentication-method nil))))))
(navigation/navigate-to :keycard-authentication-method nil))))))
(rf/defn load-preparing-screen
{:events [:keycard/load-preparing-screen]}
@@ -120,7 +120,7 @@
[cofx]
(rf/merge cofx
(recovery-phrase-start-confirmation)
(navigation/navigate-to-cofx :keycard-onboarding-recovery-phrase-confirm-word1 nil)))
(navigation/navigate-to :keycard-onboarding-recovery-phrase-confirm-word1 nil)))
(rf/defn recovery-phrase-next-word
[{:keys [db]}]
@@ -143,7 +143,7 @@
:on-verified :keycard/generate-and-load-key
:current []})
(assoc-in [:keycard :setup-step] :loading-keys))}
(navigation/navigate-to-cofx :keycard-onboarding-pin nil))
(navigation/navigate-to :keycard-onboarding-pin nil))
(load-finishing-screen cofx))))
(rf/defn recovery-phrase-confirm-word-next-pressed
@@ -178,10 +178,10 @@
(rf/merge cofx
{:keycard/check-nfc-enabled nil}
(if (= flow :import)
(navigation/navigate-to-cofx :keycard-recovery-intro nil)
(navigation/navigate-to :keycard-recovery-intro nil)
(do
(common/listen-to-hardware-back-button)
(navigation/navigate-to-cofx :keycard-onboarding-intro nil))))))
(navigation/navigate-to :keycard-onboarding-intro nil))))))
(rf/defn start-onboarding-flow
{:events [:keycard/start-onboarding-flow]}
@@ -190,7 +190,7 @@
{:db (assoc-in db [:keycard :flow] :create)
:keycard/check-nfc-enabled nil}
(common/listen-to-hardware-back-button)
(navigation/navigate-to-cofx :keycard-onboarding-intro nil)))
(navigation/navigate-to :keycard-onboarding-intro nil)))
(rf/defn open-nfc-settings-pressed
{:events [:keycard.onboarding.nfc-on/open-nfc-settings-pressed]}
+13 -13
View File
@@ -1,7 +1,7 @@
(ns status-im.keycard.recovery
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im2.constants :as constants]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
@@ -54,16 +54,16 @@
(rf/merge cofx
{:db (-> db
(assoc-in [:keycard :setup-step] :pair))
:dispatch [:bottom-sheet/hide]}
:dispatch [:bottom-sheet/hide-old]}
(common/listen-to-hardware-back-button)
(navigation/navigate-to-cofx :keycard-recovery-pair nil)))
(navigation/navigate-to :keycard-recovery-pair nil)))
(rf/defn keycard-storage-selected-for-recovery
{:events [:recovery.ui/keycard-storage-selected]}
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (assoc-in db [:keycard :flow] :recovery)}
(navigation/navigate-to-cofx :keycard-recovery-enter-mnemonic nil)))
(navigation/navigate-to :keycard-recovery-enter-mnemonic nil)))
(rf/defn start-import-flow
{:events [::recover-with-keycard-pressed]}
@@ -74,13 +74,13 @@
(assoc-in [:keycard :flow] :import)
(assoc :recovered-account? true))
:keycard/check-nfc-enabled nil}
(bottom-sheet/hide-bottom-sheet)
(navigation/navigate-to-cofx :keycard-recovery-intro nil)))
(bottom-sheet/hide-bottom-sheet-old)
(navigation/navigate-to :keycard-recovery-intro nil)))
(rf/defn access-key-pressed
{:events [:multiaccounts.recover.ui/recover-multiaccount-button-pressed]}
[_]
{:dispatch [:bottom-sheet/show-sheet :recover-sheet]})
{:dispatch [:bottom-sheet/show-sheet-old :recover-sheet]})
(rf/defn recovery-keycard-selected
{:events [:recovery.ui/keycard-option-pressed]}
@@ -89,7 +89,7 @@
{:db (assoc-in db [:keycard :flow] :recovery)
:keycard/check-nfc-enabled nil}
(common/listen-to-hardware-back-button)
(navigation/navigate-to-cofx :keycard-onboarding-intro nil)))
(navigation/navigate-to :keycard-onboarding-intro nil)))
(rf/defn cancel-pressed
{:events [::cancel-pressed]}
@@ -126,10 +126,10 @@
:keycard dissoc
:multiaccount-wallet-address
:multiaccount-whisper-public-key)}
(navigation/navigate-to-cofx (if platform/android?
:notifications-settings
:welcome)
nil)))
(navigation/navigate-to (if platform/android?
:notifications-settings
:welcome)
nil)))
(rf/defn intro-wizard
{:events [:multiaccounts.create.ui/intro-wizard]}
@@ -141,7 +141,7 @@
(dissoc :restored-account?))}
(multiaccounts.create/prepare-intro-wizard)
(if (pos? (count accs))
(navigation/navigate-to-cofx :get-your-keys nil)
(navigation/navigate-to :get-your-keys nil)
(navigation/set-stack-root :onboarding [:get-your-keys])))))
(rf/defn recovery-no-key
+2 -2
View File
@@ -87,7 +87,7 @@
:content (i18n/label :t/card-unpaired)}}
(common/clear-on-card-connected)
(remove-pairing-from-multiaccount nil)
(navigation/navigate-to-cofx :keycard-settings nil))))
(navigation/navigate-to :keycard-settings nil))))
(rf/defn on-unpair-error
{:events [:keycard.callback/on-unpair-error]}
@@ -103,7 +103,7 @@
:utils/show-popup {:title ""
:content (i18n/label :t/something-went-wrong)}}
(common/clear-on-card-connected)
(navigation/navigate-to-cofx :keycard-settings nil)))
(navigation/navigate-to :keycard-settings nil)))
(rf/defn remove-key-with-unpair
{:events [:keycard/remove-key-with-unpair]}
+3 -3
View File
@@ -1,5 +1,5 @@
(ns status-im.keycard.wallet
(:require [status-im2.common.bottom-sheet.events :as bottom-sheet]
(:require [status-im.bottom-sheet.events :as bottom-sheet]
[status-im2.constants :as constants]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip55 :as eip55]
@@ -17,7 +17,7 @@
(assoc-in [:keycard :pin :enter-step] :export-key)
(update-in [:keycard :pin] dissoc :export-key))
:dismiss-keyboard nil}
(bottom-sheet/show-bottom-sheet {:view {:content add-new.views/pin}})))
(bottom-sheet/show-bottom-sheet-old {:view {:content add-new.views/pin}})))
(rf/defn verify-pin-with-delay
[cofx]
@@ -29,7 +29,7 @@
(rf/defn hide-pin-sheet
{:events [:keycard/new-account-pin-sheet-hide]}
[cofx]
(bottom-sheet/hide-bottom-sheet cofx))
(bottom-sheet/hide-bottom-sheet-old cofx))
(rf/defn generate-new-keycard-account
{:events [:wallet.accounts/generate-new-keycard-account]}
+2 -2
View File
@@ -255,7 +255,7 @@
(set-input :id id)
(set-input :url (str url))
(set-input :name (str name))
(navigation/navigate-to-cofx :edit-mailserver nil))))
(navigation/navigate-to :edit-mailserver nil))))
(defn mailserver->rpc
[mailserver current-fleet]
@@ -411,4 +411,4 @@
[{:keys [db] :as cofx}]
(rf/merge cofx
{:db (dissoc db :mailserver.edit/mailserver)}
(navigation/navigate-to-cofx :edit-mailserver nil)))
(navigation/navigate-to :edit-mailserver nil)))
+10 -10
View File
@@ -1,5 +1,6 @@
(ns status-im.mobile-sync-settings.core
(:require [status-im2.common.bottom-sheet.events :as bottom-sheet]
(:require [status-im.bottom-sheet.events :as bottom-sheet]
[status-im2.contexts.add-new-contact.events :as add-new-contact]
[status-im.mailserver.core :as mailserver]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.multiaccounts.update.core :as multiaccounts.update]
@@ -32,7 +33,7 @@
(not remember-syncing-choice?)
(not= :create-multiaccount (:view-id db)))
[(bottom-sheet/show-bottom-sheet
[(bottom-sheet/show-bottom-sheet-old
{:view :mobile-network})
(sheet-defaults)]
@@ -41,12 +42,13 @@
;; no reason to restart wallet.
(and logged-in? initialized?)
[(mailserver/process-next-messages-request)
(bottom-sheet/hide-bottom-sheet)
(wallet/restart-wallet-service nil)]
(bottom-sheet/hide-bottom-sheet-old)
(wallet/restart-wallet-service nil)
(add-new-contact/set-new-identity-reconnected)]
logged-in?
[(mailserver/process-next-messages-request)
(bottom-sheet/hide-bottom-sheet)]))))
(bottom-sheet/hide-bottom-sheet-old)]))))
(defn apply-settings
([sync?] (apply-settings sync? :default))
@@ -113,12 +115,10 @@
[cofx]
(rf/merge
cofx
(bottom-sheet/hide-bottom-sheet)
(navigation/navigate-to-cofx :mobile-network-settings nil)))
(bottom-sheet/hide-bottom-sheet-old)
(navigation/navigate-to :mobile-network-settings nil)))
(rf/defn mobile-network-show-offline-sheet
{:events [:mobile-network/show-offline-sheet]}
[cofx]
(bottom-sheet/show-bottom-sheet
cofx
{:view :mobile-network-offline}))
(bottom-sheet/hide-bottom-sheet-old cofx))
@@ -125,6 +125,28 @@
(fn [[cb options]]
(authenticate-fx #(cb %) options)))
(re-frame/reg-fx
:biometric/enable-and-save-password
(fn [{:keys [key-uid
masked-password
on-success
on-error]}]
(-> (keychain/save-user-password!
key-uid
masked-password)
(.then
(fn [_]
(keychain/save-auth-method!
key-uid
keychain/auth-method-biometric)))
(.then
(fn [_]
(when on-success
(on-success))))
(.catch (fn [error]
(when on-error
(on-error error)))))))
(rf/defn update-biometric
[{db :db :as cofx} biometric-auth?]
(let [key-uid (or (get-in db [:multiaccount :key-uid])
+20 -12
View File
@@ -2,17 +2,16 @@
(:require [clojure.string :as string]
[quo.platform :as platform]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.native-module.core :as native-module]
[status-im.theme.core :as theme]
[utils.re-frame :as rf]
[quo2.foundations.colors :as colors]
[status-im2.constants :as constants]
[status-im.utils.gfycat.core :as gfycat]
[status-im.utils.identicon :as identicon]
[status-im2.setup.hot-reload :as hot-reload]
[status-im2.common.theme.core :as utils.theme]
[status-im2.common.theme.core :as theme]
[taoensso.timbre :as log]
[status-im2.contexts.shell.animation :as shell.animation]
[status-im.contact.db :as contact.db]))
@@ -45,6 +44,7 @@
(let [me? (= (:public-key current-multiaccount) identity)]
(if me?
[(or (:preferred-name current-multiaccount)
(:primary-name contact)
(gfycat/generate-gfy identity))]
[(:primary-name contact) (:secondary-name contact)])))
@@ -137,30 +137,38 @@
{::blank-preview-flag-changed private?}))
(re-frame/reg-fx
:multiaccounts.ui/switch-theme
:multiaccounts.ui/switch-theme-fx
(fn [[theme-type view-id reload-ui?]]
(let [[theme status-bar-theme nav-bar-color]
;; Status bar theme represents status bar icons colors, so opposite to app theme
(if (or (= theme-type constants/theme-type-dark)
(and (= theme-type constants/theme-type-system)
(utils.theme/dark-mode?)))
(theme/device-theme-dark?)))
[:dark :light colors/neutral-100]
[:light :dark colors/white])]
(theme/change-theme theme)
(re-frame/dispatch [:change-root-status-bar-style
(theme/set-theme theme)
(re-frame/dispatch [:change-shell-status-bar-style
(if (shell.animation/home-stack-open?) status-bar-theme :light)])
(when reload-ui?
(hot-reload/reload)
(when-not (= view-id :shell-stack)
(re-frame/dispatch [:change-root-nav-bar-color nav-bar-color]))))))
(re-frame/dispatch [:change-shell-nav-bar-color nav-bar-color]))))))
(rf/defn switch-appearance
{:events [:multiaccounts.ui/appearance-switched]}
[cofx theme]
(rf/merge cofx
{:multiaccounts.ui/switch-theme [theme :appearance true]}
{:multiaccounts.ui/switch-theme-fx [theme :appearance true]}
(multiaccounts.update/multiaccount-update :appearance theme {})))
(rf/defn switch-theme
{:events [:multiaccounts.ui/switch-theme]}
[cofx theme view-id]
(let [theme (or theme
(get-in cofx [:db :multiaccount :appearance])
constants/theme-type-dark)]
{:multiaccounts.ui/switch-theme-fx [theme view-id false]}))
(rf/defn switch-profile-picture-show-to
{:events [:multiaccounts.ui/profile-picture-show-to-switched]}
[cofx id]
@@ -190,7 +198,7 @@
:params [key-uid (clean-path path) ax ay bx by]
;; NOTE: In case of an error we can show a toast error
:on-success #(re-frame/dispatch [::update-local-picture %])}]}
(bottom-sheet/hide-bottom-sheet))))
(bottom-sheet/hide-bottom-sheet-old))))
(rf/defn save-profile-picture-from-url
{:events [::save-profile-picture-from-url]}
@@ -201,7 +209,7 @@
:params [key-uid url]
:on-error #(log/error "::save-profile-picture-from-url error" %)
:on-success #(re-frame/dispatch [::update-local-picture %])}]}
(bottom-sheet/hide-bottom-sheet))))
(bottom-sheet/hide-bottom-sheet-old))))
(comment
(re-frame/dispatch
@@ -219,7 +227,7 @@
;; with a toast error
:on-success #(log/info "[multiaccount] Delete profile image" %)}]}
(multiaccounts.update/optimistic :images nil)
(bottom-sheet/hide-bottom-sheet))))
(bottom-sheet/hide-bottom-sheet-old))))
(rf/defn get-profile-picture
[cofx]
+10 -10
View File
@@ -94,16 +94,16 @@
(rf/defn multiaccount-generate-and-derive-addresses-success
{:events [:multiaccount-generate-and-derive-addresses-success]}
[{:keys [db]} result]
{:db (update db
:intro-wizard
(fn [data]
(-> data
(dissoc :processing?)
(assoc :multiaccounts result
:selected-storage-type :default
:selected-id (-> result first :id)
:step :choose-key))))
:navigate-to-fx :choose-name})
{:db (update db
:intro-wizard
(fn [data]
(-> data
(dissoc :processing?)
(assoc :multiaccounts result
:selected-storage-type :default
:selected-id (-> result first :id)
:step :choose-key))))
:navigate-to :choose-name})
(rf/defn generate-and-derive-addresses
{:events [:generate-and-derive-addresses]}
@@ -1,7 +1,7 @@
(ns status-im.multiaccounts.key-storage.core
(:require [clojure.string :as string]
[re-frame.core :as re-frame]
[status-im2.common.bottom-sheet.events :as bottom-sheet]
[status-im.bottom-sheet.events :as bottom-sheet]
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.mnemonic :as mnemonic]
[utils.i18n :as i18n]
@@ -22,7 +22,7 @@
"This event can be dispatched before login and from profile and needs to redirect accordingly"
{:events [::key-and-storage-management-pressed]}
[cofx]
(navigation/navigate-to-cofx
(navigation/navigate-to
cofx
(if (multiaccounts.model/logged-in? cofx)
:actions-logged-in
@@ -60,7 +60,7 @@
(rf/merge
cofx
{:db (assoc db :recovered-account? true)}
(navigation/navigate-to-cofx :seed-phrase nil)))
(navigation/navigate-to :seed-phrase nil)))
(rf/defn seed-phrase-input-changed
{:events [::seed-phrase-input-changed]}
@@ -85,7 +85,7 @@
(let [backup? (get-in db [:keycard :creating-backup?])]
(if backup?
(keycard.backup/start-keycard-backup cofx)
(navigation/navigate-to-cofx cofx :storage nil))))
(navigation/navigate-to cofx :storage nil))))
(defn validate-seed-against-key-uid
"Check if the key-uid was generated with the given seed-phrase"
@@ -173,7 +173,7 @@ We don't need to take the exact steps, just set the required state and redirect
"
(rf/defn import-multiaccount
[{:keys [db] :as cofx}]
{:dispatch [:bottom-sheet/hide]
{:dispatch [:bottom-sheet/hide-old]
::multiaccounts.recover/import-multiaccount
{:passphrase (get-in db [:multiaccounts/key-storage :seed-phrase])
:password nil
@@ -183,7 +183,7 @@ We don't need to take the exact steps, just set the required state and redirect
{:events [::delete-multiaccount-and-init-keycard-onboarding]}
[{:keys [db] :as cofx}]
(rf/merge
{:dispatch [:bottom-sheet/hide]
{:dispatch [:bottom-sheet/hide-old]
:db (assoc-in db [:multiaccounts/key-storage :reset-db-checked?] true)}
(import-multiaccount)))
@@ -192,7 +192,7 @@ We don't need to take the exact steps, just set the required state and redirect
[{:keys [db] :as cofx}]
(if (get-in db [:multiaccounts/key-storage :reset-db-checked?])
(popover/show-popover cofx {:view :transfer-multiaccount-to-keycard-warning})
(bottom-sheet/show-bottom-sheet cofx {:view :migrate-account-password})))
(bottom-sheet/hide-bottom-sheet-old cofx)))
(rf/defn skip-password-pressed
{:events [::skip-password-pressed]}
@@ -248,14 +248,14 @@ We don't need to take the exact steps, just set the required state and redirect
(dissoc :multiaccounts/key-storage))}
(popover/hide-popover)
(common/listen-to-hardware-back-button)
(navigation/navigate-to-cofx :keycard-onboarding-intro nil)))
(navigation/navigate-to :keycard-onboarding-intro nil)))
(rf/defn goto-multiaccounts-screen
{:events [::hide-popover-and-goto-multiaccounts-screen]}
[cofx _]
(rf/merge cofx
(popover/hide-popover)
(navigation/navigate-to-cofx :multiaccounts nil)))
(navigation/navigate-to :multiaccounts nil)))
(rf/defn confirm-logout-and-goto-key-storage
{:events [::confirm-logout-and-goto-key-storage]}
+27 -20
View File
@@ -44,6 +44,7 @@
[status-im2.navigation.events :as navigation]
[status-im2.common.log :as logging]
[taoensso.timbre :as log]
[status-im2.contexts.shell.animation :as shell.animation]
[utils.security.core :as security]))
(re-frame/reg-fx
@@ -338,10 +339,6 @@
{:method "permissions_getDappPermissions"
:on-success #(re-frame/dispatch [::initialize-dapp-permissions %])}]})
(rf/defn initialize-appearance
[cofx]
{:multiaccounts.ui/switch-theme [(get-in cofx [:db :multiaccount :appearance]) nil false]})
(rf/defn get-group-chat-invitations
[_]
{:json-rpc/call
@@ -393,7 +390,6 @@
#(do (re-frame/dispatch [:chats-list/load-success %])
(rf/dispatch [:communities/get-user-requests-to-join])
(re-frame/dispatch [::get-chats-callback]))})
(initialize-appearance)
(initialize-wallet-connect)
(get-node-config)
(communities/fetch)
@@ -479,8 +475,17 @@
(defn redirect-to-root
"Decides which root should be initialised depending on user and app state"
[db]
(if (get db :tos/accepted?)
(cond
(get db :local-pairing/completed-pairing?)
(re-frame/dispatch [:syncing/pairing-completed])
(get db :onboarding-2/new-account?)
(re-frame/dispatch [:onboarding-2/finalize-setup])
(get db :tos/accepted?)
(re-frame/dispatch [:init-root :shell-stack])
:else
(re-frame/dispatch [:init-root :tos])))
(rf/defn login-only-events
@@ -514,10 +519,11 @@
tos-accepted? (get db :tos/accepted?)
{:networks/keys [current-network networks]} db
network-id (str (get-in networks [current-network :config :NetworkId]))]
(shell.animation/change-selected-stack-id :communities-stack true)
(rf/merge cofx
{:db (-> db
(dissoc :multiaccounts/login)
(assoc :tos/next-root :onboarding-notification :chats/loading? false)
(assoc :tos/next-root :enable-notifications :chats/loading? false)
(assoc-in [:multiaccount :multiaccounts/first-account] first-account?))
::get-tokens [network-id accounts recovered-account?]}
(finish-keycard-setup)
@@ -528,7 +534,7 @@
(multiaccounts/switch-preview-privacy-mode-flag)
(link-preview/request-link-preview-whitelist)
(logging/set-log-level (:log-level multiaccount))
(navigation/init-root :shell-stack))))
(navigation/init-root :enable-notifications))))
(defn- keycard-setup?
[cofx]
@@ -615,12 +621,12 @@
(if password
(rf/merge
cofx
{:db (update-in db
[:multiaccounts/login]
assoc
:password password
:save-password? true)
:init-root-fx :progress}
{:db (update-in db
[:multiaccounts/login]
assoc
:password password
:save-password? true)
:set-root :progress}
login)
(rf/merge
cofx
@@ -630,10 +636,10 @@
(assoc-in [:keycard :pin :status] nil)
(assoc-in [:keycard :pin :login] []))})
#(if keycard-account?
{:init-root-fx :multiaccounts-keycard}
{:init-root-fx :multiaccounts})
{:set-root :multiaccounts-keycard}
{:set-root :profiles})
#(when goto-key-storage?
(navigation/navigate-to-cofx % :actions-not-logged-in nil))))))
(navigation/navigate-to % :actions-not-logged-in nil))))))
(rf/defn get-credentials
[{:keys [db] :as cofx} key-uid]
@@ -719,7 +725,7 @@
(rf/defn welcome-lets-go
{:events [:welcome-lets-go]}
[_]
{:init-root-fx :shell-stack})
{:set-root :shell-stack})
(rf/defn multiaccount-selected
{:events [:multiaccounts.login.ui/multiaccount-selected]}
@@ -730,8 +736,9 @@
keycard-multiaccount? (boolean (:keycard-pairing multiaccount))]
(rf/merge
cofx
{:db (update db :keycard dissoc :application-info)
:navigate-to-fx (if keycard-multiaccount? :keycard-login-pin :login)}
(merge
{:db (update db :keycard dissoc :application-info)}
(when keycard-multiaccount? {:navigate-to :keycard-login-pin}))
(open-login (select-keys multiaccount [:key-uid :name :public-key :identicon :images])))))
(rf/defn hide-keycard-banner
+1 -1
View File
@@ -14,7 +14,7 @@
[{:keys [db] :as cofx} {:keys [auth-method logout?]}]
(let [key-uid (get-in db [:multiaccount :key-uid])]
(rf/merge cofx
{:init-root-fx :progress
{:set-root :progress
:chat.ui/clear-inputs nil
:chat.ui/clear-inputs-old nil
:shell/reset-bottom-tabs nil

Some files were not shown because too many files have changed in this diff Show More