Messages: Fix local id generation (#2499)
This commit is contained in:
parent
d000a80d35
commit
cf4c199eba
@ -43,6 +43,7 @@ import {
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
DELETED_COMMENTS_CHANNEL_ID,
|
DELETED_COMMENTS_CHANNEL_ID,
|
||||||
|
LOCAL_MESSAGE_MIN_ID,
|
||||||
SERVICE_NOTIFICATIONS_USER_ID,
|
SERVICE_NOTIFICATIONS_USER_ID,
|
||||||
SPONSORED_MESSAGE_CACHE_MS,
|
SPONSORED_MESSAGE_CACHE_MS,
|
||||||
SUPPORTED_AUDIO_CONTENT_TYPES,
|
SUPPORTED_AUDIO_CONTENT_TYPES,
|
||||||
@ -65,8 +66,8 @@ import { getServerTimeOffset } from '../../../util/serverTime';
|
|||||||
const LOCAL_MEDIA_UPLOADING_TEMP_ID = 'temp';
|
const LOCAL_MEDIA_UPLOADING_TEMP_ID = 'temp';
|
||||||
const INPUT_WAVEFORM_LENGTH = 63;
|
const INPUT_WAVEFORM_LENGTH = 63;
|
||||||
|
|
||||||
let localMessageCounter = 0;
|
let localMessageCounter = LOCAL_MESSAGE_MIN_ID;
|
||||||
const getNextLocalMessageId = () => parseFloat(`${Date.now()}.${localMessageCounter++}`);
|
const getNextLocalMessageId = () => ++localMessageCounter;
|
||||||
|
|
||||||
let currentUserId!: string;
|
let currentUserId!: string;
|
||||||
|
|
||||||
|
|||||||
@ -128,7 +128,7 @@ export const MOBILE_SCREEN_MAX_WIDTH = 600; // px
|
|||||||
export const MOBILE_SCREEN_LANDSCAPE_MAX_WIDTH = 950; // px
|
export const MOBILE_SCREEN_LANDSCAPE_MAX_WIDTH = 950; // px
|
||||||
export const MOBILE_SCREEN_LANDSCAPE_MAX_HEIGHT = 450; // px
|
export const MOBILE_SCREEN_LANDSCAPE_MAX_HEIGHT = 450; // px
|
||||||
|
|
||||||
export const LOCAL_MESSAGE_MIN_ID = 1e11; // `Date.now()` is always used as base
|
export const LOCAL_MESSAGE_MIN_ID = 1e11 + 0.1; // Should have fraction part
|
||||||
export const MAX_INT_32 = 2 ** 31 - 1;
|
export const MAX_INT_32 = 2 ** 31 - 1;
|
||||||
export const TMP_CHAT_ID = '0';
|
export const TMP_CHAT_ID = '0';
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user