From df89de35fd79f491d88db3541b63fda084596cb3 Mon Sep 17 00:00:00 2001 From: Diwakar Gupta <39624018+Diwakar-Gupta@users.noreply.github.com> Date: Fri, 29 Dec 2023 13:45:38 +0530 Subject: [PATCH] t --- android/app/build.gradle | 2 +- src/screens/SignInScreen/SignInScreen.tsx | 54 ++++++++++++++++++++--- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1bcc4b9..c4490ac 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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 { diff --git a/src/screens/SignInScreen/SignInScreen.tsx b/src/screens/SignInScreen/SignInScreen.tsx index 5231d91..0864f46 100755 --- a/src/screens/SignInScreen/SignInScreen.tsx +++ b/src/screens/SignInScreen/SignInScreen.tsx @@ -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) => { @@ -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(); }, []); @@ -93,7 +124,6 @@ const SignInScreen = () => { return ( - @@ -101,6 +131,16 @@ const SignInScreen = () => { + + {/* {statusText} +