Commit Graph

2007 Commits

Author SHA1 Message Date
Pascal Precht c28d4054ef fix(Chat): ensure chat reply separator doesn't leak into message
Fixes #1988
2021-03-24 14:17:43 -04:00
Jonathan Rainville 7188579e46 fix: fix mention showing as pubkey and show styling 2021-03-24 14:16:55 -04:00
Jonathan Rainville 5d67a3f5f9 fix: fix sending three word names mentions not working 2021-03-24 14:16:55 -04:00
rinzlxr 47ae3a4c16 ens section fixes
use the available dark image for ens section

add the image, ensure 624 widths and fix button

move common strings to constants and use number consts
2021-03-24 14:09:59 -04:00
Pascal Precht 5091e258d3 fix(Chat): align emojis within chat inputs properly
Fixes #1944
2021-03-24 14:05:25 -04:00
Jonathan Rainville 2a9f9118a1 fix: fix settings not being refetched when they had been edited before 2021-03-24 12:06:24 -05:00
Pascal Precht e1a4a47636 fix(Chat): disable HoverHandler when profile popup or context menu are open
Alright, this is an interesting one:

As described in #1829, when the profile popup is opened within the chat view,
users are still able to click *through* the popup on message, which then puts them in
an active state.

I've done a bunch of debugging as described [here](https://github.com/status-im/status-desktop/issues/1829#issuecomment-804748148) and after doing some
further debugging, I found out that `isMessageActive` isn't really the culprit here.

What causes this effect is the `HoverHandler` that's attached to the `CompactMessage` item.
`HoverHandler` is a standard QML type that emits `hoverChanged` signals so one can do things like
applying hover effects on elements, which is exactly what we do:

```
HoverHandler {
  onHoverChanged: {
    root.isHovered = hovered  // `root` being the message item
  }
}
```

I assume we went with this handler because putting a `MouseArea` in there instead, which fills
the entire message component pretty much eliminates all existing mouse handlers attached to
other child components, such as the profile image or the username of the message, which also
open a message context menu.

It turns out that, having a `HoverHandler` as described above, actually activates it when the
user clicks with the left mouse button as well (not just on hover). That's what causes the "click-through"
effect. This can be verified by setting `acceptedButtons` to `Qt.RightButton`, basically telling
the handler that only right clicks will activate it.

I then tried using `Qt.NoButtons` instead so that no button clicks and only hovers will activate
the handler, but that didn't seem to have any effect at all. It still defaults to `Qt.LeftButton`.

So the last resort was to disable the `HoverHandler` altogether, whenever either the profile popup,
or the message context menu (for emojis etc) is open.

Unfortunately, we don't have access to the profile popup in the compact message component, because it's
detached from the component tree. Therefore, I've introduced a new property `profilePopupOpened` on
the chat layout, which we can read from instead.

Fixes #1829
2021-03-23 10:32:31 -04:00
Pascal Precht a030a4fadc refactor: make add new contact modal looks the same as new chat modal
Closes #1660 #2086
2021-03-22 15:55:13 -04:00
Pascal Precht e2113553b9 feat(PrivateChatPopupSearchResults): introduce reset() and config API
This commit introduces a `reset()` function so that search results inside
the application can be easily reset. It also introduces a `resultClickable`
flag which allows consumers of this component to decide whether a search result
is clickable and emits a dedicated event.

This is useful when UIs should only allow actions via the result icon button
(as it's the case with the new add-to-contact modal).
2021-03-22 15:49:47 -04:00
Pascal Precht 20d0d162b5 fix(Contacts): ensure app doesn't crash when contact can't be resolved
There was a bug introduced https://github.com/status-im/status-desktop/commit/2ac67f95a where we'd rely on the
possibly resolved public key, which is passed to `generateAlias()`.

The public key is never guaranteed to be an actual key (if resolution fails,
it's a an empty string). Passing an empty string to `generateAlias()` causes
`status-go` to crash and we don't handle that error.

This commit ensures that we only attempt to generate an alias when we
indeed have a successfully resolved public key.
2021-03-22 15:49:38 -04:00
Jonathan Rainville 7fb9578285 feat: highlite mentions in the chat input as well 2021-03-22 15:49:21 -04:00
Pascal Precht d2b9d54c4b fix: ensure lists and radio button groups look concise throughout app
Fixes #1992
2021-03-19 16:17:14 -04:00
Pascal Precht a27f9cf25d fix(StatusRadioButtonRow): ensure checked state is propagated properly
There were cases in which this component was used and its `checked` state wasn't
properly emitted to the underlying component.

This commit fixes that by ensuring the `MouseArea` only alters the radio button's
`checked` state and let the radio button handle the event propagation.
2021-03-19 16:17:14 -04:00
Pascal Precht accf92be2f fix(Separator): ensure custom color works as expected
This was a regression introduced in https://github.com/status-im/status-desktop/pull/2065.
The new wrapping Rectangle would get the color that is possibily passed down
to Separator. Instead it should get properly bound to the actual separator.
2021-03-19 15:54:27 -04:00
Eric Mastro b7124372e9 feat: stickers spawnAndSend to threadpool task
Move the remaining stickers spawnAndSend (obtainAvailableStickerPacks) into a threadpool task.

refactor: create a base class for tasks models to inherit from

NOTE: this branch is based off of `experiment/tasks-3` and should be rebased on master once that branch is merged.
2021-03-19 15:38:50 -04:00
Jonathan Rainville 98ef76d3c8 chore: hide edit community button until the feature is implemented 2021-03-18 14:52:28 -04:00
Pascal Precht 29c7f7b91d uiux(Profile): adjust layout max width of profile sections
Closes #1994
2021-03-18 14:50:58 -04:00
Pascal Precht 010a7e0d8e feat(Communities): open member profile on memberlist click 2021-03-18 14:47:36 -04:00
Eric Mastro 66912fd811 feat: introduce Task Manager threadpool
The `TaskManager` threadpool is a memory-safe replacement for the `spawnAndSend` operations that are currently causing memory issues in status-desktop.

From a fundamental memory management point of view, `libstatus/settings`, `libstatus/contracts`, and `libstatus/tokens` (custom tokens) have all been converted to `{.threadvar.}`s and `Atomic[bool]`s to maintain the cache and `dirty` flag across threads, respectively, eliminating the need for thread locks and incorrect `{.gcsafe.}` compiler overrides.

The successful [recyclable threadpool experiment from `nim-task-runner`](https://github.com/status-im/nim-task-runner/blob/test/use-cases/test/use_cases/test_sync.nim) using `AsyncChannel[ThreadSafeString]`s was brought over to `status-desktop` and implemented in somewhat of a hardcoded manner, as we knew this would save some time instead of trying to create a fully fleshed out `nim-task-runner` API and build a miraculous macro that may or may not be able to generate the needed API.

The threadpool is started by the `TaskManager` and both the `TaskManager` and the `TaskManager`'s threadpool are started as early as possible in the application lifecycle (in `nim_status_client.nim`). The `TaskManager` creates a thread to run the threadpool. During its initialization, the threadpool then spools up all the threads it will manage and puts them in an idle thread sequence. This is to prevent expensive thread creation and teardown happening during the app's lifetime as it is quite expensive and blocks the main thread. When tasks comes in to the pool, the task is sent to an idle thread, or put in a queue if all threads are busy. The idle thread is moved to the busy thread sequence. When a task is completed, the thread is taken out of the busy threads sequence and moved back in to the sequence of idle threads, effectively recycling it.

The first `spawnAndSend` we were able to change over to the new threadpool was `estimate`, which estimates the gas of a sticker purchase transaction.

From the consumer point of view, the existing `spawnAndSend` to achieve this looks like:
```nim
  proc estimate*(self: StickersView, packId: int, address: string, price: string, uuid: string) {.slot.} =
    let status_stickers = self.status.stickers
    spawnAndSend(self, "setGasEstimate") do:
      var success: bool
      var estimate = status_stickers.estimateGas(packId, address, price, success)
      if not success:
        estimate = 325000
      let result: tuple[estimate: int, uuid: string] = (estimate, uuid)
      Json.encode(result)
```
And the new syntax looks like this:
```nim
  proc estimate*(self: StickersView, packId: int, address: string, price: string, uuid: string) {.slot.} =
    self.status.taskManager.threadPool.stickers.stickerPackPurchaseGasEstimate(cast[pointer](self.vptr), "setGasEstimate", packId, address, price, uuid)
```
The logic inside the `spawnAndSend` body was moved to [src/status/tasks/stickers.nim](https://github.com/status-im/status-desktop/compare/experiment/tasks-3?expand=1#diff-09e57eef00b0cee5c4abdb9039f948d8372e7003e09e934a9b4c7e9167d47658).

This is just the first migration of `spawnAndSend`, however moving the majority of the remaining `spawnAndSend`s will likely just be an exercise in copy/pasta. There will be one or two that may require a bit more thinking, depending how they rely on data from the model.

Once the `spawnAndSend`s have been converted to the threadpool, we can start implementing the [long-running process from the task runner use case experiments](https://github.com/status-im/nim-task-runner/blob/test/use-cases/test/use_cases/test_long_running.nim).

And finally, we can then implement the [async tasks](https://github.com/status-im/nim-task-runner/blob/test/use-cases/test/use_cases/test_async.nim) if needed.

@michaelsbradleyjr and I spent many hours digging in to the depths of nim's memory management in an attempt to understand it. We have created [a presentation with our task runner experiment findings](https://docs.google.com/presentation/d/1ItCxAfsVTcIoH_E4bgvmHljhbU-tC3T6K2A6ahwAedk/edit?usp=sharing), and @michaelsbradleyjr has spent time [answering questions off the back of that presentation.](https://gist.github.com/michaelsbradleyjr/1eaa9937b3fbb4ffff3fb814f0dd82a9).

We have created a fork of `edn.nim` at `status-im/edn.nim` and we need the PR to be merged and the commit hash updated before we can merge this PR in to `status-desktop`.
2021-03-18 13:15:05 -04:00
Pascal Precht 6b6a318a8c
refactor(Communities): make member list look as intended
This change aligns the member list's look & feel of the community profile popup
with the designs by implementing the proper member list items styles, hover effects
and fine-tuning the context menu.

This commit also comments some of the actions provided by the context menu,
which aren't implemented yet. There's no point in having UI components that don't or
can't function.

Those will be re-introduced once they are actually implemented.

Closes #1959
2021-03-18 10:03:24 +01:00
Pascal Precht 05a8303d5b
feat(PopupMenu): introduce `danger` type for actions
This is needed so that "dangerous" actions, such as deleting data
or removing users from groups etc, can get a dedicated hover color as well.
2021-03-18 10:03:19 +01:00
Pascal Precht b4389402e9
refactor: make use of StatusContextMenuButton 2021-03-18 10:03:08 +01:00
Pascal Precht f497091c3e
feat: introduce new StatusContextMenuButton component
We've been implementing such a button in various ways throughout the
application. Sometimes using SVG icons and rectangles, sometimes highjacking
`StyledText` components (which was clever though).

Obviously this resulted in inconsistencies, so this commit introduces
a new dedicated component to render the three-dots button for context menus.
2021-03-18 10:03:04 +01:00
Pascal Precht d46be4f740 feat(Separator): enabled custom separator height
Sometimes, `Separator` is used inside context menus to separate groups
of actions that belong together. The separator in itself doesn't have any
padding or margins in this case because the just gets transcluded as is
in the context menu, between menu items.
There are cases in the design where a padding/margin is desired though.

This change makes that possible by wrapping the separator `Rectangle` with
another `Rectangle` which controls a custom height (if desired). The inner
rectangle is then just always vertically center.

In practice this means, existing usages of `Separator` behave exactly the same,
they don't break. In addtion one can set `Separator { height: x }` while maintaining
a 1px separator line.
2021-03-18 09:37:13 +01:00
Jonathan Rainville 23a8de0449 fix: fix community not being passed correctly to the invite bubble 2021-03-17 16:09:23 -04:00
Jonathan Rainville f3b452188a chore: extract join.status link prefixes to Constants 2021-03-17 16:09:23 -04:00
Jonathan Rainville 62d10eba49 feat: show community invite component on community link 2021-03-17 16:09:23 -04:00
Jonathan Rainville 5581fca41d feat: show default unfurling for community links 2021-03-17 16:09:23 -04:00
Jonathan Rainville c5c348b0b1 feat: add back status link whitelisting and public chat links 2021-03-17 16:09:23 -04:00
Pascal Precht 907fbc21b8 fix(Chat): don't render "Copy Link" menu item if not desired
This adjust the rules to render the copy link menu item so that it aligns
with what has been mentioned in #1943.

Fixes #1943
2021-03-17 15:28:12 -04:00
Iuri Matias 98eea14da8 fix default mode 2021-03-17 15:25:15 -04:00
Jonathan Rainville d0f141c1b8 fix: fix appSetting not defined by removing sounds from login 2021-03-17 13:35:15 -04:00
Pascal Precht 053c7fdcf3 fix: enforce compact mode
Since https://github.com/status-im/status-desktop/commit/93668ff75
we're hiding the setting to change appearance for compact normal mode
of the UI. For now, compact mode is the new default (reasoning is unclear
at this point).

Prior to this change, most likely many users are still using the
normal mode configuration, so we have to enforce compact mode for
those.
2021-03-17 13:34:42 -04:00
Pascal Precht 9faf349b83 fix(libstatus): add safety check before accessing API response
We've introduced a regression in https://github.com/status-im/status-desktop/commit/f1e83f74b#diff-f35edd413addd14c1f81816d6b5ee2bcbdf85fa0e3295d324cb78c98e26d4327L364 where we check whether an RPC's `error` is `null`
and its `result` is not `null`.

This breaks the application with an illegal storage access,
 as in case of a successful API call, the response will have only a `result` key
 (even when it's `null`).

Since we haven't done anything with a possible `error` in the reponse even before
that change was made, this commit removes the `error` check and safe guards around
whether `result` exists.

Fixes #2062
2021-03-17 12:13:59 +01:00
Pascal Precht 362ad02ffc
refactor(Communities): make membershipt request button looks as designed
The designs for the membership request button look different now, so this
commit makes use of the `StatusSettingsLineButton` to implement that new
look & feel.
2021-03-17 10:30:19 +01:00
Pascal Precht ea39ead64b
feat(StatusSettingsLineButton): make some of the component's props configurable
This helps with using this component in other places where the default
settings for some UI related properties don't match otherwise.
2021-03-17 10:30:19 +01:00
Pascal Precht 38bd5f1422
fix(Communities): remove type error in item width
There's no `parent` in that componen, which results in a QML type error
at runtime.
2021-03-17 10:30:18 +01:00
Pascal Precht 638892f21d
refactor(Communities): use StackView inside profile popup for memberlist
Prior to this commit, the community memberlist was represented in a nested modal
which doesn't adhere to the designs. Rather, the section should render inside the
existing modal, requiring it to be refactored using a `StackView`.

This commit refactors the community profile popup so that the different content
sections ("Overview" and "MemberList") are rendered inside of the popup and can
be pushed onto and popped off a stack view.

The content components (newly introduced in this commit) `CommunityProfilePopupMembersList`
and `CommunityProfilePopupOverview` need to define a `headerTitle`, `headerDescription` and
if needed `imageSource` so they can alter the modal's header.

The same pattern might be used in other places of the modal if required.

Partially fixes #1959
2021-03-17 10:29:31 +01:00
Jonathan Rainville b9594591b0 fix: fix a lot of issues relative to dark theme
Fixes #1997
2021-03-16 17:22:58 -04:00
Jonathan Rainville 9d9b0ab5e6 fix: fix chat link preview modal
Fixes #2001
Fixes icons
Fixes Icon border
Fixes button hover
Fixes list scrolling and overflow
2021-03-16 17:20:12 -04:00
Iuri Matias 9621230e6d update default settings 2021-03-16 16:51:14 -04:00
Iuri Matias 9c404a1047 show browser favourites bar by default 2021-03-16 16:51:14 -04:00
Michael Bradley, Jr 016dd3081b refactor: nim_status -> status_go
Also, `status_go.startWallet` proc should be called with a boolean argument.
2021-03-16 16:37:27 -04:00
Michael Bradley, Jr c4e786bae3 build: add vendor/nim-status-go submodule 2021-03-16 16:37:27 -04:00
Michael Bradley, Jr 470d2e5a17 build: remove vendor/nim-status submodule 2021-03-16 16:37:27 -04:00
Michael Bradley, Jr 1474e7b7af build: ignore nimbus-build-system's .update.timestamp file in root of repo 2021-03-16 16:37:27 -04:00
Iuri Matias 5cef8e3e60 adjust content height of sticker popup 2021-03-16 15:39:52 -04:00
Richard Ramos 4f4a3f1c30 feat: see stickers details when clicking on a sticker 2021-03-16 15:39:52 -04:00
Pascal Precht 8ad9e52abf fix(Communities): render community image in profile popup 2021-03-16 14:57:45 -04:00
Pascal Precht 79338f76be feat(ModalPopup): hide footer section if footerContent height is 0
In the recent past we've improved our `ModalPopup` to allow for a bit more control
when it comes to rendering a modal footer section with call-to-action items.

The footer section is rendered when there's `footerContent` and when the height
of the footer content is > 0. This means it's possible to also hide the footer content
section from the modal, even when there's footer content children.

However, there's a separator rendered whenver the footer is visible, regardless of its
height. This results in undesired behaviour when rendering footer children of height 0.

To avoid this, this commit adjust the condition so that the separator is only rendered
when the footer visible AND the height of it is > 0.
2021-03-16 14:29:36 -04:00