加入tiktok登陆相关代码
This commit is contained in:
parent
f38a4354fd
commit
6b3b788ed5
1
src/JCWallet.d.ts
vendored
1
src/JCWallet.d.ts
vendored
@ -17,6 +17,7 @@ declare namespace jsb {
|
||||
export function loadLocalStorage(key: string);
|
||||
export function signWithGoogle(id: number);
|
||||
export function signWithApple(id: number);
|
||||
export function signWithTikTok(id: number);
|
||||
export function signOutGoogle(id: number);
|
||||
export function scanQRCode(id: number, title: string);
|
||||
export function restoreKey(id: number, oid: string);
|
||||
|
@ -11,6 +11,11 @@ export function appleAuth(idToken: string) {
|
||||
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() {
|
||||
const url = `${WALLET_API_HOST}/wallet/info`;
|
||||
return GET_JSON(url);
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
appleAuth,
|
||||
getWalletInfo,
|
||||
googleAuth,
|
||||
tikTokAuth,
|
||||
uploadWalletInfo,
|
||||
} from "../api/WalletApi";
|
||||
import { WalletEnv } from "../config/WalletEnv";
|
||||
@ -41,6 +42,10 @@ export async function loadInternalWallet(channel: number) {
|
||||
let res: any = await new NativeSvr().signWithApple();
|
||||
console.log("native apple res: " + 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 {
|
||||
let res: any = await new NativeSvr().signWithGoogle();
|
||||
console.log("native google res: " + res);
|
||||
|
@ -40,6 +40,12 @@ export class NativeSvr {
|
||||
return this._subscribeToCallResponse(id);
|
||||
}
|
||||
|
||||
public signWithTikTok() {
|
||||
let id = payloadId();
|
||||
jsb.signWithTikTok(id);
|
||||
return this._subscribeToCallResponse(id);
|
||||
}
|
||||
|
||||
public signOutGoogle() {
|
||||
let id = payloadId();
|
||||
jsb.signOutGoogle(id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user