完善facebook登录
This commit is contained in:
parent
e055eaba7f
commit
2cd244f3d3
3
src/JCWallet.d.ts
vendored
3
src/JCWallet.d.ts
vendored
@ -18,6 +18,9 @@ declare namespace jsb {
|
||||
export function signWithGoogle(id: number);
|
||||
export function signWithApple(id: number);
|
||||
export function signWithTikTok(id: number);
|
||||
export function signWithFacebook(id: number);
|
||||
export function callJcVoidMethodJNI(id: number, methodName: string);
|
||||
export function signWithTwitter(id: number);
|
||||
export function signOutGoogle(id: number);
|
||||
export function scanQRCode(id: number, title: string);
|
||||
export function restoreKey(id: number, oid: string);
|
||||
|
@ -16,6 +16,16 @@ export function tikTokAuth(idToken: string) {
|
||||
return POST_JSON(url, { code: idToken });
|
||||
}
|
||||
|
||||
export function facebookAuth(idToken: string) {
|
||||
const url = `${WALLET_API_HOST}/wallet/login/facebook`;
|
||||
return POST_JSON(url, { code: idToken });
|
||||
}
|
||||
|
||||
export function twitterAuth(idToken: string) {
|
||||
const url = `${WALLET_API_HOST}/wallet/login/twitter`;
|
||||
return POST_JSON(url, { code: idToken });
|
||||
}
|
||||
|
||||
export function getWalletInfo() {
|
||||
const url = `${WALLET_API_HOST}/wallet/info`;
|
||||
return GET_JSON(url);
|
||||
|
@ -4,9 +4,11 @@ import { loadMnemonic, saveMnemonic } from "./DataManage";
|
||||
import { NativeSvr } from "../services/NativeSvr";
|
||||
import {
|
||||
appleAuth,
|
||||
facebookAuth,
|
||||
getWalletInfo,
|
||||
googleAuth,
|
||||
tikTokAuth,
|
||||
twitterAuth,
|
||||
uploadWalletInfo,
|
||||
} from "../api/WalletApi";
|
||||
import { WalletEnv } from "../config/WalletEnv";
|
||||
@ -46,6 +48,14 @@ export async function loadInternalWallet(channel: number) {
|
||||
let res: any = await new NativeSvr().signWithTikTok();
|
||||
console.log("native tiktok res: " + res);
|
||||
tokenRes = await tikTokAuth(res);
|
||||
} else if (channel == 3) {
|
||||
let res: any = await new NativeSvr().signWithFacebook();
|
||||
console.log("native facebook res: " + res);
|
||||
tokenRes = await facebookAuth(res);
|
||||
} else if (channel == 4) {
|
||||
let res: any = await new NativeSvr().signWithTwitter();
|
||||
console.log("native twitter res: " + res);
|
||||
tokenRes = await twitterAuth(res);
|
||||
} else {
|
||||
let res: any = await new NativeSvr().signWithGoogle();
|
||||
console.log("native google res: " + res);
|
||||
|
@ -46,6 +46,18 @@ export class NativeSvr {
|
||||
return this._subscribeToCallResponse(id);
|
||||
}
|
||||
|
||||
public signWithFacebook() {
|
||||
let id = payloadId();
|
||||
jsb.callJcVoidMethodJNI(id, "signWithFacebook");
|
||||
return this._subscribeToCallResponse(id);
|
||||
}
|
||||
|
||||
public signWithTwitter() {
|
||||
let id = payloadId();
|
||||
jsb.callJcVoidMethodJNI(id, "signWithTwitter");
|
||||
return this._subscribeToCallResponse(id);
|
||||
}
|
||||
|
||||
public signOutGoogle() {
|
||||
let id = payloadId();
|
||||
jsb.signOutGoogle(id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user