Skip to content

Commit 6e094fe

Browse files
authored
refactor: Add debug toggle to disable gzipping [WPB-14314] (#19677)
1 parent 5e412b1 commit 6e094fe

File tree

4 files changed

+48
-15
lines changed

4 files changed

+48
-15
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@wireapp/avs": "10.2.7",
1717
"@wireapp/avs-debugger": "0.0.7",
1818
"@wireapp/commons": "5.4.5",
19-
"@wireapp/core": "46.39.5",
19+
"@wireapp/core": "46.39.7",
2020
"@wireapp/kalium-backup": "0.0.4",
2121
"@wireapp/promise-queue": "2.4.5",
2222
"@wireapp/react-ui-kit": "9.68.0",

src/script/components/ConfigToolbar/ConfigToolbar.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {wrapperStyles} from './ConfigToolbar.styles';
3232

3333
export function ConfigToolbar() {
3434
const [showConfig, setShowConfig] = useState(false);
35+
const [isGzipEnabled, setIsGzipEnabled] = useState(window.wire?.app.debug?.isGzippingEnabled() || false);
3536
const [configFeaturesState, setConfigFeaturesState] = useState<Configuration['FEATURE']>(Config.getConfig().FEATURE);
3637
const [isMessageSendingActive, setIsMessageSendingActive] = useState(false);
3738
const messageCountRef = useRef<number>(0);
@@ -182,7 +183,7 @@ export function ConfigToolbar() {
182183
setAvsDebuggerEnabled(!!window.wire?.app?.debug?.enableAvsDebugger(isChecked));
183184
};
184185

185-
const renderAvsSwitch = (value: boolean) => {
186+
const renderAvsSwitch = () => {
186187
return (
187188
<div style={{marginBottom: '10px'}}>
188189
<label htmlFor="avs-debugger-checkbox" style={{display: 'block', fontWeight: 'bold'}}>
@@ -200,7 +201,7 @@ export function ConfigToolbar() {
200201
const handleAvsRustSftEnable = (isChecked: boolean) => {
201202
setAvsRustSftEnabled(!!window.wire?.app?.debug?.enableAvsRustSFT(isChecked));
202203
};
203-
const renderAvsRustSftSwitch = (value: boolean) => {
204+
const renderAvsRustSftSwitch = () => {
204205
return (
205206
<div style={{marginBottom: '10px'}}>
206207
<label htmlFor="avs-rust-sft-checkbox" style={{display: 'block', fontWeight: 'bold'}}>
@@ -215,6 +216,26 @@ export function ConfigToolbar() {
215216
);
216217
};
217218

219+
const renderGzipSwitch = () => {
220+
return (
221+
<div style={{marginBottom: '10px'}}>
222+
<label htmlFor="gzip-checkbox" style={{display: 'block', fontWeight: 'bold'}}>
223+
ENABLE GZIP
224+
</label>
225+
<Switch
226+
id="gzip-checkbox"
227+
checked={isGzipEnabled}
228+
onToggle={() => {
229+
setIsGzipEnabled(previousIsGzipEnabled => {
230+
window.wire?.app?.debug?.toggleGzipping(!previousIsGzipEnabled);
231+
return !previousIsGzipEnabled;
232+
});
233+
}}
234+
/>
235+
</div>
236+
);
237+
};
238+
218239
if (!showConfig) {
219240
return null;
220241
}
@@ -235,11 +256,15 @@ export function ConfigToolbar() {
235256
<Button onClick={() => window.wire?.app?.debug?.enablePressSpaceToUnmute()}>enablePressSpaceToUnmute</Button>
236257
<Button onClick={() => window.wire?.app?.debug?.disablePressSpaceToUnmute()}>disablePressSpaceToUnmute</Button>
237258

238-
<div>{renderAvsSwitch(avsDebuggerEnabled)}</div>
259+
<div>{renderAvsSwitch()}</div>
260+
261+
<hr />
262+
263+
<div>{renderAvsRustSftSwitch()}</div>
239264

240265
<hr />
241266

242-
<div>{renderAvsRustSftSwitch(avsRustSftEnabled)}</div>
267+
<div>{renderGzipSwitch()}</div>
243268

244269
<hr />
245270

src/script/util/DebugUtil.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ export class DebugUtil {
232232
);
233233
}
234234

235+
isGzippingEnabled(): boolean {
236+
return this.apiClient.transport.http.isGzipEnabled();
237+
}
238+
239+
toggleGzipping(enabled: boolean) {
240+
this.apiClient.transport.http.toggleGzip(enabled);
241+
}
242+
235243
enableCameraBlur(flag: boolean) {
236244
return this.callingRepository.switchVideoBackgroundBlur(flag);
237245
}

yarn.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8510,9 +8510,9 @@ __metadata:
85108510
languageName: node
85118511
linkType: hard
85128512

8513-
"@wireapp/api-client@npm:^27.78.1":
8514-
version: 27.78.1
8515-
resolution: "@wireapp/api-client@npm:27.78.1"
8513+
"@wireapp/api-client@npm:^27.79.1":
8514+
version: 27.79.1
8515+
resolution: "@wireapp/api-client@npm:27.79.1"
85168516
dependencies:
85178517
"@aws-sdk/client-s3": "npm:3.908.0"
85188518
"@aws-sdk/lib-storage": "npm:3.908.0"
@@ -8531,7 +8531,7 @@ __metadata:
85318531
uuid: "npm:11.1.0"
85328532
ws: "npm:8.18.1"
85338533
zod: "npm:3.24.2"
8534-
checksum: 10/84644ce542f9082fdb067cddc284cea6dae82e88c4f312a55cdb3edff313b278bb2258e5232a2975e98af34f034f91eb242f3c1bdbb374abc763a361ffde05a8
8534+
checksum: 10/3dc09f0c036d270f5ae5dc4fcb1026930cb88f9e329bafa2150a5e29c8b543c5d16448580e6811697a2e420c34da03bcd7fe9654274c66a1c31b718286292180
85358535
languageName: node
85368536
linkType: hard
85378537

@@ -8596,11 +8596,11 @@ __metadata:
85968596
languageName: node
85978597
linkType: hard
85988598

8599-
"@wireapp/core@npm:46.39.5":
8600-
version: 46.39.5
8601-
resolution: "@wireapp/core@npm:46.39.5"
8599+
"@wireapp/core@npm:46.39.7":
8600+
version: 46.39.7
8601+
resolution: "@wireapp/core@npm:46.39.7"
86028602
dependencies:
8603-
"@wireapp/api-client": "npm:^27.78.1"
8603+
"@wireapp/api-client": "npm:^27.79.1"
86048604
"@wireapp/commons": "npm:^5.4.5"
86058605
"@wireapp/core-crypto": "npm:9.1.0"
86068606
"@wireapp/cryptobox": "npm:12.8.0"
@@ -8618,7 +8618,7 @@ __metadata:
86188618
long: "npm:^5.2.0"
86198619
uuid: "npm:9.0.1"
86208620
zod: "npm:3.24.2"
8621-
checksum: 10/2a61ab3396081fe61a7f876bb97b4a8785da5b3f6df6351a6b3e8e84eee61b0cc6b87d4b2b94c8791091db864c67e353fe97df895cd30913aac54f07bee52fde
8621+
checksum: 10/1a3219376790a2123e4ae25b1c16dd0c056c7fa0eb77dbb67630c5286b527a6b7a307b6799382106fde8b4c697a3c35b5d4e67259f12f95097e8c18316bf4ad8
86228622
languageName: node
86238623
linkType: hard
86248624

@@ -22506,7 +22506,7 @@ __metadata:
2250622506
"@wireapp/avs-debugger": "npm:0.0.7"
2250722507
"@wireapp/commons": "npm:5.4.5"
2250822508
"@wireapp/copy-config": "npm:2.3.4"
22509-
"@wireapp/core": "npm:46.39.5"
22509+
"@wireapp/core": "npm:46.39.7"
2251022510
"@wireapp/eslint-config": "npm:3.0.7"
2251122511
"@wireapp/kalium-backup": "npm:0.0.4"
2251222512
"@wireapp/prettier-config": "npm:0.6.5"

0 commit comments

Comments
 (0)