Add confirm modal when setting pnp to not discoverable
This commit is contained in:
parent
f29fc7cf9d
commit
79035f5570
2 changed files with 54 additions and 1 deletions
|
@ -6078,6 +6078,14 @@
|
|||
"messageformat": "Nobody",
|
||||
"description": "Option for letting nobody discover you by phone number"
|
||||
},
|
||||
"icu:Preferences__pnp__discoverability__nobody__confirmModal__title": {
|
||||
"messageformat": "Are you sure?",
|
||||
"description": "Title for the confirmation modal when turning the phone number discoverability setting to nobody"
|
||||
},
|
||||
"icu:Preferences__pnp__discoverability__nobody__confirmModal__description": {
|
||||
"messageformat": "If you change “{settingTitle}” to “{nobodyLabel}” it will make it harder for people to find you on Signal.",
|
||||
"description": "Description for the confirmation modal when turning the phone number discoverability setting to nobody"
|
||||
},
|
||||
"icu:Preferences--messaging": {
|
||||
"messageformat": "Messaging",
|
||||
"description": "Title for the messaging settings"
|
||||
|
|
|
@ -363,6 +363,8 @@ export function Preferences({
|
|||
>(localeOverride);
|
||||
const [languageSearchInput, setLanguageSearchInput] = useState('');
|
||||
const [toast, setToast] = useState<AnyToast | undefined>();
|
||||
const [confirmPnpNotDiscoverable, setConfirmPnpNoDiscoverable] =
|
||||
useState(false);
|
||||
|
||||
function closeLanguageDialog() {
|
||||
setLanguageDialog(null);
|
||||
|
@ -1484,7 +1486,13 @@ export function Preferences({
|
|||
title={i18n('icu:Preferences__pnp__discoverability--title')}
|
||||
>
|
||||
<SettingsRadio
|
||||
onChange={onWhoCanFindMeChange}
|
||||
onChange={value => {
|
||||
if (value === PhoneNumberDiscoverability.NotDiscoverable) {
|
||||
setConfirmPnpNoDiscoverable(true);
|
||||
} else {
|
||||
onWhoCanFindMeChange(value);
|
||||
}
|
||||
}}
|
||||
options={[
|
||||
{
|
||||
text: i18n('icu:Preferences__pnp__discoverability__everyone'),
|
||||
|
@ -1515,6 +1523,43 @@ export function Preferences({
|
|||
</div>
|
||||
</div>
|
||||
</SettingsRow>
|
||||
{confirmPnpNotDiscoverable && (
|
||||
<ConfirmationDialog
|
||||
i18n={i18n}
|
||||
title={i18n(
|
||||
'icu:Preferences__pnp__discoverability__nobody__confirmModal__title'
|
||||
)}
|
||||
dialogName="Preference.turnPnpDiscoveryOff"
|
||||
onClose={() => {
|
||||
setConfirmPnpNoDiscoverable(false);
|
||||
}}
|
||||
actions={[
|
||||
{
|
||||
action: () =>
|
||||
onWhoCanFindMeChange(
|
||||
PhoneNumberDiscoverability.NotDiscoverable
|
||||
),
|
||||
style: 'affirmative',
|
||||
text: i18n('icu:ok'),
|
||||
},
|
||||
]}
|
||||
>
|
||||
{i18n(
|
||||
'icu:Preferences__pnp__discoverability__nobody__confirmModal__description',
|
||||
{
|
||||
// This is a rare instance where we want to interpolate the exact
|
||||
// text of the string into quotes in the translation as an
|
||||
// explanation.
|
||||
settingTitle: i18n(
|
||||
'icu:Preferences__pnp__discoverability--title'
|
||||
),
|
||||
nobodyLabel: i18n(
|
||||
'icu:Preferences__pnp__discoverability__nobody'
|
||||
),
|
||||
}
|
||||
)}
|
||||
</ConfirmationDialog>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue