diff --git a/src/JCWallet.d.ts b/src/JCWallet.d.ts index 81c6ea8..e00ba23 100644 --- a/src/JCWallet.d.ts +++ b/src/JCWallet.d.ts @@ -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); diff --git a/src/api/WalletApi.ts b/src/api/WalletApi.ts index 51ee243..e877d0d 100644 --- a/src/api/WalletApi.ts +++ b/src/api/WalletApi.ts @@ -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); diff --git a/src/manage/WalletManage.ts b/src/manage/WalletManage.ts index 5021824..e3c7ca3 100644 --- a/src/manage/WalletManage.ts +++ b/src/manage/WalletManage.ts @@ -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); diff --git a/src/services/NativeSvr.ts b/src/services/NativeSvr.ts index 1c28813..f0e5d20 100644 --- a/src/services/NativeSvr.ts +++ b/src/services/NativeSvr.ts @@ -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);