@capillarytech/creatives-library 9.1.7 → 9.1.8-alpha.sprint-cap-214249.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constants/unified.js +0 -1
- package/index.js +0 -13
- package/package.json +1 -1
- package/services/getSchema.js +1 -4
- package/services/tests/getSchema.test.js +2 -2
- package/utils/common.js +0 -6
- package/utils/createMobilePushPayload.js +47 -33
- package/utils/tests/createMobilePushPayload.test.js +102 -8
- package/v2Components/CapMpushCTA/index.js +10 -9
- package/v2Components/CapMpushCTA/index.scss +29 -3
- package/v2Components/CapMpushCTA/tests/index.test.js +89 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +26 -13
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +13 -1
- package/v2Components/CommonTestAndPreview/constants.js +2 -0
- package/v2Components/CommonTestAndPreview/index.js +49 -11
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +79 -5
- package/v2Components/CommonTestAndPreview/tests/index.test.js +86 -0
- package/v2Components/FormBuilder/Functional/tests/mpush.crossFlowParity.test.js +1 -1
- package/v2Components/FormBuilder/Functional/tests/mpush.shellEvents.test.js +1 -1
- package/v2Components/FormBuilder/Functional/tests/mpush.singlePlatform.test.js +1 -1
- package/v2Components/FormBuilder/tests/mpush.characterization.test.js +2 -2
- package/v2Components/TemplatePreview/_templatePreview.scss +12 -2
- package/v2Components/TemplatePreview/index.js +30 -17
- package/v2Components/TemplatePreview/tests/index.test.js +61 -0
- package/v2Containers/Cap/index.js +0 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +70 -151
- package/v2Containers/CreativesContainer/index.js +3 -6
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +29 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +52 -47
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +207 -192
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +116 -121
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +30 -208
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +316 -72
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +45 -16
- package/v2Containers/MobilePushNew/constants.js +5 -0
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +63 -1
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +52 -0
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +38 -1
- package/v2Containers/MobilePushNew/hooks/useUpload.js +29 -39
- package/v2Containers/MobilePushNew/index.js +453 -188
- package/v2Containers/MobilePushNew/index.scss +188 -4
- package/v2Containers/MobilePushNew/messages.js +86 -6
- package/v2Containers/MobilePushNew/tests/index.test.js +450 -1
- package/v2Containers/MobilePushNew/tests/utils.test.js +25 -0
- package/v2Containers/MobilePushNew/utils.js +8 -0
- package/v2Containers/Templates/_templates.scss +10 -2
- package/v2Containers/Templates/index.js +84 -90
- package/v2Containers/Templates/tests/index.test.js +68 -0
- package/v2Components/FormBuilder/Functional/tests/manual.typingPerf.test.js +0 -135
- package/v2Components/FormBuilder/Functional/tests/mpush.ctaFlows.parity.test.js +0 -320
- package/v2Components/FormBuilder/Functional/tests/mpush.editContainer.parity.test.js +0 -148
- package/v2Components/FormBuilder/Functional/tests/mpush.libraryValidity.parity.test.js +0 -152
- package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +0 -70
- package/v2Containers/MobilePush/Create/actions.js +0 -52
- package/v2Containers/MobilePush/Create/constants.js +0 -26
- package/v2Containers/MobilePush/Create/index.js +0 -2149
- package/v2Containers/MobilePush/Create/messages.js +0 -349
- package/v2Containers/MobilePush/Create/reducer.js +0 -72
- package/v2Containers/MobilePush/Create/sagas.js +0 -79
- package/v2Containers/MobilePush/Create/selectors.js +0 -29
- package/v2Containers/MobilePush/Create/test/contentValidity.test.js +0 -154
- package/v2Containers/MobilePush/Create/test/saga.test.js +0 -19
- package/v2Containers/MobilePush/Create/test/stayOpenOnSave.test.js +0 -80
- package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +0 -65
- package/v2Containers/MobilePush/Edit/actions.js +0 -94
- package/v2Containers/MobilePush/Edit/constants.js +0 -37
- package/v2Containers/MobilePush/Edit/index.js +0 -2407
- package/v2Containers/MobilePush/Edit/messages.js +0 -341
- package/v2Containers/MobilePush/Edit/reducer.js +0 -113
- package/v2Containers/MobilePush/Edit/sagas.js +0 -113
- package/v2Containers/MobilePush/Edit/selectors.js +0 -33
- package/v2Containers/MobilePush/Edit/test/contentValidity.test.js +0 -149
- package/v2Containers/MobilePush/Edit/test/saga.test.js +0 -255
- package/v2Containers/MobilePush/Edit/test/stayOpenOnSave.test.js +0 -60
- package/v2Containers/MobilePush/commonMethods.js +0 -333
- package/v2Containers/MobilePush/eventsMap.js +0 -130
- package/v2Containers/MobilePush/tests/commonMethods.test.js +0 -401
- package/v2Containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -22
- package/v2Containers/MobilepushWrapper/index.js +0 -178
- package/v2Containers/MobilepushWrapper/messages.js +0 -29
- /package/{v2Containers/MobilePush/initialSchema.js → v2Components/FormBuilder/Functional/tests/fixtures/mpushInitialSchema.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { renderHook, act } from '@testing-library/react';
|
|
2
2
|
import usePlatformSync from '../usePlatformSync';
|
|
3
3
|
import {
|
|
4
|
-
ANDROID, GIF, IMAGE, IOS, VIDEO,
|
|
4
|
+
ANDROID, GIF, IMAGE, IOS, VIDEO, DEEP_LINK, EXTERNAL_LINK, TAP_ACTION_APP,
|
|
5
5
|
} from '../../constants';
|
|
6
6
|
import { NONE } from '../../../Whatsapp/constants';
|
|
7
7
|
|
|
@@ -979,6 +979,68 @@ describe('usePlatformSync Hook', () => {
|
|
|
979
979
|
});
|
|
980
980
|
});
|
|
981
981
|
|
|
982
|
+
describe('handleTapActionChange', () => {
|
|
983
|
+
it('turns the tap action on with External link in one update', () => {
|
|
984
|
+
const { result } = renderHook(() => usePlatformSync(defaultProps));
|
|
985
|
+
|
|
986
|
+
act(() => {
|
|
987
|
+
result.current.handleTapActionChange(ANDROID, EXTERNAL_LINK);
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
expect(mockSetAndroidContent).toHaveBeenCalledTimes(1);
|
|
991
|
+
expect(mockSetAndroidContent).toHaveBeenCalledWith(expect.objectContaining({
|
|
992
|
+
actionOnClick: true,
|
|
993
|
+
linkType: EXTERNAL_LINK,
|
|
994
|
+
deepLinkValue: '',
|
|
995
|
+
externalLinkValue: '',
|
|
996
|
+
}));
|
|
997
|
+
expect(mockSetIosContent).not.toHaveBeenCalled();
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
it('turns the tap action off and resets the link for App', () => {
|
|
1001
|
+
const props = {
|
|
1002
|
+
...defaultProps,
|
|
1003
|
+
iosContent: {
|
|
1004
|
+
...defaultIosContent, actionOnClick: true, linkType: EXTERNAL_LINK, externalLinkValue: 'https://x.com',
|
|
1005
|
+
},
|
|
1006
|
+
};
|
|
1007
|
+
const { result } = renderHook(() => usePlatformSync(props));
|
|
1008
|
+
|
|
1009
|
+
act(() => {
|
|
1010
|
+
result.current.handleTapActionChange(IOS, TAP_ACTION_APP);
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
expect(mockSetIosContent).toHaveBeenCalledWith(expect.objectContaining({
|
|
1014
|
+
actionOnClick: false,
|
|
1015
|
+
linkType: DEEP_LINK,
|
|
1016
|
+
externalLinkValue: '',
|
|
1017
|
+
}));
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
it('does nothing when the same option is chosen again', () => {
|
|
1021
|
+
const { result } = renderHook(() => usePlatformSync(defaultProps));
|
|
1022
|
+
|
|
1023
|
+
act(() => {
|
|
1024
|
+
result.current.handleTapActionChange(ANDROID, TAP_ACTION_APP);
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
expect(mockSetAndroidContent).not.toHaveBeenCalled();
|
|
1028
|
+
});
|
|
1029
|
+
|
|
1030
|
+
it('syncs to the other platform when sync is enabled', () => {
|
|
1031
|
+
const { result } = renderHook(() => usePlatformSync({ ...defaultProps, sameContent: true }));
|
|
1032
|
+
|
|
1033
|
+
act(() => {
|
|
1034
|
+
result.current.handleTapActionChange(ANDROID, DEEP_LINK);
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
expect(mockSetIosContent).toHaveBeenCalledWith(expect.objectContaining({
|
|
1038
|
+
actionOnClick: true,
|
|
1039
|
+
linkType: DEEP_LINK,
|
|
1040
|
+
}));
|
|
1041
|
+
});
|
|
1042
|
+
});
|
|
1043
|
+
|
|
982
1044
|
describe('handleLinkTypeChange', () => {
|
|
983
1045
|
it('should update Android linkType when sync is disabled', () => {
|
|
984
1046
|
const { result } = renderHook(() => usePlatformSync(defaultProps));
|
|
@@ -1121,6 +1121,19 @@ describe('useUpload Hook', () => {
|
|
|
1121
1121
|
});
|
|
1122
1122
|
});
|
|
1123
1123
|
|
|
1124
|
+
it('clears the platform it is given, not the visible tab', () => {
|
|
1125
|
+
const { result } = createHook({ sameContent: false, activeTab: ANDROID });
|
|
1126
|
+
act(() => {
|
|
1127
|
+
result.current.setImageSrc({ androidImageSrc: 'a.jpg', iosImageSrc: 'b.jpg' });
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
act(() => {
|
|
1131
|
+
result.current.clearImageDataByMediaType(IMAGE, IOS);
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
expect(result.current.imageSrc).toEqual({ androidImageSrc: 'a.jpg', iosImageSrc: '' });
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1124
1137
|
it('should clear video data with sync enabled', () => {
|
|
1125
1138
|
const { result } = createHook({ sameContent: true });
|
|
1126
1139
|
|
|
@@ -1456,4 +1469,43 @@ describe('useUpload Hook', () => {
|
|
|
1456
1469
|
});
|
|
1457
1470
|
});
|
|
1458
1471
|
});
|
|
1472
|
+
|
|
1473
|
+
describe('Ticking same content', () => {
|
|
1474
|
+
// Android has image A, iOS has video V; then tick on the given tab
|
|
1475
|
+
const renderAndTick = (activeTab) => {
|
|
1476
|
+
const hook = renderHook(({ sameContent }) => useUpload(
|
|
1477
|
+
mockMobilePushActions, {}, {}, {}, false, sameContent,
|
|
1478
|
+
mockSetAndroidContent, mockSetIosContent, activeTab, androidContent, iosContent, mockFormatMessage,
|
|
1479
|
+
), { initialProps: { sameContent: false } });
|
|
1480
|
+
act(() => {
|
|
1481
|
+
hook.result.current.setImageSrc({ androidImageSrc: 'A.jpg', iosImageSrc: '' });
|
|
1482
|
+
hook.result.current.setUpdateMpushVideoSrc(1, { videoSrc: 'V.mp4', previewUrl: 'V.jpg', videoDuration: 5 });
|
|
1483
|
+
});
|
|
1484
|
+
hook.rerender({ sameContent: true });
|
|
1485
|
+
return hook.result;
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
it('wipes the iOS video when ticked on Android, which has none', () => {
|
|
1489
|
+
const result = renderAndTick(ANDROID);
|
|
1490
|
+
expect(result.current.videoState).toEqual({
|
|
1491
|
+
androidVideoSrc: '',
|
|
1492
|
+
iosVideoSrc: '',
|
|
1493
|
+
androidVideoPreview: '',
|
|
1494
|
+
iosVideoPreview: '',
|
|
1495
|
+
androidVideoDuration: 0,
|
|
1496
|
+
iosVideoDuration: 0,
|
|
1497
|
+
});
|
|
1498
|
+
expect(result.current.iosAssetList).toEqual([]);
|
|
1499
|
+
expect(result.current.imageSrc).toEqual({ androidImageSrc: 'A.jpg', iosImageSrc: 'A.jpg' });
|
|
1500
|
+
expect(androidContent.videoSrc).toBe('');
|
|
1501
|
+
expect(iosContent.videoSrc).toBe('');
|
|
1502
|
+
});
|
|
1503
|
+
|
|
1504
|
+
it('wipes the Android image when ticked on iOS, which has none', () => {
|
|
1505
|
+
const result = renderAndTick(IOS);
|
|
1506
|
+
expect(result.current.imageSrc).toEqual({ androidImageSrc: '', iosImageSrc: '' });
|
|
1507
|
+
expect(result.current.videoState.androidVideoSrc).toBe('V.mp4');
|
|
1508
|
+
expect(result.current.androidAssetList).toMatchObject({ videoSrc: 'V.mp4' });
|
|
1509
|
+
});
|
|
1510
|
+
});
|
|
1459
1511
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line jsx-a11y/href-no-hash
|
|
2
2
|
import { useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import {
|
|
4
|
-
ANDROID, DEEP_LINK, GIF, IMAGE, IOS, VIDEO,
|
|
4
|
+
ANDROID, DEEP_LINK, GIF, IMAGE, IOS, VIDEO, TAP_ACTION_APP,
|
|
5
5
|
} from '../constants';
|
|
6
6
|
import { NONE } from '../../Whatsapp/constants';
|
|
7
7
|
|
|
@@ -353,6 +353,42 @@ const usePlatformSync = ({
|
|
|
353
353
|
}
|
|
354
354
|
}, [androidContent, iosContent, setAndroidContent, setIosContent, sameContent, deepSyncContent]);
|
|
355
355
|
|
|
356
|
+
// "When tapped, open" dropdown: TAP_ACTION_APP turns the tap action off, DEEP_LINK / EXTERNAL_LINK
|
|
357
|
+
// turn it on with that link type. One update, so actionOnClick and linkType can't overwrite each other.
|
|
358
|
+
const handleTapActionChange = useCallback((platform, value) => {
|
|
359
|
+
const {
|
|
360
|
+
setContent,
|
|
361
|
+
otherSetContent,
|
|
362
|
+
otherContent,
|
|
363
|
+
currentContent,
|
|
364
|
+
targetPlatform,
|
|
365
|
+
} = getPlatformContent(platform, {
|
|
366
|
+
androidContent,
|
|
367
|
+
iosContent,
|
|
368
|
+
setAndroidContent,
|
|
369
|
+
setIosContent,
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
const isApp = value === TAP_ACTION_APP;
|
|
373
|
+
const currentValue = currentContent?.actionOnClick ? (currentContent?.linkType || DEEP_LINK) : TAP_ACTION_APP;
|
|
374
|
+
if (value === currentValue) return;
|
|
375
|
+
|
|
376
|
+
const newContent = {
|
|
377
|
+
...currentContent,
|
|
378
|
+
actionOnClick: !isApp,
|
|
379
|
+
linkType: isApp ? DEEP_LINK : value,
|
|
380
|
+
deepLinkValue: "",
|
|
381
|
+
deepLinkKeysValue: [],
|
|
382
|
+
externalLinkValue: "",
|
|
383
|
+
};
|
|
384
|
+
setContent(newContent);
|
|
385
|
+
|
|
386
|
+
if (sameContent) {
|
|
387
|
+
const synced = deepSyncContent(newContent, otherContent, targetPlatform);
|
|
388
|
+
otherSetContent(synced);
|
|
389
|
+
}
|
|
390
|
+
}, [androidContent, iosContent, setAndroidContent, setIosContent, sameContent, deepSyncContent]);
|
|
391
|
+
|
|
356
392
|
return {
|
|
357
393
|
handleTitleChange,
|
|
358
394
|
handleMessageChange,
|
|
@@ -361,6 +397,7 @@ const usePlatformSync = ({
|
|
|
361
397
|
handleButtonChange,
|
|
362
398
|
handleActionOnClickChange,
|
|
363
399
|
handleLinkTypeChange,
|
|
400
|
+
handleTapActionChange,
|
|
364
401
|
};
|
|
365
402
|
};
|
|
366
403
|
|
|
@@ -148,8 +148,9 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
|
|
|
148
148
|
mobilePushActions.uploadAsset(file, assetType, fileParams, activeTab === ANDROID ? 0 : 1, mobilePushParams);
|
|
149
149
|
}, [mobilePushActions, validateImageFile, validateVideoFile, validateGifFile, activeTab]);
|
|
150
150
|
|
|
151
|
-
// Clear media data when switching media types
|
|
152
|
-
|
|
151
|
+
// Clear media data when switching media types.
|
|
152
|
+
// platform: the tab whose media changed (defaults to the visible tab).
|
|
153
|
+
const clearImageDataByMediaType = useCallback((mediaType, platform = activeTab) => {
|
|
153
154
|
if (mediaType === IMAGE) {
|
|
154
155
|
if (sameContent) {
|
|
155
156
|
// When sync is enabled, clear both platforms
|
|
@@ -158,11 +159,11 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
|
|
|
158
159
|
iosImageSrc: "",
|
|
159
160
|
});
|
|
160
161
|
} else {
|
|
161
|
-
// When sync is disabled, only clear
|
|
162
|
-
const
|
|
162
|
+
// When sync is disabled, only clear that platform
|
|
163
|
+
const platformKey = platform === ANDROID ? 'androidImageSrc' : 'iosImageSrc';
|
|
163
164
|
setImageSrc((prevState) => ({
|
|
164
165
|
...prevState,
|
|
165
|
-
[
|
|
166
|
+
[platformKey]: "",
|
|
166
167
|
}));
|
|
167
168
|
}
|
|
168
169
|
} else if (mediaType === VIDEO || mediaType === GIF) {
|
|
@@ -196,9 +197,9 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
|
|
|
196
197
|
mobilePushActions.clearAsset(0);
|
|
197
198
|
mobilePushActions.clearAsset(1);
|
|
198
199
|
} else {
|
|
199
|
-
// When sync is disabled, only clear
|
|
200
|
-
const platformIndex =
|
|
201
|
-
const isAndroid =
|
|
200
|
+
// When sync is disabled, only clear that platform
|
|
201
|
+
const platformIndex = platform === ANDROID ? 0 : 1;
|
|
202
|
+
const isAndroid = platform === ANDROID;
|
|
202
203
|
const videoProps = getVideoProperties(isAndroid);
|
|
203
204
|
|
|
204
205
|
setVideoState((prevState) => ({
|
|
@@ -293,17 +294,11 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
|
|
|
293
294
|
}
|
|
294
295
|
}, [videoState?.androidVideoSrc, videoState?.iosVideoSrc, videoState?.androidVideoPreview, videoState?.iosVideoPreview, videoState?.androidVideoDuration, videoState?.iosVideoDuration, sameContent]);
|
|
295
296
|
|
|
296
|
-
//
|
|
297
|
+
// On tick, copy the active tab's image to both tabs, even when it has none
|
|
297
298
|
useEffect(() => {
|
|
298
299
|
if (sameContent) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (activeTab === ANDROID) {
|
|
302
|
-
currentImageSrc = imageSrc?.androidImageSrc || imageSrc?.iosImageSrc;
|
|
303
|
-
} else {
|
|
304
|
-
currentImageSrc = imageSrc?.iosImageSrc || imageSrc?.androidImageSrc;
|
|
305
|
-
}
|
|
306
|
-
if (currentImageSrc && (imageSrc?.androidImageSrc !== currentImageSrc || imageSrc?.iosImageSrc !== currentImageSrc)) {
|
|
300
|
+
const currentImageSrc = (activeTab === ANDROID ? imageSrc?.androidImageSrc : imageSrc?.iosImageSrc) || '';
|
|
301
|
+
if (imageSrc?.androidImageSrc !== currentImageSrc || imageSrc?.iosImageSrc !== currentImageSrc) {
|
|
307
302
|
setImageSrc({
|
|
308
303
|
androidImageSrc: currentImageSrc,
|
|
309
304
|
iosImageSrc: currentImageSrc,
|
|
@@ -314,31 +309,20 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
|
|
|
314
309
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
315
310
|
}, [sameContent, activeTab]);
|
|
316
311
|
|
|
317
|
-
//
|
|
312
|
+
// On tick, copy the active tab's video to both tabs, even when it has none
|
|
318
313
|
useEffect(() => {
|
|
319
314
|
if (sameContent) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (activeTab === ANDROID) {
|
|
325
|
-
currentVideoSrc = videoState?.androidVideoSrc || videoState?.iosVideoSrc;
|
|
326
|
-
currentVideoPreview = videoState?.androidVideoPreview || videoState?.iosVideoPreview;
|
|
327
|
-
currentVideoDuration = videoState?.androidVideoDuration || videoState?.iosVideoDuration;
|
|
328
|
-
} else {
|
|
329
|
-
currentVideoSrc = videoState?.iosVideoSrc || videoState?.androidVideoSrc;
|
|
330
|
-
currentVideoPreview = videoState?.iosVideoPreview || videoState?.androidVideoPreview;
|
|
331
|
-
currentVideoDuration = videoState?.iosVideoDuration || videoState?.androidVideoDuration;
|
|
332
|
-
}
|
|
315
|
+
const isAndroid = activeTab === ANDROID;
|
|
316
|
+
const currentVideoSrc = (isAndroid ? videoState?.androidVideoSrc : videoState?.iosVideoSrc) || '';
|
|
317
|
+
const currentVideoPreview = (isAndroid ? videoState?.androidVideoPreview : videoState?.iosVideoPreview) || '';
|
|
318
|
+
const currentVideoDuration = (isAndroid ? videoState?.androidVideoDuration : videoState?.iosVideoDuration) || 0;
|
|
333
319
|
if (
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|| videoState?.iosVideoDuration !== currentVideoDuration
|
|
341
|
-
)
|
|
320
|
+
videoState?.androidVideoSrc !== currentVideoSrc
|
|
321
|
+
|| videoState?.iosVideoSrc !== currentVideoSrc
|
|
322
|
+
|| videoState?.androidVideoPreview !== currentVideoPreview
|
|
323
|
+
|| videoState?.iosVideoPreview !== currentVideoPreview
|
|
324
|
+
|| videoState?.androidVideoDuration !== currentVideoDuration
|
|
325
|
+
|| videoState?.iosVideoDuration !== currentVideoDuration
|
|
342
326
|
) {
|
|
343
327
|
setVideoState({
|
|
344
328
|
androidVideoSrc: currentVideoSrc,
|
|
@@ -349,6 +333,12 @@ const useUpload = (mobilePushActions, editData = {}, _uploadedAssetData0 = {}, _
|
|
|
349
333
|
iosVideoDuration: currentVideoDuration,
|
|
350
334
|
});
|
|
351
335
|
}
|
|
336
|
+
// The upload box also reads the uploaded-file list
|
|
337
|
+
const sourceAssetList = isAndroid ? androidAssetList : iosAssetList;
|
|
338
|
+
const targetAssetList = isAndroid ? iosAssetList : androidAssetList;
|
|
339
|
+
if (JSON.stringify(sourceAssetList) !== JSON.stringify(targetAssetList)) {
|
|
340
|
+
(isAndroid ? updateIosAssetList : updateAndroidAssetList)(sourceAssetList);
|
|
341
|
+
}
|
|
352
342
|
}
|
|
353
343
|
// Only run when sameContent or activeTab changes
|
|
354
344
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|