From db6dd891ce2b42896795867a2595dfc16464a1ed Mon Sep 17 00:00:00 2001 From: Ahmed Islam Date: Mon, 27 Feb 2023 14:14:16 +1100 Subject: [PATCH] Version 1.1.3 --- App.js | 7 +- android/app/build.gradle | 4 +- android/app/src/main/AndroidManifest.xml | 2 +- app.json | 6 +- src/components/DefaultSettingsButton.js | 5 +- src/components/FeaturedContentCardList.js | 14 +- src/data/common.json | 481 +++++----------------- src/screens/GeneralSettingsScreen.js | 11 + src/screens/LoadingScreen.js | 7 +- src/screens/NewSelectScreen.js | 63 ++- src/screens/SearchScreen.js | 40 +- src/screens/StartupScreen.js | 69 ++-- src/screens/TabScreen.js | 8 +- src/screens/TrendingContentScreen.js | 22 +- src/screens/WatchScreen.js | 5 +- 15 files changed, 288 insertions(+), 456 deletions(-) diff --git a/App.js b/App.js index afb1794..048a5a4 100644 --- a/App.js +++ b/App.js @@ -19,11 +19,7 @@ const MyStack = () => { return ( { headerTintColor: theme.dark ? "white" : "black", navigationBarHidden: true, headerShadowVisible: false, + contentStyle: { backgroundColor: theme.colors.background }, }} > - + diff --git a/app.json b/app.json index 8768a7b..ba4d504 100644 --- a/app.json +++ b/app.json @@ -2,15 +2,15 @@ "expo": { "name": "NoFasel", "slug": "no-fasel", - "version": "1.1.2", + "version": "1.1.3", "sdkVersion": "47.0.0", "jsEngine": "hermes", "platforms": [ "android" ], "android": { - "runtimeVersion": "1.1.2", - "versionCode": 12 + "runtimeVersion": "1.1.3", + "versionCode": 13 }, "extra": { "eas": { diff --git a/src/components/DefaultSettingsButton.js b/src/components/DefaultSettingsButton.js index a309b12..f1a9d1e 100644 --- a/src/components/DefaultSettingsButton.js +++ b/src/components/DefaultSettingsButton.js @@ -3,7 +3,7 @@ import { Pressable } from "react-native"; import { Text, useTheme } from "react-native-paper"; import { MaterialCommunityIcons } from "@expo/vector-icons"; -const DefaultSettingsButton = ({ label, onPress, iconName }) => { +const DefaultSettingsButton = ({ label, onPress, iconName, fontSize = 18 }) => { const theme = useTheme(); return ( @@ -27,8 +27,9 @@ const DefaultSettingsButton = ({ label, onPress, iconName }) => { /> {label} diff --git a/src/components/FeaturedContentCardList.js b/src/components/FeaturedContentCardList.js index d85f2b2..734a82a 100644 --- a/src/components/FeaturedContentCardList.js +++ b/src/components/FeaturedContentCardList.js @@ -2,16 +2,24 @@ import React, { useState, useEffect, useRef } from "react"; import FeaturedContentCard from "./FeaturedContentCard"; import * as FileSystem from "expo-file-system"; import { Dimensions, ScrollView } from "react-native"; +import { Storage } from "./Storage"; const FeaturedContentCardList = ({ navigation }) => { const [data, setData] = useState(); const [currentPosition, setCurrentPosition] = useState(0); const scrollViewRef = useRef(); + let filePath = ""; + + if (Storage.getString("provider") == "fasel") { + filePath = FileSystem.documentDirectory + "featured-content.json"; + } else { + filePath = FileSystem.documentDirectory + "hdw-featured-content.json"; + } useEffect(() => { - FileSystem.readAsStringAsync( - FileSystem.documentDirectory + "featured-content.json" - ).then((data) => setData(JSON.parse(data))); + FileSystem.readAsStringAsync(filePath).then((data) => + setData(JSON.parse(data)) + ); }, []); useEffect(() => { diff --git a/src/data/common.json b/src/data/common.json index d418120..ac23828 100644 --- a/src/data/common.json +++ b/src/data/common.json @@ -1,15 +1,55 @@ { + "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0", "faselBaseUrl": "https://www.faselhd.ac/", - "categories": [ - { "label": "Movies", "key": "movies" }, - { "label": "Series", "key": "series" }, - { "label": "Anime", "key": "anime" }, - { "label": "Asian Series", "key": "asian-series" }, - { "label": "Arabic Series", "key": "arabic-series" }, - { "label": "Arabic Movies", "key": "arabic-movies" }, - { "label": "TV Shows", "key": "tvshows" } + "categoriesFasel": [ + { + "label": "Movies", + "key": "movies" + }, + { + "label": "Series", + "key": "series" + }, + { + "label": "Anime", + "key": "anime" + }, + { + "label": "Asian Series", + "key": "asian-series" + }, + { + "label": "Arabic Series", + "key": "arabic-series" + }, + { + "label": "Arabic Movies", + "key": "arabic-movies" + }, + { + "label": "TV Shows", + "key": "tvshows" + } ], - "fileUrls": [ + "categoriesHdw": [ + { + "label": "Movies", + "key": "hdwmovies" + }, + { + "label": "Series", + "key": "hdwseries" + }, + { + "label": "Arabic Series", + "key": "arabic-series" + }, + { + "label": "Arabic Movies", + "key": "arabic-movies" + } + ], + "fileUrlsFasel": [ "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/all-content.json", "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/anime.json", "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/asian-series.json", @@ -20,10 +60,55 @@ "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/arabic-series.json", "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/arabic-movies.json", "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/featured-content.json", - "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/file-hashes.json", "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/last-scraped.txt" ], - "genres": [ + "fileUrlsHdw": [ + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/arabic-series.json", + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/arabic-movies.json", + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/last-scraped.txt", + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/hdw-featured-content.json", + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/hdw-trending-content.json", + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/hdw-all-content.json", + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/hdwmovies.json", + "https://raw.githubusercontent.com/N0-0NE-Dev/no-fasel-scrapers/main/output/hdwseries.json" + ], + "genresHdw": [ + "Comedy", + "Music", + "Drama", + "Mystery", + "Ramadan", + "Crime", + "Horror", + "Action.Adventure", + "Comedy.Romance", + "Drime", + "Adcenture", + "Netflix", + "History", + "Biography", + "Kids", + "Short", + "Sports", + "Animation", + "Documentary", + "Science Fiction", + "Animated", + "Sci-Fi", + "Western", + "Fantasy", + "Adevnture", + "Musical", + "Romance", + "Action", + "War", + "Family", + "Sport", + "Dubbed", + "Adventure", + "Thriller" + ], + "genresFasel": [ "Netflix", "Ramadan", "Fantasy", @@ -68,377 +153,5 @@ "Short", "Action", "Supernatural" - ], - "languagsData": [ - { - "code": "af", - "name": "Afrikaans", - "flag": "https://imgpile.com/images/d3Ydwk.gif" - }, - { - "code": "sq", - "name": "Albanian", - "flag": "https://imgpile.com/images/d3YhsM.jpg" - }, - { - "code": "ar", - "name": "Arabic", - "flag": "https://imgpile.com/images/d3Y9W4.jpg" - }, - { - "code": "an", - "name": "Aragonese", - "flag": "https://imgpile.com/images/d3YGKG.png" - }, - { - "code": "hy", - "name": "Armenian", - "flag": "https://imgpile.com/images/d3YM9h.png" - }, - { - "code": "at", - "name": "Asturian", - "flag": "https://imgpile.com/images/d3YJzE.png" - }, - { - "code": "eu", - "name": "Basque", - "flag": "https://imgpile.com/images/d3YP3r.png" - }, - { - "code": "be", - "name": "Belarusian", - "flag": "https://imgpile.com/images/d3Yi5R.png" - }, - { - "code": "bn", - "name": "Bengali", - "flag": "https://imgpile.com/images/d3Yssg.jpg" - }, - { - "code": "bs", - "name": "Bosnian", - "flag": "https://imgpile.com/images/d3YX8x.png" - }, - { - "code": "br", - "name": "Breton", - "flag": "https://imgpile.com/images/d3YH3j.png" - }, - { - "code": "bg", - "name": "Bulgarian", - "flag": "https://imgpile.com/images/d3Y2cC.png" - }, - { - "code": "my", - "name": "Burmese", - "flag": "https://imgpile.com/images/d3YAWS.jpg" - }, - { - "code": "ca", - "name": "Catalan", - "flag": "https://imgpile.com/images/d3YSu4.png" - }, - { - "code": "zh-cn", - "name": "Chinese (simplified)", - "flag": "https://imgpile.com/images/d3Yeea.jpg" - }, - { - "code": "cs", - "name": "Czech", - "flag": "https://imgpile.com/images/d3YyCX.png" - }, - { - "code": "da", - "name": "Danish", - "flag": "https://imgpile.com/images/d3i4Vh.png" - }, - { - "code": "nl", - "name": "Dutch", - "flag": "https://imgpile.com/images/d3iIRr.png" - }, - { - "code": "en", - "name": "English", - "flag": "https://imgpile.com/images/d3iufR.png" - }, - { - "code": "eo", - "name": "Esperanto", - "flag": "https://imgpile.com/images/d3i7Bg.png" - }, - { - "code": "et", - "name": "Estonian", - "flag": "https://imgpile.com/images/d3ssnN.png" - }, - { - "code": "fi", - "name": "Finnish", - "flag": "https://imgpile.com/images/d3sctW.pngs" - }, - { - "code": "fr", - "name": "French", - "flag": "https://imgpile.com/images/d3sfoP.png" - }, - { - "code": "ka", - "name": "Georgian", - "flag": "https://imgpile.com/images/d3slZ1.png" - }, - { - "code": "de", - "name": "German", - "flag": "https://imgpile.com/images/d3srdL.png" - }, - { - "code": "gl", - "name": "Galician", - "flag": "https://imgpile.com/images/d3s8gj.png" - }, - { - "code": "el", - "name": "Greek", - "flag": "https://imgpile.com/images/d3sXUo.jpg" - }, - { - "code": "hi", - "name": "Hindi", - "flag": "https://imgpile.com/images/d3sHiC.jpg" - }, - { - "code": "hr", - "name": "Croatian", - "flag": "https://imgpile.com/images/d3sokS.jpg" - }, - { - "code": "hu", - "name": "Hungarian", - "flag": "https://imgpile.com/images/d3s2n8.png" - }, - { - "code": "is", - "name": "Icelandic", - "flag": "https://imgpile.com/images/d3sLo3.jpg" - }, - { - "code": "id", - "name": "Indonesian", - "flag": "https://imgpile.com/images/d3sOZl.jpg" - }, - { - "code": "it", - "name": "Italian", - "flag": "https://imgpile.com/images/d3s0hw.jpg" - }, - { - "code": "ja", - "name": "Japanese", - "flag": "https://imgpile.com/images/d3sv0M.jpg" - }, - { - "code": "kk", - "name": "Kazakh", - "flag": "https://imgpile.com/images/d3sahX.png" - }, - { - "code": "km", - "name": "Khmer", - "flag": "https://imgpile.com/images/d3sezh.jpg" - }, - { - "code": "ko", - "name": "Korean", - "flag": "https://imgpile.com/images/d3cABR.jpg" - }, - { - "code": "lv", - "name": "Latvian", - "flag": "https://imgpile.com/images/d3c0AN.jpg" - }, - { - "code": "lt", - "name": "Lithuanian", - "flag": "https://imgpile.com/images/d3c3Rx.png" - }, - { - "code": "lb", - "name": "Luxembourgish", - "flag": "https://imgpile.com/images/d3c6cj.jpg" - }, - { - "code": "mk", - "name": "Macedonian", - "flag": "https://imgpile.com/images/d3cejb.jpg" - }, - { - "code": "ml", - "name": "Malayalam", - "flag": "https://imgpile.com/images/d3sHiC.jpg" - }, - { - "code": "ms", - "name": "Malay", - "flag": "https://imgpile.com/images/d3fufi.jpg" - }, - { - "code": "ma", - "name": "Manipuri", - "flag": "https://imgpile.com/images/d3f7Fu.jpg" - }, - { - "code": "mn", - "name": "Mongolian", - "flag": "https://imgpile.com/images/d3fUuk.png" - }, - { - "code": "no", - "name": "Norwegian", - "flag": "https://imgpile.com/images/d3fwJM.jpg" - }, - { - "code": "oc", - "name": "Occitan", - "flag": "https://imgpile.com/images/d3fYDW.png" - }, - { - "code": "fa", - "name": "Persian", - "flag": "https://imgpile.com/images/d3fz7o.jpg" - }, - { - "code": "pl", - "name": "Polish", - "flag": "https://imgpile.com/images/d3fVLS.png" - }, - { - "code": "pt-pt", - "name": "Portuguese", - "flag": "https://imgpile.com/images/d3fXy8.png" - }, - { - "code": "ru", - "name": "Russian", - "flag": "https://imgpile.com/images/d3fqX3.jpg" - }, - { - "code": "sr", - "name": "Serbian", - "flag": "https://imgpile.com/images/d3feNr.jpg" - }, - { - "code": "si", - "name": "Sinhalese", - "flag": "https://imgpile.com/images/d3luSP.jpg" - }, - { - "code": "sk", - "name": "Slovak", - "flag": "https://imgpile.com/images/d3lNd1.jpg" - }, - { - "code": "sl", - "name": "Slovenian", - "flag": "https://imgpile.com/images/d3lNd1.jpg" - }, - { - "code": "es", - "name": "Spanish", - "flag": "https://imgpile.com/images/d3lwgx.png" - }, - { - "code": "sw", - "name": "Swahili", - "flag": "https://imgpile.com/images/d3l9t8.jpg" - }, - { - "code": "sv", - "name": "Swedish", - "flag": "https://imgpile.com/images/d3lCob.png" - }, - { - "code": "sy", - "name": "Syriac", - "flag": "https://imgpile.com/images/d3lDS3.png" - }, - { - "code": "ta", - "name": "Tamil", - "flag": "https://imgpile.com/images/d3lKgF.jpg" - }, - { - "code": "te", - "name": "Telugu", - "flag": "https://imgpile.com/images/d3sHiC.jpg" - }, - { - "code": "tl", - "name": "Tagalog", - "flag": "https://imgpile.com/images/d3lfo2.png" - }, - { - "code": "th", - "name": "Thai", - "flag": "https://imgpile.com/images/d3llZG.jpg" - }, - { - "code": "tr", - "name": "Turkish", - "flag": "https://imgpile.com/images/d3lrda.png" - }, - { - "code": "uk", - "name": "Ukrainian", - "flag": "https://imgpile.com/images/d3lzrX.png" - }, - { - "code": "ur", - "name": "Urdu", - "flag": "https://imgpile.com/images/d3l8vh.jpg" - }, - { - "code": "uz", - "name": "Uzbek", - "flag": "https://imgpile.com/images/d3lXUE.png" - }, - { - "code": "vi", - "name": "Vietnamese", - "flag": "https://imgpile.com/images/d3lHir.jpg" - }, - { - "code": "ro", - "name": "Romanian", - "flag": "https://imgpile.com/images/d3lo0R.png" - }, - { - "code": "pt-br", - "name": "Portuguese (Brazilian)", - "flag": "https://imgpile.com/images/d3l2ng.jpg" - }, - { - "code": "me", - "name": "Montenegrin", - "flag": "https://imgpile.com/images/d3lAxc.png" - }, - { - "code": "zh-tw", - "name": "Chinese (traditional)", - "flag": "https://imgpile.com/images/d3Yeea.jpg" - }, - { - "code": "ze", - "name": "Chinese bilingual", - "flag": "https://imgpile.com/images/d3Yeea.jpg" - }, - { - "code": "se", - "name": "Northern Sami", - "flag": "https://imgpile.com/images/d3lLqN.jpg" - } ] -} +} \ No newline at end of file diff --git a/src/screens/GeneralSettingsScreen.js b/src/screens/GeneralSettingsScreen.js index 17cf1a2..19bce90 100644 --- a/src/screens/GeneralSettingsScreen.js +++ b/src/screens/GeneralSettingsScreen.js @@ -3,6 +3,7 @@ import { View, Pressable } from "react-native"; import { useTheme, Text, Switch } from "react-native-paper"; import { Storage } from "../components/Storage"; import DefaultSettingsButton from "../components/DefaultSettingsButton"; +import RNRestart from "react-native-restart"; const GeneralSettingsScreen = ({ navigation }) => { const theme = useTheme(); @@ -42,6 +43,16 @@ const GeneralSettingsScreen = ({ navigation }) => { setUseProxy(!useProxy)} /> + { + Storage.delete("provider"); + Storage.delete("preferedLanguage"); + RNRestart.Restart(); + }} + /> { - const fileUrls = require("../data/common.json").fileUrls; + const common = require("../data/common.json"); let progress = 0; + const fileUrls = + Storage.getString("provider") == "fasel" + ? common.fileUrlsFasel + : common.fileUrlsHdw; fileUrls.forEach((url) => { const fileName = url.split("/").slice(-1)[0]; diff --git a/src/screens/NewSelectScreen.js b/src/screens/NewSelectScreen.js index f47e753..74fb65d 100644 --- a/src/screens/NewSelectScreen.js +++ b/src/screens/NewSelectScreen.js @@ -172,6 +172,7 @@ const Buttons = ({ showModal, setType, theme, tmdbId, category }) => { labelColor: theme.colors.primary, }, ]; + return ( { onPress={item.onPress} buttonColor={item.color} style={styles.buttonStyle} + key={item.label} > {item.label} @@ -275,11 +277,14 @@ const QualitySelector = ({ }; const NewSelectScreen = ({ navigation, route }) => { - const faselBaseUrl = require("../data/common.json").faselBaseUrl; + const provider = Storage.getString("provider"); + const common = require("../data/common.json"); + const faselBaseUrl = common.faselBaseUrl; + const userAgent = common.userAgent; const { id, category } = route.params; const theme = useTheme(); const useProxy = Storage.getBoolean("useProxy"); - const contentWithSeasons = ["series", "tvshows", "asian-series"]; + const contentWithSeasons = ["series", "tvshows", "asian-series", "hdwseries"]; const watchlist = JSON.parse(Storage.getString("watchlist")); const resume = JSON.parse(Storage.getString("resume")); const isFocused = useIsFocused(); @@ -373,7 +378,7 @@ const NewSelectScreen = ({ navigation, route }) => { }, [data]); useEffect(() => { - if (category === "movies" && !webpageUrl) { + if (category == "movies" && !webpageUrl) { setTimeout(() => setWebpageUrl(`${faselBaseUrl}?p=${id}`), 250); } else if (category.includes("arabic") && webpageUrl) { fetch( @@ -420,6 +425,8 @@ const NewSelectScreen = ({ navigation, route }) => { seasons[`Season ${season[1]["Season Number"]}`] = season[0]; }); setSeasons(seasons); + } else { + // pass } }, [data, webpageUrl, selectedSeason]); @@ -435,13 +442,45 @@ const NewSelectScreen = ({ navigation, route }) => { useEffect(() => { if (data) { - getOverview(data["TMDb ID"], category).then((json) => setOverview(json)); - getCast(data["TMDb ID"], category).then((json) => setCast(json)); + const tmdbId = data["TMDb ID"]; + getOverview(tmdbId, category).then((json) => setOverview(json)); + getCast(tmdbId, category).then((json) => setCast(json)); } else { // pass } }, [data]); + const getHdwSource = () => { + if (category == "hdwmovies" || selectedEpisode) { + setShowLoading(true); + fetch( + `https://www.hdwatched.xyz/embed/${ + category == "hdwmovies" ? id : selectedEpisode + }`, + { + credentials: "include", + headers: { + "User-Agent": userAgent, + }, + method: "GET", + mode: "cors", + } + ) + .then((resp) => resp.text()) + .then((text) => { + let HTMLParser = require("fast-html-parser"); + let root = HTMLParser.parse(text); + const source = root.querySelector("source").attributes.src; + setQualities({ "1080p": source }); + setShowLoading(false); + }); + } else { + // pass + } + }; + + useEffect(() => getHdwSource(), [selectedEpisode]); + const EpisodeCard = ({ label, posterSource, source }) => { return ( { setSelectedEpisode(source); setShowLoading(true); setQualities(null); - if (category == "anime" || contentWithSeasons.includes(category)) { + if ( + (category == "anime" || contentWithSeasons.includes(category)) && + provider == "fasel" + ) { setWebpageUrl(`${faselBaseUrl}?p=${source}`); - } else { + } else if (category == "movies") { setWebpageUrl(source); + } else { + // pass } }} > @@ -610,6 +654,7 @@ const NewSelectScreen = ({ navigation, route }) => { setType={setType} tmdbId={data["TMDb ID"]} category={category} + provider={provider} /> ) : ( { Genres: {data["Genres"].map((genre) => ( - {genre} + + {genre} + ))} { + const provider = Storage.getString("provider"); const common = require("../data/common.json"); - const categories = common.categories; - const genres = common.genres; + const genres = provider == "fasel" ? common.genresFasel : common.genresHdw; const theme = useTheme(); + let allContentPath = ""; + let featuredContentPath = ""; const [searchText, setSearchText] = useState(""); const [allData, setAllData] = useState(null); @@ -26,6 +29,9 @@ const SearchScreen = ({ navigation }) => { const [end, setEnd] = useState(20); const pageNumber = end / 20; + const categories = + provider == "fasel" ? common.categoriesFasel : common.categoriesHdw; + const handleNext = () => { setStart(end); setEnd(end + 20); @@ -40,16 +46,28 @@ const SearchScreen = ({ navigation }) => { } }; + if (provider == "fasel") { + allContentPath = FileSystem.documentDirectory + "all-content.json"; + + featuredContentPath = + FileSystem.documentDirectory + "featured-content.json"; + } else { + allContentPath = FileSystem.documentDirectory + "hdw-all-content.json"; + + featuredContentPath = + FileSystem.documentDirectory + "hdw-featured-content.json"; + } + useEffect(() => { - FileSystem.readAsStringAsync( - FileSystem.documentDirectory + "all-content.json" - ).then((allData) => setAllData(JSON.parse(allData))); - FileSystem.readAsStringAsync( - FileSystem.documentDirectory + "featured-content.json" - ).then((featuredContent) => { - setFeaturedContent(JSON.parse(featuredContent)); - setData(JSON.parse(featuredContent).content); - }); + FileSystem.readAsStringAsync(allContentPath).then((allData) => + setAllData(JSON.parse(allData)) + ); + FileSystem.readAsStringAsync(featuredContentPath).then( + (featuredContent) => { + setFeaturedContent(JSON.parse(featuredContent)); + setData(JSON.parse(featuredContent).content); + } + ); }, []); const applyFilter = (item) => { diff --git a/src/screens/StartupScreen.js b/src/screens/StartupScreen.js index 5305746..b2bb8e0 100644 --- a/src/screens/StartupScreen.js +++ b/src/screens/StartupScreen.js @@ -1,40 +1,51 @@ -import React, { useState } from "react"; -import { View, Modal, StyleSheet, Pressable } from "react-native"; +import React from "react"; +import { View, StyleSheet } from "react-native"; import { Storage } from "../components/Storage"; -import { useTheme, Dialog, Text, Button } from "react-native-paper"; +import { Text, Button } from "react-native-paper"; -const StartupScreen = () => { - const theme = useTheme(); - const [languaDialogVisible, setLanguaDialogVisible] = useState(true); - const languages = require("../data/common.json").languagsData; - - const hideDialog = () => setLanguaDialogVisible(false); +const StartupScreen = ({ navigation }) => { + const handleProvider = (provider) => { + Storage.set("provider", provider); + navigation.navigate("Loading"); + }; return ( - - Alert - - This is simple dialog - - - - - + + Select Content Provider + (If the app worked for you before choose FaselHD) + + + ); }; const styles = StyleSheet.create({ - modalBackgroundStyle: { - backgroundColor: "rgba(0,0,0,0.5)", - position: "absolute", - ...StyleSheet.absoluteFillObject, - justifyContent: "center", - alignItems: "center", - }, - modalViewStyle: { - marginHorizontal: 20, - borderRadius: 20, - alignItems: "center", + textStyle: { + fontSize: 20, + fontWeight: "bold", + marginHorizontal: 10, + marginBottom: 10, }, }); diff --git a/src/screens/TabScreen.js b/src/screens/TabScreen.js index 5c4c9a7..9da1c7e 100644 --- a/src/screens/TabScreen.js +++ b/src/screens/TabScreen.js @@ -16,12 +16,16 @@ import { const TabScreen = ({ navigation }) => { let progress = 0; - const common = require("../data/common.json") - const fileUrls = common.fileUrls; + const common = require("../data/common.json"); const [contentUpdated, setContentUpdated] = useState(false); const [loggedin, setLoggedin] = useState(false); const [index, setIndex] = useState(0); const theme = useTheme(); + const provider = Storage.getString("provider"); + + const fileUrls = + provider == "fasel" ? common.fileUrlsFasel : common.fileUrlsHdw; + const [routes] = useState([ { key: "home", diff --git a/src/screens/TrendingContentScreen.js b/src/screens/TrendingContentScreen.js index 84cee8c..0149589 100644 --- a/src/screens/TrendingContentScreen.js +++ b/src/screens/TrendingContentScreen.js @@ -6,16 +6,30 @@ import FeaturedContentCardList from "../components/FeaturedContentCardList"; import { useDeviceOrientation } from "@react-native-community/hooks"; import CentredActivityIndicator from "../components/CentredActivityIndicator"; import { isTablet } from "react-native-device-info"; +import { Storage } from "../components/Storage"; const TrendingContentScreen = ({ navigation }) => { const [data, setData] = useState(null); - const listData = require("../data/common.json").categories.slice(0, 5); + const common = require("../data/common.json"); const orientation = useDeviceOrientation(); + const provider = Storage.getString("provider"); + let filePath = ""; + + const listData = + provider == "fasel" + ? common.categoriesFasel.slice(0, 5) + : common.categoriesHdw; + + if (provider == "fasel") { + filePath = FileSystem.documentDirectory + "trending-content.json"; + } else { + filePath = FileSystem.documentDirectory + "hdw-trending-content.json"; + } useEffect(() => { - FileSystem.readAsStringAsync( - FileSystem.documentDirectory + "trending-content.json" - ).then((data) => setData(JSON.parse(data))); + FileSystem.readAsStringAsync(filePath).then((data) => + setData(JSON.parse(data)) + ); }, []); if (data) { diff --git a/src/screens/WatchScreen.js b/src/screens/WatchScreen.js index 397b365..420391d 100644 --- a/src/screens/WatchScreen.js +++ b/src/screens/WatchScreen.js @@ -55,7 +55,7 @@ const WatchScreen = ({ route, navigation }) => {