From 6b3b788ed51e6b1264f1a8b7f45f55e540c17d61 Mon Sep 17 00:00:00 2001 From: cebgcontract <99630598+cebgcontract@users.noreply.github.com> Date: Mon, 5 Dec 2022 12:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5tiktok=E7=99=BB=E9=99=86?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JCWallet.d.ts | 1 + src/api/WalletApi.ts | 5 +++++ src/manage/WalletManage.ts | 5 +++++ src/services/NativeSvr.ts | 6 ++++++ 4 files changed, 17 insertions(+) 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);