From b79fba523081404e60232dc06a35f80852e89b4e Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Thu, 4 May 2023 15:54:35 -0300 Subject: [PATCH 1/2] Remove platform index.ts setting of Realtime properties These properties are all already set inside the Realtime class. --- src/platform/nativescript/index.ts | 5 ----- src/platform/nodejs/index.ts | 5 ----- src/platform/react-native/index.ts | 5 ----- src/platform/web-noencryption/index.ts | 5 ----- src/platform/web/index.ts | 5 ----- 5 files changed, 25 deletions(-) diff --git a/src/platform/nativescript/index.ts b/src/platform/nativescript/index.ts index 9ca1e47d44..00cf43ff05 100644 --- a/src/platform/nativescript/index.ts +++ b/src/platform/nativescript/index.ts @@ -14,7 +14,6 @@ import Config from './config'; import Transports from '../web/lib/transport'; import Logger from '../../common/lib/util/logger'; import { getDefaults } from '../../common/lib/util/defaults'; -import ConnectionManager from '../../common/lib/transport/connectionmanager'; // @ts-ignore import WebStorage from './lib/util/webstorage'; import PlatformDefaults from '../web/lib/util/defaults'; @@ -33,12 +32,8 @@ Rest.Crypto = Crypto; Realtime.Crypto = Crypto; Rest.Message = Message; -Realtime.Message = Message; Rest.PresenceMessage = PresenceMessage; -Realtime.PresenceMessage = PresenceMessage; - -Realtime.ConnectionManager = ConnectionManager; Logger.initLogHandlers(); diff --git a/src/platform/nodejs/index.ts b/src/platform/nodejs/index.ts index 2b05e01e5c..4d94ef3e1e 100644 --- a/src/platform/nodejs/index.ts +++ b/src/platform/nodejs/index.ts @@ -13,7 +13,6 @@ import Config from './config'; import Transports from './lib/transport'; import Logger from '../../common/lib/util/logger'; import { getDefaults } from '../../common/lib/util/defaults'; -import ConnectionManager from '../../common/lib/transport/connectionmanager'; import PlatformDefaults from './lib/util/defaults'; import Message from 'common/lib/types/message'; import PresenceMessage from 'common/lib/types/presencemessage'; @@ -29,12 +28,8 @@ Rest.Crypto = Crypto; Realtime.Crypto = Crypto; Rest.Message = Message; -Realtime.Message = Message; Rest.PresenceMessage = PresenceMessage; -Realtime.PresenceMessage = PresenceMessage; - -Realtime.ConnectionManager = ConnectionManager; Logger.initLogHandlers(); diff --git a/src/platform/react-native/index.ts b/src/platform/react-native/index.ts index 210c7005a5..fd83f02b13 100644 --- a/src/platform/react-native/index.ts +++ b/src/platform/react-native/index.ts @@ -13,7 +13,6 @@ import Config from './config'; import Transports from '../web/lib/transport'; import Logger from '../../common/lib/util/logger'; import { getDefaults } from '../../common/lib/util/defaults'; -import ConnectionManager from '../../common/lib/transport/connectionmanager'; import WebStorage from '../web/lib/util/webstorage'; import PlatformDefaults from '../web/lib/util/defaults'; import msgpack from '../web/lib/util/msgpack'; @@ -31,12 +30,8 @@ Rest.Crypto = Crypto; Realtime.Crypto = Crypto; Rest.Message = Message; -Realtime.Message = Message; Rest.PresenceMessage = PresenceMessage; -Realtime.PresenceMessage = PresenceMessage; - -Realtime.ConnectionManager = ConnectionManager; Logger.initLogHandlers(); diff --git a/src/platform/web-noencryption/index.ts b/src/platform/web-noencryption/index.ts index 62c7620784..1a49275350 100644 --- a/src/platform/web-noencryption/index.ts +++ b/src/platform/web-noencryption/index.ts @@ -12,7 +12,6 @@ import Config from '../web/config'; import Transports from '../web/lib/transport'; import Logger from '../../common/lib/util/logger'; import { getDefaults } from '../../common/lib/util/defaults'; -import ConnectionManager from '../../common/lib/transport/connectionmanager'; import WebStorage from '../web/lib/util/webstorage'; import PlatformDefaults from '../web/lib/util/defaults'; import msgpack from '../web/lib/util/msgpack'; @@ -30,12 +29,8 @@ Rest.Crypto = Crypto; Realtime.Crypto = Crypto; Rest.Message = Message; -Realtime.Message = Message; Rest.PresenceMessage = PresenceMessage; -Realtime.PresenceMessage = PresenceMessage; - -Realtime.ConnectionManager = ConnectionManager; Logger.initLogHandlers(); diff --git a/src/platform/web/index.ts b/src/platform/web/index.ts index d945aa3517..5caa607dca 100644 --- a/src/platform/web/index.ts +++ b/src/platform/web/index.ts @@ -13,7 +13,6 @@ import Config from './config'; import Transports from './lib/transport'; import Logger from '../../common/lib/util/logger'; import { getDefaults } from '../../common/lib/util/defaults'; -import ConnectionManager from '../../common/lib/transport/connectionmanager'; import WebStorage from './lib/util/webstorage'; import PlatformDefaults from './lib/util/defaults'; import msgpack from './lib/util/msgpack'; @@ -31,12 +30,8 @@ Rest.Crypto = Crypto; Realtime.Crypto = Crypto; Rest.Message = Message; -Realtime.Message = Message; Rest.PresenceMessage = PresenceMessage; -Realtime.PresenceMessage = PresenceMessage; - -Realtime.ConnectionManager = ConnectionManager; Logger.initLogHandlers(); From bb480b056796f6c8b928f3b39963822d701263b7 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Thu, 4 May 2023 15:59:45 -0300 Subject: [PATCH 2/2] Set Rest.{Message, PresenceMessage} directly in the class Less code, and consistent with Realtime. --- src/common/lib/client/rest.ts | 4 ++-- src/platform/nativescript/index.ts | 6 ------ src/platform/nodejs/index.ts | 6 ------ src/platform/react-native/index.ts | 6 ------ src/platform/web-noencryption/index.ts | 6 ------ src/platform/web/index.ts | 6 ------ 6 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/common/lib/client/rest.ts b/src/common/lib/client/rest.ts index b0ec25e3e7..1ee41d8dfc 100644 --- a/src/common/lib/client/rest.ts +++ b/src/common/lib/client/rest.ts @@ -241,8 +241,8 @@ class Rest { static Callbacks = Rest; static Platform = Platform; static Crypto?: typeof Platform.Crypto; - static Message?: typeof Message; - static PresenceMessage?: typeof PresenceMessage; + static Message = Message; + static PresenceMessage = PresenceMessage; } class Channels { diff --git a/src/platform/nativescript/index.ts b/src/platform/nativescript/index.ts index 00cf43ff05..9457b30c12 100644 --- a/src/platform/nativescript/index.ts +++ b/src/platform/nativescript/index.ts @@ -18,8 +18,6 @@ import { getDefaults } from '../../common/lib/util/defaults'; import WebStorage from './lib/util/webstorage'; import PlatformDefaults from '../web/lib/util/defaults'; import msgpack from '../web/lib/util/msgpack'; -import Message from 'common/lib/types/message'; -import PresenceMessage from 'common/lib/types/presencemessage'; Platform.Crypto = Crypto; Platform.BufferUtils = BufferUtils; @@ -31,10 +29,6 @@ Platform.WebStorage = WebStorage; Rest.Crypto = Crypto; Realtime.Crypto = Crypto; -Rest.Message = Message; - -Rest.PresenceMessage = PresenceMessage; - Logger.initLogHandlers(); Platform.Defaults = getDefaults(PlatformDefaults); diff --git a/src/platform/nodejs/index.ts b/src/platform/nodejs/index.ts index 4d94ef3e1e..9460725ab3 100644 --- a/src/platform/nodejs/index.ts +++ b/src/platform/nodejs/index.ts @@ -14,8 +14,6 @@ import Transports from './lib/transport'; import Logger from '../../common/lib/util/logger'; import { getDefaults } from '../../common/lib/util/defaults'; import PlatformDefaults from './lib/util/defaults'; -import Message from 'common/lib/types/message'; -import PresenceMessage from 'common/lib/types/presencemessage'; Platform.Crypto = Crypto; Platform.BufferUtils = BufferUtils; @@ -27,10 +25,6 @@ Platform.WebStorage = null; Rest.Crypto = Crypto; Realtime.Crypto = Crypto; -Rest.Message = Message; - -Rest.PresenceMessage = PresenceMessage; - Logger.initLogHandlers(); Platform.Defaults = getDefaults(PlatformDefaults); diff --git a/src/platform/react-native/index.ts b/src/platform/react-native/index.ts index fd83f02b13..b304d7fcef 100644 --- a/src/platform/react-native/index.ts +++ b/src/platform/react-native/index.ts @@ -16,8 +16,6 @@ import { getDefaults } from '../../common/lib/util/defaults'; import WebStorage from '../web/lib/util/webstorage'; import PlatformDefaults from '../web/lib/util/defaults'; import msgpack from '../web/lib/util/msgpack'; -import Message from 'common/lib/types/message'; -import PresenceMessage from 'common/lib/types/presencemessage'; Platform.Crypto = Crypto; Platform.BufferUtils = BufferUtils; @@ -29,10 +27,6 @@ Platform.WebStorage = WebStorage; Rest.Crypto = Crypto; Realtime.Crypto = Crypto; -Rest.Message = Message; - -Rest.PresenceMessage = PresenceMessage; - Logger.initLogHandlers(); Platform.Defaults = getDefaults(PlatformDefaults); diff --git a/src/platform/web-noencryption/index.ts b/src/platform/web-noencryption/index.ts index 1a49275350..15b6552b4f 100644 --- a/src/platform/web-noencryption/index.ts +++ b/src/platform/web-noencryption/index.ts @@ -15,8 +15,6 @@ import { getDefaults } from '../../common/lib/util/defaults'; import WebStorage from '../web/lib/util/webstorage'; import PlatformDefaults from '../web/lib/util/defaults'; import msgpack from '../web/lib/util/msgpack'; -import Message from 'common/lib/types/message'; -import PresenceMessage from 'common/lib/types/presencemessage'; Platform.Crypto = null; Platform.BufferUtils = BufferUtils; @@ -28,10 +26,6 @@ Platform.WebStorage = WebStorage; Rest.Crypto = Crypto; Realtime.Crypto = Crypto; -Rest.Message = Message; - -Rest.PresenceMessage = PresenceMessage; - Logger.initLogHandlers(); Platform.Defaults = getDefaults(PlatformDefaults); diff --git a/src/platform/web/index.ts b/src/platform/web/index.ts index 5caa607dca..33b36e706b 100644 --- a/src/platform/web/index.ts +++ b/src/platform/web/index.ts @@ -16,8 +16,6 @@ import { getDefaults } from '../../common/lib/util/defaults'; import WebStorage from './lib/util/webstorage'; import PlatformDefaults from './lib/util/defaults'; import msgpack from './lib/util/msgpack'; -import Message from 'common/lib/types/message'; -import PresenceMessage from 'common/lib/types/presencemessage'; Platform.Crypto = Crypto; Platform.BufferUtils = BufferUtils; @@ -29,10 +27,6 @@ Platform.WebStorage = WebStorage; Rest.Crypto = Crypto; Realtime.Crypto = Crypto; -Rest.Message = Message; - -Rest.PresenceMessage = PresenceMessage; - Logger.initLogHandlers(); Platform.Defaults = getDefaults(PlatformDefaults);