Skip to content
This repository was archived by the owner on Sep 17, 2023. It is now read-only.

Commit

Permalink
Disable fasel sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
N0-0NE-Dev committed Mar 1, 2023
1 parent 82c6a5d commit 7719528
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 52 deletions.
1 change: 0 additions & 1 deletion .easignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ buck-out/
/ios/Pods/
/vendor/bundle/

android/keystore.properties
.prettierrc
.expo
dist
Expand Down
56 changes: 5 additions & 51 deletions src/screens/TabScreen.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
import React, { useState, useEffect } from "react";
import { View } from "react-native";
import React, { useState } from "react";
import TrendingContentScreen from "./TrendingContentScreen";
import { Storage } from "../components/Storage";
import WatchlistScreen from "./WatchlistScreen";
import * as FileSystem from "expo-file-system";
import WebView from "react-native-webview";
import { FASEL_EMAIL, FASEL_PASSWORD } from "@env";
import SearchScreen from "./SearchScreen";
import NewSettingsScreen from "./NewSettingsScreen";
import {
BottomNavigation,
ActivityIndicator,
useTheme,
} from "react-native-paper";
import { BottomNavigation } from "react-native-paper";
import CentredActivityIndicator from "../components/CentredActivityIndicator";

const TabScreen = ({ navigation }) => {
let progress = 0;
const provider = Storage.getString("provider");
const common = require("../data/common.json");
const [contentUpdated, setContentUpdated] = useState(false);
const [loggedin, setLoggedin] = useState(provider == "fasel" ? false : true);
const [index, setIndex] = useState(0);
const theme = useTheme();

const fileUrls =
provider == "fasel" ? common.fileUrlsFasel : common.fileUrlsHdw;
Expand Down Expand Up @@ -68,16 +60,6 @@ const TabScreen = ({ navigation }) => {
},
});

const jsCode = `
if (document.getElementById('yorke_user_login')) {
document.getElementById('yorke_user_login').value='${FASEL_EMAIL}';
document.getElementById('yorke_user_pass').value='${FASEL_PASSWORD}';
document.getElementById('yorke_login_submit').click();
} else {
// pass
}
`;

const updateContent = () => {
fileUrls.forEach((url) => {
const fileName = url.split("/").slice(-1)[0];
Expand Down Expand Up @@ -134,15 +116,7 @@ const TabScreen = ({ navigation }) => {
// pass
}

const handleNavigationChange = (webViewState) => {
if (webViewState.url === "https://www.faselhd.ac/") {
setLoggedin(true);
} else {
// pass
}
};

if (contentUpdated && loggedin) {
if (contentUpdated) {
return (
<BottomNavigation
navigationState={{ index, routes }}
Expand All @@ -152,27 +126,7 @@ const TabScreen = ({ navigation }) => {
/>
);
} else {
return (
<View
style={{
flex: 1,
justifyContent: "center",
backgroundColor: theme.colors.background,
}}
>
<ActivityIndicator size={50} />
{!loggedin && (
<View>
<WebView
source={{ uri: common.faselBaseUrl + "account/login" }}
injectedJavaScript={jsCode}
sharedCookiesEnabled={true}
onNavigationStateChange={handleNavigationChange}
/>
</View>
)}
</View>
);
return <CentredActivityIndicator />;
}
};

Expand Down

0 comments on commit 7719528

Please sign in to comment.