Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
Diwakar-Gupta committed Dec 29, 2023
1 parent f3b6ed1 commit df89de3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 24
versionName "1.0.0"
versionName "1.1.0"
}
signingConfigs {
debug {
Expand Down
54 changes: 47 additions & 7 deletions src/screens/SignInScreen/SignInScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ import UserContext from '../../contexts/UserContext';
import signToken from '../../utils/signToken';
import {domain_URL} from '../../constants';
import AsyncStorage from '@react-native-async-storage/async-storage';
import codePush from 'react-native-code-push';

import {
GoogleSignin,
statusCodes,
} from '@react-native-google-signin/google-signin'; // to implement google sign in
import {GoogleSignin} from '@react-native-google-signin/google-signin'; // to implement google sign in
import PoweredBy from '../../components/PoweredBy';

const registerBackend = async (userInfo, did) => {
Expand Down Expand Up @@ -52,9 +50,42 @@ const SignInScreen = () => {
const {height} = useWindowDimensions();
const did = useContext(DidContext);
const {onSuccessRegister} = useContext(UserContext);
const [userLoggedIn, setUserLoggedIn] = useState(null);
const [loggInError, setLoggInError] = useState(null);

const [statusText, setStatus] = useState('init');

const updateApp = () => {
codePush
.checkForUpdate()
.then(remotePackage => {
if (remotePackage === null) {
setStatus('No update available');
throw Error([{message: 'No update available'}]);
} else {
setStatus('Downloading');
return remotePackage.download();
}
})
.then(localPackage => {
setStatus('Installing');
return localPackage.install(codePush.InstallMode.ON_NEXT_RESTART);
})
.then(() => {
// setUpdate({
// show: false,
// update: null,
// }),
codePush.notifyAppReady();
codePush.restartApp();
})
.catch(err => {
setStatus(err[0].message);
console.error(err);
});
};
useEffect(() => {
// updateApp();
}, []);
useEffect(() => {
GoogleSignin.configure();
}, []);
Expand Down Expand Up @@ -93,22 +124,31 @@ const SignInScreen = () => {
return (
<View>
<StatusBar animated={true} backgroundColor="#1A0721" />

<LinearGradient
colors={['#1A0721', '#1A0721', '#1A0721']}
style={{height: '100%'}}>
<View style={styles.root}>
<Logo size={height * 0.4} style={styles.logo} />
</View>
<AppVersionView />

{/* <Text style={{color: 'red'}}>{statusText}</Text>
<Button onPress={updateApp} title="Update" /> */}

<Pressable style={googlestyles.container} onPress={updateApp}>
{/* <GoogleLogo /> */}

<Text style={{color: 'red'}}>{statusText}</Text>
</Pressable>

<View style={[styles.atBottom]}>
<HavingTrouble error={loggInError} />
<Pressable
style={googlestyles.container}
onPress={LoginWithGoogleNow}>
<GoogleLogo />

<Text style={googlestyles.data}>Login with Google</Text>
<Text style={googlestyles.data}>Continue with Google</Text>
</Pressable>

<PoweredBy />
Expand Down

0 comments on commit df89de3

Please sign in to comment.