Skip to content

Commit

Permalink
[not verified] Enable v5 edit component only on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
fluiddot committed Mar 9, 2023
1 parent 2ef1722 commit e850663
Showing 1 changed file with 40 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Platform } from '@wordpress/element';
import { addFilter } from '@wordpress/hooks';
import deprecatedV1 from './deprecated/v1';
import deprecatedV2 from './deprecated/v2';
import deprecatedV3 from './deprecated/v3';
import deprecatedV4 from './deprecated/v4';
import withVideoPressEdit from './edit';
import withVideoPressSave from './save';

const addVideoPressSupport = ( settings, name ) => {
Expand All @@ -7,7 +13,7 @@ const addVideoPressSupport = ( settings, name ) => {
return settings;
}

const { save } = settings;
const { deprecated, edit, save, supports } = settings;

const attributesDefinition = {
autoplay: {
Expand Down Expand Up @@ -93,11 +99,39 @@ const addVideoPressSupport = ( settings, name ) => {
},
};

return {
...settings,
attributes: attributesDefinition,
save: withVideoPressSave( save ),
};
return Platform.select( {
ios: {
...settings,
attributes: attributesDefinition,
supports: {
...supports,
reusable: false,
},
edit: withVideoPressEdit( edit ),
save: withVideoPressSave( save ),
deprecated: [
...( deprecated || [] ),
deprecatedV4,
deprecatedV3,
{
attributes: attributesDefinition,
isEligible: attrs => ! attrs.guid,
save,
supports,
isDeprecation: true,
},
deprecatedV2,
deprecatedV1,
],
},
// The VideoPress token fetch is not supported yet on Android.
// So for now, we keep using the edit component of the core Video block.
android: {
...settings,
attributes: attributesDefinition,
save: withVideoPressSave( save ),
},
} );
};

addFilter(
Expand Down

0 comments on commit e850663

Please sign in to comment.