|
@@ -9,7 +9,7 @@ import AsyncStorage from '@react-native-community/async-storage';
|
|
|
|
|
|
import C from 'rn-class'
|
|
|
C.addColor("#03cf5d", "color-naver");
|
|
|
-
|
|
|
+GoogleSignin.configure({});
|
|
|
const initials = {
|
|
|
kConsumerKey: 'VWv4bOdB5Bf07a26eJ5h',
|
|
|
kConsumerSecret: 'pBASnpI7X5',
|
|
@@ -22,9 +22,14 @@ class Lm {
|
|
|
logout = async ()=>{
|
|
|
let result = await LoginManager.logOut();
|
|
|
try {
|
|
|
- result = await GoogleSignin.revokeAccess();
|
|
|
- result = await GoogleSignin.signOut();
|
|
|
+ console.log("=====")
|
|
|
+ // await GoogleSignin.revokeAccess();
|
|
|
+ console.log("222222")
|
|
|
+ await GoogleSignin.signOut();
|
|
|
+
|
|
|
+ console.log("111")
|
|
|
} catch (error) {
|
|
|
+ console.log(error)
|
|
|
}
|
|
|
|
|
|
result = await RNKakao.logout();
|
|
@@ -42,25 +47,24 @@ export {
|
|
|
|
|
|
export default (props)=>{
|
|
|
let callLogin = async (bfirst)=>{
|
|
|
- let rtn = {iface : null, token : null, id : null };
|
|
|
+ let rtn = {type : null, token : null, id : null };
|
|
|
let fbData = await AccessToken.getCurrentAccessToken(); // 페이스북
|
|
|
- console.log("fbData >>>: " , fbData);
|
|
|
if (fbData){
|
|
|
- rtn.iface = "facebook"
|
|
|
+ rtn.type = "facebook"
|
|
|
rtn.id = fbData.userID;
|
|
|
rtn.token = fbData.accessToken;
|
|
|
props.onLogin && props.onLogin(rtn, bfirst);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if(GoogleSignin.isSignedIn()){
|
|
|
- try {
|
|
|
- rtn.iface = "google";
|
|
|
+ if(await GoogleSignin.isSignedIn()){
|
|
|
+ try {
|
|
|
+ rtn.type = "google";
|
|
|
rtn.token = (await GoogleSignin.getTokens()).accessToken;
|
|
|
rtn.id = (await GoogleSignin.getCurrentUser()).user.id;
|
|
|
+ props.onLogin && props.onLogin(rtn, bfirst);
|
|
|
+ return;
|
|
|
} catch (error) {}
|
|
|
- props.onLogin && props.onLogin(rtn, bfirst);
|
|
|
- return;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -68,7 +72,7 @@ export default (props)=>{
|
|
|
if(naverToken){
|
|
|
let profile = await getProfile(naverToken);
|
|
|
if(profile.resultcode =='00') {
|
|
|
- rtn.iface = "naver";
|
|
|
+ rtn.type = "naver";
|
|
|
rtn.id = profile.response.id;
|
|
|
rtn.token = naverToken;
|
|
|
props.onLogin && props.onLogin(rtn, bfirst);
|
|
@@ -79,7 +83,7 @@ export default (props)=>{
|
|
|
try {
|
|
|
const kakaoData = await RNKakao.userInfo();
|
|
|
if (kakaoData){
|
|
|
- rtn.iface = "kakao"
|
|
|
+ rtn.type = "kakao"
|
|
|
rtn.id = kakaoData.id;
|
|
|
rtn.token = kakaoData.accessToken;
|
|
|
props.onLogin && props.onLogin(rtn, bfirst);
|
|
@@ -131,7 +135,7 @@ export default (props)=>{
|
|
|
if(result ){
|
|
|
callLogin(true);
|
|
|
}
|
|
|
- props.onlogin && props.onlogin({iface : "kakao", id : result.id , token : accessToken }, true);
|
|
|
+ props.onlogin && props.onlogin({type : "kakao", id : result.id , token : accessToken }, true);
|
|
|
}
|
|
|
let naverLogin = async () =>{
|
|
|
|