Browse Source

Better monospace text

master
Eduard Kuzmenko 3 years ago
parent
commit
3d6c42432e
  1. 2
      src/components/appMediaPlaybackController.ts
  2. 2
      src/components/appMediaViewer.ts
  3. 4
      src/components/appMediaViewerBase.ts
  4. 2
      src/components/appMediaViewerNew.ts
  5. 2
      src/components/appNavigationController.ts
  6. 4
      src/components/appSearchSuper..ts
  7. 2
      src/components/appSelectPeers.ts
  8. 4
      src/components/audio.ts
  9. 2
      src/components/avatar.ts
  10. 2
      src/components/button.ts
  11. 4
      src/components/buttonMenu.ts
  12. 2
      src/components/buttonMenuToggle.ts
  13. 2
      src/components/call/button.ts
  14. 2
      src/components/chat/audio.ts
  15. 8
      src/components/chat/bubbles.ts
  16. 2
      src/components/chat/chat.ts
  17. 2
      src/components/chat/contextMenu.ts
  18. 2
      src/components/chat/input.ts
  19. 2
      src/components/chat/markupTooltip.ts
  20. 4
      src/components/chat/pinnedContainer.ts
  21. 2
      src/components/chat/pinnedMessage.ts
  22. 2
      src/components/chat/replies.ts
  23. 2
      src/components/chat/replyKeyboard.ts
  24. 4
      src/components/chat/search.ts
  25. 2
      src/components/chat/selection.ts
  26. 2
      src/components/chat/sendContextMenu.ts
  27. 2
      src/components/chat/topbar.ts
  28. 2
      src/components/checkboxField.ts
  29. 2
      src/components/connectionStatus.ts
  30. 4
      src/components/emoticonsDropdown/index.ts
  31. 4
      src/components/emoticonsDropdown/tabs/emoji.ts
  32. 2
      src/components/gifsMasonry.ts
  33. 2
      src/components/groupCall/participants.ts
  34. 7
      src/components/languageChangeButton.ts
  35. 2
      src/components/misc.ts
  36. 2
      src/components/passwordInputField.ts
  37. 2
      src/components/peerProfileAvatars.ts
  38. 4
      src/components/poll.ts
  39. 2
      src/components/popups/createPoll.ts
  40. 4
      src/components/popups/index.ts
  41. 2
      src/components/preloader.ts
  42. 4
      src/components/ripple.ts
  43. 2
      src/components/row.ts
  44. 2
      src/components/scrollable.ts
  45. 2
      src/components/sidebarLeft/index.ts
  46. 2
      src/components/sidebarLeft/tabs/2fa/email.ts
  47. 2
      src/components/sidebarLeft/tabs/2fa/enterPassword.ts
  48. 2
      src/components/sidebarLeft/tabs/2fa/hint.ts
  49. 2
      src/components/sidebarLeft/tabs/2fa/reEnterPassword.ts
  50. 2
      src/components/sidebarLeft/tabs/background.ts
  51. 2
      src/components/sidebarLeft/tabs/chatFolders.ts
  52. 2
      src/components/sidebarRight/tabs/pollResults.ts
  53. 2
      src/components/swipeHandler.ts
  54. 2
      src/components/topbarCall.ts
  55. 4
      src/components/transition.ts
  56. 4
      src/components/wrappers.ts
  57. 2
      src/helpers/animation.ts
  58. 4
      src/helpers/cancellablePromise.ts
  59. 2
      src/helpers/dom/anchorCopy.ts
  60. 2
      src/helpers/dom/attachListNavigation.ts
  61. 2
      src/helpers/dom/cancelEvent.ts
  62. 2
      src/helpers/dom/handleHorizontalSwipe.ts
  63. 59
      src/helpers/dom/loadFonts.ts
  64. 2
      src/helpers/dom/lockTouchScroll.ts
  65. 18
      src/helpers/dom/toggleAttributePolyfill.ts
  66. 2
      src/helpers/files.ts
  67. 2
      src/helpers/heavyQueue.ts
  68. 8
      src/helpers/schedulers/pause.ts
  69. 2
      src/helpers/sequentialDom.ts
  70. 20
      src/helpers/setWorkerProxy.ts
  71. 4
      src/hooks/useHeavyAnimationCheck.ts
  72. 565
      src/index.ts
  73. 2
      src/lib/appManagers/appDialogsManager.ts
  74. 2
      src/lib/appManagers/appDownloadManager.ts
  75. 4
      src/lib/appManagers/appImManager.ts
  76. 2
      src/lib/appManagers/appMessagesManager.ts
  77. 2
      src/lib/appManagers/appNotificationsManager.ts
  78. 2
      src/lib/appManagers/appUsersManager.ts
  79. 2
      src/lib/mediaPlayer.ts
  80. 2
      src/lib/mtproto/apiFileManager.ts
  81. 4
      src/lib/mtproto/apiManager.ts
  82. 2
      src/lib/mtproto/mtprotoworker.ts
  83. 4
      src/lib/mtproto/networker.ts
  84. 4
      src/lib/mtproto/transports/controller.ts
  85. 2
      src/lib/mtproto/transports/http.ts
  86. 2
      src/lib/rlottie/lottieLoader.ts
  87. 1
      src/lib/rootScope.ts
  88. 2
      src/lib/serviceWorker/cache.ts
  89. 2
      src/lib/serviceWorker/stream.ts
  90. 2
      src/lib/storage.ts
  91. 2
      src/lib/webp/webpWorkerController.ts
  92. 6
      src/pages/pageIm.ts
  93. 2
      src/pages/pagePassword.ts
  94. 4
      src/pages/pageSignIn.ts
  95. 2
      src/pages/pageSignQR.ts

2
src/components/appMediaPlaybackController.ts

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
import rootScope from "../lib/rootScope";
import appMessagesManager from "../lib/appManagers/appMessagesManager";
import appDocsManager, {MyDocument} from "../lib/appManagers/appDocsManager";
import { CancellablePromise, deferredPromise } from "../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../helpers/cancellablePromise";
import { IS_APPLE, IS_SAFARI } from "../environment/userAgent";
import { MOUNT_CLASS_TO } from "../config/debug";
import appDownloadManager from "../lib/appManagers/appDownloadManager";

2
src/components/appMediaViewer.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import MEDIA_MIME_TYPES_SUPPORTED from "../environment/mediaMimeTypesSupport";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent";
import setInnerHTML from "../helpers/dom/setInnerHTML";
import mediaSizes from "../helpers/mediaSizes";

4
src/components/appMediaViewerBase.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { deferredPromise } from "../helpers/cancellablePromise";
import deferredPromise from "../helpers/cancellablePromise";
import mediaSizes from "../helpers/mediaSizes";
import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import { IS_MOBILE_SAFARI, IS_SAFARI } from "../environment/userAgent";
@ -29,7 +29,7 @@ import findUpClassName from "../helpers/dom/findUpClassName"; @@ -29,7 +29,7 @@ import findUpClassName from "../helpers/dom/findUpClassName";
import renderImageFromUrl, { renderImageFromUrlPromise } from "../helpers/dom/renderImageFromUrl";
import getVisibleRect from "../helpers/dom/getVisibleRect";
import appDownloadManager from "../lib/appManagers/appDownloadManager";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import fillPropertyValue from "../helpers/fillPropertyValue";
import generatePathData from "../helpers/generatePathData";
import replaceContent from "../helpers/dom/replaceContent";

2
src/components/appMediaViewerNew.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
// import { deferredPromise } from "../helpers/cancellablePromise";
// import deferredPromise from "../helpers/cancellablePromise";
// import mediaSizes from "../helpers/mediaSizes";
// import { isTouchSupported } from "../helpers/touchSupport";
// import { isSafari } from "../helpers/userAgent";

2
src/components/appNavigationController.ts

@ -8,7 +8,7 @@ import { MOUNT_CLASS_TO } from "../config/debug"; @@ -8,7 +8,7 @@ import { MOUNT_CLASS_TO } from "../config/debug";
import { IS_MOBILE_SAFARI } from "../environment/userAgent";
import { logger } from "../lib/logger";
import blurActiveElement from "../helpers/dom/blurActiveElement";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import isSwipingBackSafari from "../helpers/dom/isSwipingBackSafari";
import indexOfAndSplice from "../helpers/array/indexOfAndSplice";

4
src/components/appSearchSuper..ts

@ -18,7 +18,7 @@ import { SearchGroup, SearchGroupType } from "./appSearch"; @@ -18,7 +18,7 @@ import { SearchGroup, SearchGroupType } from "./appSearch";
import { horizontalMenu } from "./horizontalMenu";
import LazyLoadQueue from "./lazyLoadQueue";
import { attachContextMenuListener, openBtnMenu, positionMenu, putPreloader } from "./misc";
import { ripple } from "./ripple";
import ripple from "./ripple";
import Scrollable, { ScrollableX } from "./scrollable";
import { wrapDocument, wrapPhoto, wrapVideo } from "./wrappers";
import useHeavyAnimationCheck, { getHeavyAnimationPromise } from "../hooks/useHeavyAnimationCheck";
@ -44,7 +44,7 @@ import PopupDeleteMessages from "./popups/deleteMessages"; @@ -44,7 +44,7 @@ import PopupDeleteMessages from "./popups/deleteMessages";
import Row from "./row";
import htmlToDocumentFragment from "../helpers/dom/htmlToDocumentFragment";
import { SearchSelection } from "./chat/selection";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent, simulateClickEvent } from "../helpers/dom/clickEvent";
import { MyDocument } from "../lib/appManagers/appDocsManager";
import AppMediaViewer from "./appMediaViewer";

2
src/components/appSelectPeers.ts

@ -17,7 +17,7 @@ import { i18n, LangPackKey, _i18n } from "../lib/langPack"; @@ -17,7 +17,7 @@ import { i18n, LangPackKey, _i18n } from "../lib/langPack";
import findUpAttribute from "../helpers/dom/findUpAttribute";
import findUpClassName from "../helpers/dom/findUpClassName";
import PeerTitle from "./peerTitle";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import replaceContent from "../helpers/dom/replaceContent";
import debounce from "../helpers/schedulers/debounce";
import windowSize from "../helpers/windowSize";

4
src/components/audio.ts

@ -15,10 +15,10 @@ import { IS_SAFARI } from "../environment/userAgent"; @@ -15,10 +15,10 @@ import { IS_SAFARI } from "../environment/userAgent";
import appMessagesManager from "../lib/appManagers/appMessagesManager";
import rootScope from "../lib/rootScope";
import './middleEllipsis';
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent } from "../helpers/dom/clickEvent";
import LazyLoadQueue from "./lazyLoadQueue";
import { CancellablePromise, deferredPromise } from "../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../helpers/cancellablePromise";
import ListenerSetter, { Listener } from "../helpers/listenerSetter";
import noop from "../helpers/noop";
import findUpClassName from "../helpers/dom/findUpClassName";

2
src/components/avatar.ts

@ -12,7 +12,7 @@ import appPeersManager from "../lib/appManagers/appPeersManager"; @@ -12,7 +12,7 @@ import appPeersManager from "../lib/appManagers/appPeersManager";
import appPhotosManager from "../lib/appManagers/appPhotosManager";
import type { LazyLoadQueueIntersector } from "./lazyLoadQueue";
import { attachClickEvent } from "../helpers/dom/clickEvent";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import appAvatarsManager from "../lib/appManagers/appAvatarsManager";
import AppMediaViewer from "./appMediaViewer";
import AppMediaViewerAvatar from "./appMediaViewerAvatar";

2
src/components/button.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import { i18n, LangPackKey } from "../lib/langPack";
import { ripple } from "./ripple";
import ripple from "./ripple";
export type ButtonOptions = Partial<{
noRipple: true,

4
src/components/buttonMenu.ts

@ -4,13 +4,13 @@ @@ -4,13 +4,13 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { AttachClickOptions, attachClickEvent, CLICK_EVENT_NAME } from "../helpers/dom/clickEvent";
import ListenerSetter from "../helpers/listenerSetter";
import { FormatterArguments, i18n, LangPackKey } from "../lib/langPack";
import CheckboxField from "./checkboxField";
import { closeBtnMenu } from "./misc";
import { ripple } from "./ripple";
import ripple from "./ripple";
export type ButtonMenuItemOptions = {
icon?: string,

2
src/components/buttonMenuToggle.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { AttachClickOptions, CLICK_EVENT_NAME } from "../helpers/dom/clickEvent";
import ListenerSetter from "../helpers/listenerSetter";
import ButtonIcon from "./buttonIcon";

2
src/components/call/button.ts

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
import { attachClickEvent } from "../../helpers/dom/clickEvent";
import ListenerSetter from "../../helpers/listenerSetter";
import { i18n, LangPackKey } from "../../lib/langPack";
import { ripple } from "../ripple";
import ripple from "../ripple";
export default function makeButton(className: string, listenerSetter: ListenerSetter, options: {
text?: LangPackKey | HTMLElement,

2
src/components/chat/audio.ts

@ -11,7 +11,7 @@ import appMediaPlaybackController, { AppMediaPlaybackController } from "../appMe @@ -11,7 +11,7 @@ import appMediaPlaybackController, { AppMediaPlaybackController } from "../appMe
import DivAndCaption from "../divAndCaption";
import PinnedContainer from "./pinnedContainer";
import Chat from "./chat";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../helpers/dom/clickEvent";
import replaceContent from "../../helpers/dom/replaceContent";
import PeerTitle from "../peerTitle";

8
src/components/chat/bubbles.ts

@ -34,7 +34,7 @@ import mediaSizes from "../../helpers/mediaSizes"; @@ -34,7 +34,7 @@ import mediaSizes from "../../helpers/mediaSizes";
import { IS_ANDROID, IS_APPLE, IS_MOBILE, IS_SAFARI } from "../../environment/userAgent";
import I18n, { FormatterArguments, i18n, langPack, LangPackKey, UNSUPPORTED_LANG_PACK_KEY, _i18n } from "../../lib/langPack";
import AvatarElement from "../avatar";
import { ripple } from "../ripple";
import ripple from "../ripple";
import { wrapAlbum, wrapPhoto, wrapVideo, wrapDocument, wrapSticker, wrapPoll, wrapGroupedDocuments } from "../wrappers";
import { MessageRender } from "./messageRender";
import LazyLoadQueue from "../lazyLoadQueue";
@ -46,7 +46,7 @@ import { NULL_PEER_ID, REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config" @@ -46,7 +46,7 @@ import { NULL_PEER_ID, REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config"
import { FocusDirection, ScrollStartCallbackDimensions } from "../../helpers/fastSmoothScroll";
import useHeavyAnimationCheck, { getHeavyAnimationPromise, dispatchHeavyAnimationEvent, interruptHeavyAnimation } from "../../hooks/useHeavyAnimationCheck";
import { fastRaf, fastRafPromise } from "../../helpers/schedulers";
import { deferredPromise } from "../../helpers/cancellablePromise";
import deferredPromise from "../../helpers/cancellablePromise";
import RepliesElement from "./replies";
import DEBUG from "../../config/debug";
import { SliceEnd } from "../../helpers/slicedArray";
@ -57,7 +57,7 @@ import findUpTag from "../../helpers/dom/findUpTag"; @@ -57,7 +57,7 @@ import findUpTag from "../../helpers/dom/findUpTag";
import { toast } from "../toast";
import { getElementByPoint } from "../../helpers/dom/getElementByPoint";
import { getMiddleware } from "../../helpers/middleware";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { attachClickEvent, simulateClickEvent } from "../../helpers/dom/clickEvent";
import htmlToDocumentFragment from "../../helpers/dom/htmlToDocumentFragment";
import positionElementByIndex from "../../helpers/dom/positionElementByIndex";
@ -89,7 +89,7 @@ import ReactionsElement, { REACTIONS_ELEMENTS } from "./reactions"; @@ -89,7 +89,7 @@ import ReactionsElement, { REACTIONS_ELEMENTS } from "./reactions";
import type ReactionElement from "./reaction";
import type { AppReactionsManager } from "../../lib/appManagers/appReactionsManager";
import RLottiePlayer from "../../lib/rlottie/rlottiePlayer";
import { pause } from "../../helpers/schedulers/pause";
import pause from "../../helpers/schedulers/pause";
import ScrollSaver from "../../helpers/scrollSaver";
import getObjectKeysAndSort from "../../helpers/object/getObjectKeysAndSort";
import forEachReverse from "../../helpers/array/forEachReverse";

2
src/components/chat/chat.ts

@ -44,7 +44,7 @@ import { IS_TOUCH_SUPPORTED } from "../../environment/touchSupport"; @@ -44,7 +44,7 @@ import { IS_TOUCH_SUPPORTED } from "../../environment/touchSupport";
import getAutoDownloadSettingsByPeerId, { ChatAutoDownloadSettings } from "../../helpers/autoDownload";
import ChatBackgroundGradientRenderer from "./gradientRenderer";
import ChatBackgroundPatternRenderer from "./patternRenderer";
import { pause } from "../../helpers/schedulers/pause";
import pause from "../../helpers/schedulers/pause";
export type ChatType = 'chat' | 'pinned' | 'replies' | 'discussion' | 'scheduled';

2
src/components/chat/contextMenu.ts

@ -22,7 +22,7 @@ import PopupSendNow from "../popups/sendNow"; @@ -22,7 +22,7 @@ import PopupSendNow from "../popups/sendNow";
import { toast } from "../toast";
import I18n, { i18n, LangPackKey } from "../../lib/langPack";
import findUpClassName from "../../helpers/dom/findUpClassName";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { attachClickEvent, simulateClickEvent } from "../../helpers/dom/clickEvent";
import isSelectionEmpty from "../../helpers/dom/isSelectionEmpty";
import { Message, Poll, Chat as MTChat, MessageMedia, AvailableReaction } from "../../layer";

2
src/components/chat/input.ts

@ -50,7 +50,7 @@ import { generateTail } from './bubbles'; @@ -50,7 +50,7 @@ import { generateTail } from './bubbles';
import findUpClassName from '../../helpers/dom/findUpClassName';
import ButtonCorner from '../buttonCorner';
import blurActiveElement from '../../helpers/dom/blurActiveElement';
import { cancelEvent } from '../../helpers/dom/cancelEvent';
import cancelEvent from '../../helpers/dom/cancelEvent';
import cancelSelection from '../../helpers/dom/cancelSelection';
import { attachClickEvent, simulateClickEvent } from '../../helpers/dom/clickEvent';
import getRichValue from '../../helpers/dom/getRichValue';

2
src/components/chat/markupTooltip.ts

@ -11,7 +11,7 @@ import { IS_TOUCH_SUPPORTED } from "../../environment/touchSupport"; @@ -11,7 +11,7 @@ import { IS_TOUCH_SUPPORTED } from "../../environment/touchSupport";
import { IS_APPLE, IS_MOBILE } from "../../environment/userAgent";
import appNavigationController from "../appNavigationController";
import { _i18n } from "../../lib/langPack";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../helpers/dom/clickEvent";
import getSelectedNodes from "../../helpers/dom/getSelectedNodes";
import isSelectionEmpty from "../../helpers/dom/isSelectionEmpty";

4
src/components/chat/pinnedContainer.ts

@ -8,9 +8,9 @@ import type Chat from "./chat"; @@ -8,9 +8,9 @@ import type Chat from "./chat";
import type ChatTopbar from "./topbar";
import mediaSizes from "../../helpers/mediaSizes";
import DivAndCaption from "../divAndCaption";
import { ripple } from "../ripple";
import ripple from "../ripple";
import ListenerSetter from "../../helpers/listenerSetter";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../helpers/dom/clickEvent";
import { Message } from "../../layer";
import safeAssign from "../../helpers/object/safeAssign";

2
src/components/chat/pinnedMessage.ts

@ -17,7 +17,7 @@ import ListenerSetter from "../../helpers/listenerSetter"; @@ -17,7 +17,7 @@ import ListenerSetter from "../../helpers/listenerSetter";
import ButtonIcon from "../buttonIcon";
import { getHeavyAnimationPromise } from "../../hooks/useHeavyAnimationCheck";
import { i18n } from "../../lib/langPack";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../helpers/dom/clickEvent";
import handleScrollSideEvent from "../../helpers/dom/handleScrollSideEvent";
import debounce from "../../helpers/schedulers/debounce";

2
src/components/chat/replies.ts

@ -9,7 +9,7 @@ import { Message } from "../../layer"; @@ -9,7 +9,7 @@ import { Message } from "../../layer";
import appMessagesManager from "../../lib/appManagers/appMessagesManager";
import appPeersManager from "../../lib/appManagers/appPeersManager";
import rootScope from "../../lib/rootScope";
import { ripple } from "../ripple";
import ripple from "../ripple";
import I18n from "../../lib/langPack";
import replaceContent from "../../helpers/dom/replaceContent";
import StackedAvatars from "../stackedAvatars";

2
src/components/chat/replyKeyboard.ts

@ -14,7 +14,7 @@ import ListenerSetter, { Listener } from "../../helpers/listenerSetter"; @@ -14,7 +14,7 @@ import ListenerSetter, { Listener } from "../../helpers/listenerSetter";
import findUpClassName from "../../helpers/dom/findUpClassName";
import { IS_TOUCH_SUPPORTED } from "../../environment/touchSupport";
import findUpAsChild from "../../helpers/dom/findUpAsChild";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { getHeavyAnimationPromise } from "../../hooks/useHeavyAnimationCheck";
import confirmationPopup from "../confirmationPopup";
import safeAssign from "../../helpers/object/safeAssign";

4
src/components/chat/search.ts

@ -7,11 +7,11 @@ @@ -7,11 +7,11 @@
import type ChatTopbar from "./topbar";
import AppSearch, { SearchGroup } from "../appSearch";
import PopupDatePicker from "../popups/datePicker";
import { ripple } from "../ripple";
import ripple from "../ripple";
import InputSearch from "../inputSearch";
import type Chat from "./chat";
import findUpTag from "../../helpers/dom/findUpTag";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import whichChild from "../../helpers/dom/whichChild";
import replaceContent from "../../helpers/dom/replaceContent";
import { i18n } from "../../lib/langPack";

2
src/components/chat/selection.ts

@ -23,7 +23,7 @@ import { IS_MOBILE_SAFARI } from "../../environment/userAgent"; @@ -23,7 +23,7 @@ import { IS_MOBILE_SAFARI } from "../../environment/userAgent";
import I18n, { i18n, _i18n } from "../../lib/langPack";
import findUpClassName from "../../helpers/dom/findUpClassName";
import blurActiveElement from "../../helpers/dom/blurActiveElement";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import cancelSelection from "../../helpers/dom/cancelSelection";
import getSelectedText from "../../helpers/dom/getSelectedText";
import rootScope from "../../lib/rootScope";

2
src/components/chat/sendContextMenu.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import ListenerSetter from "../../helpers/listenerSetter";
import rootScope from "../../lib/rootScope";
import ButtonMenu, { ButtonMenuItemOptions } from "../buttonMenu";

2
src/components/chat/topbar.ts

@ -33,7 +33,7 @@ import PeerTitle from "../peerTitle"; @@ -33,7 +33,7 @@ import PeerTitle from "../peerTitle";
import { i18n } from "../../lib/langPack";
import findUpClassName from "../../helpers/dom/findUpClassName";
import blurActiveElement from "../../helpers/dom/blurActiveElement";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../helpers/dom/clickEvent";
import findUpTag from "../../helpers/dom/findUpTag";
import { toast, toastNew } from "../toast";

2
src/components/checkboxField.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import appStateManager from "../lib/appManagers/appStateManager";
import { ripple } from "./ripple";
import ripple from "./ripple";
import { LangPackKey, _i18n } from "../lib/langPack";
import getDeepProperty from "../helpers/object/getDeepProperty";

2
src/components/connectionStatus.ts

@ -16,7 +16,7 @@ import ProgressivePreloader from "./preloader"; @@ -16,7 +16,7 @@ import ProgressivePreloader from "./preloader";
import SetTransition from "./singleTransition";
import sessionStorage from '../lib/sessionStorage';
import { ConnectionStatus } from "../lib/mtproto/connectionStatus";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import apiManager from "../lib/mtproto/mtprotoworker";
import { attachClickEvent } from "../helpers/dom/clickEvent";

4
src/components/emoticonsDropdown/index.ts

@ -23,9 +23,9 @@ import findUpClassName from "../../helpers/dom/findUpClassName"; @@ -23,9 +23,9 @@ import findUpClassName from "../../helpers/dom/findUpClassName";
import findUpTag from "../../helpers/dom/findUpTag";
import blurActiveElement from "../../helpers/dom/blurActiveElement";
import whichChild from "../../helpers/dom/whichChild";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import DropdownHover from "../../helpers/dropdownHover";
import { pause } from "../../helpers/schedulers/pause";
import pause from "../../helpers/schedulers/pause";
import appMessagesManager from "../../lib/appManagers/appMessagesManager";
import { IS_APPLE_MOBILE } from "../../environment/userAgent";

4
src/components/emoticonsDropdown/tabs/emoji.ts

@ -5,10 +5,10 @@ @@ -5,10 +5,10 @@
*/
import emoticonsDropdown, { EmoticonsDropdown, EmoticonsTab } from "..";
import { cancelEvent } from "../../../helpers/dom/cancelEvent";
import cancelEvent from "../../../helpers/dom/cancelEvent";
import findUpClassName from "../../../helpers/dom/findUpClassName";
import { fastRaf } from "../../../helpers/schedulers";
import { pause } from "../../../helpers/schedulers/pause";
import pause from "../../../helpers/schedulers/pause";
import appEmojiManager from "../../../lib/appManagers/appEmojiManager";
import appImManager from "../../../lib/appManagers/appImManager";
import { i18n, LangPackKey } from "../../../lib/langPack";

2
src/components/gifsMasonry.ts

@ -9,7 +9,7 @@ import { wrapVideo } from "./wrappers"; @@ -9,7 +9,7 @@ import { wrapVideo } from "./wrappers";
import { LazyLoadQueueRepeat2 } from "./lazyLoadQueue";
import animationIntersector from "./animationIntersector";
import Scrollable from "./scrollable";
import { CancellablePromise, deferredPromise } from "../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../helpers/cancellablePromise";
import renderImageFromUrl from "../helpers/dom/renderImageFromUrl";
import calcImageInBox from "../helpers/calcImageInBox";
import { doubleRaf } from "../helpers/schedulers";

2
src/components/groupCall/participants.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import PopupGroupCall from ".";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import findUpClassName from "../../helpers/dom/findUpClassName";
import { addFullScreenListener, isFullScreen } from "../../helpers/dom/fullScreen";
import ListenerSetter from "../../helpers/listenerSetter";

7
src/components/languageChangeButton.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent } from "../helpers/dom/clickEvent";
import loadFonts from "../helpers/dom/loadFonts";
import { Config, LangPackDifference, LangPackString } from "../layer";
@ -53,9 +53,10 @@ export default function getLanguageChangeButton(appendTo: HTMLElement) { @@ -53,9 +53,10 @@ export default function getLanguageChangeButton(appendTo: HTMLElement) {
I18n.strings.set(string.key as LangPackKey, string);
});
const btnChangeLanguage = Button('btn-primary btn-secondary btn-primary-transparent primary', {text: 'Login.ContinueOnLanguage'});
const key: LangPackKey = 'Login.ContinueOnLanguage';
const btnChangeLanguage = Button('btn-primary btn-secondary btn-primary-transparent primary', {text: key});
btnChangeLanguage.lastElementChild.classList.remove('i18n'); // prevent changing language
loadFonts().then(() => {
loadFonts({text: [I18n.format(key, true)]}).then(() => {
window.requestAnimationFrame(() => {
appendTo.append(btnChangeLanguage);
});

2
src/components/misc.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import { MOUNT_CLASS_TO } from "../config/debug";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { CLICK_EVENT_NAME } from "../helpers/dom/clickEvent";
import ListenerSetter from "../helpers/listenerSetter";
import mediaSizes from "../helpers/mediaSizes";

2
src/components/passwordInputField.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
// import { IS_MOBILE_SAFARI, IS_SAFARI } from "../environment/userAgent";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import InputField, { InputFieldOptions } from "./inputField";
export default class PasswordInputField extends InputField {

2
src/components/peerProfileAvatars.ts

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
import IS_PARALLAX_SUPPORTED from "../environment/parallaxSupport";
import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import findAndSplice from "../helpers/array/findAndSplice";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent } from "../helpers/dom/clickEvent";
import filterChatPhotosMessages from "../helpers/filterChatPhotosMessages";
import ListenerSetter from "../helpers/listenerSetter";

4
src/components/poll.ts

@ -11,14 +11,14 @@ import appPollsManager from "../lib/appManagers/appPollsManager"; @@ -11,14 +11,14 @@ import appPollsManager from "../lib/appManagers/appPollsManager";
import serverTimeManager from "../lib/mtproto/serverTimeManager";
import { RichTextProcessor } from "../lib/richtextprocessor";
import rootScope from "../lib/rootScope";
import { ripple } from "./ripple";
import ripple from "./ripple";
import appSidebarRight from "./sidebarRight";
import AppPollResultsTab from "./sidebarRight/tabs/pollResults";
import { i18n, LangPackKey } from "../lib/langPack";
import { fastRaf } from "../helpers/schedulers";
import SetTransition from "./singleTransition";
import findUpClassName from "../helpers/dom/findUpClassName";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent";
import replaceContent from "../helpers/dom/replaceContent";
import windowSize from "../helpers/windowSize";

2
src/components/popups/createPoll.ts

@ -13,7 +13,7 @@ import Scrollable from "../scrollable"; @@ -13,7 +13,7 @@ import Scrollable from "../scrollable";
import SendContextMenu from "../chat/sendContextMenu";
import I18n, { _i18n } from "../../lib/langPack";
import findUpTag from "../../helpers/dom/findUpTag";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import getRichValue from "../../helpers/dom/getRichValue";
import isInputEmpty from "../../helpers/dom/isInputEmpty";
import whichChild from "../../helpers/dom/whichChild";

4
src/components/popups/index.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import rootScope from "../../lib/rootScope";
import { ripple } from "../ripple";
import ripple from "../ripple";
import animationIntersector from "../animationIntersector";
import appNavigationController, { NavigationItem } from "../appNavigationController";
import { i18n, LangPackKey } from "../../lib/langPack";
@ -14,7 +14,7 @@ import blurActiveElement from "../../helpers/dom/blurActiveElement"; @@ -14,7 +14,7 @@ import blurActiveElement from "../../helpers/dom/blurActiveElement";
import ListenerSetter from "../../helpers/listenerSetter";
import { attachClickEvent, simulateClickEvent } from "../../helpers/dom/clickEvent";
import isSendShortcutPressed from "../../helpers/dom/isSendShortcutPressed";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import cancelEvent from "../../helpers/dom/cancelEvent";
import EventListenerBase, { EventListenerListeners } from "../../helpers/eventListenerBase";
import { addFullScreenListener, getFullScreenElement } from "../../helpers/dom/fullScreen";
import indexOfAndSplice from "../../helpers/array/indexOfAndSplice";

2
src/components/preloader.ts

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
import { CancellablePromise } from "../helpers/cancellablePromise";
import SetTransition from "./singleTransition";
import { fastRaf } from "../helpers/schedulers";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent } from "../helpers/dom/clickEvent";
import isInDOM from "../helpers/dom/isInDOM";
import safeAssign from "../helpers/object/safeAssign";

4
src/components/ripple.ts

@ -6,12 +6,12 @@ @@ -6,12 +6,12 @@
import findUpClassName from "../helpers/dom/findUpClassName";
import sequentialDom from "../helpers/sequentialDom";
import {IS_TOUCH_SUPPORTED} from "../environment/touchSupport";
import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import rootScope from "../lib/rootScope";
import findUpAsChild from "../helpers/dom/findUpAsChild";
let rippleClickId = 0;
export function ripple(
export default function ripple(
elem: HTMLElement,
callback: (id: number) => Promise<boolean | void> = () => Promise.resolve(),
onEnd: (id: number) => void = null,

2
src/components/row.ts

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
import CheckboxField from "./checkboxField";
import RadioField from "./radioField";
import { ripple } from "./ripple";
import ripple from "./ripple";
import { SliderSuperTab } from "./slider";
import RadioForm from "./radioForm";
import { i18n, LangPackKey } from "../lib/langPack";

2
src/components/scrollable.ts

@ -8,7 +8,7 @@ import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport"; @@ -8,7 +8,7 @@ import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import { logger, LogTypes } from "../lib/logger";
import fastSmoothScroll, { ScrollOptions } from "../helpers/fastSmoothScroll";
import useHeavyAnimationCheck from "../hooks/useHeavyAnimationCheck";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
/*
var el = $0;
var height = 0;

2
src/components/sidebarLeft/index.ts

@ -45,7 +45,7 @@ import IS_GEOLOCATION_SUPPORTED from "../../environment/geolocationSupport"; @@ -45,7 +45,7 @@ import IS_GEOLOCATION_SUPPORTED from "../../environment/geolocationSupport";
import type SortedUserList from "../sortedUserList";
import Button, { ButtonOptions } from "../button";
import noop from "../../helpers/noop";
import { ripple } from "../ripple";
import ripple from "../ripple";
import indexOfAndSplice from "../../helpers/array/indexOfAndSplice";
import formatNumber from "../../helpers/number/formatNumber";
import AvatarElement from "../avatar";

2
src/components/sidebarLeft/tabs/2fa/email.ts

@ -17,7 +17,7 @@ import AppTwoStepVerificationSetTab from "./passwordSet"; @@ -17,7 +17,7 @@ import AppTwoStepVerificationSetTab from "./passwordSet";
import AppTwoStepVerificationEmailConfirmationTab from "./emailConfirmation";
import RichTextProcessor from "../../../../lib/richtextprocessor";
import PopupPeer from "../../../popups/peer";
import { cancelEvent } from "../../../../helpers/dom/cancelEvent";
import cancelEvent from "../../../../helpers/dom/cancelEvent";
import { canFocus } from "../../../../helpers/dom/canFocus";
import { attachClickEvent } from "../../../../helpers/dom/clickEvent";

2
src/components/sidebarLeft/tabs/2fa/enterPassword.ts

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
import AppTwoStepVerificationTab from ".";
import { SettingSection } from "../..";
import { cancelEvent } from "../../../../helpers/dom/cancelEvent";
import cancelEvent from "../../../../helpers/dom/cancelEvent";
import { canFocus } from "../../../../helpers/dom/canFocus";
import { attachClickEvent } from "../../../../helpers/dom/clickEvent";
import replaceContent from "../../../../helpers/dom/replaceContent";

2
src/components/sidebarLeft/tabs/2fa/hint.ts

@ -14,7 +14,7 @@ import InputField from "../../../inputField"; @@ -14,7 +14,7 @@ import InputField from "../../../inputField";
import AppTwoStepVerificationEmailTab from "./email";
import { toast } from "../../../toast";
import I18n from "../../../../lib/langPack";
import { cancelEvent } from "../../../../helpers/dom/cancelEvent";
import cancelEvent from "../../../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../../../helpers/dom/clickEvent";
export default class AppTwoStepVerificationHintTab extends SliderSuperTab {

2
src/components/sidebarLeft/tabs/2fa/reEnterPassword.ts

@ -12,7 +12,7 @@ import { SliderSuperTab } from "../../../slider"; @@ -12,7 +12,7 @@ import { SliderSuperTab } from "../../../slider";
import TrackingMonkey from "../../../monkeys/tracking";
import AppTwoStepVerificationHintTab from "./hint";
import { InputState } from "../../../inputField";
import { cancelEvent } from "../../../../helpers/dom/cancelEvent";
import cancelEvent from "../../../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../../../helpers/dom/clickEvent";
export default class AppTwoStepVerificationReEnterPasswordTab extends SliderSuperTab {

2
src/components/sidebarLeft/tabs/background.ts

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
import { generateSection } from "..";
import { averageColor, averageColorFromCanvas } from "../../../helpers/averageColor";
import blur from "../../../helpers/blur";
import { deferredPromise } from "../../../helpers/cancellablePromise";
import deferredPromise from "../../../helpers/cancellablePromise";
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
import findUpClassName from "../../../helpers/dom/findUpClassName";
import { requestFile } from "../../../helpers/files";

2
src/components/sidebarLeft/tabs/chatFolders.ts

@ -20,7 +20,7 @@ import AppEditFolderTab from "./editFolder"; @@ -20,7 +20,7 @@ import AppEditFolderTab from "./editFolder";
import Row from "../../row";
import { SettingSection } from "..";
import { i18n, i18n_, LangPackKey, join } from "../../../lib/langPack";
import { cancelEvent } from "../../../helpers/dom/cancelEvent";
import cancelEvent from "../../../helpers/dom/cancelEvent";
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
import positionElementByIndex from "../../../helpers/dom/positionElementByIndex";
import RLottiePlayer from "../../../lib/rlottie/rlottiePlayer";

2
src/components/sidebarRight/tabs/pollResults.ts

@ -10,7 +10,7 @@ import appPollsManager from "../../../lib/appManagers/appPollsManager"; @@ -10,7 +10,7 @@ import appPollsManager from "../../../lib/appManagers/appPollsManager";
import { roundPercents } from "../../poll";
import { RichTextProcessor } from "../../../lib/richtextprocessor";
import appDialogsManager from "../../../lib/appManagers/appDialogsManager";
import { ripple } from "../../ripple";
import ripple from "../../ripple";
import { i18n } from "../../../lib/langPack";
export default class AppPollResultsTab extends SliderSuperTab {

2
src/components/swipeHandler.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import rootScope from "../lib/rootScope";
import safeAssign from "../helpers/object/safeAssign";

2
src/components/topbarCall.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent } from "../helpers/dom/clickEvent";
import ListenerSetter from "../helpers/listenerSetter";
import type { AppGroupCallsManager } from "../lib/appManagers/appGroupCallsManager";

4
src/components/transition.ts

@ -5,10 +5,10 @@ @@ -5,10 +5,10 @@
*/
import rootScope from "../lib/rootScope";
import { CancellablePromise, deferredPromise } from "../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../helpers/cancellablePromise";
import { dispatchHeavyAnimationEvent } from "../hooks/useHeavyAnimationCheck";
import whichChild from "../helpers/dom/whichChild";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
function slideNavigation(tabContent: HTMLElement, prevTabContent: HTMLElement, toRight: boolean) {
const width = prevTabContent.getBoundingClientRect().width;

4
src/components/wrappers.ts

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
import type Chat from './chat/chat';
import { getEmojiToneIndex } from '../vendor/emoji';
import { deferredPromise } from '../helpers/cancellablePromise';
import deferredPromise from '../helpers/cancellablePromise';
import { formatFullSentTime } from '../helpers/date';
import mediaSizes, { MediaSizeType, ScreenSize } from '../helpers/mediaSizes';
import { IS_SAFARI } from '../environment/userAgent';
@ -35,7 +35,7 @@ import sequentialDom from '../helpers/sequentialDom'; @@ -35,7 +35,7 @@ import sequentialDom from '../helpers/sequentialDom';
import { fastRaf } from '../helpers/schedulers';
import appDownloadManager, { DownloadBlob, ThumbCache } from '../lib/appManagers/appDownloadManager';
import appStickersManager from '../lib/appManagers/appStickersManager';
import { cancelEvent } from '../helpers/dom/cancelEvent';
import cancelEvent from '../helpers/dom/cancelEvent';
import { attachClickEvent, simulateClickEvent } from '../helpers/dom/clickEvent';
import isInDOM from '../helpers/dom/isInDOM';
import lottieLoader from '../lib/rlottie/lottieLoader';

2
src/helpers/animation.ts

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
// * Jolly Cobra's animation.ts
import { fastRaf } from './schedulers';
import { CancellablePromise, deferredPromise } from './cancellablePromise';
import deferredPromise, { CancellablePromise } from './cancellablePromise';
interface AnimationInstance {
isCancelled: boolean;

4
src/helpers/cancellablePromise.ts

@ -21,7 +21,7 @@ export interface CancellablePromise<T> extends Promise<T> { @@ -21,7 +21,7 @@ export interface CancellablePromise<T> extends Promise<T> {
isRejected?: boolean
}
export function deferredPromise<T>() {
export default function deferredPromise<T>() {
let deferredHelper: any = {
isFulfilled: false,
isRejected: false,
@ -76,4 +76,4 @@ export function deferredPromise<T>() { @@ -76,4 +76,4 @@ export function deferredPromise<T>() {
Object.assign(deferred, deferredHelper);
return deferred;
}
}

2
src/helpers/dom/anchorCopy.ts

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
import { toastNew } from "../../components/toast";
import { copyTextToClipboard } from "../clipboard";
import { cancelEvent } from "./cancelEvent";
import cancelEvent from "./cancelEvent";
import { attachClickEvent } from "./clickEvent";
export default function anchorCopy(options: Partial<{

2
src/helpers/dom/attachListNavigation.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import fastSmoothScroll from "../fastSmoothScroll";
import { cancelEvent } from "./cancelEvent";
import cancelEvent from "./cancelEvent";
import { attachClickEvent, detachClickEvent } from "./clickEvent";
import findUpAsChild from "./findUpAsChild";
import findUpClassName from "./findUpClassName";

2
src/helpers/dom/cancelEvent.ts

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/
export function cancelEvent(event: Event) {
export default function cancelEvent(event: Event) {
event = event || window.event;
if(event) {
// @ts-ignore

2
src/helpers/dom/handleHorizontalSwipe.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import SwipeHandler, { SwipeHandlerOptions } from "../../components/swipeHandler";
import { cancelEvent } from "./cancelEvent";
import cancelEvent from "./cancelEvent";
import findUpClassName from "./findUpClassName";
import isSwipingBackSafari from "./isSwipingBackSafari";

59
src/helpers/dom/loadFonts.ts

@ -4,14 +4,53 @@ @@ -4,14 +4,53 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
let promise: Promise<any>;
export default function loadFonts(): Promise<any> {
if(promise) return promise;
return promise = 'fonts' in document ?
Promise.race([
// @ts-ignore
Promise.all(['400 1rem Roboto', '500 1rem Roboto', '500 1rem tgico'].map(font => document.fonts.load(font))),
new Promise((resolve) => setTimeout(resolve, 1e3))
]) :
Promise.resolve();
import pause from "../schedulers/pause";
const texts = ['b', 'б'];
type FontType = 'text' | 'icons' | 'monospace';
const cache: {
[key: string]: {
[text: string]: Promise<any>
}
} = {};
const fonts: {[type in FontType]: string} = {
text: 'Roboto',
icons: 'tgico',
monospace: 'Roboto Mono'
};
export default function loadFonts(types: {[type in FontType]?: string[] | 'all'} = {
text: texts,
icons: undefined,
monospace: texts
}): Promise<any> {
if(!('fonts' in document)) {
return Promise.resolve();
}
const promises: Promise<any>[] = [];
for(const type in types) {
let _texts = types[type as FontType];
if(_texts === 'all') {
_texts = texts;
}
const font = fonts[type as FontType];
const weights = type === 'icons' ? [500] : [400, 500];
for(const weight of weights) {
const _promises = (_texts || [undefined]).map(text => {
const key = [weight, '1rem', font].join(' ');
const promise = (cache[key] ??= {})[text || ''] ??= document.fonts.load(key, text);
return promise;
});
promises.push(..._promises);
}
}
return Promise.race([
Promise.all(promises),
pause(1000)
]);
}

2
src/helpers/dom/lockTouchScroll.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { cancelEvent } from "./cancelEvent";
import cancelEvent from "./cancelEvent";
export default function lockTouchScroll(container: HTMLElement) {
const onTouchMove = (e: TouchEvent) => {

18
src/helpers/dom/toggleAttributePolyfill.ts

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
export default function toggleAttributePolyfill() {
if(!Element.prototype.toggleAttribute) {
Element.prototype.toggleAttribute = function(name, force) {
if(force !== void 0) force = !!force;
if(this.hasAttribute(name)) {
if(force) return true;
this.removeAttribute(name);
return false;
}
if(force === false) return false;
this.setAttribute(name, "");
return true;
};
}
}

2
src/helpers/files.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import { makeMediaSize, MediaSize } from "./mediaSizes";
import { pause } from "./schedulers/pause";
import pause from "./schedulers/pause";
import { IS_APPLE_MOBILE } from "../environment/userAgent";
export function scaleMediaElement(options: {

2
src/helpers/heavyQueue.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { CancellablePromise, deferredPromise } from "./cancellablePromise";
import deferredPromise, { CancellablePromise } from "./cancellablePromise";
import { getHeavyAnimationPromise } from "../hooks/useHeavyAnimationCheck";
import { fastRaf } from "./schedulers";

8
src/helpers/schedulers/pause.ts

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
export const pause = (ms: number) => new Promise<void>((resolve) => {
setTimeout(resolve, ms);
});
export default function pause(ms: number) {
return new Promise<void>((resolve) => {
setTimeout(resolve, ms);
});
}

2
src/helpers/sequentialDom.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import { fastRaf } from "./schedulers";
import { CancellablePromise, deferredPromise } from "./cancellablePromise";
import deferredPromise, { CancellablePromise } from "./cancellablePromise";
import { MOUNT_CLASS_TO } from "../config/debug";
import isInDOM from "./dom/isInDOM";

20
src/helpers/setWorkerProxy.ts

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
export default function setWorkerProxy() {
// * hook worker constructor to set search parameters (test, debug, etc)
const workerHandler = {
construct(target: any, args: any) {
//console.log(target, args);
const url = args[0] + location.search;
return new target(url);
}
};
const workerProxy = new Proxy(Worker, workerHandler);
Worker = workerProxy;
}

4
src/hooks/useHeavyAnimationCheck.ts

@ -8,10 +8,10 @@ @@ -8,10 +8,10 @@
import { AnyToVoidFunction } from '../types';
import ListenerSetter from '../helpers/listenerSetter';
import { CancellablePromise, deferredPromise } from '../helpers/cancellablePromise';
import deferredPromise, { CancellablePromise } from '../helpers/cancellablePromise';
import rootScope from '../lib/rootScope';
import DEBUG from '../config/debug';
import { pause } from '../helpers/schedulers/pause';
import pause from '../helpers/schedulers/pause';
const ANIMATION_START_EVENT = 'event-heavy-animation-start';
const ANIMATION_END_EVENT = 'event-heavy-animation-end';

565
src/index.ts

@ -6,380 +6,299 @@ @@ -6,380 +6,299 @@
import App from './config/app';
import blurActiveElement from './helpers/dom/blurActiveElement';
import { cancelEvent } from './helpers/dom/cancelEvent';
import cancelEvent from './helpers/dom/cancelEvent';
import { IS_STICKY_INPUT_BUGGED } from './helpers/dom/fixSafariStickyInputFocusing';
import loadFonts from './helpers/dom/loadFonts';
import IS_EMOJI_SUPPORTED from './environment/emojiSupport';
import { IS_MOBILE_SAFARI } from './environment/userAgent';
import { IS_ANDROID, IS_APPLE, IS_APPLE_MOBILE, IS_FIREFOX, IS_MOBILE, IS_MOBILE_SAFARI, IS_SAFARI } from './environment/userAgent';
import './materialize.scss';
import './scss/style.scss';
/* import { computeCheck } from './lib/crypto/srp';
import { salt1, salt2, g, p, srp_id, secure_random, srp_B, password } from './mock/srp'; */
//console.log('pineapples are in my head');
/* console.time('get storage1');
import * as a from './lib/config';
import * as b from './lib/mtproto/mtproto_config';
import * as c from './helpers/userAgent';
import * as d from './lib/mtproto/mtprotoworker';
import * as e from './lib/polyfill';
import * as f from './lib/storage';
a && b && c && d && e && f;
console.timeEnd('get storage1'); */
/* Promise.all([
import('./components/pageIm'),
import('./components/pageSignIn'),
import('./components/misc'),
import('./lib/storage')
]).then(imports => {
let [pageIm, pageSignIn, misc, AppStorage] = imports; */
document.addEventListener('DOMContentLoaded', async() => {
//let socket = new Socket(2);
if(!Element.prototype.toggleAttribute) {
Element.prototype.toggleAttribute = function(name, force) {
if(force !== void 0) force = !!force;
if(this.hasAttribute(name)) {
if(force) return true;
this.removeAttribute(name);
return false;
}
if(force === false) return false;
this.setAttribute(name, "");
return true;
};
import pause from './helpers/schedulers/pause';
import setWorkerProxy from './helpers/setWorkerProxy';
import toggleAttributePolyfill from './helpers/dom/toggleAttributePolyfill';
import rootScope from './lib/rootScope';
import IS_TOUCH_SUPPORTED from './environment/touchSupport';
import appStateManager from './lib/appManagers/appStateManager';
import I18n from './lib/langPack';
import './helpers/peerIdPolyfill';
import './lib/polyfill';
document.addEventListener('DOMContentLoaded', async() => {
toggleAttributePolyfill();
// We listen to the resize event (https://css-tricks.com/the-trick-to-viewport-units-on-mobile/)
const w = window.visualViewport || window; // * handle iOS keyboard
let setViewportVH = false/* , hasFocus = false */;
let lastVH: number;
const setVH = () => {
const vh = (setViewportVH && !rootScope.isOverlayActive ? (w as VisualViewport).height || (w as Window).innerHeight : window.innerHeight) * 0.01;
if(lastVH === vh) {
return;
} else if(IS_TOUCH_SUPPORTED && lastVH < vh && (vh - lastVH) > 1) {
blurActiveElement(); // (Android) fix blurring inputs when keyboard is being closed (e.g. closing keyboard by back arrow and touching a bubble)
}
// We listen to the resize event (https://css-tricks.com/the-trick-to-viewport-units-on-mobile/)
// @ts-ignore
const w = window.visualViewport || window; // * handle iOS keyboard
let setViewportVH = false/* , hasFocus = false */;
let lastVH: number;
const setVH = () => {
// @ts-ignore
const vh = (setViewportVH && !rootScope.default.isOverlayActive ? w.height || w.innerHeight : window.innerHeight) * 0.01;
if(lastVH === vh) {
return;
} else if(touchSupport.IS_TOUCH_SUPPORTED && lastVH < vh && (vh - lastVH) > 1) {
blurActiveElement(); // (Android) fix blurring inputs when keyboard is being closed (e.g. closing keyboard by back arrow and touching a bubble)
}
lastVH = vh;
lastVH = vh;
//const vh = document.documentElement.scrollHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
//const vh = document.documentElement.scrollHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
//console.log('setVH', vh, setViewportVH ? w : window);
//console.log('setVH', vh, setViewportVH ? w : window);
/* if(setViewportVH && userAgent.isSafari && touchSupport.isTouchSupported && document.activeElement && (document.activeElement as HTMLElement).blur) {
const rect = document.activeElement.getBoundingClientRect();
if(rect.top < 0 || rect.bottom >= (w as any).height) {
fastSmoothScroll(findUpClassName(document.activeElement, 'scrollable-y') || window as any, document.activeElement as HTMLElement, 'center', 4, undefined, FocusDirection.Static);
/* if(setViewportVH && userAgent.isSafari && touchSupport.isTouchSupported && document.activeElement && (document.activeElement as HTMLElement).blur) {
const rect = document.activeElement.getBoundingClientRect();
if(rect.top < 0 || rect.bottom >= (w as any).height) {
fastSmoothScroll(findUpClassName(document.activeElement, 'scrollable-y') || window as any, document.activeElement as HTMLElement, 'center', 4, undefined, FocusDirection.Static);
}
} */
};
setWorkerProxy();
// const [_, touchSupport, userAgent, _rootScope, _appStateManager, _I18n, __/* , ___ */] = await Promise.all([
// import('./lib/polyfill'),
// import('./environment/touchSupport'),
// import('./environment/userAgent'),
// import('./lib/rootScope'),
// import('./lib/appManagers/appStateManager'),
// import('./lib/langPack'),
// import('./helpers/peerIdPolyfill'),
// // import('./helpers/cacheFunctionPolyfill')
// ]);
/* const {IS_TOUCH_SUPPORTED} = touchSupport;
const {IS_FIREFOX, IS_MOBILE, IS_APPLE, IS_SAFARI, IS_APPLE_MOBILE, IS_ANDROID} = userAgent;
const rootScope = _rootScope.default;
const appStateManager = _appStateManager.default;
const I18n = _I18n.default; */
window.addEventListener('resize', setVH);
setVH();
if(IS_STICKY_INPUT_BUGGED) {
const toggleResizeMode = () => {
setViewportVH = tabId === 1 && IS_STICKY_INPUT_BUGGED && !rootScope.isOverlayActive;
setVH();
if(w !== window) {
if(setViewportVH) {
window.removeEventListener('resize', setVH);
w.addEventListener('resize', setVH);
} else {
w.removeEventListener('resize', setVH);
window.addEventListener('resize', setVH);
}
} */
}
};
// * hook worker constructor to set search parameters (test, debug, etc)
const workerHandler = {
construct(target: any, args: any) {
//console.log(target, args);
const url = args[0] + location.search;
let tabId: number;
rootScope.addEventListener('im_tab_change', (id) => {
const wasTabId = tabId !== undefined;
tabId = id;
return new target(url);
if(wasTabId || tabId === 1) {
toggleResizeMode();
}
};
});
const workerProxy = new Proxy(Worker, workerHandler);
Worker = workerProxy;
const [_, touchSupport, userAgent, rootScope, appStateManager, I18n, __/* , ___ */] = await Promise.all([
import('./lib/polyfill'),
import('./environment/touchSupport'),
import('./environment/userAgent'),
import('./lib/rootScope'),
import('./lib/appManagers/appStateManager'),
import('./lib/langPack'),
import('./helpers/peerIdPolyfill'),
// import('./helpers/cacheFunctionPolyfill')
]);
//console.timeEnd('get storage');
window.addEventListener('resize', setVH);
setVH();
//console.log(new Uint8Array([255, 200, 145]).hex);
if(IS_STICKY_INPUT_BUGGED) {
const toggleResizeMode = () => {
setViewportVH = tabId === 1 && IS_STICKY_INPUT_BUGGED && !rootScope.default.isOverlayActive;
setVH();
if(w !== window) {
if(setViewportVH) {
window.removeEventListener('resize', setVH);
w.addEventListener('resize', setVH);
} else {
w.removeEventListener('resize', setVH);
window.addEventListener('resize', setVH);
}
}
};
let tabId: number;
rootScope.default.addEventListener('im_tab_change', (id) => {
const wasTabId = tabId !== undefined;
tabId = id;
if(wasTabId || tabId === 1) {
toggleResizeMode();
}
});
rootScope.default.addEventListener('overlay_toggle', () => {
toggleResizeMode();
});
}
if(userAgent.IS_FIREFOX && !IS_EMOJI_SUPPORTED) {
document.addEventListener('dragstart', (e) => {
const target = e.target as HTMLElement;
if(target.tagName === 'IMG' && target.classList.contains('emoji')) {
cancelEvent(e);
return false;
}
});
}
rootScope.addEventListener('overlay_toggle', () => {
toggleResizeMode();
});
}
// prevent firefox image dragging
if(IS_FIREFOX && !IS_EMOJI_SUPPORTED) {
document.addEventListener('dragstart', (e) => {
if((e.target as HTMLElement)?.tagName === "IMG") {
e.preventDefault();
const target = e.target as HTMLElement;
if(target.tagName === 'IMG' && target.classList.contains('emoji')) {
cancelEvent(e);
return false;
}
});
}
if(userAgent.IS_FIREFOX) {
document.documentElement.classList.add('is-firefox');
// prevent firefox image dragging
document.addEventListener('dragstart', (e) => {
if((e.target as HTMLElement)?.tagName === "IMG") {
e.preventDefault();
return false;
}
});
if(userAgent.IS_MOBILE) {
document.documentElement.classList.add('is-mobile');
}
if(userAgent.IS_APPLE) {
if(userAgent.IS_SAFARI) {
document.documentElement.classList.add('is-safari');
}
// document.documentElement.classList.add('emoji-supported');
if(userAgent.IS_APPLE_MOBILE) {
document.documentElement.classList.add('is-ios');
} else {
document.documentElement.classList.add('is-mac');
}
} else if(userAgent.IS_ANDROID) {
document.documentElement.classList.add('is-android');
if(IS_FIREFOX) {
document.documentElement.classList.add('is-firefox');
}
/* document.addEventListener('focusin', (e) => {
hasFocus = true;
focusTime = Date.now();
}, {passive: true});
if(IS_MOBILE) {
document.documentElement.classList.add('is-mobile');
}
document.addEventListener('focusout', () => {
hasFocus = false;
}, {passive: true}); */
if(IS_APPLE) {
if(IS_SAFARI) {
document.documentElement.classList.add('is-safari');
}
// document.documentElement.classList.add('emoji-supported');
if(!touchSupport.IS_TOUCH_SUPPORTED) {
document.documentElement.classList.add('no-touch');
if(IS_APPLE_MOBILE) {
document.documentElement.classList.add('is-ios');
} else {
document.documentElement.classList.add('is-touch');
/* document.addEventListener('touchmove', (event: any) => {
event = event.originalEvent || event;
if(event.scale && event.scale !== 1) {
event.preventDefault();
}
}, {capture: true, passive: false}); */
document.documentElement.classList.add('is-mac');
}
} else if(IS_ANDROID) {
document.documentElement.classList.add('is-android');
/* document.addEventListener('focusin', (e) => {
hasFocus = true;
focusTime = Date.now();
}, {passive: true});
document.addEventListener('focusout', () => {
hasFocus = false;
}, {passive: true}); */
}
if(!IS_TOUCH_SUPPORTED) {
document.documentElement.classList.add('no-touch');
} else {
document.documentElement.classList.add('is-touch');
/* document.addEventListener('touchmove', (event: any) => {
event = event.originalEvent || event;
if(event.scale && event.scale !== 1) {
event.preventDefault();
}
}, {capture: true, passive: false}); */
}
/* if(config.isServiceWorkerSupported) {
await navigator.serviceWorker.ready;
navigator.serviceWorker.controller ? true : await new Promise((resolve, reject) => {
navigator.serviceWorker.addEventListener('controllerchange', resolve);
});
} */
//console.time('get storage');
const perf = performance.now();
let perf = performance.now();
//import('./vendor/dateFormat');
const langPromise = I18n.getCacheLangPack();
const langPromise = I18n.default.getCacheLangPack();
const [state, langPack] = await Promise.all([
appStateManager.getState(),
langPromise
]);
I18n.setTimeFormat(state.settings.timeFormat);
const [state, langPack] = await Promise.all([
appStateManager.default.getState(),
langPromise
]);
//I18n.getCacheLangPack();
//console.log('got auth:', auth);
//console.timeEnd('get storage');
rootScope.setThemeListener();
I18n.default.setTimeFormat(state.settings.timeFormat);
if(langPack.appVersion !== App.langPackVersion) {
I18n.getLangPack(langPack.lang_code);
}
rootScope.default.setThemeListener();
/**
* won't fire if font is loaded too fast
*/
function fadeInWhenFontsReady(elem: HTMLElement, promise: Promise<any>) {
elem.style.opacity = '0';
if(langPack.appVersion !== App.langPackVersion) {
I18n.default.getLangPack(langPack.lang_code);
}
promise.then(() => {
window.requestAnimationFrame(() => {
elem.style.opacity = '';
});
});
}
/**
* won't fire if font is loaded too fast
*/
function fadeInWhenFontsReady(elem: HTMLElement, promise: Promise<any>) {
elem.style.opacity = '0';
console.log('got state, time:', performance.now() - perf);
promise.then(() => {
window.requestAnimationFrame(() => {
elem.style.opacity = '';
});
});
}
const authState = state.authState;
if(authState._ !== 'authStateSignedIn'/* || 1 === 1 */) {
console.log('Will mount auth page:', authState._, Date.now() / 1000);
console.log('got state, time:', performance.now() - perf);
const el = document.getElementById('auth-pages');
let scrollable: HTMLElement;
if(el) {
scrollable = el.querySelector('.scrollable') as HTMLElement;
if((!IS_TOUCH_SUPPORTED || IS_MOBILE_SAFARI)) {
scrollable.classList.add('no-scrollbar');
}
const authState = state.authState;
if(authState._ !== 'authStateSignedIn'/* || 1 === 1 */) {
console.log('Will mount auth page:', authState._, Date.now() / 1000);
// * don't remove this line
scrollable.style.opacity = '0';
const el = document.getElementById('auth-pages');
let scrollable: HTMLElement;
if(el) {
scrollable = el.querySelector('.scrollable') as HTMLElement;
if((!touchSupport.IS_TOUCH_SUPPORTED || IS_MOBILE_SAFARI)) {
scrollable.classList.add('no-scrollbar');
}
const placeholder = document.createElement('div');
placeholder.classList.add('auth-placeholder');
// * don't remove this line
scrollable.style.opacity = '0';
scrollable.prepend(placeholder);
scrollable.append(placeholder.cloneNode());
}
const placeholder = document.createElement('div');
placeholder.classList.add('auth-placeholder');
try {
await Promise.all([
import('./lib/mtproto/telegramMeWebManager'),
import('./lib/mtproto/webPushApiManager')
]).then(([meModule, pushModule]) => {
meModule.default.setAuthorized(false);
pushModule.default.forceUnsubscribe();
});
} catch(err) {
}
scrollable.prepend(placeholder);
scrollable.append(placeholder.cloneNode());
let pagePromise: Promise<void>;
//langPromise.then(async() => {
switch(authState._) {
case 'authStateSignIn':
pagePromise = (await import('./pages/pageSignIn')).default.mount();
break;
case 'authStateSignQr':
pagePromise = (await import('./pages/pageSignQR')).default.mount();
break;
case 'authStateAuthCode':
pagePromise = (await import('./pages/pageAuthCode')).default.mount(authState.sentCode);
break;
case 'authStatePassword':
pagePromise = (await import('./pages/pagePassword')).default.mount();
break;
case 'authStateSignUp':
pagePromise = (await import('./pages/pageSignUp')).default.mount(authState.authCode);
break;
}
//});
try {
await Promise.all([
import('./lib/mtproto/telegramMeWebManager'),
import('./lib/mtproto/webPushApiManager')
]).then(([meModule, pushModule]) => {
meModule.default.setAuthorized(false);
pushModule.default.forceUnsubscribe();
});
} catch(err) {
if(scrollable) {
// wait for text appear
if(pagePromise) {
await pagePromise;
}
let pagePromise: Promise<void>;
//langPromise.then(async() => {
switch(authState._) {
case 'authStateSignIn':
pagePromise = (await import('./pages/pageSignIn')).default.mount();
break;
case 'authStateSignQr':
pagePromise = (await import('./pages/pageSignQR')).default.mount();
break;
case 'authStateAuthCode':
pagePromise = (await import('./pages/pageAuthCode')).default.mount(authState.sentCode);
break;
case 'authStatePassword':
pagePromise = (await import('./pages/pagePassword')).default.mount();
break;
case 'authStateSignUp':
pagePromise = (await import('./pages/pageSignUp')).default.mount(authState.authCode);
break;
}
//});
if(scrollable) {
// wait for text appear
if(pagePromise) {
await pagePromise;
}
const promise = 'fonts' in document ?
Promise.race([
new Promise((resolve) => setTimeout(resolve, 1e3)),
// @ts-ignore
document.fonts.ready
]) :
Promise.resolve();
fadeInWhenFontsReady(scrollable, promise);
}
const promise = 'fonts' in document ?
Promise.race([
pause(1000),
document.fonts.ready
]) :
Promise.resolve();
fadeInWhenFontsReady(scrollable, promise);
}
/* computeCheck(password, {
current_algo: {
salt1,
salt2,
p,
g
/* setTimeout(async() => {
(await import('./pages/pageAuthCode')).default.mount({
"_": "auth.sentCode",
"pFlags": {},
"flags": 6,
"type": {
"_": "auth.sentCodeTypeSms",
"length": 5
},
srp_id,
srp_B,
secure_random,
}).then(res => {
console.log(res);
}); */
/* setTimeout(async() => {
(await import('./pages/pageAuthCode')).default.mount({
"_": "auth.sentCode",
"pFlags": {},
"flags": 6,
"type": {
"_": "auth.sentCodeTypeSms",
"length": 5
},
"phone_code_hash": "",
"next_type": {
"_": "auth.codeTypeCall"
},
"timeout": 120,
"phone_number": ""
});
}, 500); */
/* setTimeout(async() => {
(await import('./pages/pageSignQR')).default.mount();
}, 500); */
/* setTimeout(async() => {
(await import('./pages/pagePassword')).default.mount();
}, 500); */
/* setTimeout(async() => {
(await import('./pages/pageSignUp')).default.mount({
"phone_code_hash": "",
"phone_number": ""
});
}, 500); */
} else {
console.log('Will mount IM page:', Date.now() / 1000);
fadeInWhenFontsReady(document.getElementById('main-columns'), loadFonts());
(await import('./pages/pageIm')).default.mount();
//getNearestDc();
}
"phone_code_hash": "",
"next_type": {
"_": "auth.codeTypeCall"
},
"timeout": 120,
"phone_number": ""
});
const ripple = (await import('./components/ripple')).ripple;
(Array.from(document.getElementsByClassName('rp')) as HTMLElement[]).forEach(el => ripple(el));
});
//});
(await import('./pages/pageSignQR')).default.mount();
(await import('./pages/pagePassword')).default.mount();
(await import('./pages/pageSignUp')).default.mount({
"phone_code_hash": "",
"phone_number": ""
});
}, 500); */
} else {
console.log('Will mount IM page:', Date.now() / 1000);
fadeInWhenFontsReady(document.getElementById('main-columns'), loadFonts());
(await import('./pages/pageIm')).default.mount();
}
});

2
src/lib/appManagers/appDialogsManager.ts

@ -11,7 +11,7 @@ import AvatarElement from "../../components/avatar"; @@ -11,7 +11,7 @@ import AvatarElement from "../../components/avatar";
import DialogsContextMenu from "../../components/dialogsContextMenu";
import { horizontalMenu } from "../../components/horizontalMenu";
import { attachContextMenuListener, putPreloader } from "../../components/misc";
import { ripple } from "../../components/ripple";
import ripple from "../../components/ripple";
//import Scrollable from "../../components/scrollable";
import Scrollable, { ScrollableX, SliceSides } from "../../components/scrollable";
import { formatDateAccordingToTodayNew } from "../../helpers/date";

2
src/lib/appManagers/appDownloadManager.ts

@ -10,7 +10,7 @@ import type { MyDocument } from "./appDocsManager"; @@ -10,7 +10,7 @@ import type { MyDocument } from "./appDocsManager";
import type { MyPhoto } from "./appPhotosManager";
import rootScope from "../rootScope";
import apiManager from "../mtproto/mtprotoworker";
import { deferredPromise, CancellablePromise } from "../../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../../helpers/cancellablePromise";
import { InputFile } from "../../layer";
import { getFileNameByLocation } from "../../helpers/fileName";
import CacheStorageController from "../cacheStorage";

4
src/lib/appManagers/appImManager.ts

@ -50,7 +50,7 @@ import PeerTitle from '../../components/peerTitle'; @@ -50,7 +50,7 @@ import PeerTitle from '../../components/peerTitle';
import PopupPeer from '../../components/popups/peer';
import { SliceEnd } from '../../helpers/slicedArray';
import blurActiveElement from '../../helpers/dom/blurActiveElement';
import { cancelEvent } from '../../helpers/dom/cancelEvent';
import cancelEvent from '../../helpers/dom/cancelEvent';
import disableTransition from '../../helpers/dom/disableTransition';
import placeCaretAtEnd from '../../helpers/dom/placeCaretAtEnd';
import replaceContent from '../../helpers/dom/replaceContent';
@ -62,7 +62,7 @@ import PopupStickers from '../../components/popups/stickers'; @@ -62,7 +62,7 @@ import PopupStickers from '../../components/popups/stickers';
import PopupJoinChatInvite from '../../components/popups/joinChatInvite';
import { toast, toastNew } from '../../components/toast';
import debounce from '../../helpers/schedulers/debounce';
import { pause } from '../../helpers/schedulers/pause';
import pause from '../../helpers/schedulers/pause';
import appMessagesIdsManager from './appMessagesIdsManager';
import { InternalLink, InternalLinkTypeMap, INTERNAL_LINK_TYPE } from './internalLink';
import RichTextProcessor from '../richtextprocessor';

2
src/lib/appManagers/appMessagesManager.ts

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
import { LazyLoadQueueBase } from "../../components/lazyLoadQueue";
import ProgressivePreloader from "../../components/preloader";
import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../../helpers/cancellablePromise";
import { formatDateAccordingToTodayNew, formatTime, tsNow } from "../../helpers/date";
import { createPosterForVideo } from "../../helpers/files";
import { randomLong } from "../../helpers/random";

2
src/lib/appManagers/appNotificationsManager.ts

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
import { fontFamily } from "../../components/middleEllipsis";
import { MOUNT_CLASS_TO } from "../../config/debug";
import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../../helpers/cancellablePromise";
import { tsNow } from "../../helpers/date";
import { IS_MOBILE } from "../../environment/userAgent";
import { InputNotifyPeer, InputPeerNotifySettings, NotifyPeer, PeerNotifySettings, Update } from "../../layer";

2
src/lib/appManagers/appUsersManager.ts

@ -13,7 +13,7 @@ import { MOUNT_CLASS_TO } from "../../config/debug"; @@ -13,7 +13,7 @@ import { MOUNT_CLASS_TO } from "../../config/debug";
import filterUnique from "../../helpers/array/filterUnique";
import findAndSplice from "../../helpers/array/findAndSplice";
import indexOfAndSplice from "../../helpers/array/indexOfAndSplice";
import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../../helpers/cancellablePromise";
import cleanSearchText from "../../helpers/cleanSearchText";
import cleanUsername from "../../helpers/cleanUsername";
import { formatFullSentTimeRaw, tsNow } from "../../helpers/date";

2
src/lib/mediaPlayer.ts

@ -9,7 +9,7 @@ import { IS_APPLE_MOBILE } from "../environment/userAgent"; @@ -9,7 +9,7 @@ import { IS_APPLE_MOBILE } from "../environment/userAgent";
import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import RangeSelector from "../components/rangeSelector";
import { onMediaLoad } from "../helpers/files";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import ListenerSetter from "../helpers/listenerSetter";
import ButtonMenu from "../components/buttonMenu";
import { ButtonMenuToggleHandler } from "../components/buttonMenuToggle";

2
src/lib/mtproto/apiFileManager.ts

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
import type { ReferenceBytes } from "./referenceDatabase";
import { MOUNT_CLASS_TO } from "../../config/debug";
import Modes from "../../config/modes";
import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../../helpers/cancellablePromise";
import { notifyAll, notifySomeone } from "../../helpers/context";
import { getFileNameByLocation } from "../../helpers/fileName";
import { randomLong } from "../../helpers/random";

4
src/lib/mtproto/apiManager.ts

@ -19,7 +19,7 @@ import dcConfigurator, { ConnectionType, DcConfigurator, TransportType } from '. @@ -19,7 +19,7 @@ import dcConfigurator, { ConnectionType, DcConfigurator, TransportType } from '.
import { logger } from '../logger';
import type { DcAuthKey, DcId, DcServerSalt, InvokeApiOptions } from '../../types';
import type { MethodDeclMap } from '../../layer';
import { CancellablePromise, deferredPromise } from '../../helpers/cancellablePromise';
import deferredPromise, { CancellablePromise } from '../../helpers/cancellablePromise';
//import { clamp } from '../../helpers/number';
import { IS_SAFARI } from '../../environment/userAgent';
import App from '../../config/app';
@ -32,7 +32,7 @@ import Modes from '../../config/modes'; @@ -32,7 +32,7 @@ import Modes from '../../config/modes';
import bytesFromHex from '../../helpers/bytes/bytesFromHex';
import bytesToHex from '../../helpers/bytes/bytesToHex';
import isObject from '../../helpers/object/isObject';
import { pause } from '../../helpers/schedulers/pause';
import pause from '../../helpers/schedulers/pause';
/// #if !MTPROTO_WORKER
import rootScope from '../rootScope';

2
src/lib/mtproto/mtprotoworker.ts

@ -28,7 +28,7 @@ import appRuntimeManager from '../appManagers/appRuntimeManager'; @@ -28,7 +28,7 @@ import appRuntimeManager from '../appManagers/appRuntimeManager';
import { SocketProxyTask } from './transports/socketProxied';
import telegramMeWebManager from './telegramMeWebManager';
import { CacheStorageDbName } from '../cacheStorage';
import { pause } from '../../helpers/schedulers/pause';
import pause from '../../helpers/schedulers/pause';
import IS_WEBP_SUPPORTED from '../../environment/webpSupport';
import type { ApiError } from './apiManager';
import { MTAppConfig } from './appConfig';

4
src/lib/mtproto/networker.ts

@ -41,8 +41,8 @@ import isObject from '../../helpers/object/isObject'; @@ -41,8 +41,8 @@ import isObject from '../../helpers/object/isObject';
import forEachReverse from '../../helpers/array/forEachReverse';
import sortLongsArray from '../../helpers/long/sortLongsArray';
import randomize from '../../helpers/array/randomize';
import { CancellablePromise, deferredPromise } from '../../helpers/cancellablePromise';
import { pause } from '../../helpers/schedulers/pause';
import deferredPromise, { CancellablePromise } from '../../helpers/cancellablePromise';
import pause from '../../helpers/schedulers/pause';
//console.error('networker included!', new Error().stack);

4
src/lib/mtproto/transports/controller.ts

@ -5,9 +5,9 @@ @@ -5,9 +5,9 @@
*/
import App from "../../../config/app";
import { deferredPromise } from "../../../helpers/cancellablePromise";
import deferredPromise from "../../../helpers/cancellablePromise";
import EventListenerBase from "../../../helpers/eventListenerBase";
import { pause } from "../../../helpers/schedulers/pause";
import pause from "../../../helpers/schedulers/pause";
import dcConfigurator, { TransportType } from "../dcConfigurator";
import type HTTP from "./http";
import type TcpObfuscated from "./tcpObfuscated";

2
src/lib/mtproto/transports/http.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { pause } from '../../../helpers/schedulers/pause';
import pause from '../../../helpers/schedulers/pause';
import { DcId } from '../../../types';
import { logger, LogTypes } from '../../logger';
import type MTPNetworker from '../networker';

2
src/lib/rlottie/lottieLoader.ts

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
import RLottieWorker from 'worker-loader!./rlottie.worker';
import animationIntersector from "../../components/animationIntersector";
import { MOUNT_CLASS_TO } from '../../config/debug';
import { pause } from '../../helpers/schedulers/pause';
import pause from '../../helpers/schedulers/pause';
import { logger, LogTypes } from "../logger";
import apiManager from "../mtproto/mtprotoworker";
import RLottiePlayer, { RLottieOptions } from './rlottiePlayer';

1
src/lib/rootScope.ts

@ -117,7 +117,6 @@ export type BroadcastEvents = { @@ -117,7 +117,6 @@ export type BroadcastEvents = {
'event-heavy-animation-start': void,
'event-heavy-animation-end': void,
'im_mount': void,
'im_tab_change': number,
'idle': boolean,

2
src/lib/serviceWorker/cache.ts

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
import { pause } from "../../helpers/schedulers/pause";
import pause from "../../helpers/schedulers/pause";
const ctx = self as any as ServiceWorkerGlobalScope;
export const CACHE_ASSETS_NAME = 'cachedAssets';

2
src/lib/serviceWorker/stream.ts

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
*/
import readBlobAsUint8Array from "../../helpers/blob/readBlobAsUint8Array";
import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../../helpers/cancellablePromise";
import { getWindowClients } from "../../helpers/context";
import debounce from "../../helpers/schedulers/debounce";
import { InputFileLocation, UploadFile } from "../../layer";

2
src/lib/storage.ts

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
import { Database } from "../config/databases";
//import DATABASE_SESSION from "../config/databases/session";
import { CancellablePromise, deferredPromise } from "../helpers/cancellablePromise";
import deferredPromise, { CancellablePromise } from "../helpers/cancellablePromise";
import throttle from "../helpers/schedulers/throttle";
//import { WorkerTaskTemplate } from "../types";
import IDBStorage from "./idb";

2
src/lib/webp/webpWorkerController.ts

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
import WebpWorker from 'worker-loader!./webp.worker';
import { MOUNT_CLASS_TO } from '../../config/debug';
import { CancellablePromise, deferredPromise } from '../../helpers/cancellablePromise';
import deferredPromise, { CancellablePromise } from '../../helpers/cancellablePromise';
import apiManagerProxy from '../mtproto/mtprotoworker';
export type WebpConvertTask = {

6
src/pages/pageIm.ts

@ -8,17 +8,13 @@ import blurActiveElement from "../helpers/dom/blurActiveElement"; @@ -8,17 +8,13 @@ import blurActiveElement from "../helpers/dom/blurActiveElement";
import loadFonts from "../helpers/dom/loadFonts";
import appStateManager from "../lib/appManagers/appStateManager";
import I18n from "../lib/langPack";
import rootScope from "../lib/rootScope";
import Page from "./page";
let onFirstMount = () => {
//return;
appStateManager.pushToState('authState', {_: 'authStateSignedIn'});
// ! TOO SLOW
/* appStateManager.saveState(); */
rootScope.dispatchEvent('im_mount');
if(!I18n.requestedServerLanguage) {
I18n.getCacheLangPack().then(langPack => {
if(langPack.local) {
@ -28,8 +24,6 @@ let onFirstMount = () => { @@ -28,8 +24,6 @@ let onFirstMount = () => {
}
page.pageEl.style.display = '';
//alert('pageIm!');
//AudioContext && global.navigator && global.navigator.mediaDevices && global.navigator.mediaDevices.getUserMedia && global.WebAssembly;

2
src/pages/pagePassword.ts

@ -16,7 +16,7 @@ import PasswordMonkey from '../components/monkeys/password'; @@ -16,7 +16,7 @@ import PasswordMonkey from '../components/monkeys/password';
import RichTextProcessor from '../lib/richtextprocessor';
import I18n from '../lib/langPack';
import LoginPage from './loginPage';
import { cancelEvent } from '../helpers/dom/cancelEvent';
import cancelEvent from '../helpers/dom/cancelEvent';
import { attachClickEvent } from '../helpers/dom/clickEvent';
import htmlToSpan from '../helpers/dom/htmlToSpan';
import replaceContent from '../helpers/dom/replaceContent';

4
src/pages/pageSignIn.ts

@ -18,7 +18,7 @@ import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport"; @@ -18,7 +18,7 @@ import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import App from "../config/app";
import I18n, { _i18n, i18n } from "../lib/langPack";
import lottieLoader from "../lib/rlottie/lottieLoader";
import { ripple } from "../components/ripple";
import ripple from "../components/ripple";
import findUpTag from "../helpers/dom/findUpTag";
import findUpClassName from "../helpers/dom/findUpClassName";
import { randomLong } from "../helpers/random";
@ -26,7 +26,7 @@ import AppStorage from "../lib/storage"; @@ -26,7 +26,7 @@ import AppStorage from "../lib/storage";
import CacheStorageController from "../lib/cacheStorage";
import pageSignQR from "./pageSignQR";
import getLanguageChangeButton from "../components/languageChangeButton";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent } from "../helpers/dom/clickEvent";
import replaceContent from "../helpers/dom/replaceContent";
import toggleDisability from "../helpers/dom/toggleDisability";

2
src/pages/pageSignQR.ts

@ -17,7 +17,7 @@ import appStateManager from '../lib/appManagers/appStateManager'; @@ -17,7 +17,7 @@ import appStateManager from '../lib/appManagers/appStateManager';
import rootScope from '../lib/rootScope';
import { putPreloader } from '../components/misc';
import getLanguageChangeButton from '../components/languageChangeButton';
import { pause } from '../helpers/schedulers/pause';
import pause from '../helpers/schedulers/pause';
import fixBase64String from '../helpers/fixBase64String';
import bytesCmp from '../helpers/bytes/bytesCmp';
import bytesToBase64 from '../helpers/bytes/bytesToBase64';

Loading…
Cancel
Save