-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/development-2' into TW-1385-gas-token-send-r…
…eceive # Conflicts: # src/lib/temple/front/client.ts # yarn.lock
- Loading branch information
Showing
41 changed files
with
439 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React, { memo, useCallback, useMemo } from 'react'; | ||
|
||
import { startCase } from 'lodash'; | ||
|
||
import { IconBase } from 'app/atoms'; | ||
import { ReactComponent as LocktimeIcon } from 'app/icons/base/locktime.svg'; | ||
import { NEVER_AUTOLOCK_VALUE } from 'lib/constants'; | ||
import { t } from 'lib/i18n'; | ||
import { formatDuration } from 'lib/i18n/core'; | ||
import { useLockUpTimeout } from 'lib/lock-up'; | ||
import { SearchKey } from 'lib/utils/search-items'; | ||
|
||
import { CellPartProps, NullComponent, SelectWithModal } from '../select-with-modal'; | ||
|
||
import { SecuritySettingsSelectors } from './selectors'; | ||
|
||
interface DurationOption { | ||
value: number; | ||
label: string; | ||
} | ||
|
||
const durationOptionsValues = [Infinity, 60, 5 * 60, 30 * 60, 60 * 60, 5 * 60 * 60]; | ||
const DEFAULT_OPTION_INDEX = 2; | ||
const SEARCH_KEYS: Array<SearchKey<DurationOption, null>> = []; | ||
const durationOptionKeyFn = ({ value }: DurationOption) => value; | ||
|
||
const CellName = ({ option: { label } }: CellPartProps<DurationOption>) => <span>{label}</span>; | ||
const AutoLockIcon = () => <IconBase size={16} Icon={LocktimeIcon} className="text-primary" />; | ||
|
||
export const AutoLockSelect = memo(() => { | ||
const [timeoutDurationMs, setTimeoutDurationMs] = useLockUpTimeout(); | ||
const options = useMemo( | ||
() => | ||
durationOptionsValues.map(value => ({ | ||
value, | ||
label: Number.isFinite(value) ? startCase(formatDuration(value)) : t('never') | ||
})), | ||
[] | ||
); | ||
const value = useMemo( | ||
() => | ||
options.find(({ value }) => | ||
Number.isFinite(value) ? value * 1000 === timeoutDurationMs : timeoutDurationMs === NEVER_AUTOLOCK_VALUE | ||
) ?? options[DEFAULT_OPTION_INDEX], | ||
[options, timeoutDurationMs] | ||
); | ||
const handleAutoLockOptionSelect = useCallback( | ||
({ value }: DurationOption) => setTimeoutDurationMs(Number.isFinite(value) ? value * 1000 : NEVER_AUTOLOCK_VALUE), | ||
[setTimeoutDurationMs] | ||
); | ||
|
||
return ( | ||
<SelectWithModal | ||
title={t('autoLock')} | ||
options={options} | ||
value={value} | ||
searchKeys={SEARCH_KEYS} | ||
keyFn={durationOptionKeyFn} | ||
CellIcon={AutoLockIcon} | ||
ModalCellIcon={NullComponent} | ||
CellName={CellName} | ||
onSelect={handleAutoLockOptionSelect} | ||
testID={SecuritySettingsSelectors.autoLockTimeDropDown} | ||
itemTestID={SecuritySettingsSelectors.autoLockTimeItem} | ||
/> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React, { memo } from 'react'; | ||
|
||
import { AutoLockSelect } from './auto-lock-select'; | ||
import { UsageAnalyticsSettings } from './usage-analytics-settings'; | ||
|
||
export const SecuritySettings = memo(() => ( | ||
<div className="w-full flex flex-col gap-6"> | ||
<AutoLockSelect /> | ||
|
||
<UsageAnalyticsSettings /> | ||
</div> | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum SecuritySettingsSelectors { | ||
autoLockTimeItem = 'Security Settings/Auto Lock Time Item', | ||
autoLockTimeDropDown = 'Security Settings/Auto Lock Time Drop-down', | ||
usageAnalyticsToggle = 'Security Settings/Usage Analytics Toggle' | ||
} |
28 changes: 28 additions & 0 deletions
28
src/app/templates/SecuritySettings/usage-analytics-settings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { memo, useCallback } from 'react'; | ||
|
||
import { useDispatch } from 'react-redux'; | ||
|
||
import { setIsAnalyticsEnabledAction } from 'app/store/settings/actions'; | ||
import { useAnalyticsEnabledSelector } from 'app/store/settings/selectors'; | ||
import { T } from 'lib/i18n'; | ||
|
||
import { EnablingSetting } from '../enabling-setting'; | ||
|
||
import { SecuritySettingsSelectors } from './selectors'; | ||
|
||
export const UsageAnalyticsSettings = memo(() => { | ||
const dispatch = useDispatch(); | ||
const enabled = useAnalyticsEnabledSelector(); | ||
|
||
const handleSwitch = useCallback((newValue: boolean) => dispatch(setIsAnalyticsEnabledAction(newValue)), [dispatch]); | ||
|
||
return ( | ||
<EnablingSetting | ||
title={<T id="usageAnalytics" />} | ||
enabled={enabled} | ||
description={<T id="usageAnalyticsSettingsDescription" />} | ||
onChange={handleSwitch} | ||
testID={SecuritySettingsSelectors.usageAnalyticsToggle} | ||
/> | ||
); | ||
}); |
3 changes: 1 addition & 2 deletions
3
src/app/templates/SettingsGeneral/components/fiat-currency-select/currency-icon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
export enum SettingsGeneralSelectors { | ||
languageitem = 'Settings General/Language Item', | ||
languageItem = 'Settings General/Language Item', | ||
languageDropDown = 'Settings General/Language Drop-down', | ||
currencyItem = 'Settings General/Currency Item', | ||
currenctyDropDown = 'Settings General/Currency Drop-down', | ||
currencyDropDown = 'Settings General/Currency Drop-down', | ||
popUpCheckBox = 'Setting General/Pop-up Check Box', | ||
extensionLockUpCheckBox = 'Setting General/Extension Lock-up Check Box', | ||
anonymousAnalyticsCheckBox = 'Setting General/Anonymous Analytics Check Box', | ||
notificationCheckBox = 'Setting General/Notification Check Box' | ||
notificationCheckBox = 'Setting General/Notification Check Box', | ||
partnersPromotion = 'Setting General/Partners Promotion Check Box' | ||
} |
Oops, something went wrong.