status-mobile/translations
Icaro Motta 206730a777
Show "Added to group chat" notifications (#14785)
Partially implements https://github.com/status-im/status-mobile/issues/14712
Fixes #14744

### Summary

This PR implements the first, among what will probably be many different kinds of membership notifications. For this PR, I started with implementing a particular flow for private group chats because it's already supported by `status-go` (albeit I had to make some changes, see [PR in status-go](https://github.com/status-im/status-go/pull/3088).

1. `A` and `B` are mutual contacts.
2. `A` creates a private group chat with `B` as member.
3. `B` sees the group chat in the app, but doesn't interact with it.
4. `B` reinstalls the app (remember to back up the seed phrase).
5. `A` mentions `B` in the group chat.
6. `B` should see a group chat notification, which can be accepted/declined.

- [x] Also fixes #14744

### Demo

In the video I'm simulating the steps outlined in the *Summary*, but using the approach described in *Steps to test*, because it's way easier to iterate during development.

[demo.webm](https://user-images.githubusercontent.com/46027/212470798-c135d229-948d-4ba5-98db-ee73cc5495cd.webm)

### Review Notes

Some changes had to be made in `status-go` ([PR](https://github.com/status-im/status-go/pull/3088)), namely:

- According to [Figma](https://www.figma.com/file/eDfxTa9IoaCMUy5cLTp0ys/Shell-for-Mobile?node-id=3806%3A586901&t=xLTAjLXjG1UtorpI-0), users should be able to see `accepted` group chat notifications. Until now, `status-go` hardcoded that `accepted` notifications would *not* be returned in query results, and so it would be impossible to show them to users. This was changed and now the RPC endpoint accepts an additional filter. The implementation on the backend is backwards compatible so as to not break Status desktop.
- The `Membership` tab needs to display various types of notifications (group chat, community, etc), but the membership type doesn't exist on the backend. To overcome this constraint, this PR makes the membership type a logical/virtual type, i.e. a Clojure set of types. `status-go` was changed to support querying for multiple notification types (also backwards compatible).

#### Platforms

- Android
- iOS

### Steps to test

Please, follow the steps described in the Summary and you should be able to test.

But during development, I followed these steps (recommended by @cammellos). I documented them here for reference.

1. Checkout `feature/e2e` in status-go. Apply the diff below.
2. `cd cmd/e2e && ./e2e`
3. This will create a temporary account automatically, let's call it `A`.
4. On another device, create account `B`.
5. Follow the steps documented in bdc406ea2e/cmd/e2e/README.md (L2) in order for user `A` to create a group chat with `B` as member. Don't make `A` and `B` mutual contacts.
6. On `B`'s device, a notification should appear, and `B` should be able to accept or decline the "invitation" (actually *invitation* is another concept and related to another feature).

```diff
modified   cmd/e2e/main.go
@@ -283,6 +283,11 @@ func defaultNodeConfig(installationID string) (*params.NodeConfig, error) {
    nodeConfig.NetworkID = 1
    nodeConfig.LogLevel = "ERROR"
    nodeConfig.DataDir = "/ethereum/mainnet_rpc"
+        nodeConfig.HTTPEnabled = true
+        nodeConfig.HTTPPort = 8545
+        nodeConfig.HTTPHost = "localhost"
+        nodeConfig.HTTPVirtualHosts = []string{"localhost"}
+
         nodeConfig.APIModules = "wakuext,ext,waku"

    nodeConfig.UpstreamConfig = params.UpstreamRPCConfig{
modified   protocol/messenger_group_chat.go
@@ -26,17 +26,17 @@ func (m *Messenger) validateAddedGroupMembers(members []string) error {
        }

        contact, _ := m.allContacts.Load(contactID)
-		if contact == nil || !(contact.Added && contact.HasAddedUs) {
-			return ErrGroupChatAddedContacts
-		}
+                if contact == nil {
+                  contact, err = buildContactFromPkString(contactID)
+                  if err != nil {
+                    return err
+                  }
+                }
    }
    return nil
 }

 func (m *Messenger) CreateGroupChatWithMembers(ctx context.Context, name string, members []string) (*MessengerResponse, error) {
-	if err := m.validateAddedGroupMembers(members); err != nil {
-		return nil, err
-	}

    var response MessengerResponse
    logger := m.logger.With(zap.String("site", "CreateGroupChatWithMembers"))
```
2023-01-23 13:54:51 -03:00
..
af.json Remove unused translatins 2020-02-26 20:36:48 +02:00
ar.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
bel.json fix #9003 Recover deleted translations 2019-09-20 13:07:11 +02:00
bn.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
cs.json Remove unused translatins 2020-02-26 20:36:48 +02:00
da.json Remove unused translatins 2020-02-26 20:36:48 +02:00
de.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
de_ch.json fix #9003 Recover deleted translations 2019-09-20 13:07:11 +02:00
el.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
en.json Show "Added to group chat" notifications (#14785) 2023-01-23 13:54:51 -03:00
es.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
es_419.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
es_AR.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
es_mx.json Remove unused translatins 2020-02-26 20:36:48 +02:00
fa.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
fi.json Remove unused translatins 2020-02-26 20:36:48 +02:00
fil.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
fr.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
fr_ch.json Remove unused translatins 2020-02-26 20:36:48 +02:00
fy.json Remove unused translatins 2020-02-26 20:36:48 +02:00
he.json Remove unused translatins 2020-02-26 20:36:48 +02:00
hi.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
hu.json Remove unused translatins 2020-02-26 20:36:48 +02:00
id.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
it.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
it_ch.json Remove unused translatins 2020-02-26 20:36:48 +02:00
ja.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
ko.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
la.json fix #9003 Recover deleted translations 2019-09-20 13:07:11 +02:00
lt.json Remove unused translatins 2020-02-26 20:36:48 +02:00
lv.json Remove unused translatins 2020-02-26 20:36:48 +02:00
ms.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
nb.json Remove unused translatins 2020-02-26 20:36:48 +02:00
ne.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
nl.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
pl.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
pt.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
pt_BR.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
pt_pt.json Remove unused translatins 2020-02-26 20:36:48 +02:00
ro.json Remove unused translatins 2020-02-26 20:36:48 +02:00
ru.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
sl.json Remove unused translatins 2020-02-26 20:36:48 +02:00
sr_rs_cyrl.json Remove unused translatins 2020-02-26 20:36:48 +02:00
sr_rs_latn.json Remove unused translatins 2020-02-26 20:36:48 +02:00
sv.json Remove unused translatins 2020-02-26 20:36:48 +02:00
sw.json fix #9003 Recover deleted translations 2019-09-20 13:07:11 +02:00
th.json fix #8717 change ens welcome screen 2020-04-17 10:29:41 +02:00
tl.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
tr.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
uk.json Remove unused translatins 2020-02-26 20:36:48 +02:00
ur.json Remove unused translatins 2020-02-26 20:36:48 +02:00
vi.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
zh.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
zh_Hans_CN.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
zh_TW.json Update translation (#14483) 2023-01-04 12:18:26 +01:00
zh_hans.json [#14120] Remove Ropsten and Rinkeby test networks 2022-10-21 13:20:40 +02:00
zh_hant.json Remove unused translatins 2020-02-26 20:36:48 +02:00
zh_hant_hk.json Remove unused translatins 2020-02-26 20:36:48 +02:00
zh_hant_sg.json Remove unused translatins 2020-02-26 20:36:48 +02:00
zh_hant_tw.json Remove unused translatins 2020-02-26 20:36:48 +02:00
zh_wuu.json Remove unused translatins 2020-02-26 20:36:48 +02:00
zh_yue.json Remove unused translatins 2020-02-26 20:36:48 +02:00