Skip to content

Commit

Permalink
LIVE-2540 - Small fixes notification settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
jules-grenier-ledger committed Jun 28, 2022
1 parent 0275226 commit d684f71
Showing 1 changed file with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import React, { useCallback } from "react";
import { Linking } from "react-native";
import { useDispatch, useSelector } from "react-redux";
import { useTranslation } from "react-i18next";
import { capitalize } from "lodash/fp";
import { Box, Switch, Text, Button } from "@ledgerhq/native-ui";
import { SettingsMedium } from "@ledgerhq/native-ui/assets/icons";

import SettingsNavigationScrollView from "../SettingsNavigationScrollView";
import SettingsRow from "../../../components/SettingsRow";
import Track from "../../../analytics/Track";
import { TrackScreen } from "../../../analytics";

import { notificationsSelector } from "../../../reducers/settings";
import { setNotifications } from "../../../actions/settings";
import { useTranslation } from "react-i18next";
import SettingsRow from "../../../components/SettingsRow";
import Track from "../../../analytics/Track";
import { State } from "../../../reducers";
import { Box, Switch, Text, Button } from "@ledgerhq/native-ui";

type NotificationRowProps = {
disabled?: boolean;
Expand All @@ -34,21 +39,23 @@ function NotificationSettingsRow({
}),
);
},
[dispatch],
[dispatch, notificationKey],
);

const capitalizedKey = capitalize(notificationKey);

return (
<SettingsRow
event="TransactionsRow"
event={`${capitalizedKey}Row`}
title={t(`settings.notifications.${notificationKey}.title`)}
desc={t(`settings.notifications.${notificationKey}.desc`)}
label={label}
>
<Track
event={
notifications.transactions
? `Enable${notificationKey}Notifications`
: `Disable${notificationKey}Notifications`
notifications[notificationKey]
? `Enable${capitalizedKey}Notifications`
: `Disable${capitalizedKey}Notifications`
}
onUpdate
/>
Expand All @@ -67,6 +74,8 @@ function NotificationsSettings() {

const disableSubSettings = !notifications.allowed;

const openSettings = useCallback(() => Linking.openSettings(), []);

return (
<SettingsNavigationScrollView>
<TrackScreen category="Settings" name="Notifications" />
Expand All @@ -84,7 +93,13 @@ function NotificationsSettings() {
on your phone, visit your device’s settings to turn on Ledger Live
notifications.
</Text>
<Button type={"main"} mt={6}>
<Button
type={"main"}
mt={6}
onPress={openSettings}
icon={SettingsMedium}
iconPosition={"left"}
>
Go to system settings
</Button>
</Box>
Expand Down

0 comments on commit d684f71

Please sign in to comment.