Skip to content

Commit

Permalink
imporve login screen message and login to website using token (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalkishor1991 authored Apr 28, 2023
1 parent fea244a commit 37e4b4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
18 changes: 15 additions & 3 deletions components/GridActionButton.android.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import { NativeModules, Image, Linking } from 'react-native';
import Color from 'pigment/full';
import RNColorThief from 'react-native-color-thief';
Expand All @@ -13,6 +13,7 @@ import { launchImageLibrary } from 'react-native-image-picker';
import { CromaContext } from '../store/store';
import { useTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
import { retrieveUserSession } from '../libs/EncryptedStoreage';

const GridActionButtonAndroid = ({ navigation, setPickImageLoading }) => {
const { t } = useTranslation();
Expand All @@ -25,7 +26,14 @@ const GridActionButtonAndroid = ({ navigation, setPickImageLoading }) => {
setDetailedColor,
clearPalette
} = React.useContext(CromaContext);

const [userData, setUserData] = useState();
useEffect(() => {
// check if already logged in
(async () => {
const userData = await retrieveUserSession();
setUserData(userData);
})();
}, []);
const pickImageResult = async () => {
const result = await launchImageLibrary({
mediaType: 'photo',
Expand Down Expand Up @@ -139,7 +147,11 @@ const GridActionButtonAndroid = ({ navigation, setPickImageLoading }) => {
text2: t(' ChatGPT'),
onPress: async () => {
logEvent('hm_create_palette_using_chatgpt');
Linking.openURL('https://huehive.co/');
let link = 'https://huehive.co/';
if (userData && userData.userToken) {
link = link + 'users/login_using_token?token=' + userData.userToken;
}
Linking.openURL(link);
}
},
isPro
Expand Down
3 changes: 0 additions & 3 deletions components/HamburgerMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ import React, { useEffect, useState } from 'react';
import {
Image,
Linking,
NativeModules,
StyleSheet,
Text,
View,
SafeAreaView,
Platform,
TouchableOpacity
} from 'react-native';
import Colors from '../constants/Colors';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import Ionicons from 'react-native-vector-icons/Ionicons';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import { logEvent } from '../libs/Helpers';
import { ScrollView } from 'react-native-gesture-handler';
import { launchImageLibrary } from 'react-native-image-picker';
import { CromaContext } from '../store/store';
import { useTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
Expand Down
5 changes: 2 additions & 3 deletions screens/LoginScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { material } from 'react-native-typography';
import { useTranslation } from 'react-i18next';
import { CromaContext } from '../store/store';
import { login, signUp, googleLogin } from '../network/login-and-signup';
// import { notifyMessage } from "../libs/Helpers";
import PropTypes from 'prop-types';
import {
retrieveUserSession,
Expand Down Expand Up @@ -240,8 +239,8 @@ function LoginScreen(props) {
return (
<ScrollView style={styles.scrollView} showsVerticalScrollIndicator={false}>
<View style={[styles.container, { minHeight: screenType === LOGIN ? 400 : 500 }]}>
<Text style={styles.title}>{t('Welcome,')}</Text>
<Text style={styles.intro}>{t('Glad to see you!,')}</Text>
<Text style={styles.title}>{t('Welcome to HueHive (Croma),')}</Text>
<Text style={styles.intro}>{t('Please Singin/Signup to continue...')}</Text>
{error && <Notification message={error} onPress={() => setError(undefined)}></Notification>}
{screenType === SIGN_UP && (
<>
Expand Down

0 comments on commit 37e4b4d

Please sign in to comment.