diff --git a/src/types/Plugins/JSBridge.d.ts b/src/types/Plugins/JSBridge.d.ts index d73d04c8..a8780e29 100644 --- a/src/types/Plugins/JSBridge.d.ts +++ b/src/types/Plugins/JSBridge.d.ts @@ -43,6 +43,17 @@ declare namespace TGApp.Plugins.JSBridge { */ type UnknownArg = Arg; + /** + * @description configShare 方法参数 + * @since Beta v0.3.9 + * @interface ConfigSharePayload + * @property {boolean} enable - 是否启用分享 + * @return ConfigSharePayload + */ + interface ConfigSharePayload { + enable: boolean; + } + /** * @description eventTrack 方法参数 * @since Beta v0.3.9 diff --git a/src/utils/TGClient.ts b/src/utils/TGClient.ts index fac8c291..8c12741b 100644 --- a/src/utils/TGClient.ts +++ b/src/utils/TGClient.ts @@ -186,6 +186,9 @@ class TGClient { await this.closePage(argParse); break; case "configure_share": + await this.configShare( + >argParse, + ); break; case "eventTrack": await this.eventTrack( @@ -248,6 +251,11 @@ class TGClient { >argParse, ); break; + case "setPresentationStyle": + await this.setPresentationStyle( + >argParse, + ); + break; case "share": await this.share(>argParse); break; @@ -394,18 +402,34 @@ class TGClient { await this.loadJSBridge(); } + /** + * @func configShare + * @since Beta v0.3.9 + * @desc 配置分享 + * @param {TGApp.Plugins.JSBridge.Arg} arg - 请求参数 + * @returns {Promise} - 无返回值 + */ + async configShare( + arg: TGApp.Plugins.JSBridge.Arg, + ): Promise { + console.log(`[configShare] ${JSON.stringify(arg.payload)}`); + await this.loadJSBridge(); + await this.nullCallback({ method: arg.method, payload: null, callback: arg.callback }); + } + /** * @func eventTrack * @since Beta v0.3.9 * @desc 事件跟踪 * @param {TGApp.Plugins.Arg} arg - 请求参数 - * @returns {void} - 无返回值 + * @returns {Promise} - 无返回值 */ async eventTrack( arg: TGApp.Plugins.JSBridge.Arg, ): Promise { console.log(`[eventTrack] ${JSON.stringify(arg.payload)}`); await this.loadJSBridge(); + await this.nullCallback({ method: arg.method, payload: null, callback: arg.callback }); } /** @@ -635,7 +659,7 @@ class TGClient { * @since Beta v0.3.9 * @desc 打开米游社客户端的页面 * @param {TGApp.Plugins.JSBridge.Arg} arg - 方法参数 - * @returns {void} - 无返回值 + * @returns {Promise} - 无返回值 */ async pushPage( arg: TGApp.Plugins.JSBridge.Arg, @@ -669,12 +693,27 @@ class TGClient { await this.window?.setFocus(); } + /** + * @func setPresentationStyle + * @since Beta v0.3.9 + * @desc 设置米游社客户端的展示方式 + * @param {TGApp.Plugins.JSBridge.Arg} arg - 方法参数 + * @returns {Promise} - 无返回值 + */ + async setPresentationStyle( + arg: TGApp.Plugins.JSBridge.Arg, + ): Promise { + console.log(`[setPresentationStyle] ${JSON.stringify(arg.payload)}`); + await this.loadJSBridge(); + await this.nullCallback({ method: arg.method, payload: null, callback: arg.callback }); + } + /** * @func share * @since Beta v0.3.9 * @desc 分享 * @param {TGApp.Plugins.JSBridge.Arg} arg - 方法参数 - * @returns {void} - 无返回值 + * @returns {Promise} - 无返回值 */ async share(arg: TGApp.Plugins.JSBridge.Arg): Promise { // 如果有数据