Skip to content

Commit

Permalink
feat(project): remove deprecated app config props
Browse files Browse the repository at this point in the history
  • Loading branch information
olga-jwp committed Jan 4, 2023
1 parent c2c0f50 commit b6bb06f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ These are the available configuration parameters for the JW OTT Webapp's config.

**player**

Player key of your custom created player in the [JW Player dashboard](https://dashboard.jwplayer.com).
Player key of the default player.

---

Expand Down Expand Up @@ -166,6 +166,12 @@ You can change the background color of the shelf with the help of this property

---

**custom.enableSharing** (optional)

Set this parameter to `true` if you want to enable the "Share" button on the video and series detail screen.

---

**styling**

Use the `styling` object to define extra styles for your application.
Expand Down Expand Up @@ -237,19 +243,13 @@ Use the `features` object to define extra properties for your app.
```
{
"features": {
"enableSharing": true,
"recommendationsPlaylist": "IHBjjkSN",
"searchPlaylist": "D4soEviP"
}
```

---

**features.enableSharing** (optional)

Set this parameter to `false` if you want to disable the "Share" button on the video and series detail screen.

---

**features.recommendationsPlaylist** (optional)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Button from '#components/Button/Button';
import type { ScreenComponent } from '#types/screens';
import useQueryParam from '#src/hooks/useQueryParam';
import InlinePlayer from '#src/containers/InlinePlayer/InlinePlayer';
import { isTruthyCustomParamValue } from '#src/utils/common';

const MediaMovie: ScreenComponent<PlaylistItem> = ({ data, isLoading }) => {
const { t } = useTranslation('video');
Expand All @@ -46,7 +47,7 @@ const MediaMovie: ScreenComponent<PlaylistItem> = ({ data, isLoading }) => {
const { siteName, styling, features, custom } = config;

const posterFading: boolean = styling?.posterFading === true;
const enableSharing: boolean = features?.enableSharing === true;
const enableSharing: boolean = isTruthyCustomParamValue(custom?.enableSharing);
const isFavoritesEnabled: boolean = Boolean(features?.favoritesList);
const inlineLayout = Boolean(custom?.inlinePlayer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type { ScreenComponent } from '#types/screens';
import useQueryParam from '#src/hooks/useQueryParam';
import useGetSeriesId from '#src/hooks/useGetSeriesId';
import Loading from '#src/pages/Loading/Loading';
import { isTruthyCustomParamValue } from '#src/utils/common';

const MediaSeriesEpisode: ScreenComponent<PlaylistItem> = ({ data }) => {
const breakpoint = useBreakpoint();
Expand All @@ -47,7 +48,7 @@ const MediaSeriesEpisode: ScreenComponent<PlaylistItem> = ({ data }) => {
const { config, accessModel } = useConfigStore(({ config, accessModel }) => ({ config, accessModel }), shallow);
const { styling, features, siteName, custom } = config;
const posterFading: boolean = styling?.posterFading === true;
const enableSharing: boolean = features?.enableSharing === true;
const enableSharing: boolean = isTruthyCustomParamValue(custom?.enableSharing);
const isFavoritesEnabled: boolean = Boolean(features?.favoritesList);
const inlineLayout = Boolean(custom?.inlinePlayer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ import { generateMovieJSONLD } from '#src/utils/structuredData';
import type { ScreenComponent } from '#types/screens';
import type { Playlist } from '#types/playlist';
import Loading from '#src/pages/Loading/Loading';
import { isTruthyCustomParamValue } from '#src/utils/common';

const PlaylistLiveChannels: ScreenComponent<Playlist> = ({ data: { feedid, playlist } }) => {
const { t } = useTranslation('epg');

// Config
const { config, accessModel } = useConfigStore(({ config, accessModel }) => ({ config, accessModel }), shallow);
const { siteName, styling, features } = config;
const { siteName, styling, custom } = config;

const posterFading: boolean = styling?.posterFading === true;
const enableSharing: boolean = features?.enableSharing === true;
const enableSharing: boolean = isTruthyCustomParamValue(custom?.enableSharing);

const updateBlurImage = useBlurImageUpdater(playlist);

Expand Down
2 changes: 0 additions & 2 deletions src/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const menuSchema: SchemaOf<Menu> = object().shape({
});

const featuresSchema: SchemaOf<Features> = object({
enableCasting: boolean().notRequired(),
enableSharing: boolean().notRequired(),
recommendationsPlaylist: string().nullable(),
searchPlaylist: string().nullable(),
continueWatchingList: string().nullable(),
Expand Down
7 changes: 4 additions & 3 deletions src/utils/configLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ export async function loadAndValidateConfig(configSource: string | undefined) {
footerText: '',
shelfTitles: true,
},
features: {
enableSharing: true,
},
features: {},
};

if (!configSource) {
Expand All @@ -86,6 +84,9 @@ export async function loadAndValidateConfig(configSource: string | undefined) {
let config = await loadConfig(configSource);
config.assets = config.assets || {};

//set default value for the OTT shared player
config.player = 'M4qoGvUk';

// make sure the banner always defaults to the JWP banner when not defined in the config
if (!config.assets.banner) {
config.assets.banner = defaultConfig.assets.banner;
Expand Down
2 changes: 0 additions & 2 deletions types/Config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export type InPlayer = {
useSandbox?: boolean;
};
export type Features = {
enableCasting?: boolean;
enableSharing?: boolean;
recommendationsPlaylist?: string | null;
searchPlaylist?: string | null;
favoritesList?: string | null;
Expand Down

0 comments on commit b6bb06f

Please sign in to comment.