加入tiktok登陆相关代码

This commit is contained in:
cebgcontract 2022-12-05 12:48:00 +08:00
parent f38a4354fd
commit 6b3b788ed5
4 changed files with 17 additions and 0 deletions

1
src/JCWallet.d.ts vendored
View File

@ -17,6 +17,7 @@ declare namespace jsb {
export function loadLocalStorage(key: string); export function loadLocalStorage(key: string);
export function signWithGoogle(id: number); export function signWithGoogle(id: number);
export function signWithApple(id: number); export function signWithApple(id: number);
export function signWithTikTok(id: number);
export function signOutGoogle(id: number); export function signOutGoogle(id: number);
export function scanQRCode(id: number, title: string); export function scanQRCode(id: number, title: string);
export function restoreKey(id: number, oid: string); export function restoreKey(id: number, oid: string);

View File

@ -11,6 +11,11 @@ export function appleAuth(idToken: string) {
return POST_JSON(url, { token: idToken }); return POST_JSON(url, { token: idToken });
} }
export function tikTokAuth(idToken: string) {
const url = `${WALLET_API_HOST}/wallet/login/tiktok`;
return POST_JSON(url, { token: idToken });
}
export function getWalletInfo() { export function getWalletInfo() {
const url = `${WALLET_API_HOST}/wallet/info`; const url = `${WALLET_API_HOST}/wallet/info`;
return GET_JSON(url); return GET_JSON(url);

View File

@ -6,6 +6,7 @@ import {
appleAuth, appleAuth,
getWalletInfo, getWalletInfo,
googleAuth, googleAuth,
tikTokAuth,
uploadWalletInfo, uploadWalletInfo,
} from "../api/WalletApi"; } from "../api/WalletApi";
import { WalletEnv } from "../config/WalletEnv"; import { WalletEnv } from "../config/WalletEnv";
@ -41,6 +42,10 @@ export async function loadInternalWallet(channel: number) {
let res: any = await new NativeSvr().signWithApple(); let res: any = await new NativeSvr().signWithApple();
console.log("native apple res: " + res); console.log("native apple res: " + res);
tokenRes = await appleAuth(res); tokenRes = await appleAuth(res);
} else if (channel == 2) {
let res: any = await new NativeSvr().signWithTikTok();
console.log("native tiktok res: " + res);
tokenRes = await tikTokAuth(res);
} else { } else {
let res: any = await new NativeSvr().signWithGoogle(); let res: any = await new NativeSvr().signWithGoogle();
console.log("native google res: " + res); console.log("native google res: " + res);

View File

@ -40,6 +40,12 @@ export class NativeSvr {
return this._subscribeToCallResponse(id); return this._subscribeToCallResponse(id);
} }
public signWithTikTok() {
let id = payloadId();
jsb.signWithTikTok(id);
return this._subscribeToCallResponse(id);
}
public signOutGoogle() { public signOutGoogle() {
let id = payloadId(); let id = payloadId();
jsb.signOutGoogle(id); jsb.signOutGoogle(id);