Commit Graph

1056 Commits

Author SHA1 Message Date
Anthony Laibe 58506fbd97 feat(@desktop/chat): Display gif popup next to emoji 2021-07-23 15:27:56 -04:00
Andrei Smirnov 2df8e938ae fix(@desktop/login): crash on login and login ux improvements 2021-07-23 15:13:45 -04:00
Andrei Smirnov b1be4d643b fix(@desktop/communities): pending membership counter 2021-07-23 14:45:07 -04:00
Anthony Laibe 076a5bc5b7 fix(@desktop/communities): mute/unmute communities
fixes #2880
2021-07-23 13:40:40 -04:00
Andrei Smirnov b3528bd717 fix(@desktop): missing context menu on SystemTrayIcon 2021-07-23 13:22:04 -04:00
Andrei Smirnov f73fbe3204 chore(@desktop): nim compilation warnings - unused imports 2021-07-23 13:19:37 -04:00
Richard Ramos b7747104ec fix: code review 2021-07-22 13:48:53 -04:00
Richard Ramos 07c399530b fix: load old user status, and fix code review obs. 2021-07-22 13:48:53 -04:00
Richard Ramos 7aaca9ec4d toggle switch to control if status should be broadcasted or not 2021-07-22 13:48:53 -04:00
Richard Ramos 6849091460 feat: community user status pt 2 2021-07-22 13:48:53 -04:00
Richard Ramos c21f80e7da feat: select bloom filter level 2021-07-21 15:09:23 -04:00
Richard Ramos f4da94af6a refactor: node config 2021-07-21 15:09:23 -04:00
Richard Ramos d8053f5291 fix: getNodeConfig 2021-07-21 15:09:23 -04:00
Richard Ramos 42a31f66b3 update statusgo 2021-07-21 15:09:23 -04:00
Richard Ramos 2205d57636 fix: paths 2021-07-21 15:09:23 -04:00
Richard Ramos 5daf7894f5 go-waku store protocol 2021-07-21 15:09:23 -04:00
Richard Ramos 561991da67 Add wakuv2 fleets 2021-07-21 15:09:23 -04:00
Richard Ramos 26c17afb5d Using go-waku 2021-07-21 15:09:23 -04:00
Pascal Precht 5bf5095c3c refactor(communities): remove typo in `exportCommunity()` API 2021-07-21 12:18:02 -04:00
Jonathan Rainville aa87a3f7fe feat(activity): add 1-1 messages to activity center
Fixes #2830
2021-07-20 10:55:42 -04:00
Anthony Laibe 5f8a6f33fa fix(@desktop/chat): start chat after contact request accepted
fixes #2902
2021-07-20 10:30:18 -04:00
Jonathan Rainville 1621818ecf feat(link): handle group chat invite links
Fixes #2676
The group chat is still not usable. It is missing the feature to request access to the group chat.
2021-07-20 10:00:54 -04:00
Anthony Laibe a811ee215c fix(@desktop/chat): cannot unpin last message in modal
fixes #2659

1 - Change call from remove to deleteMessage
Remove were not updating the index and was causing the issue

2 - Erase the remove proc as the deleteMessage should always be used
2021-07-20 10:00:26 -04:00
Sale Djenic abf89fa399 chore(@desktop/general): use different icons for Windows/Linux and MacOS
Icons are updated, mac uses rounded rect log, win and linux circle logo.

Fixes: #2833
2021-07-19 13:37:56 -04:00
Anthony Laibe 4269b51ea6 feat(@desktop/wallet): display confirmation block count
fixes #2715
2021-07-19 13:33:32 -04:00
Anthony Laibe 8a4eeb14c0 fix(@desktop/communities): reaction are being displayed on pinned message
fixes #2838

This also fix the ability to add/remove a reaction to a pinned message
2021-07-19 13:18:59 -04:00
Andrei Smirnov 011b7804ef fix(@desktop/chat): mentions badge cleanup 2021-07-19 12:53:01 -04:00
Sale Djenic e9585e6209 feature(@desktop/communities): add loading state when import community
Toast message is added when user access an existing community using community's private key. Toast
message with message that importing community is in progress is displayed while community is being
imported and once it is imported toast is closed and new one, which will be closed in 4 seconds,
with message that community is imported is displayed.

Fixes: #2467
2021-07-19 12:27:45 -04:00
Anthony Laibe 9d4fa890b4 fix(@desktop/communities): update communities chat
fixes #2826
2021-07-16 17:59:10 -04:00
Sale Djenic ecb2bac6e5 fix(@desktop/chat): sign and send appears for both recipient and sender when sharing the address
The reason for this issue is a message where recipient accepted to share his address with sender.
In that message recipient's public key is set as a "from" property of a "Message" object and we
cannot determine which of two users has initiated transaction actually.

This is fixed checking if the "from" address from the "commandParameters" object of the "Message"
is contained as an address in the wallet of logged in user. If yes, means that currently logged in
user has initiated a transaction (he is a sender), otherwise currently logged in user is a
recipient.

We were just sending a transaction, without notifying message about that. Now we call
callPrivateRPC("acceptRequestTransaction".prefix, %* [transactionHash, messageId, signature])
and that notifies message about the change, but only on the sender side. Appropriate message
on the recipient side was not notified about the change. That need to be checked.
2021-07-16 17:41:22 -04:00
Richard Ramos 2f2b3726df feat: waku bloom filter mode switch 2021-07-15 09:41:39 -04:00
Andrei Smirnov cd423336e1 fix(@desktop): windows application unresponsive when fetching Status updates 2021-07-14 18:28:41 -04:00
Anthony Laibe 511c959121 fix(@desktop/chat): fix sticker/image notification with placeholder
fixes #2450
2021-07-14 18:27:38 -04:00
Anthony Laibe b31bd265c5 fix(@desktop/profile): chat confirmation notification
fixes #2637

When changing a contact, the notification about being able to chat was sent again.
Prevent this behaviour by ensuring the contact hasn't already been added
2021-07-14 18:17:55 -04:00
Pascal Precht d10ffd56ce fix: ensure Chat navbar tab button shows correct message count
The chat navbar tab button renders an indicator when there's unread messages
in any of the chats. It also renders a message count, which prior to this commit
equals to the number of total unread messages.

This however is not the desired behaviour. Instead, the count should be the total
number of unread one on one messages (DMs), plus the total number of mentions in any
chats the user is participating in.

This commiit ensures the correct message count is rendered. It also adds an "unread messages"
indicator to community buttons.

Closes #2869
2021-07-14 18:17:21 -04:00
Jonathan Rainville 3e33db039f fix(search): fix 1-1 name, pic, icon and symbol 2021-07-14 17:42:55 -04:00
Jonathan Rainville 6e218ad924 feat: add basic local chat search
Fixes #2771
2021-07-14 17:42:55 -04:00
Sale Djenic 47d1546893 fix(@desktop/chat): app crash when you leave a chat
The issue is happening randomly. I managed to catch it few times and hopefully fix it. Problem was
in leave proc in src/status/chat.nim cause we were sending activeChannelChanged signal from it what
started setting activeChannel to the value of the backToFirstChat variable, and while that process
was in progress setActiveChannelByIndex was called from activeChannel what caused another emit of
activeChannelChanged signal while the previous one was not completed. That caused new setting of
activeChannel with active channel index 0, what caused an app crash.

This is fixed by setting active channel to the first one from the list when we get a signal that
any channel from the list is removed. This way activeChannelChanged is broadcasted to the other
parts correctly.

Fixes: #2825
2021-07-14 16:15:40 -04:00
Anthony Laibe 869ae63518 fix(@desktop/profile): Unmuted chat from profile -> notification
fixes #2557
2021-07-13 17:20:13 -04:00
Sale Djenic 102a385943 fix(@desktop/chat): app crash when you accept contact request
This issue is being happened randomly, no general rule, in my case it happens often when you accept
first contact from the list immediately after the app start, but the ticket says that it happens
when you click accept while context menu is opened.

Two places were threat for this crash and both are fixed here:
- getChannel proc, direct access by index to Chat element of the chats sequence,
- setChatItem proc, where we actually were setting chatItem and accessing its property without
  checking if it is an empty object.

Fixes: #2837
2021-07-13 16:33:08 -04:00
Anthony Laibe 314d1833a2 fix(@desktop/wallet): Iterate over collectible with balance 2021-07-13 11:39:38 -04:00
Sale Djenic 4d148b5c78 fix(@desktop/wallet): app crash when signing token transaction with invalid password
The issue was accessing non existent property after parsing received response. That caused
app crash, fixed now.

Fixes: #2623
2021-07-12 17:01:11 -04:00
Andrei Smirnov 3bb5be8685 fix(@desktop/chat): navigating from Chats to Timeline shows wrong messages 2021-07-12 16:51:20 -04:00
Andrei Smirnov 0eab4009ba fix(@desktop/chat): crash when pinning a message for a chat with cleared history 2021-07-09 12:20:45 -04:00
Pascal Precht c675aff0f8 refactor(Communities): replace `CategoryList and `ChannelList` with StatusQ components
This commit replaces `CategoryList` and `ChannelList` with `StatusChatListAndCategories`,
`StatusPopupMenu` etc. provided by StatusQ.

It also removes components that lived inside Status Desktop but are no longer used
anywhere after the refactor.

Since StatusQ components are decoupled from UI model logic, we also needed to introduce
a new API retrieve a community category from within QML.

Closes #2805
2021-07-09 10:39:58 -04:00
Pascal Precht 23b103795a refactor(ContactsColumn): replace `ChannelList` with `StatusChatList`
Closes #2745
2021-07-09 10:39:58 -04:00
Richard Ramos 9e58563fcf feat: community userlist
Fixes #2810
Probably a big chunk of the code from this PR is going to be replaced by #2811
2021-07-08 14:14:27 -04:00
Sale Djenic 7fbccec227 fix(activity_center): Mark as read does not clear @ symbol in chat
Mark all mention notifications as read is fixed. Also mark as read one by one notification removes "@" from the appropriate channel along with the marking as read last mention notification for that channel. hasMention field which was bool is switched with mentionsCount field which is int, so we have evidention how many mentions were for each channel.

Fixes: #2788
2021-07-07 14:25:52 -04:00
Richard Ramos c5cc001ee1 fix: code review 2021-07-07 06:19:41 -04:00
Richard Ramos 2fcbe4ac16 feat: user list 2021-07-07 06:19:41 -04:00
Pascal Precht 189d761d20 fix(Status): import missing `utils` module
There's an API used in `provider.nim`, which is defined in `utils.nim` but utils aren't imported.
The usage of that API was introduced in 065bd26786 (diff-778feda87f0918b600d692bd16cdd1af92ae0611f81ae6557749e5f462636694R127)
2021-07-07 11:06:24 +02:00
Jonathan Rainville e1c6cf224b fix(act-center): fix unread count when accepting or dismissing notif
Fixes #2727
2021-07-06 12:51:43 -04:00
Jonathan Rainville cd44b8a606 feat: add group requests to the activity center
Fixes #2679
2021-07-06 12:51:43 -04:00
Richard Ramos 065bd26786 fix: code review 2021-07-06 11:58:47 -04:00
Richard Ramos 5f7f899c3b refactor: separate slots for sending eth and tokens 2021-07-06 11:58:47 -04:00
Richard Ramos fd976c770d fix: notifications 2021-07-06 11:30:07 -04:00
Richard Ramos 2c553f48f7 fix: issues 2021-07-06 11:30:07 -04:00
Richard Ramos c7750da267 feat: edit messages 2021-07-06 11:30:07 -04:00
Eric Mastro 77e501c478 fix(wallet): QML error when loading history
Fixes: #2725.

When clicking on the History tab for a wallet account, there was a QML error for `qrc:/app/AppLayouts/Wallet/WalletLayout.qml:113: TypeError: Property 'checkIfHistoryIsBeingFetched' of object HistoryTab_QMLTYPE_503(0x7fed35da2710) is not a function`. This must have been reintroduced when StatusQ objects were introduced. It has now been removed.

chore: change log level to warn for non-archival node
Previously, there was an error being logged for non-archival infura nodes being used (typically in dev). This log level has been reduced to a warning as the application still functions with non-archival nodes.
2021-07-06 11:28:00 -04:00
Richard Ramos 0f66508a79 fix: invalid keyuid being used with a newly generated account on first login 2021-07-06 11:06:23 -04:00
Andrei Smirnov 7255dcd256 Fixed: starting a group chat shouldn't show the section to fetch more messages. 2021-07-06 10:57:37 -04:00
Sale Djenic 6f55c51ff2 fix(wallet): Crash when enter -1 to Gas Selector
Validation check is updated, so user cannot enter zero or less than zero value for "gas amount limit" or "per-gas overall limit".
In gas.nim a crash prevention check is added.

Fixes: #2753
2021-07-06 10:46:07 -04:00
Sale Djenic a9fd4513aa fix(wallet): Clicking Request Address when sending -1 STT crashes the app
Validation check is updated, so user cannot enter zero or less than zero value in amount input field.
Also in utils.nim a crash prevention check is added so if we try to convert a less than zero float number to an unsigned number, app won't crash any more, but that casting will return a zero as unsigned int number.

Fixes: #2755
2021-07-06 10:45:25 -04:00
Andrei Smirnov 746d120479 Added $HEZ as default ERC-20 token. 2021-07-06 10:44:45 -04:00
Richard Ramos 516d1974b2 fix: pin messages counter and load 2021-07-06 10:44:20 -04:00
Jonathan Rainville 2e98724641 feat(community): add notification setting to community
Fixes #2421
2021-07-06 10:41:10 -04:00
Jonathan Rainville 60b6390581 chore: fix nim import warnings 2021-07-02 08:56:49 -04:00
Jonathan Rainville 10601710e9 fix(community): fix crash on going back to chats from community
Fixes #2504
2021-07-02 08:53:51 -04:00
Jonathan Rainville dfebe88be7 fix(communities): fix duplicated communities and joining through link
Fixes #2665
2021-07-02 08:51:48 -04:00
Richard Ramos ba2b553d7c refactor: Profile 2021-07-02 08:51:30 -04:00
Eric Mastro 4c0371144b fix: chat view shown after community creation
Fixes: #2686.

Previously, when using a new account, joining a chat then creating a community and then returning back to the chat would not show a chat at all and instead show the default chat view. This was due to the previous index not being set when there were no other channels in the chat.

This has been updated such that the previous channel index is set when switching from chat to community and no previous channel index has been set.

# Conflicts:
#	src/app/chat/view.nim
2021-06-29 07:56:51 -04:00
Jonathan Rainville b720a611c4 fix(wallet): fix loading of initial balances 2021-06-29 07:55:26 -04:00
Jonathan Rainville eb726a315c fix(hisotry): fix load more history button
Fixes #2754
2021-06-29 07:55:26 -04:00
Eric Mastro e281ec3871 fix(communities): re-joining of left communities
Fixes: #2649.

Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.

fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.

The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble  with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.

The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-29 07:52:47 -04:00
Iuri Matias f8e5b25a09 refactor: extract messages from chat view
refactor: extract messages from chat view

refactor: extract messages from chat view

refactor: extract messages from chat view

update references to messageView

fix setup

remove duplicated method
2021-06-22 15:12:01 -04:00
Jonathan Rainville 702f52f6ed fix(browser): fix browser undefined model 2021-06-22 12:59:11 -04:00
Jonathan Rainville 3ef403a022 feat(act-center): add community badge links to community and channel 2021-06-21 16:29:42 -04:00
RichΛrd 3b7b346c1b
fix: remove echo 2021-06-21 15:34:42 -04:00
Richard Ramos 157a53b02b fix: various
- Timeline updates were displaying the current active chat messages
- Cursor for existing chat messages was being overwritten
2021-06-21 15:31:31 -04:00
Iuri Matias d299e05e02 fix wrong setup of channel view which was causing app to crash 2021-06-18 12:12:01 -04:00
Iuri Matias 599bf731fb refactor: extract 'channels' to its own file 2021-06-18 12:12:01 -04:00
Iuri Matias 9aba9ae3c1 refactor: extract ens code from chat view 2021-06-17 16:29:35 -04:00
Iuri Matias 45b0e5e756 refactor: move input formatting code to its own file 2021-06-17 16:29:35 -04:00
Iuri Matias 6bcdb9ca54 refactor wallet views
add getSettings methods to src/status

fix issue with calling getSettings; document issue

remove most direct references to libstatus; document some common issues

remove most references to libstatus wallet

add mailserver layer to status lib; remove references to libstatus mailservers

remove libstatus accounts references

move types out of libstatus; remove libstatus types references

remove libstatus browser references

refactor libstatus utils references

remove more references to libstatus stickers

remove references to libstatus constants from src/app

remove more libstatus references from src/app

refactor token_list usage of libstatus

refactor stickers usage of libstatus

refactor chat usage of libstatus

remove libstatus references from the wallet view

remove logic from ens manager view

fix issue with import & namespace conflict

remove unnecessary imports

refactor provider view to not depend on libstatus

refactor provider view

refactor: move accounts specific code to its own section

fix account selection

move collectibles to their own module

update references to wallet transactions

refactor: move gas methods to their own file

refactor: extract tokens into their own file

refactor: extract ens to its own file

refactor: extract dappbrowser code to its own file

refactor: extract history related code to its own file

refactor: extract balance to its own file

refactor: extract utils to its own file

clean up wallet imports

fix: identicon for transaction commands
Fixes #2533
2021-06-17 16:11:01 -04:00
Iuri Matias d5dc7c29ca fix rebase issues 2021-06-17 11:11:36 -04:00
Iuri Matias ca990796a0 refactor provider view to not depend on libstatus 2021-06-17 11:11:36 -04:00
Iuri Matias 1b7799944e remove unnecessary imports 2021-06-17 11:11:36 -04:00
Iuri Matias 985532ce9a fix issue with import & namespace conflict 2021-06-17 11:11:36 -04:00
Iuri Matias 01dc488870 remove logic from ens manager view 2021-06-17 11:11:36 -04:00
Iuri Matias 80456eaa10 remove libstatus references from the wallet view 2021-06-17 11:11:36 -04:00
Iuri Matias a90aa4cc3a refactor chat usage of libstatus 2021-06-17 11:11:36 -04:00
Iuri Matias 2e8af89adf refactor stickers usage of libstatus 2021-06-17 11:11:36 -04:00
Iuri Matias 29e794b8cf refactor token_list usage of libstatus 2021-06-17 11:11:36 -04:00
Iuri Matias 000ddf0ddc remove more libstatus references from src/app 2021-06-17 11:11:36 -04:00
Iuri Matias 8bb2dbb82a remove references to libstatus constants from src/app 2021-06-17 11:11:36 -04:00
Iuri Matias f7a8b14bfb remove more references to libstatus stickers 2021-06-17 11:11:36 -04:00
Iuri Matias 482aac8e98 refactor libstatus utils references 2021-06-17 11:11:36 -04:00
Iuri Matias 6e99b769be remove libstatus browser references 2021-06-17 11:11:36 -04:00
Iuri Matias eab9d68aff move types out of libstatus; remove libstatus types references 2021-06-17 11:11:36 -04:00
Iuri Matias daed733ebb remove libstatus accounts references 2021-06-17 11:11:36 -04:00
Iuri Matias be696ad20f add mailserver layer to status lib; remove references to libstatus mailservers 2021-06-17 11:11:36 -04:00
Iuri Matias ceb7f85e4e remove most references to libstatus wallet 2021-06-17 11:11:36 -04:00
Iuri Matias e8de7e0c99 remove most direct references to libstatus; document some common issues 2021-06-17 11:11:36 -04:00
Iuri Matias 36c25aaab9 fix issue with calling getSettings; document issue 2021-06-17 11:11:36 -04:00
Iuri Matias 09f77177b0 add getSettings methods to src/status 2021-06-17 11:11:36 -04:00
Jonathan Rainville b1bcd539a2 feat: add replies to the activity center 2021-06-15 13:14:19 -04:00
Jonathan Rainville 5f7e277065 feat: make it possible to mark individual as read
Fixes #2663
2021-06-15 13:14:19 -04:00
Jonathan Rainville 0b00a426ae feat: add show more button to activity center
Fixes #2670
2021-06-15 13:14:19 -04:00
Jonathan Rainville 414b39d7e0 feat: add mentions to activity center and interactions
Fixes #2610
2021-06-15 13:14:19 -04:00
Eric Mastro 45286e179c fix: kick and re-invite user to group chat
Fixes: #2601.

Kicking a user and re-inviting them now correctly redisplays the join/decline options. Other combinations of User B leaving or declining an invitation are not handled. Please see the notes below for clarification.

Additionally, the group invite popup (that shows the list of members belonging to the group) correctly shows when a user is kicked or when a user leaves the group in real time. Previously, the popup needed to be reopened to display this.

fix: decline invitation crash
Declining a group invitation was crashing the app. This has been fixed.

### NOTES
1. In the case where User A invites User B to a group, but User B declines (or User B joins, then leaves), then from a status-go standpoint, User B is still part of the group, but the chat is marked as `active: false` for User B. This creates a situation where User B cannot re-join the group once s/he has declined the invitation. @cammellos mentioned there possibly will need to be a refactor of cab6281dc5/protocol/messenger.go (L1710) (which, by retaining User B as a member, effectively prevents the re-invitation) once “swipe to delete” is implemented on mobile. There is an activity center notification received for User B that is meant to allow re-joining of the group when the notification is accepted. The activity center notification received from status-go looks like the following:
```json
"activityCenterNotifications": [
      {
        "id": "0x0e342d33",
        "chatId": "e342d33f-dd05-4d7b-b14e-b5335e1a3ee9-0x043bf46aa874c377a34946eab67a32cf36c15907b328216dfce375d169fed7d81c21cada3229db1fd37c762d2c02702111a646657feca6621e2e948febcf378fb4",
        "name": "test-22",
        "type": 2,
        "lastMessage": null,
        "message": null,
        "timestamp": 1623305612000,
        "read": false,
        "dismissed": false,
        "accepted": false
      }
    ]
```
2021-06-11 11:03:16 -04:00
Jonathan Rainville 32676d50af fix: fix pinnedBy not being right when reopening the app 2021-06-11 10:55:55 -04:00
Richard Ramos 78f7bddb36 Remove community from list after being kicked/banned from it
Fixes #2517
2021-06-10 19:33:14 -04:00
Eric Mastro 0b0a542828 fix: loading of wallet history, display of tx datetime
Fixes: #2539.

Transaction history is now correctly being fetched from status-go as per mobile. Firstly, when accounts are added (ie as watch accounts), `wallet_checkRecentHistory` must be called first so that the status-go db is populated. After that, `wallet_getTransfersByAddress` can be called. On app load, when we run the `initBalance` logic, we are calling `wallet_getTransfersByAddress`, asking for the last 20 transactions with the `loadMore` parameter set to false. When the user navigates to the Wallet > History tab, they can then click “Load More” to fetch more transactions from status-go. Once the number of transactions returns false below the expected amount, the remaining transactions to fetch have been exhausted and the “Load More” button is disabled.

feat: add non-archival node warning to the UI to indicate to the user that they may not have complete results

feat: set active account to the added account
Once an account is added to the wallet, that newly added account is selected as the active account.

1. The “load more” button is active when new transactions that aren’t already displayed are returned from `wallet_getTransfersByAddress`. This is the only way to enable or disable the “Load more” button as status-go is not able to return information regarding whether or not there are more transactions to be fetched. The downside to this is that lets say the last page of transactions is returned, but there are no more pages left. These returned txs are not currently displayed, so the “load more” button will still be enabled. However, the next click of the button will return 0 results, thus disabling it. It’s effectively an extra click to get to the disabled state.
2. For more information on how the `toBlock` parameter operates for the `wallet_getTransfersForAddress` RPC call, see https://notes.status.im/XmENTrVRRaqhwE4gK0m8Mg?view.
2021-06-10 10:47:03 +10:00
Eric Mastro 21e6affa98 feat: edit community channels
Closes #2344.

Add ability to edit name, description, and private fields of a community channel.

feat: Display community channel description
Ensure the width of the description does not surpass the context menu and instead wraps to the next line.

feat: After channel is created, set it as the active channel
2021-06-09 10:19:26 +10:00
Michael Bradley, Jr 816b2f0ee9 fix: on macOS remove -psn_... cli params before processing with confutils 2021-06-03 14:01:06 -05:00
Iuri Matias e88f4aa170 fix: rename transactionHash to hash due to breaking changes in the api 2021-06-02 16:41:04 -04:00
Jonathan Rainville 6895dc6c6c fix: fix community crash when no chat is active
Fixes #2628
2021-06-02 12:04:55 -04:00
Eric Mastro 815abdc226 fix: Timeline view crash with SIGSEGV when loaded
Fixes: #2618.

The main culprit was that `self.pinnedMessagesList` did not contain the `self.activeChannel.id` because it was correctly upserted in `upsertChannel`.

To fix this, when calling `upsertChannel`, `self.pinnedMessagesList` was checked if it contained an entry for the upserted channel first before adding it to the list.

Nil checks were added to parsing the messages RPC response in case specific fields were not returned in the response.

In addition, a copy/paste error was fixed in `asyncMessageLoadTask`.
2021-06-02 11:54:56 -04:00
Jonathan Rainville 18b26a1c67 start of activity center function calls 2021-05-31 15:54:18 -04:00
Pascal Precht f138f93815 fix(Communities): disable chat input when active user is banned
Fixes #2507
2021-05-31 13:57:02 -04:00
Richard Ramos 0498613d28 fix: unread count 2021-05-31 10:29:10 -04:00
Jonathan Rainville 7b95031ee6 hide input field until mutual contacts and notify on contact accepted 2021-05-28 13:31:33 -04:00
Jonathan Rainville ecf8b241f0 feat: add setting to not receive contact requests 2021-05-28 13:31:33 -04:00
Jonathan Rainville 436cb42eae feat: add contact requests and handling of them 2021-05-28 13:31:33 -04:00
Eric Mastro 24d8e429b8 feat: edit communities
Allow editing of Community name, description, image, colour, and access.
2021-05-28 19:08:19 +10:00
Eric Mastro c415f3b989 fix: interrupt running sticker task when exiting
Fixes: #2318.

Currently, when exiting the app and the sticker packs task is being run, the app will wait for the sticker packs task to completely finish before exiting the app. This causes a beachball to be displayed and can cause a long delay while waiting for the task to finish.

This PR passes an interrupt signal to the sticker pack loading task in the threadpool thread. The task loads the interrupt on each iteration of its loop (each sticker pack to load) and also during the processing of each sticker pack (getting of sticker pack data). This allows the application to exit neatly.

fix: Handle shutdown of long-running (marathon) task before login
Currently, we wait for the “loggedIn” message to be passed to the marathon task runner before initialising the mailserver model. We were, however, blocking the thread until “loggedIn” was received, meaning that if “shutdown” was received (as it is when cmd+q is pressed), this message would be ignored and the application would have to be forced to quit.

This PR adds logic that not only listens for the “loggedIn” message, but also for the “shudown” message. Once the “shutdown” message is received, the marathon worker thread exits.
2021-05-27 16:19:10 +10:00
Richard Ramos fb47d73e79 fix: set nickname without creating a contact
Fixes #2589
2021-05-26 18:10:46 -04:00
Jonathan Rainville c8cc65506b fix(CommunityRequest): fix request list emptying after accepting
Fixes #2474
2021-05-26 15:27:49 -04:00
Jonathan Rainville 0fe7da0480 feat(community): fetch community info from link
Fixes #2290
2021-05-26 15:27:49 -04:00
Jonathan Rainville c1f6afd799 fixes 2021-05-26 12:12:05 -04:00
Jonathan Rainville 8952d55028 update status-go to develop version 2021-05-26 12:12:05 -04:00
Jonathan Rainville b52dceb984 feat(Chat): add pinned messages feature 2021-05-26 12:12:05 -04:00
Richard Ramos 872aa7794c feat: edit categories 2021-05-25 15:23:07 -04:00
Richard Ramos 0ded790f0d feat: create community categories 2021-05-25 15:23:07 -04:00
Richard Ramos f86611303f feat: updated mailserver logic 2021-05-25 14:47:13 -04:00
Richard Ramos 62d7fc9853 feat: mailserver gaps 2021-05-25 14:47:13 -04:00
Richard Ramos 22839f177b feat: use new API for joining/leaving chats
Fixes #2526
Fixes #2487
2021-05-25 14:47:13 -04:00
Pascal Precht 923350a46f fix(Chat): honor joined date when preserving channel order
Prior to this commit, loaded channels and chats would always be
sorted by date of last message received, with the latest one being
moved to the top of the list.

When new channels or chats are joined, they are added on top of the
list as well, however, when the application is restarted,
those new joined chats would not necessarily show up at the top anymore
becaue nothing keeps track of when a channel was joined, which should
be taken into account when preserving the order.

The changes introduced in this commit solve this by introducing a
new `joined` property on the `Chat` type which gets updated with
the current timestamp whenever a channel is joined.

It also depends on the changes made to the `status-go` client, which
have to land first: https://github.com/status-im/status-go/pull/2158

Closes: #1832
2021-05-21 13:06:34 -04:00
Eric Mastro 1387ba3157 fix: prevent crash checking pending transactions
There is an unknown state that the data dir seems to get in that causes the application to crash when checking pending transactions. This is fixed by checking if the pending transactions RPC result has a `”result”` field first before attempting to read it.

### NOTE:
Clearing the data directory fixed the issue for me, however I do not know what caused it in the first place. While the crash was happening, there was also an error appearing in the logs:
```
ERR 2021-05-18 15:40:47+10:00 rpc response error                         topics="rpc" tid=3893906 file=core.nim:24 methodName=wallet_getPendingTransactions payload=[] result="{\"jsonrpc\":\"2.0\",\"id\":0,\"error\":{\"code\":-32000,\"message\":\"no such column: transaction_hash\"}}"
```
After clearing the data dir, this error also went away.
2021-05-19 16:24:59 -04:00
Pascal Precht 2a706d2b09 feat(Communities): allow admins to ban users
Closes #2514
2021-05-18 15:27:29 -04:00
Richard Ramos 0b4c465f51 handle cases where the id is nil 2021-05-18 15:25:04 -04:00
Richard Ramos 0fa9064481 fix: add id to signature response
Fixes #2542
2021-05-18 15:25:04 -04:00
Pascal Precht 18ecb87e9b fix(Communities): don't list members in contacts to invite list
When inviting contacts to a community, Status Desktop suggests a list of
all contacts, even if contacts of that list are already members of the community.

This commit introduces a new flag to `ExistingContacts` component that
allows for configuring whether community members should be hidden or not

Fixes #2502
2021-05-18 15:24:50 -04:00
Richard Ramos 6fd7142cb5 feat: watch transactions with new wallet API 2021-05-18 15:24:05 -04:00
Richard Ramos 3a042a4a09 feat: use new pending transfer API 2021-05-18 15:24:05 -04:00
Richard Ramos 7d56e66a86 fix: check null 2021-05-18 15:24:05 -04:00
Richard Ramos 19d4279237 use new wallet api to receive wallet signals 2021-05-18 15:24:05 -04:00
Richard Ramos 9493839b65 force messages to dissapear if a contact is blocked 2021-05-14 11:56:07 -04:00
Richard Ramos fdf6be5f64 feat: delete messages on block 2021-05-14 11:56:07 -04:00
Eric Mastro 29ac475385 feat: add DockClicker event filter
Add an event filter to `qApp` that can detect a dock icon click (in macos) when the main window is hidden or closed.

When the event has been triggered, the main window will be shown again.

Co-authored-by: Boris Melnik <82511785+borismelnik@users.noreply.github.com>
2021-05-14 10:28:14 -04:00
Eric Mastro 590192ad9e fix: show suggestion profile pics for contacts only
Fixes: #2365.

Previously, suggestions for mentions were showing profile pics even for users who were not contacts. Now, profile pics are only shown for those users who are contacts. The user’s identicon is shown otherwise.

fix: user thumbnail not shown when no profile pic
When a user was a contact, but didn’t have a profile pic, an image would not be loaded and a ‘reload’ image would be shown instead. With this PR, if the user is a contact and they do not have a profile pic, their identicon will be shown instead.
2021-05-14 10:27:53 -04:00
Jonathan Rainville a0029ce270 refactor(ChatInput): refactor text formation to increase perfo and enbale undo 2021-05-14 10:27:47 -04:00
Eric Mastro ee1287b71d fix: prevent crash on generate account wrong password
Fixes #2448.

Currently, if a wrong password is entered when generating a wallet account, the app will crash due to attempting to decode a `GeneratedAccount ` from an rpc response containing only an error.

With this PR, we are detecting if an error is returned in the response, and if so, raising a StatusGoException. This exception is caught in the call chain, and translated in to a `StatusGoError` which is serialised and sent to the QML view, where it is parsed and displayed as an invalid password error in the input box.

refactor: remove string return values as error messages in wallet model
In the wallet model, we were passing back empty strings for no error, or an error as a string. This is not only confusing, but does not benefit from leaning on the compiler and strong types. One has to read the entire code to understand if a string result is returned when there is no error instead of implicitly being able to understand there is no return type.

To alleviate this, account creation fundtions that do not need to return a value have been changed to a void return type, and raise `StatusGoException` if there is an error encountered. This can be caught in the call chain and used as necessary (ie to pass to QML).

refactor: move invalid password string detection to Utils
Currently, we are reading returned view model values and checking to see if they include a known string from Status Go that means there was an invalid password used. This string was placed in the codebased in mulitple locations.

This PR moves the string check to a Utils function and updates all the references to use the function in Utils.
2021-05-14 10:27:37 -04:00
Pascal Precht 7329522a28 chore: add StatusQ as dependency
This commit does a couple of things:

- add StatusQ as a dependency (https://github.com/status-im/StatusQ)
  our emerging component library
- updates the rcc generation script to follow symlinks as well
- add qrc:/./StatusQ/src as import path

At the time of creating this commit `StatusQ` provides only the StatusIcon
component, but more will be added in the future.
2021-05-04 14:42:28 -04:00
Jonathan Rainville eac7009807 feat(community): fetch community info from link
Fixes #2290
2021-05-03 14:36:37 -04:00
Eric Mastro 0850835b34 fix: Send Message button not working in profile popup
Fixes: #2364

The Send Message button click event was erroring due to a refactor that had been done to allow for changing app sections.

This has been updated to follow the current way to change app sections.

fix: “Send Message” button crash in communities
This required switching from communities to normal view.

fix: crash when clicking channel link in community message
When a message in communities contains a link to another channel (ie #otherchannel), the search for this channel needed to be updated to also search for the channel by name, allowing for switching between channels within a community by message link. Additionally, when in a community, if the channel was located in a normal chat, it will switch the view to the normal chat after being found.
2021-04-29 12:36:58 -04:00
Jonathan Rainville 3a7c95967a feat: implement redesign of message replies
Fixes #2303
2021-04-29 12:35:59 -04:00
Jonathan Rainville 2c3449e676 chore: comment out StartWallet for the moment 2021-04-29 12:30:05 -04:00
Pascal Precht bceed7b7aa fix(Communities): receive community info after community import
This commit ensures that, once a community was imported, the application
will listen to the newly introduced `community.found` signal, which will be
emitted by status-go.

The signal exposes a `Community` object that is then used to add a
community item to the community list in the UI.

**This can only land after https://github.com/status-im/status-go/pull/2177 has landed first!**

Fixes #2024
2021-04-29 12:30:05 -04:00
Michael Bradley, Jr 02b26f3c28 build: launch nim_status_client directly in packaged builds for macOS
Remove the `nim_status_client.sh` launcher script and make related changes.
2021-04-28 07:15:44 -05:00
Jonathan Rainville fcc133e9d1 fix(Settings): fix QT settings not being saved on first start
Fixes #2312

This will reset the QT settings of all users, since we change from using the address to using the pubkey.
The reason for that is that the account address also called keyId is somehow not set correctly on first login. The pubkey stays constant on the other hand. So using the pubkey is better.
2021-04-27 15:27:48 -04:00
Richard Ramos 6fd68c10f3 fix: handle tokens with no decimals
Fixes #2432
2021-04-27 14:12:19 -04:00
Eric Mastro cf361de1e0 feat: show ENS name in notifications
Fixes: #2418.

Chat notifications for one-on-one chats were showing only a user’s alias and not their ENS name if they have one.

This PR now shows a user’s ENS name if they have one, or their alias if they don’t in one-on-one chat notifications.
2021-04-27 10:29:32 +02:00
Michael Bradley, Jr c03a086c01 feat: command-line option can be used to specify app's data directory
In the repo:
```
$ bin/nim_status_client --help
```
In the packaged app (macOS example):
```
$ cd /Applications/Status.app/Contents/MacOS
$ ./nim_status_client --help
```
Output:
```
Usage:

nim_status_client [OPTIONS]...

The following options are available:

 -d, --dataDir      Status Desktop data directory.
```

**Using the option**

```
$ cd ~/status-ci-builds/master/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir:"${HOME}/status-dirs/master"
```
In another terminal:
```
$ cd ~/status-ci-builds/PR-4242/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir:"${HOME}/status-dirs/PR-4242"
```

The path supplied can be relative or absolute, and can be specified with
`--dataDir:[path]`, `--dataDir=[path]`, `-d:[path]`, or `-d=[path]`.

Either `:` or `=` must be used, i.e. this *will not* work: `--dataDir [path]`
or `-d [path]`.

The name of the option follows Nim's partial case-insensitivity rules, so
`--dataDir`, `--datadir`, and `--data_dir` are all equivalent. See
[Identifier equality][ieq] in the Nim Manual.

It is possible to run the same build in multiple terminals by supplying
different `--dataDir`, i.e. this works:
```
$ cd /Applications/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir="${HOME}/temp/some1"
```
In another terminal:
```
$ cd /Applications/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir="${HOME}/temp/some2"
```

**Windows**

It is recommended to use a Git Bash or MSYS2 terminal when invoking
`bin/nim_status_client.exe` (development build) or `bin/Status.exe` (production
build) on the command-line. The reason is that if the exe is invoked in a
session of `cmd.exe` it will return to the prompt immediately; the app will run
but there will be no output in the terminal. In any case, the `--dataDir`
option will take effect whether the exe is invoked in `cmd.exe` or a
recommended terminal.

For development builds, when invoking `bin/nim_status_client.exe` directly
instead of via `make run`, because e.g. you wish to use the `--dataDir` option,
it is required to first setup the `PATH` environment variable correctly. See
the `run-windows` target in this repo's Makefile for more information.

**Linux**

The `--dataDir` option may be passed to command-line invocation of a
production (AppImage) build in the same way as passing it to a development
build:

```
$ Status.AppImage --dataDir:/path/to/wherever
```

For development builds, when invoking `bin/nim_status_client` directly instead
of via `make run`, because e.g. you wish to use the `--dataDir` option, it is
required to setup the `LD_LIBRARY_PATH` environment variable correctly. See the
`run-linux` target in this repo's Makefile for more information.

---

BREAKING CHANGE: The `qt` subdir of the app's data directory is now a sibling
of the status-go directory rather than a subdir of the status-go directory:

```
Status (app data directory)
├── data (status-go directory)
├── qt
└── tmp
```

Because app settings are stored in the `qt` directory that means that existing
installations will lose their customized settings.

At app startup, it would be possible to detect `Status/data/qt` and if
`Status/qt` doesn't exist yet then copy `Status/data/qt` to
`Status/qt`. However, there was some concern that behavior could lead to
problems later on if we forget the workaround is in place. So for now that
settings preservation strategy has not been implemented, but it might be before
this commit is merged pending full team awareness/consensus.

---

Command-line option support is provided by
[nim-confutils](https://github.com/status-im/nim-confutils).

The environment variable `NIM_STATUS_CLIENT_DEV` has been removed in favor of
passing a "define" option to the Nim compiler: `-d:development` for development
builds (e.g. `make V=1`) and `-d:production` for packaged builds (e.g. `make
V=1 pkg`). Passing the correct option is handled automatically by the Makefile.

A make variable named `RELEASE` has been introduced, which defaults to
`false`. Presently the `RELEASE` variable should not be set on the command-line
nor in CI as more work needs to be done to toggle the proper compiler flags. In
the case of Status Desktop, "release vs. debug" is a concern orthogonal to
"production vs. development". At present, production builds and development
builds are all debug builds, but that will likely change in the future: we can
have non-release CI production builds and local development builds be debug
builds, while release builds in CI would be production builds with
`RELEASE=true` (the compiled executable will be fully optimized).

Prior to the changes in this PR, symmetry is somewhat lacking between
development and production (packaged) builds with respect to the concept of the
"data directory". In development builds the root of the repo effectively serves
as the `Status` directory used by production builds, e.g. on macOS
`~/Library/Application Support/Status`. Also, there's a bit of confusion as to
whether "data directory" refers to a directory for the desktop app's overall
data (including status-go data) or to the specific directory used by status-go.

This PR attempts to provide symmetry and reduce confusion:
* The term "data directory" means the directory used by the desktop app to
store multiple kinds of data and is not a reference to the subdirectory used by
status-go.
* For development builds the "data directory" defaults to `./Status/` relative
to the root of the repo.
* For production builds the "data directory" default is the same as before,
e.g. on macOS it's ` ~/Library/Application Support/Status/`.

The directory used by status-go is `Status/data/`. To be clear, that should be
referred to as the "status-go directory" and not the app's "data directory". It
would nice if we could rename it from `Status/data/` to `Status/status-go/`. We
can do that, I already checked that it works correctly; however, for existing
installations it would require that at app launch we check for the presence of
`Status/data/` and rename it to `Status/status-go`. While simple enough to do,
I was concerned that there might be edge cases where the directory rename could
cause a problem (e.g. if another copy of the app is running) so chose for now
to stick with the status-go directory being `Status/data/`.

---

**NOTES**

More work needs to be done to ensure that all data written by the app is
contained in the default or cli-specified data directory. Currently, both
development and production (packaged) builds are writing to common directories
outside of the data directory, e.g. located within `~/Library/` on
macOS. Changing that behavior seems like it will mainly involve changing
defaults related to Qt components such as the web engine. See:
https://github.com/status-im/status-desktop/issues/1141.

In general, additional refactoring could be done in the future. For
example, implementing `StatusDesktopConfig` in
`src/status/libstatus/accounts/constants.nim` (as done in this PR) works fine
for now, but better code organization is desirable.

---

Closes #2268

[ieq]: https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality
2021-04-26 09:40:58 -05:00
Eric Mastro 86e69132c6 feat: add error handling to mark messages as seen logic 2021-04-20 14:44:27 -04:00
Pascal Precht aeedc87368 feat: introduce global settings
This commit introces global settings that apply across accounts used
inside the application. This is useful when settings like the selected
locale should b the same across all accounts.

Closes #2144
2021-04-19 13:53:14 +02:00
Eric Mastro e47092cfd0 feat: settings cache efficiency update
Current settings caching logic was inefficient when attempting to retrieve settings that contain the sensitive mnemonic. While those calls were limited to the login logic, each call would need to round trip to status-go to get all settings when they wanted to include sensitive data, as the cache was not being updated for these calls.

This PR updates the cache regardless if sensitive data is requested of not, effectively making the caching mechanism more efficient during login.
2021-04-15 17:02:28 -04:00
Eric Mastro 0a108dd849 feat: Add libstatus contacts caching
Fixes #2131.

After some heavy profiling, it became clear that sending of each message was causing a fetch to get all contacts from status-go. This was incurring a minimum of a 0.03s delay for each fetch, which was causing a bottleneck each time it was called for various operations throughout the codebase.

This code addds a layer of threadsafe caching to the contacts call, such that only the first call to contacts fetching will incur the delay, as well as every fetch after a contacts CUD operation.
2021-04-15 17:02:08 -04:00
Eric Mastro e7571bd2a4 feat: Add Methuselah and Mailserver long-running task
Fixes #2143.

Methuselah is the a task manager for long-running tasks. It allows fo registration of workers that will each run in their own thead. Each worker can pass messages to and recieve messages from the main thread.

MailserverWoker was also introduced which moves all mailserver model logic to a MethuselahWorker. All communication to/from the model is done via a MethuselahTask. Results of the task are returned to the main thread by way of `signal_handler`, which calls the QtObject slot specified in the task.

Mailsever also provides a way for the model to emit events inside of the worker. These events are forwarded to the main thread via the `receiveEvent` slot of the `MailserverController`.

Co-authored-by: Michael Bradley, Jr <michaelsbradleyjr@gmail.com>
2021-04-14 15:37:05 -04:00
Eric Mastro 0d677eb156 chore: change threadpool logs from debug to trace 2021-04-14 15:36:36 -04:00
Jonathan Rainville 1983fa79aa feat: improve ens search in wallet send by showing the result 2021-04-14 14:39:11 -04:00
Jonathan Rainville 438517a610 fix: fix missing channel identifier in new community chats
Fixes #2211
2021-04-14 12:33:45 -04:00
Jonathan Rainville ba500e5f73 fix: fix notifications not working for community chats
Fixes #2210
2021-04-14 12:33:45 -04:00
Pascal Precht 46fd32aaee feat: add SOCKS token to list of default tokens
Closes #2215
2021-04-14 10:46:49 +02:00
Jonathan Rainville 63b5c549b9 fix: fix invite button not setting Joined correctly
Fixes #2209
2021-04-13 17:50:32 -04:00
Pascal Precht 5ca9d66212 fix(Communities): ensure newly created community is opened 2021-04-13 15:21:00 -04:00
Richard Ramos 8543bf04d4 fix: code review 2021-04-06 14:31:06 -04:00
Richard Ramos 61555d610b fix: it's not necessary to leave chats 2021-04-06 14:31:06 -04:00
Richard Ramos 55ecb50f1b chore: autoremove chat groups 2021-04-06 14:31:06 -04:00
Richard Ramos 31f85787a6 fix: decline chat group invites if admin is not a contact 2021-04-05 12:02:05 -04:00
Richard Ramos 52b18c0c82 fix: leave chat groups 2021-04-05 12:01:45 -04:00
Eric Mastro 40dc428f63 fix: ens search hang
ENS search was executed in a task runner task. The task had a mistake during the copy/paste port from spawnAndSend.
2021-04-01 17:16:54 -04:00
Jonathan Rainville a01e851070 fix: fix being unable to put multiple spaces in a row 2021-04-01 17:07:25 -04:00
Jonathan Rainville 8b3ce83d00 fix: input box disappearing on communities
Fixes #2155
2021-03-31 16:53:08 -04:00
Jonathan Rainville 996b36714d fix: fix scroll speed on Windows 2021-03-30 16:02:10 -04:00
Jonathan Rainville a337b293da feat: show community context menu on Community button 2021-03-30 15:53:32 -04:00
Jonathan Rainville 147d93815f fix: fix unable to write to invite only community channels
This was caused by the fact that the canPost property was not exposed from the ChatItem model.
I'm actually not sure why it didn't show an error trying to call  a function that doesn't exist
2021-03-25 16:38:05 -04:00
Eric Mastro 2336aa4e6f fix: custom token validation for non-token addresses
When contract addresses that are not ERC-20 or ERC-721 were input, the token would be allowed to be added and would crash the app.

In addition, when an ERC-20 contract was deployed without a name and symbol, “Invalid ERC-20 address” would appear.

This PR adds error checking from the token detail lookup and reports the error back to the user in the modal. This prevents non-ERC-20/721 contracts from being able to be added to the app and prevents a crash.
2021-03-25 15:52:02 -04:00
Pascal Precht bb932ac35e fix(Timeline): remove "fetch more" fake message
Two fake messages are usually added to chat message lists inside a channel or
chat:

- One that imitates a chat identifier
- one that creates a button to fetch older messages

These two fake messages are added so it's ensured they show up at the beginning
of the chat.

The status timeline is also just a list of messages (filtered by a certain message
type), however there's no need to render these fake messages in this scenario.
That's why a `addFakeMessages` flag has been introduced which conditionally adds
those fake messages here: https://github.com/status-im/status-desktop/commit/3f012dbf0#diff-6aa545137319516beb03623bc6a9750e1d14a40c68d8868b5a672320fc4d680aR69

At some point, possibly around here (https://github.com/status-im/status-desktop/commit/8ee5abe57), the fake message for
the fetch more button has been reintroduced as default fake message.

This commit puts it back into the function so that it doesn't show up
inside the timeline view.
2021-03-24 14:41:43 -04:00
Michael Bradley, Jr 1200632989 feat: remove all remaining spawnAndSends
refactor: move threadpool task declarations inline with views

Co-authored-by: Michael Bradley Jr. <michaelsbradleyjr@gmail.com>
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2021-03-24 14:30:33 -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
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 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
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
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
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
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
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