Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prettierignore #672

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
steria.json
steriaGarb.json
25 changes: 7 additions & 18 deletions src/components/login/google/YTM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import CookieManager from '@react-native-cookies/cookies';
import { get_option, get_current_user } from 'libmuse';
import { useTranslation } from 'react-i18next';

import useGoogleTVOauth from '@components/login/google/useGoogleTVOauth';
import { saveSecure as saveItem } from '@utils/ChromeStorageAPI';
import { StorageKeys } from '@enums/Storage';
import { User, UseYTMLogin } from './useYTMLogin';
Expand All @@ -24,10 +23,7 @@ const clearCookies = () => {

const checkYTM = async () => console.log(await get_current_user());

interface LoginProps {
refresh: () => void;
}
const Login = ({ refresh }: LoginProps) => {
const Login = () => {
const { t } = useTranslation();
const [webView, _setWebView] = useState(false);
const [cookies, setCookies] = useState<string[]>([]);
Expand All @@ -36,9 +32,6 @@ const Login = ({ refresh }: LoginProps) => {
_setWebView(val);
toggleCollapse(val);
};
const { userURL, loginCodes, getNewLoginCode } = useGoogleTVOauth({
setWebView,
});

const onMessage = (event: any) => {
const { data } = event.nativeEvent;
Expand All @@ -57,12 +50,6 @@ const Login = ({ refresh }: LoginProps) => {
value,
});
});
auth
.load_token_with_code(loginCodes!.deviceCode, loginCodes!.interval)
.then(t => {
museStore.set('token', t);
refresh();
});
saveItem(StorageKeys.YTMCOOKIES, cookies.join('; '));
return true;
}
Expand All @@ -80,14 +67,16 @@ const Login = ({ refresh }: LoginProps) => {

return webView ? (
<WebView
source={{ uri: userURL }}
source={{
uri: 'https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Den%26next%3Dhttps%253A%252F%252Fwww.youtube.com%252F&hl=en&ec=65620',
}}
injectedJavaScript={jsCode}
onMessage={onMessage}
/>
) : (
<SafeAreaView>
{__DEV__ && <Button onPress={checkYTM}>{t('Login.Check')}</Button>}
<Button onPress={getNewLoginCode}>{t('Login.Login')}</Button>
<Button onPress={() => setWebView(true)}>{t('Login.Login')}</Button>
<Button onPress={clearCookies}>{t('Login.Clear')}</Button>
</SafeAreaView>
);
Expand Down Expand Up @@ -123,7 +112,7 @@ interface Props {
ytmLogin: UseYTMLogin;
}
const Explore = ({ ytmLogin }: Props) => {
const { user, clear, initialized, refresh, init } = ytmLogin;
const { user, clear, initialized, init } = ytmLogin;

useEffect(() => {
init();
Expand All @@ -143,7 +132,7 @@ const Explore = ({ ytmLogin }: Props) => {
}}
/>
) : (
<Login refresh={refresh} />
<Login />
);
};

Expand Down
Loading