Skip to content

Commit ed79a8e

Browse files
aweiss-deve-maad
authored andcommitted
runfix(cells): disable spammy tracking (#19829)
1 parent 22b1446 commit ed79a8e

File tree

2 files changed

+19
-21
lines changed
  • src/script/components/MessagesList/Message/ContentMessage/asset

2 files changed

+19
-21
lines changed

src/script/components/MessagesList/Message/ContentMessage/asset/MultipartAssets/VideoAssetCard/VideoAssetPlayer/useVideoPlayback/useVideoPlayback.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919

2020
import {useState, useCallback, useRef, SyntheticEvent} from 'react';
2121

22-
import {amplify} from 'amplify';
23-
24-
import {WebAppEvents} from '@wireapp/webapp-events';
25-
26-
import {EventName} from 'Repositories/tracking/EventName';
27-
2822
import {isVideoPlayable} from './isVideoPlayable/isVideoPlayable';
2923

3024
interface UseVideoPlaybackProps {
@@ -59,8 +53,9 @@ export const useVideoPlayback = ({url, videoElement, isEnabled}: UseVideoPlaybac
5953
if (!playable) {
6054
const status = 'unplayable';
6155

62-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
63-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.UNPLAYABLE_ERROR);
56+
// Todo: This needs to be revisited
57+
// amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
58+
// amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.UNPLAYABLE_ERROR);
6459
setIsError(true);
6560
playabilityStatusRef.current = status;
6661
return status;
@@ -108,7 +103,8 @@ export const useVideoPlayback = ({url, videoElement, isEnabled}: UseVideoPlaybac
108103

109104
const handleError = useCallback((event: SyntheticEvent<HTMLVideoElement>) => {
110105
setIsError(true);
111-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
106+
// Todo: This needs to be revisited
107+
//amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
112108
console.error('Video cannot be played', event);
113109
}, []);
114110

src/script/components/MessagesList/Message/ContentMessage/asset/VideoAsset/VideoAsset.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919

2020
import {useCallback, useEffect, useState} from 'react';
2121

22-
import {amplify} from 'amplify';
2322
import cx from 'classnames';
2423
import {container} from 'tsyringe';
2524

2625
import {TabIndex, Button, ButtonVariant, useTimeout} from '@wireapp/react-ui-kit';
27-
import {WebAppEvents} from '@wireapp/webapp-events';
2826

2927
import {RestrictedVideo} from 'Components/asset/RestrictedVideo';
3028
import {AssetError} from 'Repositories/assets/AssetError';
@@ -33,7 +31,6 @@ import {AssetTransferState} from 'Repositories/assets/AssetTransferState';
3331
import type {ContentMessage} from 'Repositories/entity/message/ContentMessage';
3432
import type {FileAsset as FileAssetType} from 'Repositories/entity/message/FileAsset';
3533
import {TeamState} from 'Repositories/team/TeamState';
36-
import {EventName} from 'Repositories/tracking/EventName';
3734
import {useKoSubscribableChildren} from 'Util/ComponentUtil';
3835
import {t} from 'Util/LocalizerUtil';
3936
import {formatSeconds} from 'Util/TimeUtil';
@@ -94,10 +91,11 @@ const VideoAsset = ({
9491
const video = document.createElement('video');
9592
const canPlay = video.canPlayType(mimeType) !== '';
9693

97-
if (!canPlay) {
98-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
99-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.UNSUPPORTED_MIME_TYPE);
100-
}
94+
// ToDo: This needs to be revisited
95+
// if (!canPlay) {
96+
// amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
97+
// amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.UNSUPPORTED_MIME_TYPE);
98+
// }
10199

102100
return canPlay;
103101
};
@@ -136,22 +134,25 @@ const VideoAsset = ({
136134
const playable = await isVideoPlayable(assetUrl.url);
137135

138136
if (!playable) {
139-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
140-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.UNPLAYABLE_ERROR);
137+
// ToDo: This needs to be revisited
138+
// amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
139+
// amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.UNPLAYABLE_ERROR);
141140
setVideoPlaybackError(true);
142141
return;
143142
}
144143

145144
setVideoSrc(assetUrl);
146145
setIsVideoLoaded(true);
147-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_SUCCESS);
146+
// ToDo: This needs to be revisited
147+
//amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_SUCCESS);
148148
} catch (error) {
149149
if (error instanceof Error) {
150150
if (error.name !== AssetError.CANCEL_ERROR) {
151151
setVideoPlaybackError(true);
152152
}
153153
}
154-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
154+
// ToDo: This needs to be revisited
155+
//amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
155156
console.error('Failed to load video asset ', error);
156157
}
157158

@@ -216,7 +217,8 @@ const VideoAsset = ({
216217
poster={videoPreview?.url}
217218
onError={event => {
218219
setVideoPlaybackError(true);
219-
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
220+
// ToDo: This needs to be revisited
221+
//amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.MESSAGES.VIDEO.PLAY_FAILED);
220222
console.error('Video cannot be played', event);
221223
}}
222224
onPlaying={onVideoPlaying}

0 commit comments

Comments
 (0)