mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-01 10:18:20 +03:00
steemConnect login bug fixes
This commit is contained in:
parent
89aa175914
commit
c2920b1fad
@ -179,8 +179,7 @@ export const loginWithSC2 = async (access_token, pinCode) => {
|
||||
await steemConnect.setAccessToken(access_token);
|
||||
account = await steemConnect.me();
|
||||
|
||||
console.log(account._id);
|
||||
console.log(account.name);
|
||||
//console.log(account.name);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
|
@ -4,19 +4,29 @@ import { Text, View } from "react-native";
|
||||
import { goToAuthScreens, goToNoAuthScreens } from "../../navigation";
|
||||
|
||||
import SplashScreen from "./splashScreen";
|
||||
import { getAuthStatus } from "../../realm/realm";
|
||||
|
||||
class SplashContainer extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
goToNoAuthScreens();
|
||||
}
|
||||
componentDidMount() {
|
||||
getAuthStatus().then(result => {
|
||||
if(result === true) {
|
||||
goToAuthScreens();
|
||||
} else {
|
||||
goToNoAuthScreens();
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
goToAuthScreens();
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return <SplashScreen />;
|
||||
}
|
||||
render() {
|
||||
return <SplashScreen />;
|
||||
}
|
||||
}
|
||||
|
||||
export default SplashContainer;
|
||||
|
@ -13,14 +13,21 @@ export default class SteemConnect extends Component {
|
||||
}
|
||||
|
||||
onNavigationStateChange(event) {
|
||||
let access_token = event.url.match(/\?(?:access_token)\=([\S\s]*?)\&/)[1];
|
||||
let access_token;
|
||||
try {
|
||||
access_token = event.url.match(/\?(?:access_token)\=([\S\s]*?)\&/)[1];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
if(access_token) {
|
||||
loginWithSC2(access_token, "pinCode").then(result => {
|
||||
if(result === true) {
|
||||
// TODO: Handle pinCode and navigate to home page
|
||||
|
||||
Navigation.dismissModal(this.props.componentId);
|
||||
RNRestart.Restart();
|
||||
} else {
|
||||
Navigation.dismissModal(this.props.componentId);
|
||||
// TODO: Error alert (Toast Message)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user