Username recovery improvements

This commit is contained in:
Fedor Indutny 2024-02-06 10:35:59 -08:00 committed by GitHub
parent a70ae1060d
commit 533a1b32d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 423 additions and 99 deletions

View file

@ -43,6 +43,7 @@ import { StoryViewModeType, StoryViewTargetType } from '../types/Stories';
import { isValidE164 } from './isValidE164';
import { fromWebSafeBase64 } from './webSafeBase64';
import { getConversation } from './getConversation';
import { instance, PhoneNumberFormat } from './libphonenumberInstance';
type SentMediaQualityType = 'standard' | 'high';
type ThemeType = 'light' | 'dark' | 'system';
@ -90,6 +91,7 @@ export type IPCEventsValuesType = {
readReceiptSetting: boolean;
typingIndicatorSetting: boolean;
deviceName: string | undefined;
phoneNumber: string | undefined;
};
export type IPCEventsCallbacksType = {
@ -158,6 +160,7 @@ type ValuesWithSetters = Omit<
| 'readReceiptSetting'
| 'typingIndicatorSetting'
| 'deviceName'
| 'phoneNumber'
// Optional
| 'mediaPermissions'
@ -222,6 +225,11 @@ export function createIPCEvents(
},
getDeviceName: () => window.textsecure.storage.user.getDeviceName(),
getPhoneNumber: () => {
const e164 = window.textsecure.storage.user.getNumber();
const parsedNumber = instance.parse(e164);
return instance.format(parsedNumber, PhoneNumberFormat.INTERNATIONAL);
},
getZoomFactor: () => {
return ipcRenderer.invoke('getZoomFactor');