Skip to content

Commit

Permalink
Feature/update notification preferences (#693)
Browse files Browse the repository at this point in the history
* Fix spacing on toggle

* Fetch notification preferences with profile

* Implement happy path for setting notification preferences

* Implement error handling

* Translate messages

* Send language preference on app startup and when user changes language

* Update graphql types so that the notification preferences are not nullable

* Update Graphql types to include the Transfer permission
  • Loading branch information
henriquecbuss authored Feb 23, 2022
1 parent 3d4b408 commit 267b4cd
Show file tree
Hide file tree
Showing 11 changed files with 339 additions and 8 deletions.
6 changes: 6 additions & 0 deletions public/translations/amh-ETH.json
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,12 @@
"edit": "አርትዕ",
"viewPrivatekey": "የግል ቁልፍ ተመለከት"
},
"preferences": {
"claim_notification": "የይገባኛል ጥያቄ ማስታወቂያ",
"transfer_notification": "ማሳወቂያ ማስተላለፍ",
"digest": "ስለ ማህበረሰቡ ወርሃዊ ዜና",
"error": "ምርጫዎችዎን በሚያስቀምጡበት ጊዜ የሆነ ችግር ተፈጥሯል"
},
"edit": {
"avatar_section": "አምሳያ",
"general_section": "ጠቅላላ",
Expand Down
6 changes: 6 additions & 0 deletions public/translations/cat-CAT.json
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,12 @@
"edit": "Editar",
"viewPrivatekey": "Veure clau privada"
},
"preferences": {
"claim_notification": "Notificació de reclamació",
"transfer_notification": "Notificació de transferència",
"digest": "Notícies mensuals sobre la comunitat",
"error": "S'ha produït un error en desar les preferències"
},
"edit": {
"avatar_section": "Avatar",
"general_section": "General",
Expand Down
6 changes: 6 additions & 0 deletions public/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,12 @@
"edit": "Edit",
"viewPrivatekey": "View Private Key"
},
"preferences": {
"claim_notification": "Claim notification",
"transfer_notification": "Transfer notification",
"digest": "Monthly news about the community",
"error": "Something went wrong when saving your preferences"
},
"edit": {
"avatar_section": "Avatar",
"general_section": "General",
Expand Down
6 changes: 6 additions & 0 deletions public/translations/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,12 @@
"edit": "Editar",
"viewPrivatekey": "Ver Llave Privada"
},
"preferences": {
"claim_notification": "Notificación de reclamo",
"transfer_notification": "Notificación de transferencia",
"digest": "Noticias mensuales sobre la comunidad",
"error": "Algo salió mal al guardar tus preferencias"
},
"edit": {
"avatar_section": "Avatar",
"general_section": "General",
Expand Down
6 changes: 6 additions & 0 deletions public/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,12 @@
"edit": "Editar",
"viewPrivatekey": "Ver chave privada"
},
"preferences": {
"claim_notification": "Notificação de reivindicação",
"transfer_notification": "Notificação de transferência",
"digest": "Notícias mensais sobre a comunidade",
"error": "Algo deu errado ao salvar suas preferências"
},
"edit": {
"avatar_section": "Avatar",
"general_section": "Geral",
Expand Down
13 changes: 12 additions & 1 deletion src/elm/Cambiatus/Enum/Permission.elm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Json.Decode as Decode exposing (Decoder)
- Invite - Role permission that allows to create invitations to the community
- Order - Role permission that allows to create orders to buy from the shop
- Sell - Role permission that allows to sell products and services in the community
- Transfer - Role permission that allows users to transfer tokens on their community
- Verify - Role permission that allows to verify claims
-}
Expand All @@ -23,12 +24,13 @@ type Permission
| Invite
| Order
| Sell
| Transfer
| Verify


list : List Permission
list =
[ Award, Claim, Invite, Order, Sell, Verify ]
[ Award, Claim, Invite, Order, Sell, Transfer, Verify ]


decoder : Decoder Permission
Expand All @@ -52,6 +54,9 @@ decoder =
"SELL" ->
Decode.succeed Sell

"TRANSFER" ->
Decode.succeed Transfer

"VERIFY" ->
Decode.succeed Verify

Expand Down Expand Up @@ -80,6 +85,9 @@ toString enum =
Sell ->
"SELL"

Transfer ->
"TRANSFER"

Verify ->
"VERIFY"

Expand Down Expand Up @@ -113,6 +121,9 @@ fromString enumString =
"SELL" ->
Just Sell

"TRANSFER" ->
Just Transfer

"VERIFY" ->
Just Verify

Expand Down
12 changes: 6 additions & 6 deletions src/elm/Cambiatus/Object/User.elm
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ chatUserId =
Object.selectionForField "(Maybe String)" "chatUserId" [] (Decode.string |> Decode.nullable)


claimNotification : SelectionSet (Maybe Bool) Cambiatus.Object.User
claimNotification : SelectionSet Bool Cambiatus.Object.User
claimNotification =
Object.selectionForField "(Maybe Bool)" "claimNotification" [] (Decode.bool |> Decode.nullable)
Object.selectionForField "Bool" "claimNotification" [] Decode.bool


type alias ClaimsOptionalArguments =
Expand Down Expand Up @@ -163,9 +163,9 @@ createdEosAccount =
Object.selectionForField "(Maybe String)" "createdEosAccount" [] (Decode.string |> Decode.nullable)


digest : SelectionSet (Maybe Bool) Cambiatus.Object.User
digest : SelectionSet Bool Cambiatus.Object.User
digest =
Object.selectionForField "(Maybe Bool)" "digest" [] (Decode.bool |> Decode.nullable)
Object.selectionForField "Bool" "digest" [] Decode.bool


email : SelectionSet (Maybe String) Cambiatus.Object.User
Expand Down Expand Up @@ -235,9 +235,9 @@ roles object_ =
Object.selectionForCompositeField "roles" [] object_ (identity >> Decode.list)


transferNotification : SelectionSet (Maybe Bool) Cambiatus.Object.User
transferNotification : SelectionSet Bool Cambiatus.Object.User
transferNotification =
Object.selectionForField "(Maybe Bool)" "transferNotification" [] (Decode.bool |> Decode.nullable)
Object.selectionForField "Bool" "transferNotification" [] Decode.bool


type alias TransfersOptionalArguments =
Expand Down
2 changes: 1 addition & 1 deletion src/elm/Form/Toggle.elm
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ view (Options options) viewConfig =
div [ class "flex" ]
[ viewLabel (Options options)
, Html.label
[ class "flex cursor-pointer ml-auto space-x-7"
[ class "flex cursor-pointer ml-auto space-x-7 pl-4"
, for options.id
]
[ viewStatusText (Options options) viewConfig
Expand Down
Loading

0 comments on commit 267b4cd

Please sign in to comment.