Skip to content

Commit

Permalink
Merge pull request #79 from lrtlt/feature/radioteka
Browse files Browse the repository at this point in the history
Feature/radioteka
  • Loading branch information
KestasVenslauskas authored Feb 8, 2025
2 parents c700dc7 + 43a70af commit 41b4449
Show file tree
Hide file tree
Showing 70 changed files with 2,871 additions and 318 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js b/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js
index 3d0dc75..7138615 100644
--- a/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js
+++ b/node_modules/react-native-autoheight-webview/autoHeightWebView/index.js
diff --git a/autoHeightWebView/index.js b/autoHeightWebView/index.js
index 3d0dc752d665d51a1bc4197aede9aa0db7ea114a..c35cbf75b9be4d95b7df3925bb922349cbc393a0 100644
--- a/autoHeightWebView/index.js
+++ b/autoHeightWebView/index.js
@@ -1,6 +1,6 @@
import React, {useState, useEffect, forwardRef} from 'react';

Expand All @@ -20,16 +20,21 @@ index 3d0dc75..7138615 100644
const AutoHeightWebView = React.memo(
forwardRef((props, ref) => {
const {
@@ -44,9 +47,10 @@ const AutoHeightWebView = React.memo(
@@ -44,11 +47,12 @@ const AutoHeightWebView = React.memo(
scrollEnabledWithZoomedin &&
setScrollable(!!zoomedin);
const {height: previousHeight, width: previousWidth} = size;
- isSizeChanged({height, previousHeight, width, previousWidth}) &&
- setSize({
- height,
- width,
- });
+ const newHeight = MAX_HEIGHT !== -1 ? Math.min(height, MAX_HEIGHT) : height;
+ isSizeChanged({height: newHeight, previousHeight, width, previousWidth}) &&
setSize({
- height,
+ height: newHeight,
width,
});
+ setSize({
+ height: newHeight,
+ width,
+ });
} catch (error) {
onMessage && onMessage(event);
}
1 change: 1 addition & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {runArticleStorageMigration} from './app/state/article_storage_store';
import {runOnboardingStorageMigration} from './app/screens/main/useOnboardingLogic';
import {runFirebaseTopicSubsriptionMigration} from './app/util/useFirebaseTopicSubscription';
import {runSettingsStorageMigration} from './app/state/settings_store';

enableFreeze(true);

const App: React.FC = () => {
Expand Down
13 changes: 13 additions & 0 deletions Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type Article = {
read_count: number;
summary?: string;
media_duration?: string;
media_duration_sec?: number;
photo_count?: number;
photo_horizontal?: 1 | 0;
photo_horizontal_small?: 1 | 0;
Expand All @@ -50,4 +51,16 @@ export type Article = {
badge_id: string | number | null;
badge_class: 'badge-danger' | 'badge-primary' | 'badge-secondary' | 'badge-warning' | 'badge-info' | null;
badge_title: string | null;
branch0_term?: string;
branch0_title?: string;
branch1_term?: string;
branch1_title?: string;
hero_photo?: {
w_h: string;
title: string;
img_path_prefix: string;
path: string;
author: string;
img_path_postfix: string;
};
};
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ android {
applicationId "lt.mediapark.lrt"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 205301
versionName "2.53.1"
versionCode 205400
versionName "2.54.0"
multiDexEnabled true
resValue "string", "build_config_package", "lt.mediapark.lrt"
}
Expand Down
7 changes: 5 additions & 2 deletions app/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export const strings: Dictionary = {
about: 'Apie LRT',
contacts: 'Kontaktai',
feeback: 'Pranešk apie klaidą',
about_episode: 'APIE EPIZODĄ',
about_show: 'APIE LAIDĄ',
about_episode: 'Apie epizodą',
about_show: 'Apie laidą',
previous_songs: 'ANKSTESNI',
no_search_results: 'Deja, rezultatų pagal šią užklausą rasti nepavyko.',
error_no_connection: 'Tinklo sutrikimas',
Expand Down Expand Up @@ -169,6 +169,7 @@ type ColorScheme = {
lightGreyBackground: '#F9F9F9';
dailyQuestionProgress: string;
epikaGreen: '#58EB52';
playerIcons: 'rgb(217, 32, 83)';
};

const colorsLight: ColorScheme = {
Expand Down Expand Up @@ -212,6 +213,7 @@ const colorsLight: ColorScheme = {
lightGreyBackground: '#F9F9F9',
ripple: '#99999940',
epikaGreen: '#58EB52',
playerIcons: 'rgb(217, 32, 83)',
};

const colorsDark: ColorScheme = {
Expand Down Expand Up @@ -255,6 +257,7 @@ const colorsDark: ColorScheme = {
ripple: '#99999940',
dailyQuestionProgress: '#36414f',
epikaGreen: '#58EB52',
playerIcons: 'rgb(217, 32, 83)',
};
//#endregion

Expand Down
12 changes: 12 additions & 0 deletions app/api/Endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export const audiotekaGet = () => {
return `${BASE_URL}audioteka-home`;
};

export const radiotekaGet = () => {
return `${BASE_URL}audioteka-home/v2`;
};

/**
* Returns all channels TV program data for a week.
*/
Expand Down Expand Up @@ -171,6 +175,14 @@ export const liveFeedGet = (id: string | number, count: number, order: 'desc' |
return `${BASE_URL}get-feed-items/${id}?count=${count}&order=${order}`;
};

export const articleRecommendations = (articleId: number | string) => {
return `https://peach.ebu.io/api/v1/ltlrt/similar?article_id=${articleId}`;
};

export const articlesByIds = (ids: string[]) => {
return `https://www.lrt.lt/api/json/search?ids=${ids.join(',')}`;
};

export const carPlaylistNewestGet = () => 'https://www.lrt.lt/static/carplay/naujausi.json';

export const carPlaylistPopularGet = () => 'https://www.lrt.lt/static/carplay/pop.json';
Expand Down
190 changes: 172 additions & 18 deletions app/api/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export type HomeBlockEpikaBlock = {
};

export type HomeBlockTopFeedBlock = {
//TODO: remove this template after audioteka api update
template: 'top_feed';
type: 'top_feed';
articles: FeedArticle[];
Expand Down Expand Up @@ -314,6 +313,130 @@ export type URLTypeExternalURL = {
url: string;
};

export type RadiotekaResponse = RadiotekaTemplate[];

export type RadiotekaTemplate =
| RadiotekaTopArticlesBlock
| RadiotekaSlugArticlesBlock
| RadiotekaCategoryCollectionBlock
| RadiotekaCategoryBlock;

export type RadiotekaTopArticlesBlock = {
widget_id: 21;
widget_name: string;
type: 'articles_block';
template_id: 7;
data: {
articles_list: FeedArticle[];
};
};

export type RadiotekaCategoryBlock = {
template_id: 25 | 42 | 43; // 25 - hero style, 42, 43 - horizontal list
type: 'category';
data: {
category_id: number;
category_url: string;
category_title: string;
articles_list: FeedArticle[];
};
};

export type RadiotekaSlugArticlesBlock = {
type: 'slug';
template_id: 20;
data: {
template_id: 20;
slug_url: string;
articles_list: FeedArticle[];
slug_title: string;
};
};

export type RadiotekaCategoryCollectionBlock = {
type: 'audio_category_collection';
template_id: 44 | 45 | 46;
data: {
description: RadiotekaCategoryDescription;
category_list: RadiotekaCategory[];
};
};

export type RadiotekaCategoryDescription = {
article_is_photogallery: 1 | 0 | null;
badge_id: any;
category_title: string;
article_authors: {
name: string;
slug: string;
}[];
article_date: string;
article_url: string;
article_summary: string;
article_template: number;
is_audio_category_collection?: 1 | 0 | null;
article_type: number;
article_title_formated?: 1 | 0 | null;
category_id: number;
badge_class: any;
article_title: string;
badges_html: any;
paragraphs: any;
article_keywords: Keyword[];
read_count: any;
article_id: number;
badge_title: any;
category_url: string;
text2speech_file_url?: null | string;
};

export type RadiotekaCategory = {
id: number;
lrt_id: number;
branch_info_ary?: {
branch_term: string;
branch_id: number;
branch_title: string;
}[];
main_title: null;
is_children_category: null;
term: string;
related_channel_id: any;
lrt_description: string;
lrt_season_id: any;
lrt_code: string;
category_images: {
img1: {
img_path_postfix: string;
img_path: string;
img_path_prefix: string;
w_h: string;
};
img2: {
img_path_postfix: string;
img_path: string;
img_path_prefix: string;
w_h: string;
};
};
main_category_id: any;
branch_info?: {
branch_level2?: {
branch_term: string;
branch_id: number;
branch_title: string;
};
branch_level1?: {
branch_term: string;
branch_id: number;
branch_title: string;
};
};
lrt_show_id: number;
title: string;
LATEST_ITEM: ArticleContentMedia;
};

export type AudiotekaResponse = AudiotekaTemplate[];

export type AudiotekaTemplate =
Expand Down Expand Up @@ -571,20 +694,12 @@ export type CarPlayPodcastItem = {
};

export type CarPlayCategoryResponse = {
articles: CarPlayCategoryItem[];
articles: FeedArticle[];
category_info: any;
page: number;
next_page: number | null;
};

export type CarPlayCategoryItem = {
id: number;
title: string;
img_path_postfix: string;
img_path_prefix: string;
item_date: string;
};

export type ArticleContentDefault = {
article_id: number;
article_title: string;
Expand All @@ -598,10 +713,7 @@ export type ArticleContentDefault = {
name: string;
slug: string;
}[];
article_keywords: {
name: string;
slug: string;
}[];
article_keywords: Keyword[];
category_id?: number;
category_url?: string;
category_title?: string;
Expand All @@ -614,6 +726,7 @@ export type ArticleContentDefault = {
}[];
'n-18'?: 0 | 1;
is_video?: 0 | 1;
read_count?: number;
};

export type ArticleContentMedia = {
Expand All @@ -638,15 +751,14 @@ export type ArticleContentMedia = {
name: string;
slug: string;
}[];
keywords: {
name: string;
slug: string;
}[];
keywords: Keyword[];
content: string;
main_photo: ArticlePhotoType;
'n-18'?: 0 | 1;
is_video?: 0 | 1;
is_audio?: 0 | 1;
read_count?: number;
media_duration: string;
};

export const isMediaArticle = (article?: ArticleContent): article is ArticleContentMedia => {
Expand Down Expand Up @@ -808,3 +920,45 @@ export interface LiveFeedArticle {
item_date: string;
title: string;
}

export type Keyword = {
name: string;
slug: string;
};

export type ArticleRecommendationsResponse = {
result?: {
items?: {
id: string;
score: number;
}[];
id: string;
};
};

export type ArticleSearchItem = {
id_pos: number;
age_restriction?: string;
title: string;
year_interval: number;
is_epika: 0 | 1;
is_series: 0 | 1;
badges_html?: string;
subtitle?: string;
id: number;
date: string;
epika_valid_days?: string;
season_url: string;
photo: string;
article_category_id: number;
img_w_h: string;
category_id: number;
category_title: string;
is_movie: 0 | 1;
photo_id: number;
url: string;
};

export type ArticlesByIdsResponse = {
items: ArticleSearchItem[];
};
Loading

0 comments on commit 41b4449

Please sign in to comment.