This commit is contained in:
Eduard Kuzmenko 2022-05-25 21:20:20 +03:00
parent 70c27d3071
commit b43b7c4663
1 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,58 @@
/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { PrivacyType } from "../../../../lib/appManagers/appPrivacyManager";
import { SliderSuperTabEventable } from "../../../sliderTab";
import PrivacySection from "../../../privacySection";
import { i18n, LangPackKey } from "../../../../lib/langPack";
import anchorCopy from "../../../../helpers/dom/anchorCopy";
import appUsersManager from "../../../../lib/appManagers/appUsersManager";
export default class AppPrivacyPhoneNumberTab extends SliderSuperTabEventable {
protected init() {
this.header.classList.add('with-border');
this.container.classList.add('privacy-tab', 'privacy-phone-number');
this.setTitle('PrivacyPhone');
const formatted = '+' + appUsersManager.getSelf().phone;
const captionEl = document.createElement('div');
captionEl.append(
i18n('PrivacyPhoneInfo'),
document.createElement('br'),
document.createElement('br'),
i18n('PrivacyPhoneInfo4'),
document.createElement('br'),
anchorCopy({
mePath: formatted
})
);
const phoneSection = new PrivacySection({
tab: this,
title: 'PrivacyPhoneTitle',
inputKey: 'inputPrivacyKeyPhoneNumber',
captions: [captionEl, captionEl, ''],
exceptionTexts: ['PrivacySettingsController.NeverShare', 'PrivacySettingsController.AlwaysShare'],
appendTo: this.scrollable,
onRadioChange: (type) => {
s.setRadio(PrivacyType.Everybody);
s.radioSection.container.classList.toggle('hide', type !== PrivacyType.Nobody);
}
});
const sCaption: LangPackKey = 'PrivacyPhoneInfo3';
const s = new PrivacySection({
tab: this,
title: 'PrivacyPhoneTitle2',
inputKey: 'inputPrivacyKeyAddedByPhone',
captions: [sCaption, sCaption, ''],
noExceptions: true,
skipTypes: [PrivacyType.Nobody]
});
this.scrollable.container.insertBefore(s.radioSection.container, phoneSection.radioSection.container.nextSibling);
}
}